// pages/tabber/home/index.js const api = require('../../utils/api'); const app=getApp(); Page({ /** * 页面的初始数据 */ data: { menuList:[ { icon:'/image/home/wuliugailan@3x.png', tit:'物流概览', url:"/pages/logistics/index" }, { icon:'/image/home/icon_qujianxiangqing@3x.png', tit:'柜前取送', url:"/pages/take/index" }, { icon:'/image/home/icon_qianshou@3x.png', tit:'物流签收', url:"/pages/signFor/index" }, { icon:'/image/home/icon_daishoudian@3x.png', tit:'代收点', url:"/pages/servicePoint/index" }, { icon:'/image/home/icon_guiziguanli@3x.png', url:"/pages/cabinet/index", tit:'柜子管理' }, { icon:'/image/home/icon_sousuoyundan@3x.png', url:"/pages/serah/index", tit:'搜索运单' }, ], userinfo:"", }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that=this; app.api.useApi(app.globalData.baseAppUrl + "api/admin/UserInfo", { appid: wx.getAppBaseInfo().host.appId }, "post").then(function (res) { console.log(res); if (res.code == 200) { wx.showLoading({ title: '请重新登录', }) setTimeout(function () { wx.hideLoading(); wx.reLaunch({ url: '/pages/login/login', }) }, 1000); } else { wx.hideLoading(); wx.removeStorageSync('token') that.setdata({ userinfo:res.message.data }) } }).catch(function (err) { console.log(222); }) }, toUrl(e){ let {url} = e.currentTarget.dataset wx.navigateTo({ url, }) }, loginOut(){ app.api.useApi(app.globalData.baseAppUrl + "api/admin/logout", { appid: wx.getAppBaseInfo().host.appId }, "post").then(function (res) { wx.showLoading({ title: '退出中', }) console.log(res); if (res.code != 200) { wx.showLoading({ title: '失败请重试', }) setTimeout(function () { wx.hideLoading(); }, 1000); } else { wx.hideLoading(); wx.removeStorageSync('token') wx.reLaunch({ url: '/pages/login/login', }) } }).catch(function (err) { console.log(222); }) } })