123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762 |
- 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: '<span class="ionicAction_span">去认证</span>',
- type: "button-positive",
- onTap: function (e) {
- $scope.go('personIdentify');
- accountModel.setUserAuthInfo({});
- accountModel.setInfoImageList([]);
- }
- }
- ]
- });
- }
- if (authenstatus == 1) {
- $ionicPopup.show({
- title: '提示',
- template: '<span style="display:inline-block;height: 40px;line-height: 20px;width: 100%;text-align: center;">您的信息已在认证中</span>',
- buttons: [
- {
- text: '<span class="ionicAction_span">知道了</span>',
- type: "button-positive",
- onTap: function (e) {
- }
- }
- ]
- });
- }
- if (authenstatus == 2) {
- $scope.go("memberHome");
- }
- if (authenstatus == 3) {
- $ionicPopup.show({
- title: '提示',
- template: '您的信息认证失败',
- buttons: [
- {
- text: '<span class="ionicAction_span">去查看</span>',
- 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: '<p><ion-spinner icon="bubbles" class="spinner-calm"></ion-spinner><br><span style="color: #3B8BD0;font-size: 18px;font-weight: bold">努力加载中···</span></p>',
- 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,
- })
- }
- });
|