angular.module('push') .controller('AccountCtrl', function ($scope, $ionicPopup, ResourceLibraryService, AccountService, UserService, ConfigService, accountModel, homepageOfNodeService, LoginService, CommentService, UtilService, ConstantService, CommonService, $ionicModal, $ionicLoading) { document.title = '个人中心'; if (UserService.defaultLan == 'English') { document.title = 'My Center'; } $scope.defaultLan = UserService.defaultLan; //TODO if ($scope.app) { $scope.setStatusBar(1); } $scope.node = UserService.node; homepageOfNodeService.getNodeAuth($scope.node).then(function (res) { $scope.isUserManager = res.data; }) $scope.comfromWeb = sessionStorage.comfrom == 'web'; //季报分析 $scope.quarterlyAnalysis = function () { $scope.go("quarterlyAnalysis"); } //取用户id,判断是否登录 var userId = UserService.id; $scope.islogin = ConfigService.islogin; // console.log(ConfigService.islogin); var authenstatus = 0;//认证状态:0未认证 1认证中 2已认证 /* // 获取是否有新的系统消息 var getMyMessageFlg = function () { LoginService.getMyMessageFlg().then(function (response) { }, function () { }) }; getMyMessageFlg(); */ var sellevcol = function () { if ($scope.viplevel == 3) { $scope.levcol = "starRating_G"; return; } if ($scope.pushvalue >= 200 && $scope.pushvalue < 500) { $scope.levcol = "starRating_A"; return; } if ($scope.pushvalue >= 500 && $scope.pushvalue < 1000) { $scope.levcol = "starRating_B"; return; } if ($scope.pushvalue >= 1000 && $scope.pushvalue < 1500) { $scope.levcol = "starRating_C"; return; } if ($scope.pushvalue >= 1500 && $scope.pushvalue < 3500) { $scope.levcol = "starRating_D"; return; } if ($scope.pushvalue >= 3500 && $scope.pushvalue < 8000) { $scope.levcol = "starRating_E"; return; } if ($scope.pushvalue >= 8000) { $scope.levcol = "starRating_F"; } }; // 获取登录用户信息 $scope.getUserInfo = function () { AccountService.getUserInfo().then(function (response) { console.log('response', response) if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350 && response.data.userid != 0) { // console.log(response); UserService.user = response.data; $scope.user = response.data; UserService.id = response.data.userid; UserService.role = response.data.userRoleList; // 普适积分 $scope.pushintegral = response.data.pushIntegralModel ? response.data.pushIntegralModel.sysUsersPushvalue.pushintegral : null; // 普适值 $scope.pushvalue = response.data.pushIntegralModel ? response.data.pushIntegralModel.sysUsersPushvalue.pushvalue : null; /* 会员信息,暂时隐藏 $scope.viplevel = UserService.viplevel = response.member.memberid; sellevcol(); // 签到 // $scope.issign = response.member.issign; authenstatus = response.member.authenstatus; UserService.ishaspaypassword = response.member.ishaspaypassword;//是否设置过付款密码 ConfigService.mychannellist = response.channelList; */ ConfigService.comefrom = response.data.comefrom; //UserService.node = response.data.comefrom; if (response.data.node && UtilService.isDefined(response.data.node.nodename)) { //UserService.nodename = response.data.node.nodename; } $scope.personalLabels = []; if (response.otherObj && response.otherObj.length > 0) { angular.forEach(response.otherObj, function (val) { switch (val.labelKey) { case '4800': $scope.personalLabels.push({ class: 'iconfont-individual', title: val.labelName }); break; case '4801': $scope.personalLabels.push({ class: 'iconfont-talents', title: val.labelName }); break; case '4803': $scope.personalLabels.push({ class: 'iconfont-enterprise', title: val.labelName }); break; case '4804': $scope.personalLabels.push({ class: 'iconfont-colleges', title: val.labelName }); break; case '4805': $scope.personalLabels.push({ class: 'iconfont-government', title: val.labelName }); break; case '4806': $scope.personalLabels.push({ class: 'iconfont-service', title: val.labelName }); break; case 'scoreTotal': $scope.stars = Math.round(val.labelName); break; } }) } // console.log($scope.stars); } //用户没有登陆 if (response.data.userid == 0) { $scope.islogin = false; } }, function () { //$scope.user = UserService.user; }); }; $scope.getUserInfo(); $scope.range = function (n) { return new Array(n); } //日志权限 var logdata = { node: UserService.node, uid: localStorage.uid } AccountService.getLogAuthority(logdata).then(function (res) { console.log(res) if (res.code == 3350) { $scope.logAuth = res.data.isHighestAuth } }) // 获取登录用户是否签到 $scope.isSignInfo = function () { AccountService.getSignInfo().then(function (response) { if (response.data.length > 0) { $scope.issign = 1; } else { $scope.issign = 0; } }, function () { }); }; $scope.isSignInfo(); //签到 $scope.signIn = function () { $scope.showLoadingToast(); CommentService.signIn().then(function () { $scope.issign = 1; $scope.pushvalue = UtilService.isDefined($scope.pushvalue) ? $scope.pushvalue + 1 : 1; sellevcol(); $scope.hideLoadingToast(); }, function () { if ($scope.app) { UtilService.showMess("网络不给力,请重试"); } else { CommonService.showMessage('网络不给力,请重试', $scope); } $scope.hideLoadingToast(); }); }; $scope.goPublisher = function () { $scope.go('publisher', { Id: userId }); }; $scope.goMyFav = function () { $scope.go('myfav'); }; $scope.goMyCollection = function () { //TODO $scope.islogin = ConfigService.islogin; if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.go('mycollection'); } }; $scope.goMyMessage = function () { accountModel.setMyMessageTabIndex(0); $scope.islogin = ConfigService.islogin; if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.go('mymessage'); } }; $scope.goSet = function () { $scope.go('set'); }; $scope.golog = function () { $scope.go('log'); }; $scope.goImport = function () { $scope.go('Import'); } $scope.goBusinessdata = function () { $scope.go('Businessdata'); } $scope.goTeclcontract = function () { $scope.go('Teclcontract'); } $scope.goMyPublish = function () { accountModel.setPublishTabIndex(0); $scope.go('myPublish'); }; $scope.goQualify = function () { $scope.islogin = ConfigService.islogin; if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { // $scope.showAnthorBtnWrap=true; // getRolePageList(); // $("ion-nav-view[name='tab-activityIndex']").css("z-index","8"); if (authenstatus == 0 || authenstatus == 3) { // $scope.go('personIdentify'); $scope.go('identifySystem'); accountModel.setInfoImageList([]); accountModel.setUserAuthInfo({}); } else { $scope.go('successIdentify'); } } }; $scope.hasAuth = false; ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) { // console.log(res); $scope.hasAuth = res.data; }) //进入我的审核页面 $scope.goMyCheckView = function () { if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.go('myCheck'); } } $scope.goCenter = function () { if ($scope.app) { UtilService.showMess("功能正在完善中,敬请期待!"); } else { CommonService.showMessage("功能正在完善中,敬请期待!", $scope) } /* if (authenstatus == 0) { $ionicPopup.show({ title: '提示', template: '请先去认证中心认证才可以成为会员', buttons: [ { text: '去认证', type: "button-positive", onTap: function (e) { $scope.go('personIdentify'); accountModel.setUserAuthInfo({}); accountModel.setInfoImageList([]); } } ] }); } if (authenstatus == 1) { $ionicPopup.show({ title: '提示', template: '您的信息已在认证中', buttons: [ { text: '知道了', type: "button-positive", onTap: function (e) { } } ] }); } if (authenstatus == 2) { $scope.go("memberHome"); } if (authenstatus == 3) { $ionicPopup.show({ title: '提示', template: '您的信息认证失败', buttons: [ { text: '去查看', type: "button-positive", onTap: function (e) { $scope.go('personIdentify'); accountModel.setUserAuthInfo({}); accountModel.setInfoImageList([]); } } ] }); }*/ }; $scope.goPushCurrency = function () { $scope.islogin = ConfigService.islogin; if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.go("psMoneyHome"); } }; $scope.updateUserPassword = function () { $scope.islogin = ConfigService.islogin; if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.go("updatePsd", { password: UserService.user.password }); } } //加载动画 $scope.showLoadingToast = function () { $ionicLoading.show({ template: '


努力加载中···

', content: '努力加载中', animation: 'fade-in', showBackdrop: true,//是否显示蒙层 maxWidth: 150, showDelay: 0 }); // $timeout(function () { // $ionicLoading.hide(); // }, 15000); }; //通知助手 $scope.informAssitant = function () { $scope.showLoadingToast(); ResourceLibraryService.getSmsList().then(function (res) { if (res.code == 3350) { if (res.data.length > 0) { $scope.go("noticeHelper", { list: res.data }); } else { $scope.hideLoadingToast(); $scope.go("newMessagePage"); } } }) } $scope.goWhere = function (index) { if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { switch (index) { case 1: $scope.go('technicalBrokerEnterCompanyInfo', { comfrom: 'tab.account' }); break; case 2: $scope.go('taskHoll', { comfrom: 'tab.account' }); break; case 3: $scope.go('activitiesHoll', { comfrom: 'tab.account' }); break; } } }; //$scope.loginModelPublic(); $scope.loginModelShow = function () { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } }; $scope.hideModel = function () { $scope.selCom.hide(); }; $scope.registerHideModel = function () { //$scope.selCom.hide(); $scope.go('register'); }; //跳转到关注用户 $scope.jumpToFancenter = function (act) { if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.go("fancenter", { act: act, userid: $scope.user.userid }); } }; $ionicModal.fromTemplateUrl('./modules/common/views/myReleaseModal.html', { scope: $scope, animation: 'slide-in-left' }).then(function (modal) { $scope.myRelease = modal; }); $scope.getMyRelease = function () { $scope.islogin = ConfigService.islogin; if (!$scope.islogin) { if (localStorage.wxFlag == "true") { if (localStorage.isUserFocusXW == 0) { var title = localStorage.appidStr; $ionicPopup.alert({ title: '提示', template: '请先关注微信公众号"' + title + '"!' }); return; } else { if (localStorage.isUserBindWx == 0) { var wxFlag = JSON.parse(localStorage.params); if (wxFlag.weChatModel) { $scope.go('bindPhone', { params: localStorage.params, comfrom: 'maincontroller', url: window.location.href.split('#/')[1] }); } else { $scope.go('login'); return; } } else { $scope.go('login'); return; } } } else { $scope.go('login'); return; } } else { $scope.myRelease.show(); $scope.allMyRelease = []; AccountService.releaseResource(UserService.id).then(function (res) { // console.log(res); if (res.code == 3350) { angular.forEach(res.data, function (val, index) { if (val.list.length > 0) { val.active = index == 0; $scope.allMyRelease.push(val); } }) } $scope.allList = $scope.allMyRelease[0]; }) } }; var currentIndex = 0; $scope.changeActiveTitle = function (index) { currentIndex = index; angular.forEach($scope.allMyRelease, function (val) { val.active = false; }); $scope.allMyRelease[index].active = true; $scope.allList = $scope.allMyRelease[index]; }; $scope.goResourceDetail = function (resource) { // console.log(resource); $scope.go($scope.allMyRelease[currentIndex].type, { node: resource.node || resource.source, orgtype: resource.orgtype, pagecode: resource.pagecode, resid: resource.resid || resource.unique || resource.connid, templettype: resource.templettype, comfrom: 'publisher', actions: resource.otherObj.actions, title: resource.title, restype: resource.type, ifjoin: resource.otherObj.ifjoin, taskstatus: resource.otherObj.taskstatus, taskid: resource.otherObj.id, opentowho: resource.otherObj.opentowho, activityid: resource.id, recourceid: resource.unique, recourcetype: resource.type, recourcecomefrom: resource.source, creator: resource.clickthrough, }) } });