77 lines
2.3 KiB
JavaScript
77 lines
2.3 KiB
JavaScript
import { API } from './../../../utils/network/api'
|
||
let api = new API()
|
||
const app = getApp();
|
||
Page({
|
||
data: {
|
||
title: "个人中心",
|
||
navHeight: 0,
|
||
stateHeight: 0,
|
||
user_name: "医师姓名",
|
||
iden_auth_status: "0",
|
||
idcard_status: "0",
|
||
multi_point_status: "0",
|
||
avatar: "https://img.applets.igandanyiyuan.com/applet/doctor/static/images/default_photo.png",
|
||
balance_account: "0",
|
||
estimate_income: "0",
|
||
doctor_id: ""
|
||
},
|
||
|
||
// 获取状态栏信息
|
||
getMenuButtonBound() {
|
||
let stateHeight = 0; // 接收状态栏高度
|
||
const navHeight = wx.getMenuButtonBoundingClientRect().height; // 获取胶囊高度
|
||
let top = 0;
|
||
wx.getSystemInfo({
|
||
success(res) {
|
||
stateHeight = res.statusBarHeight;
|
||
},
|
||
});
|
||
top = wx.getMenuButtonBoundingClientRect().top - stateHeight; // 获取top值
|
||
console.log('navHeight', navHeight);
|
||
console.log('top', top);
|
||
this.setData({
|
||
// navHeight: navHeight + top * 2, // 导航栏高度
|
||
navHeight, // 导航栏高度
|
||
stateHeight: stateHeight + top, // 状态栏高度
|
||
});
|
||
},
|
||
|
||
onShow: function () {
|
||
console.log("onshow ");
|
||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||
this.getTabBar().setData({
|
||
active: 2 //数字是当前页面在tabbar的索引,如我的查询页索引是2,因此这边为2,同理首页就为0,审批页面为1
|
||
})
|
||
}
|
||
this.getMenuButtonBound();
|
||
},
|
||
onLoad(){
|
||
console.log("my onLoad");
|
||
//获取个人中心数据
|
||
api.getDoctorCenter().then(response => {
|
||
this.setData({
|
||
user_name: response.data.user_name,
|
||
iden_auth_status: response.data.iden_auth_status,
|
||
idcard_status: response.data.idcard_status,
|
||
multi_point_status: response.data.multi_point_status,
|
||
balance_account: response.data.balance_account,
|
||
doctor_id: response.data.doctor_id,
|
||
estimate_income: response.data.estimate_income
|
||
})
|
||
|
||
let avatar = response.data.avatar;
|
||
if(avatar && (avatar.indexOf("http") == -1)){
|
||
avatar = api.getStaticHost() + avatar;
|
||
}
|
||
this.setData({
|
||
"avatar": avatar
|
||
})
|
||
}).catch(errors => {
|
||
console.error(errors);
|
||
})
|
||
},
|
||
go(e){
|
||
let url = e.currentTarget.dataset.url;
|
||
app.go(url)
|
||
}
|
||
}) |