168 lines
4.8 KiB
JavaScript
168 lines
4.8 KiB
JavaScript
// custom-tab-bar/index.js
|
|
import { API } from '../utils/network/api'
|
|
const api = new API()
|
|
const app = getApp()
|
|
Component({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
tabBarShow: true,
|
|
active: 0,
|
|
"backgroundColor": "#ffffff",
|
|
"selectedColor": "#fff",
|
|
"listAll": {
|
|
"list1":[
|
|
{
|
|
"pagePath": "/Pages/yaoshi/home/home",
|
|
"text": "首页",
|
|
"iconPath": api.getStaticHost()+"/applet/doctor/static/images/yaoshi/home.png",
|
|
"selectedIconPath": api.getStaticHost()+"/applet/doctor/static/images/yaoshi/home_select.png",
|
|
"info": ""
|
|
},
|
|
{
|
|
"pagePath": "/Pages/yaoshi/my/my",
|
|
"text": "我的",
|
|
"iconPath": api.getStaticHost()+"/applet/doctor/static/images/yaoshi/my.png",
|
|
"selectedIconPath": api.getStaticHost()+"/applet/doctor/static/images/yaoshi/my_select.png",
|
|
"info": ""
|
|
}],
|
|
"list2":[
|
|
{
|
|
"pagePath": "/Pages/yishi/index/index",
|
|
"text": "首页",
|
|
"iconPath": api.getStaticHost()+"/applet/doctor/static/images/yishi/index.png",
|
|
"selectedIconPath": api.getStaticHost()+"/applet/doctor/static/images/yishi/index_select.png",
|
|
"info": ""
|
|
},
|
|
{
|
|
"pagePath": "/Pages/yishi/wenzhen_v2/wenzhen",
|
|
"text": "问诊",
|
|
"iconPath":api.getStaticHost()+"/applet/doctor/static/images/yishi/wenzhen.png",
|
|
"selectedIconPath":api.getStaticHost()+"/applet/doctor/static/images/yishi/wenzhen_select.png",
|
|
"info": "99"
|
|
},
|
|
{
|
|
"pagePath": "/Pages/yishi/my/index",
|
|
"text": "我的",
|
|
"iconPath": api.getStaticHost()+"/applet/doctor/static/images/yishi/my.png",
|
|
"selectedIconPath":api.getStaticHost()+"/applet/doctor/static/images/yishi/my_select.png",
|
|
"info": ""
|
|
}]
|
|
},
|
|
items: [ ],
|
|
dialog_visible: false,
|
|
dialog_content: "",
|
|
usertype: 2,
|
|
index_info: "",
|
|
wenzhen_info: "",
|
|
my_info: "",
|
|
next_url: "/Pages/yishi/identity/index",
|
|
info_inter: 0
|
|
},
|
|
|
|
lifetimes: {
|
|
attached(){
|
|
this.setData({
|
|
usertype: 2,
|
|
items: this.data.listAll.list2
|
|
})
|
|
},
|
|
ready() {
|
|
const usertype = wx.getStorageSync('usertype')
|
|
if (usertype == 3) {
|
|
this.setData({
|
|
usertype: 3,
|
|
items: this.data.listAll.list1
|
|
})
|
|
}else{
|
|
this.setData({
|
|
usertype: 2,
|
|
items: this.data.listAll.list2
|
|
})
|
|
}
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
startInterval(){
|
|
let _this = this;
|
|
const usertype = wx.getStorageSync('usertype')
|
|
let userID = wx.getStorageSync('user_id_'+usertype);
|
|
let info_inter = setInterval(() => {
|
|
if(app.globalData.config.userID == userID){
|
|
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: this.formatNum(index_info),
|
|
wenzhen_info: this.formatNum(wenzhen_info),
|
|
my_info: this.formatNum(my_info),
|
|
})
|
|
}
|
|
}, 500);
|
|
this.setData({
|
|
info_inter: info_inter
|
|
})
|
|
},
|
|
stopInterval(){
|
|
clearInterval(this.data.info_inter)
|
|
},
|
|
formatNum(val){
|
|
if(val > 99) val = '+99';
|
|
if(val == 0) val = '';
|
|
return val;
|
|
},
|
|
onChange(e) {
|
|
const usertype = wx.getStorageSync('usertype');
|
|
let userID = wx.getStorageSync('user_id_'+usertype);
|
|
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');
|
|
|
|
if(idcard_status != 1 && usertype != 3){
|
|
this.setData({
|
|
dialog_visible: true,
|
|
dialog_content: "请您先完成实名认证",
|
|
next_url: "/Pages/yishi/identity/index",
|
|
})
|
|
return;
|
|
}
|
|
if(iden_auth_status != 1 && usertype != 3){
|
|
this.setData({
|
|
dialog_visible: true,
|
|
dialog_content: "请您先医师身份认证",
|
|
next_url: "/Pages/yishi/identity/index?selected_tab=1",
|
|
})
|
|
return;
|
|
}
|
|
if(is_bind_bank != 1 && usertype != 3){
|
|
this.setData({
|
|
dialog_visible: true,
|
|
dialog_content: "请您先绑定结算银行卡",
|
|
next_url: "/Pages/yishi/bankcard/index"
|
|
})
|
|
return;
|
|
}
|
|
let url = this.data.items[e.detail].pagePath;
|
|
wx.switchTab({
|
|
url: url,
|
|
})
|
|
},
|
|
confirmDialog(){
|
|
this.setData({
|
|
dialog_visible: false
|
|
})
|
|
let next_url = this.data.next_url;
|
|
app.go(next_url);
|
|
},
|
|
cancelDialog(){
|
|
this.setData({
|
|
dialog_visible: false
|
|
})
|
|
},
|
|
}
|
|
|
|
}) |