1
This commit is contained in:
@@ -1,9 +1,77 @@
|
||||
import request from "@/utils/request"
|
||||
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
list: [
|
||||
{
|
||||
s: "李",
|
||||
name: "李医生",
|
||||
title: "主任医师 · 骨科专家",
|
||||
desc: "20年临床经验"
|
||||
},
|
||||
{
|
||||
s: "王",
|
||||
name: "王医生",
|
||||
title: "副主任医师 · 康复医学",
|
||||
desc: "15年临床经验"
|
||||
},
|
||||
{
|
||||
s: "张",
|
||||
name: "张护士长",
|
||||
title: "主管护师 · 伤口护理",
|
||||
desc: "18年护理经验"
|
||||
}
|
||||
],
|
||||
count: 0
|
||||
},
|
||||
onShow() {
|
||||
let userInfo = app.globalData.userInfo
|
||||
this.setData({
|
||||
count: userInfo.consult_remains
|
||||
})
|
||||
this.getTabBar((tabBar) => {
|
||||
tabBar.setData({
|
||||
selected: '专家服务',
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async onPlay() {
|
||||
if (this.data.count <= 0) {
|
||||
wx.showToast({
|
||||
title: '免费次数已用完',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 2. 弹窗确认
|
||||
wx.showModal({
|
||||
title: '拨打专家热线',
|
||||
content: '确认拨打专家咨询电话吗?本次咨询将使用1次免费机会',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
wx.showLoading({ title: '正在呼叫...', mask: true });
|
||||
const info = await request.get("/expert/phone");
|
||||
this.setData({
|
||||
count: this.data.count - 1
|
||||
});
|
||||
wx.hideLoading();
|
||||
|
||||
// 5. 吊起拨号盘
|
||||
if (info && info.expert_phone) {
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: info.expert_phone,
|
||||
});
|
||||
} else {
|
||||
wx.showToast({ title: '暂无专家电话', icon: 'none' });
|
||||
}
|
||||
} catch (error) {
|
||||
wx.hideLoading();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user