// 医生列表 // 网络请求工具类 var networkUtil = require('../../utils/network_util.js') var api = require('../../utils/apiFile.js') var hospitalName = '' Page({ data:{ doctorList:{}, hospitalName:'' }, /*---------生命周期--------*/ onLoad:function(options){ networkUtil.showLoading() 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){ }) }, })