doctor.js 3.42 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
// 医生信息页面

// 网络请求工具类
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')




Page({
data: {
starsM: '../../source/imageSource/icon_star.png',
hideStar: '../../source/imageSource/icon_star_light.png',
doctorInfo: {
"account": "zcf",
"areaId": "13",
"chartroomId": "212756700659718",
"cityId": "14",
"dept": "产科",
"description": "张春芳:副主任医师,从事医疗保健专业近30年,对于不同人群、各种疾病的营养能给予正确的指导,尤其对儿童、孕产妇的营养指导具有丰富的临床经验,擅长妊娠期糖尿病,围产期营养指导,产妇保健等。获省、市级科技进步奖2项,发表国家级、省级论文20篇。",
"hospitalId": "216",
"hospitalName": "秦皇岛市妇幼保健院",
"hxName": "mommydoctorwx20004",
"id": 20004,
"lastLoginTime": "2020-10-11 17:25:06",
"name": "张春芳",
"openId": "",
"parentId": 1000,
"phone": "",
"positional": "副主任医师",
"price": 20,
"provinceId": "1",
"pwd": "E10ADC3949BA59ABBE56E057F20F883E",
"status": 0,
"type": 1
},
hospitalName: '',
doctorLevel: '',
deptName: '',
hxName: '',
member: []
},
/*---------生命周期--------*/
onLoad: function (options) {
console.log(options)
// networkUtil.showLoading()
// 测试数据
options.hospitalId = 177
options.doctorId = 473
this.requestData(options.hospitalId, options.doctorId)
},
chatWithDoctor() {
var self = this
if (!self.data.hxName) {
networkUtil.showErrorToast('暂时无法咨询该医生哦')
return;
}
if (!getApp().globalData.canChat) {
networkUtil.showErrorToast('您还没有开通咨询服务,暂时无法咨询该医生哦')
return;
}
// var member = wx.getStorageSync('member')
// var isinclude = false
// for (var i = 0; i < member.length; i++) {
// if (member[i].name == self.data.hxName) {
// isinclude = true
// break;
// }
// }
// if (isinclude) {
// self.addFriend(self.data.hxName)
// }
self.addFriend(self.data.hxName)
var my = wx.getStorageSync('hxName')
var nameList = {
myName: my,
your: self.data.hxName,
yourName: self.data.doctorInfo.username,
yourIcon: self.data.doctorInfo.avatar,
}
wx.navigateTo({
url: '../chatroom/chatroom?username=' + JSON.stringify(nameList)
})
},
addFriend(hxName) {
// console.log("hxName:" + hxName)
// console.log("userName:" + wx.getStorageSync('hxName'))
var self = this
networkUtil._get(api.doctorAddFriend, { userName: wx.getStorageSync('hxName'),friendName: hxName }, function (res) {
console.log(res)
self.getRoster()
}, function (res) {

})
},
getRoster() {
var that = this

},
/*---------自定义函数--------*/
requestData(hospitalId, doctorId) {
var self = this
networkUtil._get(api.doctorInfo, { hospitalId: getApp().globalData.userInfo.hospitalId, id: doctorId, sourceType:1}, function (res) {
self.setData({
doctorInfo: res.data.doctorObj,
hospitalName: res.data.hospitalName,
deptName: res.data.deptName,
doctorLevel: res.data.doctorLevel,
hxName: res.data.hxName,
hospitalLevel: res.data.hospitalLevel
})
console.log(res)
}, function (res) {

})
}
})