haomingming cfa69efd15 优化
2023-03-22 09:01:58 +08:00

166 lines
4.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.

// 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": "首页",
"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": "问诊",
"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": "我的",
"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: "",
next_url: "/Pages/yishi/identity/index"
},
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 userID = wx.getStorageSync('user_id');
let idcard_status = wx.getStorageSync(userID+'_idcard_status');
let iden_auth_status = wx.getStorageSync(userID+'_iden_auth_status');
let multi_point_status = wx.getStorageSync(userID+'_multi_point_status');
let is_bind_bank = wx.getStorageSync(userID+'_is_bind_bank');
const usertype = wx.getStorageSync('usertype');
console.log("idcard_status: ", idcard_status);
console.log("iden_auth_status: ", iden_auth_status);
console.log("multi_point_status: ", iden_auth_status);
console.log("is_bind_bank: ", is_bind_bank);
if(idcard_status != 1 && usertype != 3){
this.setData({
dialog_visible: true,
dialog_content: "请您先实名认证",
next_url: "/Pages/yishi/identity/index",
})
return;
}
console.log(111);
if(iden_auth_status != 1 && usertype != 3){
this.setData({
dialog_visible: true,
dialog_content: "请您先医师身份认证",
next_url: "/Pages/yishi/identity/index?selected_tab=1",
})
return;
}
console.log(222);
if(is_bind_bank != 1 && usertype != 3){
this.setData({
dialog_visible: true,
dialog_content: "请您先绑定结算银行卡",
next_url: "/Pages/yishi/bankcard/index"
})
return;
}
console.log(333);
let url = this.data.items[e.detail].pagePath;
console.log(url);
wx.switchTab({
url: url,
})
},
confirmDialog(){
this.setData({
dialog_visible: false
})
console.log("next_url: ", this.data.next_url);
let next_url = this.data.next_url;
app.go(next_url);
},
cancelDialog(){
this.setData({
dialog_visible: false
})
},
}
})