frame4.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title>个人中心</title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
  9. <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
  10. <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
  11. <link rel="stylesheet" href="../../css/projeck.css">
  12. <style media="screen">
  13. .news_num{
  14. width: 20px;
  15. height: 20px;
  16. line-height: 20px;
  17. background-color: #e74e42;
  18. color: #fff;
  19. position: absolute;
  20. top: 18px;
  21. left: 68px;
  22. text-align: center;
  23. -webkit-border-radius: 50%;
  24. border-radius: 50%;
  25. font-size: 11px;
  26. font-style: normal;
  27. z-index: 1;
  28. }
  29. .api-toast{
  30. background: rgba(255,255,255,0);
  31. }
  32. .api_personal_header .api_header_img{
  33. width: 100px;
  34. height: 100px;
  35. border-radius: 50%;
  36. margin: auto;
  37. background: none;
  38. }
  39. </style>
  40. </head>
  41. <body style="background-color:#fff;">
  42. <div class="api_layout">
  43. <div class="api_personal_header">
  44. <img src="" alt="" class="api_header_img" id="head_img" onclick="actionSheetFun()">
  45. <!-- <span class="api_header_img" onclick="actionSheetFun()"></span> -->
  46. <p class="api_personal_name"></p>
  47. <p class="api_dep"></p>
  48. <button class="api_personal_more" onclick="openPersonal()">更多资料</button>
  49. </div>
  50. <div class="api_phoneBind_wrap">
  51. <div class="api_line" style="margin:0;"></div>
  52. <div class="api_phoneBind" onclick="openBind()">
  53. <img src="../../image/phoneBind.png" alt="">
  54. 未绑定手机号,请立即绑定手机号。
  55. </div>
  56. <div class="api_line" style="margin:0;"></div>
  57. </div>
  58. <div class="api_function">
  59. <section class="aui-grid">
  60. <div class="aui-row">
  61. <div class="aui-col-xs-4" onclick="openNewsList()">
  62. <i class="ico api_icon1"></i>
  63. <div class="aui-grid-label" style="font-size:14px">消息提醒</div>
  64. <i class="news_num" style="display:none"></i>
  65. </div>
  66. <div class="aui-col-xs-4">
  67. <i class="ico api_icon2"></i>
  68. <div class="aui-grid-label" style="font-size:14px">收藏</div>
  69. </div>
  70. <div class="aui-col-xs-4" onclick="openWordOrder()">
  71. <i class="ico api_icon3"></i>
  72. <div class="aui-grid-label" style="font-size:14px">工单列表</div>
  73. </div>
  74. </div>
  75. </section>
  76. <div class="api_line" style="margin:0;height:5px;"></div>
  77. </div>
  78. <div class="api_function2">
  79. <ul class="api_function_items">
  80. <li class="api_function_item" onclick="openForget()" style="height:60px;line-height:60px">
  81. <img src="../../image/pass.png" alt="" class="api_pass_img">
  82. 修改密码
  83. <img src="../../image/more.png" alt="" class="api_more_img">
  84. </li>
  85. <!-- <li class="api_function_item" onclick="clearCache()" style="height:60px;line-height:60px">
  86. <img src="../../image/clear.png" alt="" class="api_pass_img">
  87. 清除缓存
  88. <img src="../../image/more.png" alt="" class="api_more_img">
  89. </li> -->
  90. <!-- <li class="api_function_item" onclick="openExamine()" style="height:60px;line-height:60px">
  91. <img src="../../image/pass.png" alt="" class="api_pass_img">
  92. 我的审核
  93. <img src="../../image/more.png" alt="" class="api_more_img">
  94. </li>
  95. <li class="api_function_item" onclick="openExamineDetails()" style="height:60px;line-height:60px">
  96. <img src="../../image/pass.png" alt="" class="api_pass_img">
  97. 我的审核
  98. <img src="../../image/more.png" alt="" class="api_more_img">
  99. </li>
  100. <li class="api_function_item" onclick="openMyWordOder()" style="height:60px;line-height:60px">
  101. <img src="../../image/pass.png" alt="" class="api_pass_img">
  102. 我的工单
  103. <img src="../../image/more.png" alt="" class="api_more_img">
  104. </li>
  105. <li class="api_function_item" onclick="openMyWordOderList()" style="height:60px;line-height:60px">
  106. <img src="../../image/pass.png" alt="" class="api_pass_img">
  107. 我的流程
  108. <img src="../../image/more.png" alt="" class="api_more_img">
  109. </li> -->
  110. <li class="api_function_item" onclick="signOut()" style="height:60px;line-height:60px">
  111. <img src="../../image/push.png" alt="" class="api_pass_img">
  112. 退出
  113. <img src="../../image/more.png" alt="" class="api_more_img">
  114. </li>
  115. </ul>
  116. </div>
  117. </div>
  118. </body>
  119. </html>
  120. <script type="text/javascript" src="../../script/api.js"></script>
  121. <!-- <script src="../../script/aui-toast.js" charset="utf-8"></script> -->
  122. <!-- <script src="../../script/fastclick.min.js" charset="utf-8"></script> -->
  123. <script src="../../script/config.js" charset="utf-8"></script>
  124. <script type="text/javascript">
  125. var token,uuid,headers;
  126. var toast = new auiToast();
  127. apiready=function () {
  128. var info = $api.getStorage('data'),
  129. user = JSON.parse(info).data.user;
  130. token = JSON.parse(info).data.access_token;
  131. uuid = JSON.parse(info).data.user.staff_num;
  132. headers = {
  133. "Authorization": "Bearer " + token
  134. };
  135. newsNum()
  136. // 个人信息
  137. $http.fnReuestData(UrlRouter.userInfoApi,headers,'post','',personalCenterInfo);
  138. api.addEventListener({
  139. name: 'userInfo'
  140. }, function(ret, err) {
  141. $http.fnReuestData(UrlRouter.userInfoApi,headers,'post','',personalCenterInfo);
  142. });
  143. api.addEventListener({
  144. name: 'myNews'
  145. }, function(ret, err) {
  146. newsNum()
  147. });
  148. };
  149. // 个人信息展示
  150. function personalCenterInfo(ret,err){
  151. if (ret) {
  152. toast.hide();
  153. if (ret.code === 0) {
  154. var ret = ret.data;
  155. var image = 'http://jiewei-icon.oss-cn-beijing.aliyuncs.com/icon/default-avatar.png';
  156. var bindPhone = $api.dom('.api_phoneBind_wrap');
  157. var head_img = $api.byId('head_img'),
  158. name = $api.dom('.api_personal_name'),
  159. api_dep = $api.dom('.api_dep');
  160. ret.name == null? $api.html(name,'无') : $api.html(name,ret.name);
  161. ret.avatar == null? $api.attr(head_img,'src',image): $api.attr(head_img,'src',ret.avatar);
  162. ret.section_fullname == null? $api.html(api_dep,'无') : $api.html(api_dep,ret.section_fullname);
  163. if (ret.mobile == '' || ret.mobile == null) {
  164. $api.css(bindPhone,'display:block');
  165. }else {
  166. $api.css(bindPhone,'display:none');
  167. }
  168. }else if (ret.code === 401) {
  169. api.alert({
  170. title: '提示',
  171. msg: '登录过期,重新登录',
  172. }, function(ret, err) {
  173. var index = ret.buttonIndex;
  174. if (index == 1) {
  175. api.setStatusBarStyle({
  176. color: 'rgba(0,0,0,0)',
  177. style: 'light'
  178. });
  179. api.closeWin({
  180. name:'index'
  181. });
  182. }
  183. });
  184. }
  185. }else {
  186. toast.hide();
  187. api.toast({
  188. msg: '网络错误',
  189. duration: 2000,
  190. location: 'bottom'
  191. });
  192. }
  193. }
  194. // 修改密码
  195. function openForget() {
  196. $event.openTabLayout('forget','../forgetBind/forgetPass','修改密码','');
  197. }
  198. // 绑定手机号
  199. function openBind() {
  200. $event.openTabLayout('bindPhone','../forgetBind/bindPhone','绑定手机号','');
  201. }
  202. // 我的审核
  203. // function openExamine() {
  204. // $event.openWin('examine','../wordorder/examineMy_win','','');
  205. // }
  206. // // 我的审核openExamineDetails
  207. // function openExamineDetails() {
  208. // $event.openTabLayout('wordorderDetails','../wordorder/wordorderDetails','我的审核','');
  209. // }
  210. // //我的工单
  211. // function openMyWordOder() {
  212. // $event.openWin('myWordeOrder_win','../wordorder/myWordeOrder_win','','');
  213. // }
  214. // //我的流程
  215. // function openMyWordOderList() {
  216. // $event.openTabLayout('wordorderProcess','../wordorder/wordOrderProcess','工单流程','');
  217. // }
  218. // // 打开详情
  219. function openPersonal() {
  220. $event.openWin('personal','../personalData/personal','','');
  221. }
  222. // //消息列表
  223. function openNewsList() {
  224. $event.openWin('newsList','../news/news_win','','');
  225. }
  226. // 清除缓存
  227. // function clearCache() {
  228. // $event.openWin('clearCache','clearCache','','');
  229. // }
  230. // 上传头像
  231. var headImg;
  232. function actionSheetFun() {
  233. api.actionSheet({
  234. title: '选择',
  235. cancelTitle: '取消',
  236. buttons: ['相机','相册']
  237. }, function(ret, err) {
  238. if (ret.buttonIndex !=3) {
  239. var type = 'camera';
  240. if(ret.buttonIndex == 1){
  241. type = 'camera';
  242. }else {
  243. type = 'album';
  244. }
  245. api.getPicture({
  246. sourceType: type
  247. }, function(ret, err){
  248. if(ret){
  249. photoTailoring(ret.data);
  250. headImg = ret.data;
  251. }
  252. });
  253. }
  254. });
  255. }
  256. function uploadUrl(imgUrl) {
  257. var upload_avater = $api.byId('head_img');
  258. $api.attr(upload_avater,'src',imgUrl)
  259. }
  260. function uploadHead(imgUrl){
  261. toast.loading({
  262. title: "上传中",
  263. duration: 2000
  264. });
  265. api.ajax({
  266. url: urlphp+'api/user/avatar/upload',
  267. method: 'post',
  268. headers : {
  269. "Authorization": "Bearer " + token,
  270. },
  271. data: {
  272. files: {
  273. avatar:imgUrl
  274. }
  275. }
  276. },function(ret, err){
  277. if (ret) {
  278. toast.hide();
  279. if(ret.code === 0){
  280. api.toast({
  281. msg: '上传成功',
  282. duration: 2000,
  283. location: 'top'
  284. });
  285. }else {
  286. api.toast({
  287. msg: '上传失败',
  288. duration: 2000,
  289. location: 'top'
  290. });
  291. }
  292. } else {
  293. toast.hide();
  294. api.toast({
  295. msg: '网络错误',
  296. duration: 2000,
  297. location: 'top'
  298. });
  299. }
  300. });
  301. }
  302. // 退出
  303. function signOut() {
  304. api.confirm({
  305. title: '提示',
  306. msg: '退出登录?',
  307. buttons: ['确定', '取消']
  308. }, function(ret, err) {
  309. var index = ret.buttonIndex;
  310. if (index == 1) {
  311. api.setStatusBarStyle({
  312. color: 'rgba(0,0,0,0)',
  313. style: 'light'
  314. });
  315. $api.clearStorage ();
  316. api.closeWin({
  317. name:'index'
  318. });
  319. }
  320. });
  321. }
  322. // 照片裁剪
  323. function photoTailoring(imgPath) {
  324. var systemType = api.systemType;
  325. if (systemType == 'ios') {
  326. api.openFrame({
  327. name: 'tailoring',
  328. url: 'tailoring.html',
  329. rect: {
  330. x: 0,
  331. y: 0,
  332. w: api.winWidth,
  333. h: api.winHeight
  334. },
  335. pageParam: {
  336. tailoring: imgPath
  337. },
  338. bounces: false,
  339. bgColor: 'rgba(0,0,0,0)',
  340. vScrollBarEnabled: false,
  341. hScrollBarEnabled: false,
  342. });
  343. }else if (systemType == 'android') {
  344. var imageCrop = api.require('imageCrop');
  345. imageCrop.clipPhoto({
  346. imgPath: imgPath,
  347. height: api.winHeight,
  348. width: api.winWidth
  349. }, function(ret, err) {
  350. if (ret) {
  351. uploadUrl(ret.imgPath);
  352. uploadHead(ret.imgPath);
  353. }
  354. });
  355. }
  356. }
  357. //工单
  358. function openWordOrder() {
  359. // $event.openWin('wordorder_win','../wordorder/wordorder_win','','')
  360. // $event.openTabLayout('wordOrder','wordorder_frame','工单列表','')
  361. }
  362. // 消息总数
  363. function newsNum() {
  364. $http.fnReuestDataNologing(UrlRouter.getNewsNum,headers,'get','',function (ret,err) {
  365. if (ret.code === 0) {
  366. if (ret.data.unread_num === 0) {
  367. $api.css($api.dom('.news_num'), 'display:none');
  368. $api.html($api.dom('.news_num'), '');
  369. }else if(ret.data.unread_num > 99 || ret.data.unread_num == 99){
  370. $api.css($api.dom('.news_num'), 'display:block');
  371. $api.html($api.dom('.news_num'), 99);
  372. }else {
  373. $api.css($api.dom('.news_num'), 'display:block');
  374. $api.html($api.dom('.news_num'), ret.data.unread_num);
  375. }
  376. }
  377. })
  378. }
  379. </script>