123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <title>个人中心</title>
- <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
- <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
- <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
- <link rel="stylesheet" href="../../css/projeck.css">
- <style media="screen">
- .news_num{
- width: 20px;
- height: 20px;
- line-height: 20px;
- background-color: #e74e42;
- color: #fff;
- position: absolute;
- top: 18px;
- left: 68px;
- text-align: center;
- -webkit-border-radius: 50%;
- border-radius: 50%;
- font-size: 11px;
- font-style: normal;
- z-index: 1;
- }
- .api-toast{
- background: rgba(255,255,255,0);
- }
- .api_personal_header .api_header_img{
- width: 100px;
- height: 100px;
- border-radius: 50%;
- margin: auto;
- background: none;
- }
- </style>
- </head>
- <body style="background-color:#fff;">
- <div class="api_layout">
- <div class="api_personal_header">
- <img src="" alt="" class="api_header_img" id="head_img" onclick="actionSheetFun()">
- <!-- <span class="api_header_img" onclick="actionSheetFun()"></span> -->
- <p class="api_personal_name"></p>
- <p class="api_dep"></p>
- <button class="api_personal_more" onclick="openPersonal()">更多资料</button>
- </div>
- <div class="api_phoneBind_wrap">
- <div class="api_line" style="margin:0;"></div>
- <div class="api_phoneBind" onclick="openBind()">
- <img src="../../image/phoneBind.png" alt="">
- 未绑定手机号,请立即绑定手机号。
- </div>
- <div class="api_line" style="margin:0;"></div>
- </div>
- <div class="api_function">
- <section class="aui-grid">
- <div class="aui-row">
- <div class="aui-col-xs-4" onclick="openNewsList()">
- <i class="ico api_icon1"></i>
- <div class="aui-grid-label" style="font-size:14px">消息提醒</div>
- <i class="news_num" style="display:none"></i>
- </div>
- <div class="aui-col-xs-4">
- <i class="ico api_icon2"></i>
- <div class="aui-grid-label" style="font-size:14px">收藏</div>
- </div>
- <div class="aui-col-xs-4" onclick="openWordOrder()">
- <i class="ico api_icon3"></i>
- <div class="aui-grid-label" style="font-size:14px">工单列表</div>
- </div>
- </div>
- </section>
- <div class="api_line" style="margin:0;height:5px;"></div>
- </div>
- <div class="api_function2">
- <ul class="api_function_items">
- <li class="api_function_item" onclick="openForget()" style="height:60px;line-height:60px">
- <img src="../../image/pass.png" alt="" class="api_pass_img">
- 修改密码
- <img src="../../image/more.png" alt="" class="api_more_img">
- </li>
- <!-- <li class="api_function_item" onclick="clearCache()" style="height:60px;line-height:60px">
- <img src="../../image/clear.png" alt="" class="api_pass_img">
- 清除缓存
- <img src="../../image/more.png" alt="" class="api_more_img">
- </li> -->
- <!-- <li class="api_function_item" onclick="openExamine()" style="height:60px;line-height:60px">
- <img src="../../image/pass.png" alt="" class="api_pass_img">
- 我的审核
- <img src="../../image/more.png" alt="" class="api_more_img">
- </li>
- <li class="api_function_item" onclick="openExamineDetails()" style="height:60px;line-height:60px">
- <img src="../../image/pass.png" alt="" class="api_pass_img">
- 我的审核
- <img src="../../image/more.png" alt="" class="api_more_img">
- </li>
- <li class="api_function_item" onclick="openMyWordOder()" style="height:60px;line-height:60px">
- <img src="../../image/pass.png" alt="" class="api_pass_img">
- 我的工单
- <img src="../../image/more.png" alt="" class="api_more_img">
- </li>
- <li class="api_function_item" onclick="openMyWordOderList()" style="height:60px;line-height:60px">
- <img src="../../image/pass.png" alt="" class="api_pass_img">
- 我的流程
- <img src="../../image/more.png" alt="" class="api_more_img">
- </li> -->
- <li class="api_function_item" onclick="signOut()" style="height:60px;line-height:60px">
- <img src="../../image/push.png" alt="" class="api_pass_img">
- 退出
- <img src="../../image/more.png" alt="" class="api_more_img">
- </li>
- </ul>
- </div>
- </div>
- </body>
- </html>
- <script type="text/javascript" src="../../script/api.js"></script>
- <!-- <script src="../../script/aui-toast.js" charset="utf-8"></script> -->
- <!-- <script src="../../script/fastclick.min.js" charset="utf-8"></script> -->
- <script src="../../script/config.js" charset="utf-8"></script>
- <script type="text/javascript">
- var token,uuid,headers;
- var toast = new auiToast();
- apiready=function () {
- var info = $api.getStorage('data'),
- user = JSON.parse(info).data.user;
- token = JSON.parse(info).data.access_token;
- uuid = JSON.parse(info).data.user.staff_num;
- headers = {
- "Authorization": "Bearer " + token
- };
- newsNum()
- // 个人信息
- $http.fnReuestData(UrlRouter.userInfoApi,headers,'post','',personalCenterInfo);
- api.addEventListener({
- name: 'userInfo'
- }, function(ret, err) {
- $http.fnReuestData(UrlRouter.userInfoApi,headers,'post','',personalCenterInfo);
- });
- api.addEventListener({
- name: 'myNews'
- }, function(ret, err) {
- newsNum()
- });
- };
- // 个人信息展示
- function personalCenterInfo(ret,err){
- if (ret) {
- toast.hide();
- if (ret.code === 0) {
- var ret = ret.data;
- var image = 'http://jiewei-icon.oss-cn-beijing.aliyuncs.com/icon/default-avatar.png';
- var bindPhone = $api.dom('.api_phoneBind_wrap');
- var head_img = $api.byId('head_img'),
- name = $api.dom('.api_personal_name'),
- api_dep = $api.dom('.api_dep');
- ret.name == null? $api.html(name,'无') : $api.html(name,ret.name);
- ret.avatar == null? $api.attr(head_img,'src',image): $api.attr(head_img,'src',ret.avatar);
- ret.section_fullname == null? $api.html(api_dep,'无') : $api.html(api_dep,ret.section_fullname);
- if (ret.mobile == '' || ret.mobile == null) {
- $api.css(bindPhone,'display:block');
- }else {
- $api.css(bindPhone,'display:none');
- }
- }else if (ret.code === 401) {
- api.alert({
- title: '提示',
- msg: '登录过期,重新登录',
- }, function(ret, err) {
- var index = ret.buttonIndex;
- if (index == 1) {
- api.setStatusBarStyle({
- color: 'rgba(0,0,0,0)',
- style: 'light'
- });
- api.closeWin({
- name:'index'
- });
- }
- });
- }
- }else {
- toast.hide();
- api.toast({
- msg: '网络错误',
- duration: 2000,
- location: 'bottom'
- });
- }
- }
- // 修改密码
- function openForget() {
- $event.openTabLayout('forget','../forgetBind/forgetPass','修改密码','');
- }
- // 绑定手机号
- function openBind() {
- $event.openTabLayout('bindPhone','../forgetBind/bindPhone','绑定手机号','');
- }
- // 我的审核
- // function openExamine() {
- // $event.openWin('examine','../wordorder/examineMy_win','','');
- // }
- // // 我的审核openExamineDetails
- // function openExamineDetails() {
- // $event.openTabLayout('wordorderDetails','../wordorder/wordorderDetails','我的审核','');
- // }
- // //我的工单
- // function openMyWordOder() {
- // $event.openWin('myWordeOrder_win','../wordorder/myWordeOrder_win','','');
- // }
- // //我的流程
- // function openMyWordOderList() {
- // $event.openTabLayout('wordorderProcess','../wordorder/wordOrderProcess','工单流程','');
- // }
- // // 打开详情
- function openPersonal() {
- $event.openWin('personal','../personalData/personal','','');
- }
- // //消息列表
- function openNewsList() {
- $event.openWin('newsList','../news/news_win','','');
- }
- // 清除缓存
- // function clearCache() {
- // $event.openWin('clearCache','clearCache','','');
- // }
- // 上传头像
- var headImg;
- function actionSheetFun() {
- api.actionSheet({
- title: '选择',
- cancelTitle: '取消',
- buttons: ['相机','相册']
- }, function(ret, err) {
- if (ret.buttonIndex !=3) {
- var type = 'camera';
- if(ret.buttonIndex == 1){
- type = 'camera';
- }else {
- type = 'album';
- }
- api.getPicture({
- sourceType: type
- }, function(ret, err){
- if(ret){
- photoTailoring(ret.data);
- headImg = ret.data;
- }
- });
- }
- });
- }
- function uploadUrl(imgUrl) {
- var upload_avater = $api.byId('head_img');
- $api.attr(upload_avater,'src',imgUrl)
- }
- function uploadHead(imgUrl){
- toast.loading({
- title: "上传中",
- duration: 2000
- });
- api.ajax({
- url: urlphp+'api/user/avatar/upload',
- method: 'post',
- headers : {
- "Authorization": "Bearer " + token,
- },
- data: {
- files: {
- avatar:imgUrl
- }
- }
- },function(ret, err){
- if (ret) {
- toast.hide();
- if(ret.code === 0){
- api.toast({
- msg: '上传成功',
- duration: 2000,
- location: 'top'
- });
- }else {
- api.toast({
- msg: '上传失败',
- duration: 2000,
- location: 'top'
- });
- }
- } else {
- toast.hide();
- api.toast({
- msg: '网络错误',
- duration: 2000,
- location: 'top'
- });
- }
- });
- }
- // 退出
- function signOut() {
- api.confirm({
- title: '提示',
- msg: '退出登录?',
- buttons: ['确定', '取消']
- }, function(ret, err) {
- var index = ret.buttonIndex;
- if (index == 1) {
- api.setStatusBarStyle({
- color: 'rgba(0,0,0,0)',
- style: 'light'
- });
- $api.clearStorage ();
- api.closeWin({
- name:'index'
- });
- }
- });
- }
- // 照片裁剪
- function photoTailoring(imgPath) {
- var systemType = api.systemType;
- if (systemType == 'ios') {
- api.openFrame({
- name: 'tailoring',
- url: 'tailoring.html',
- rect: {
- x: 0,
- y: 0,
- w: api.winWidth,
- h: api.winHeight
- },
- pageParam: {
- tailoring: imgPath
- },
- bounces: false,
- bgColor: 'rgba(0,0,0,0)',
- vScrollBarEnabled: false,
- hScrollBarEnabled: false,
- });
- }else if (systemType == 'android') {
- var imageCrop = api.require('imageCrop');
- imageCrop.clipPhoto({
- imgPath: imgPath,
- height: api.winHeight,
- width: api.winWidth
- }, function(ret, err) {
- if (ret) {
- uploadUrl(ret.imgPath);
- uploadHead(ret.imgPath);
- }
- });
- }
- }
- //工单
- function openWordOrder() {
- // $event.openWin('wordorder_win','../wordorder/wordorder_win','','')
- // $event.openTabLayout('wordOrder','wordorder_frame','工单列表','')
- }
- // 消息总数
- function newsNum() {
- $http.fnReuestDataNologing(UrlRouter.getNewsNum,headers,'get','',function (ret,err) {
- if (ret.code === 0) {
- if (ret.data.unread_num === 0) {
- $api.css($api.dom('.news_num'), 'display:none');
- $api.html($api.dom('.news_num'), '');
- }else if(ret.data.unread_num > 99 || ret.data.unread_num == 99){
- $api.css($api.dom('.news_num'), 'display:block');
- $api.html($api.dom('.news_num'), 99);
- }else {
- $api.css($api.dom('.news_num'), 'display:block');
- $api.html($api.dom('.news_num'), ret.data.unread_num);
- }
- }
- })
- }
- </script>
|