2024-05-07 10:37:12 +08:00

62 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { API } from '../../../../utils/network/api'
const api = new API()
const app = getApp()
Page({
data: {
navbarData: {
showCapsule: 0, //是否显示左上角图标 1表示显示 0表示不显示
title: '个人中心', //导航栏 中间的标题
},
height: app.globalData.height,
info:{}
},
onShow() {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
active: 1, //数字是当前页面在tabbar的索引,如我的查询页索引是2因此这边为2同理首页就为0审批页面为1
})
}
api.getPharmacistInfo().then(response => {
console.log(response.data);
this.setData({
info: response.data
})
}).catch(errors => {
console.error(errors);
})
},
logOut(){
console.log("退出登录");
let usertype = wx.getStorageSync('usertype');
wx.showModal({
title: '确认退出登录',
content: '退出登录后您需要重新登录',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
const { envVersion } = wx.getAccountInfoSync().miniProgram;
if(envVersion=='release'){
wx.setStorageSync('AUTH_TOKEN_'+usertype, '');
}else{
wx.setStorageSync('DEV_AUTH_TOKEN_'+usertype, '');
}
// wx.setStorageSync('AUTH_TOKEN_'+usertype, "");
wx.setStorageSync('user_id_'+usertype, "");
wx.setStorageSync('client_user_id_'+usertype, "");
app.globalData.isLogin=false;
wx.setStorageSync('usertype','')
app.go("/Pages/index/index");
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
go(e){
console.log(e)
let url = e.currentTarget.dataset.url;
app.go(url);
}
})