// pages/mine/index.ts import Dialog from '@vant/weapp/dialog/dialog'; import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast'; import { accountid, loginid, loginQuery, taAccount, userid } from '../../services/utils'; Page({ /** * 页面的初始数据 */ data: { // 功能菜单项 menulists: [{id: 1, title: '我的库存', img: 'medal', path: '/mMine/pages/myinventorys/list/index'}, {id: 2, title: "我的订单", img: 'invitation', path: '/mMine/pages/myorders/list/index'}, {id: 3, title: '我的履约', img: 'underway', path: '/mMine/pages/myperformance/list/index'}, {id: 4, title: '我的出境', img: 'hot', path: '/mHome/pages/inspection/list/index'}, {id: 5, title: '我的保税', img: 'fire-o', path: '/mHome/pages/bond/list/index'}], // 列表菜单项 tablelists: [{id: 1, title: '签约账户', iconfont: 'https://www.iconfont.cn/search/index?searchType=icon&q=签约&page=1&fromCollection=1&fills=&tag=', path: '/mMine/pages/bank/index'}, {id: 2, title: '收货地址', iconfont: 'https://www.iconfont.cn/search/index?searchType=icon&q=签约&page=1&fromCollection=1&fills=&tag=', path: '/mMine/pages/address/list/index'}, {id: 3, title: '发票信息', iconfont: 'https://www.iconfont.cn/search/index?searchType=icon&q=签约&page=1&fromCollection=1&fills=&tag=', path: '/mMine/pages/invoice/list/index'}, {id: 4, title: '账户安全', iconfont: 'https://www.iconfont.cn/search/index?searchType=icon&q=签约&page=1&fromCollection=1&fills=&tag=', path: '/mMine/pages/modifypwd/index'}, {id: 5, title: '关于我们', iconfont: 'https://www.iconfont.cn/search/index?searchType=icon&q=签约&page=1&fromCollection=1&fills=&tag=', path: '/mMine/pages/about/about/index'}], /// 微信头像 avatarUrl: "", /// 微信昵称 nickName: loginQuery().userInfo.customername, /// 资金账户信息 ta: ({}), /// 登录账号 loginid: loginid(), /// 是否脱敏显示 isOpenEye: false }, onEye() { this.setData({ isOpenEye: !this.data.isOpenEye }) }, /** * 按钮点击响应事件 */ onButtonPressed(e: any) { switch (e.target.id) { case 'into-gold': /// 充值 wx.navigateTo({ url: '/mMine/pages/inoutgold/index' }) break; case 'out-gold': /// 提现 wx.navigateTo({ url: '/mMine/pages/inoutgold/index' }) break; default: break; } }, /** * 进入系统设置 */ goToSettings() { wx.navigateTo({ url: '/mMine/pages/settings/settings' }) }, /** * 生命周期函数--监听页面加载 */ onLoad() { /// 获取微信头像 let url = wx.getStorageSync('avatarUrl') if (url) { this.setData({ avatarUrl: url }) } this.setData({ /// 设置账户信息 ta: taAccount(accountid()) }) }, /** * 系统登出响应 */ onLoginOut() { Dialog.confirm({ title: '提示', message: '确定要退出系统吗?', }).then(() => { /// 清楚所有的缓存数据 wx.clearStorage() /// loding.... Toast.loading('登出中....') /// 登出 setTimeout(function () { Toast.clear() // on confirm wx.reLaunch({ url: '/pages/login/index' }) }, 2000) }).catch(() => { // on cancel }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { this.getTabBar().init() }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })