<template> <view class="main"> <u-notify ref="uNotify" message="Hi uView"></u-notify> <view class="user" @click="go(user.doctor ? '/pages/user/info' : '/pages/user/bind/index')"> <image :src="user.avatar ? ip + user.avatar : '../../static/favicon.png'" :class="user.avatar ? 'head' : ''"></image> <view class="con" v-if="user.id || user.token"> <view v-if="user.doctor"> <view class="nickName">{{ user.nickName }}</view> <view class="welcome">{{ user.dept.deptName || '欢迎使用岑溪人民医院小程序' }}</view> </view> <view v-else> <view class="nickName"> <text v-if="user.bindUserList && user.bindUserList.length > 0">{{ user.patientName ? user.patientName : '未设置当前就诊人' }}</text> <text v-else>还未绑定就诊人</text> <text v-if="user.relationship" class="relationship">({{ user.relationship }})</text> <text class="icon" v-if="user.bindUserList && user.bindUserList.length > 0" @click.stop="show = true">切换就诊人</text> </view> <view class="welcome">欢迎使用岑溪人民医院小程序</view> </view> </view> <view class="con" v-else> <view class="nickName">你还没登录</view> <view class="welcome">欢迎使用岑溪人民医院小程序</view> </view> <view class="icon edit"></view> </view> <view class="cmd animated fadeInDown"> <!--医生菜单--> <view v-if="user.doctor"> <view class="s_item" @click="go('/pages/follow/doctor/index?type=0')"> <text class="icon ic" style="color: #03a9f4"></text> <text class="title">复诊提醒</text> <text class="icon arrow"></text> </view> <view class="s_item" @click="go('/pages/follow/doctor/index?type=1')"> <text class="icon ic" style="color: #607d8b"></text> <text class="title">随访记录</text> <text class="icon arrow"></text> </view> <view class="s_item" @click="go('/pages/knowledge/doctor/index')"> <text class="icon ic" style="color: #ff5722"></text> <text class="title">我的知识库</text> <text class="icon arrow"></text> </view> <view class="s_item" @click="go('/pages/visit/doctor/selectUser')"> <text class="icon ic" style="color: #03a9f4"></text> <text class="title">就诊记录</text> <text class="icon arrow"></text> </view> <view class="s_item" @click="go('/pages/detection/doctor/selectUser')"> <text class="icon ic" style="color: #ff9800"></text> <text class="title">检测报告</text> <text class="icon arrow"></text> </view> </view> <!--患者菜单--> <view v-else> <view class="s_item" @click="go('/pages/follow/remind')"> <text class="icon ic" style="color: #03a9f4"></text> <text class="title">复诊提醒</text> <text class="icon arrow"></text> <view class="bage" v-if="user.remind > 0">{{ user.remind > 99 ? '99+' : user.remind }}</view> </view> <view class="s_item" @click="go('/pages/follow/index')"> <text class="icon ic" style="color: #607d8b"></text> <text class="title">我的随访</text> <text class="icon arrow"></text> <view class="bage" v-if="user.follow > 0">{{ user.follow > 99 ? '99+' : user.follow }}</view> </view> <view class="s_item" @click="go('/pages/visit/index')"> <text class="icon ic" style="color: #03a9f4"></text> <text class="title">就诊记录</text> <text class="icon arrow"></text> </view> <view class="s_item" @click="go('/pages/detection/index')"> <text class="icon ic" style="color: #ff9800"></text> <text class="title">检测报告</text> <text class="icon arrow"></text> </view> </view> <button class="s_item" open-type="share" hover-class="none"> <text class="icon ic" style="color: #f44336"></text> <text class="title">分享应用</text> <text class="icon arrow"></text> </button> <button class="s_item" open-type="feedback" hover-class="none"> <text class="icon ic" style="color: #4caf50"></text> <text class="title">建议反馈</text> <text class="icon arrow"></text> </button> <view class="s_item" @click="go('/pages/other/setting')"> <text class="icon ic" style="color: #9e9e9e"></text> <text class="title">设置</text> <text class="icon arrow"></text> </view> </view> <u-action-sheet round="20" title="切换就诊人" :actions="user.bindUserList" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet> </view> </template> <script> export default { data() { return { ip: this.http.ip, patientId: '', user: {}, show: false }; }, onShow() { /* this.user = { token: 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImI3ZjVlNDYwLThjY2YtNDkxZi1hNTBjLWI1MjQzNDUzNjFkZiJ9.VTDBJ3929h8qGWMZFkfq-dQAkWOptIfQk7f5CaIahgltFV4QACgf3QBabcswisGTMQZaJMkxt5uCzjv3AkN48w' }; uni.setStorageSync('user', this.user); */ this.user = this.getUser(); if (this.hasLogin() && !this.user.doctor) { this.getUserInfo(); } }, onLoad(e) { if (e.patientId) { this.http.request({ url: '/app/user/bind/change/' + e.patientId, success: (res) => { this.getUserInfo(); } }); } }, methods: { getUserInfo() { this.http.request({ url: '/app/user/info', success: (res) => { this.user = res.data.data; if (this.user.follow > 0) { setTimeout(() => { this.$refs.uNotify.show({ top: -30, message: '你有' + this.user.follow + '条随访待填写', fontSize: 15, duration: 5000 }); }, 1500); } } }); }, //切换就诊人 selectClick(e) { uni.showModal({ title: '提示', content: '确定切换就诊人', success: (res) => { if (res.confirm) { //通知模板订阅消息 uni.requestSubscribeMessage({ tmplIds: ['1Jvx8F22na-tG2Q6HFX_3vRtbiv7zZko6NwX8ICIFXc', 'S6JARkInVBjID8QMpgZdSHNyxeMDZQq7lur8YrNK0oY'], complete: (c) => { this.http.request({ url: '/app/user/bind/change/' + e.id, success: (res) => { this.getUserInfo(); } }); } }); } } }); }, go(url) { if (this.hasLogin()) { uni.navigateTo({ url: url }); } else { uni.navigateTo({ url: '/pages/user/login' }); } } }, onShareAppMessage: function (res) { return { title: '岑溪人民医院小程序', path: '/pages/index/index', imageUrl: '../../static/favicon.png', success: (res) => {}, fail: (res) => {} }; } }; </script> <style lang="scss"> .main { padding: 5px 15px 25px 15px; .user { overflow: hidden; image { float: left; width: 60px; height: 60px; border-radius: 50%; } .head { width: 40px; height: 60px; border-radius: 3px; } .con { float: left; padding-left: 15px; .nickName { padding-top: 5px; .relationship { color: #7c7c7c; font-size: 13px; padding-left: 3px; } .icon { padding-left: 6px; font-size: 13px; color: $main-color; } } .welcome { font-size: 14px; padding-top: 5px; color: #989898; } } .edit { float: right; margin-top: 14px; } } button { border-radius: 0px; line-height: 1; font-size: 15px; } } </style>