| | |
| | | // pages/mine/mine.js |
| | | import userservice from '../../../service/userservice' |
| | | import userservice from '../../../service/userservice'; |
| | | import $f from '../../../service/baserequest'; |
| | | |
| | | const app = getApp() |
| | | const app = getApp(); |
| | | |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | icon1: $f.baseIconUrl + 'res/learn_2.png', |
| | | |
| | | version: app.globalData.version, |
| | | //认证状态,[企业, 场景, 个人] |
| | | authStatus:[], |
| | | authStatus: [], |
| | | //场景类型 |
| | | sceneType: app.globalData.userInfo.extension2 |
| | | sceneType: app.globalData.userInfo.extension2, |
| | | }, |
| | | |
| | | /** |
| | |
| | | onLoad: function (options) { |
| | | this.setData({ |
| | | userRealName: app.globalData.userInfo.realname, |
| | | sceneType: app.globalData.userInfo.extension2 |
| | | }) |
| | | this.getBaseInfo() |
| | | sceneType: app.globalData.userInfo.extension2, |
| | | }); |
| | | this.getBaseInfo(); |
| | | }, |
| | | |
| | | onShow() { |
| | | this.getAuthStatus() |
| | | this.getAuthStatus(); |
| | | }, |
| | | |
| | | //获取用户认证状态 |
| | | getAuthStatus() { |
| | | var that = this |
| | | userservice.getAuthStatus(app.globalData.accessToken.openId, app.globalData.accessToken.userId, { |
| | | success(res) { |
| | | if (res.success) { |
| | | that.setData({ |
| | | authStatus: res.data |
| | | }) |
| | | }else{ |
| | | wx.showToast({ |
| | | title: res.message, |
| | | duration: 2000, |
| | | icon: 'error', |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | var that = this; |
| | | userservice.getAuthStatus( |
| | | app.globalData.accessToken.openId, |
| | | app.globalData.accessToken.userId, |
| | | { |
| | | success(res) { |
| | | if (res.success) { |
| | | that.setData({ |
| | | authStatus: res.data, |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: res.message, |
| | | duration: 2000, |
| | | icon: 'error', |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | ); |
| | | }, |
| | | |
| | | getBaseInfo() { |
| | | var that = this |
| | | userservice.getBaseInfo(app.globalData.accessToken.userId, { |
| | | success(data) { |
| | | if (data.company != null) { |
| | | that.setData({ |
| | | companyName: data.company.ciName |
| | | }) |
| | | } |
| | | } |
| | | }, app.globalData.accessToken.openId) |
| | | var that = this; |
| | | userservice.getBaseInfo( |
| | | app.globalData.accessToken.userId, |
| | | { |
| | | success(data) { |
| | | if (data.company != null) { |
| | | that.setData({ |
| | | companyName: data.company.ciName, |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | app.globalData.accessToken.openId, |
| | | ); |
| | | }, |
| | | |
| | | logout() { |
| | | wx.reLaunch({ |
| | | url: '/pages/mUser/userlogin/userlogin', |
| | | }) |
| | | }); |
| | | }, |
| | | |
| | | goto(e) { |
| | | var url = "" |
| | | var index = e.currentTarget.dataset.index |
| | | var url = ''; |
| | | var index = e.currentTarget.dataset.index; |
| | | switch (index) { |
| | | case "0": |
| | | case '0': |
| | | //监测数据 |
| | | url = "/pages/mService/pDevicedata/pDevicedata" |
| | | url = '/pages/mService/pDevicedata/pDevicedata'; |
| | | break; |
| | | case "1": |
| | | case '1': |
| | | //通知管理 |
| | | url = "/pages/mNotice/notice/notice" |
| | | url = '/pages/mNotice/notice/notice'; |
| | | break; |
| | | case "2": |
| | | case '2': |
| | | //技术支持 |
| | | url = "/pages/mUser/pSupport/pSupport" |
| | | url = '/pages/mUser/pSupport/pSupport'; |
| | | break; |
| | | case "3": |
| | | case '3': |
| | | //我的收藏 |
| | | url = "" |
| | | url = ''; |
| | | break; |
| | | case "4": |
| | | case '4': |
| | | //我要咨询 |
| | | url = "/pages/mConsult/consultonline/consultonline" |
| | | url = '/pages/mConsult/consultonline/consultonline'; |
| | | break; |
| | | case "5": |
| | | case '5': |
| | | //环保日程 |
| | | url = "/pages/mService/pSchedule/pSchedule" |
| | | url = '/pages/mService/pSchedule/pSchedule'; |
| | | break; |
| | | case "6": |
| | | case '6': |
| | | //关于 |
| | | url = "/pages/mUser/pAbout/pAbout" |
| | | url = '/pages/mUser/pAbout/pAbout'; |
| | | break; |
| | | case "7": |
| | | case '7': |
| | | //操作指引 |
| | | url = "/pages/mUser/pInstructions/pInstructions" |
| | | url = '/pages/mUser/pInstructions/pInstructions'; |
| | | break; |
| | | case '8': |
| | | //守法承诺 |
| | | url = '/pages/mPromise/promisehome/promise'; |
| | | break; |
| | | case '9': |
| | | //问题整改 |
| | | url = '/pages/mExtra/pSupervisionSummary/index'; |
| | | break; |
| | | } |
| | | if (url != "") { |
| | | if (url != '') { |
| | | wx.navigateTo({ |
| | | url: url |
| | | }) |
| | | url: url, |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '功能敬请期待', |
| | | duration: 1000, |
| | | icon: 'none', |
| | | mask: true, |
| | | }) |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | //认证 |
| | | gotoAuthentication(e) { |
| | | //等待认证状态加载完毕 |
| | | if (this.data.authStatus.length == 0) return |
| | | var url = "" |
| | | var index = e.currentTarget.dataset.index |
| | | if (this.data.authStatus.length == 0) return; |
| | | var url = ''; |
| | | var index = e.currentTarget.dataset.index; |
| | | switch (index) { |
| | | //企业认证 |
| | | case "0": |
| | | url = "/pages/mUser/companyauthentication/companyauthentication" |
| | | case '0': |
| | | url = '/pages/mUser/companyauthentication/companyauthentication'; |
| | | break; |
| | | //场景认证 |
| | | case "1": |
| | | url = "/pages/mUser/sceneauthentication/sceneauthentication" |
| | | case '1': |
| | | switch (this.data.sceneType) { |
| | | case '1': |
| | | url = '/pages/mUser/sceneauthentication/sceneauthentication'; |
| | | break; |
| | | case '6': |
| | | url = '/pages/mUser/sceneauthentication/industrial/index'; |
| | | break; |
| | | default: |
| | | url = '/pages/mUser/sceneauthentication/sceneauthentication'; |
| | | break; |
| | | } |
| | | break; |
| | | //个人认证 |
| | | case "2": |
| | | url = "/pages/mUser/personalauthentication/personalauthentication" |
| | | case '2': |
| | | url = '/pages/mUser/personalauthentication/personalauthentication'; |
| | | break; |
| | | } |
| | | if (url != "") { |
| | | if (url != '') { |
| | | wx.navigateTo({ |
| | | url: url, |
| | | success: (res) => { |
| | | success: res => { |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', { |
| | | authStatus: this.data.authStatus[parseInt(index)] |
| | | }) |
| | | authStatus: this.data.authStatus[parseInt(index)], |
| | | }); |
| | | }, |
| | | }) |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '功能敬请期待', |
| | | duration: 1000, |
| | | icon: 'none', |
| | | mask: true, |
| | | }) |
| | | }); |
| | | } |
| | | }, |
| | | |
| | |
| | | // success: (res) => { |
| | | // res.eventChannel.emit('acceptDataFromOpenerPage', app.globalData.) |
| | | // }, |
| | | }) |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | }); |