// pages/selsecPer/selsecPer.js var app = getApp() let common = require('../../config/common.js') Page({ /** * 页面的初始数据 */ data: { list:[] }, jiuZhen(e){ console.log(e.currentTarget.dataset.item,"选择就诊人") let painId = e.currentTarget.dataset.item.PATIENT_ID let trueName = e.currentTarget.dataset.item.TRUE_NAME let sfId = e.currentTarget.dataset.item.ID_CARD let carNum = e.currentTarget.dataset.item.MEDICAL_CARD wx.setStorageSync('painId', painId) wx.setStorageSync('trueName', trueName) wx.setStorageSync('sfId1', sfId) wx.setStorageSync('cardNo', carNum) wx.navigateTo({ url: '/pages/selectDepartment/selectDepartment', // url: '/pages/departmentChoose/departmentChoose', }) }, getPerList(){ wx.request({ url:'https://fy.btlsoln.com:8443/getPatientByOpenid?openid', method:"GET", data:{ openid:app.globalData.openId }, header: { 'content-type': 'application/json' }, success: (res)=> { console.log(res.data,"患者") if(res.data.length > 0){ let data1 = res.data data1.map((item,index) => { if(item.TYPE == 0){ data1.unshift(data1.splice(index , 1)[0]); } }) this.setData({ list:data1 }) }else{ wx.showModal({ title: '', content: '您还未绑定就诊人,请先绑定就诊人信息!', cancelText:"否", confirmText:'是', success: function(res) { if (res.confirm) { wx.navigateTo({ url: '/pages/userMsgDel/userMsgDel?state=0', }) }else{ wx.switchTab({ url: '/pages/index/index', }) } } }) } } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if(app.globalData.openId == ""||app.globalData.openId==null){ common.checkGlobalOpenId().then(res=>{ console.log(res) app.globalData.openId = res this.getPerList() }, err=>{ //初始化失败,弹框提示 }) }else{ this.getPerList() } wx.setNavigationBarTitle({ title: '选择就诊人', }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })