|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- // pages/mine/index.js
- import {getUserData} from '../../api/login.js'
- import {messageSum} from '../../api/mine.js'
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- userInfo: {}, // 用户授权信息
- list: [
- {title: '个人信息', type: 'userinfo', path: '/package_mine/pages/userInfo/index'},
- {title: '护河身份', type: 'myid', path: '/package_mine/pages/myId/index'},
- {title: '我的兑换', type: 'exchange', path: '/package_mine/pages/exchange/index'},
- {title: '河湖问题反馈', type: 'feedback', path: '/package_mine/pages/records/index'},
- // {title: '我的美拍', type: 'beauty', path: '/package_mine/pages/beauties/index'},
- {title: '消息通知', type: 'notice', path: '/package_mine/pages/notice/index',showNumbers: true},
- ],
- myId: '', // 身份
- integral: 0, // 积分
- numbers: 0
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.getTabBar().setData({
- selected: 2
- })
-
- },
- onShow:function() {
- this.getUserInfo()
- this.getUnReadNums()
- },
-
- goRecords(e) {
- const path = e.currentTarget.dataset.path
- wx.navigateTo({
- url: path,
- })
- },
- // 获取
- getUserInfo() {
- const params = {}
- params.tenantId = wx.getStorageSync('tenant').tenantId
- params.openid = wx.getStorageSync('openid')
- getUserData(params).then(success=> {
- const userInfo = success.data
- wx.setStorage({
- key: 'userInfo',
- data:userInfo
- })
- this.setData({userInfo})
- })
- },
- getUnReadNums(){
- const openId = wx.getStorageSync('openid')
- messageSum({openId}).then(res=>{
- this.setData({
- numbers: res.data || 0
- })
- })
- },
- // 进入申请身份页面
- goApprove() {
- wx.navigateTo({
- url: '/package_mine/pages/IdList/index',
- })
- },
- handlePointDetail(){
- wx.navigateTo({
- url: '/package_mine/pages/history/index',
- })
- }
- })
|