2023-03-17 10:13:35 +08:00

145 lines
3.9 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.

// custom-tab-bar/index.js
const app = getApp()
Component({
/**
* 页面的初始数据
*/
data: {
tabBarShow: true,
active: 0,
"backgroundColor": "#ffffff",
"selectedColor": "#fff",
"listAll": {
"list1":[
{
"pagePath": "/Pages/yaoshi/home/home",
"text": "首页",
"iconPath": "/static/images/yaoshi/tabbar_icon/home.png",
"selectedIconPath": "/static/images/yaoshi/tabbar_icon/home_select.png",
"info": ""
},
{
"pagePath": "/Pages/yaoshi/my/my",
"text": "我的",
"iconPath": "/static/images/yaoshi/tabbar_icon/my.png",
"selectedIconPath": "/static/images/yaoshi/tabbar_icon/my_select.png",
"info": ""
}],
"list2":[
{
"pagePath": "/Pages/yishi/index/index",
"text": "首页(Y)",
"iconPath": "/static/images/yishi/tabbar_icon/index.png",
"selectedIconPath": "/static/images/yishi/tabbar_icon/index_select.png",
"info": ""
},
{
"pagePath": "/Pages/yishi/wenzhen_v2/wenzhen",
"text": "问诊(Z)",
"iconPath": "/static/images/yishi/tabbar_icon/wenzhen.png",
"selectedIconPath": "/static/images/yishi/tabbar_icon/wenzhen_select.png",
"info": "99"
},
{
"pagePath": "/Pages/yishi/my/index",
"text": "我的(Y)",
"iconPath": "/static/images/yishi/tabbar_icon/my.png",
"selectedIconPath": "/static/images/yishi/tabbar_icon/my_select.png",
"info": ""
}]
},
items: [ ],
dialog_visible: false,
dialog_content: "",
usertype: "",
index_info: "",
wenzhen_info: "",
my_info: "",
},
attached() {
const usertype = wx.getStorageSync('usertype')
console.log("usertype: " ,usertype);
if (usertype == 2) {
this.setData({
usertype: usertype,
items: this.data.listAll.list2
})
}else{
this.setData({
usertype: usertype,
items: this.data.listAll.list1
})
}
let _this = this;
let userID = wx.getStorageSync('user_id');
setInterval(() => {
let index_info = wx.getStorageSync(userID+'_index_info');
let wenzhen_info = wx.getStorageSync(userID+'_wenzhen_info');
let my_info = wx.getStorageSync(userID+'_my_info');
_this.setData({
index_info: index_info,
wenzhen_info: wenzhen_info,
my_info: my_info,
})
}, 500);
},
methods: {
// swichNav: function (e) {
// console.log(123);
// let that = this;
// if (this.data.currentTab === e.target.dataset.current) {
// return false;
// } else {
// that.setData({
// currentTab: e.target.dataset.current
// })
// let url = e.currentTarget.dataset.url; // 点击tabbar时跳转对应的页面
// wx.switchTab({
// url: url,
// })
// }
// },
onChange(e) {
console.log("custom tab bar onChange");
let idcard_status = wx.getStorageSync('idcard_status');
let iden_auth_status = wx.getStorageSync('iden_auth_status');
console.log("idcard_status: ", idcard_status);
console.log("iden_auth_status: ", iden_auth_status);
if(idcard_status != 1){
this.setData({
dialog_visible: true,
dialog_content: "请您先实名认证"
})
return;
}
if(iden_auth_status != 1){
this.setData({
dialog_visible: true,
dialog_content: "请您先医师身份认证"
})
return;
}
let url = this.data.items[e.detail].pagePath;
console.log(url);
wx.switchTab({
url: url,
})
},
confirmDialog(){
this.setData({
dialog_visible: false
})
app.go("/Pages/yishi/identity/index");
},
cancelDialog(){
this.setData({
dialog_visible: false
})
},
}
})