// 医生列表 // 网络请求工具类 var networkUtil = require('../../utils/network_util.js') var api = require('../../utils/apiFile.js') var hospitalName = '' Page({ data: { doctorList: [{ "account": "zt", "areaId": "13", "chartroomId": "211218461687809", "cityId": "14", "dept": "产科", "description": "空", "hospitalId": "216", "hospitalName": "秦皇岛市妇幼保健院", "hxName": "mommydoctorwx99", "id": 99, "lastLoginTime": "2021-09-06 16:33:17", "name": "张甜", "openId": "o9UOB4uHqTHqgjujFDy0z3CxHV58", "parentId": 1000, "phone": "", "positional": "空", "price": 2, "provinceId": "1", "pwd": "E10ADC3949BA59ABBE56E057F20F883E", "status": 0, "type": 1 }, { "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: '', }, /*---------生命周期--------*/ onLoad: function(options) { // networkUtil.showLoading() if (options.isAdvertisingPage) { } else { //this.requestData() } }, toDoctorDetail: function(e) { console.log(e.currentTarget.dataset.myid) wx.navigateTo({ // url: '../doctor/doctor?doctorInfo='+JSON.stringify(this.data.doctorList[e.currentTarget.dataset.myid]), 这个url长度有限,参数太多会被剪切 url: '../doctor/doctor?doctorId=' + this.data.doctorList[e.currentTarget.dataset.myid] .doctorId + '&' + 'hospitalId=' + this.data.doctorList[e.currentTarget.dataset.myid] .hospitalId, }) }, /*---------自定义函数--------*/ requestData() { var self = this networkUtil._get(api.doctorList, {}, function(res) { console.log(res) self.setData({ doctorList: res.data.data, }) }, function(res) { }) }, })