index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="main">
  3. <u-notify ref="uNotify" message="Hi uView"></u-notify>
  4. <view class="user" @click="go(user.doctor ? '/pages/user/info' : '/pages/user/bind/index')">
  5. <image :src="user.avatar ? ip + user.avatar : '../../static/favicon.png'" :class="user.avatar ? 'head' : ''"></image>
  6. <view class="con" v-if="user.id || user.token">
  7. <view v-if="user.doctor">
  8. <view class="nickName">{{ user.nickName }}</view>
  9. <view class="welcome">{{ user.dept.deptName || '欢迎使用岑溪人民医院小程序' }}</view>
  10. </view>
  11. <view v-else>
  12. <view class="nickName">
  13. <text v-if="user.bindUserList && user.bindUserList.length > 0">{{ user.patientName ? user.patientName : '未设置当前就诊人' }}</text>
  14. <text v-else>还未绑定就诊人</text>
  15. <text v-if="user.relationship" class="relationship">({{ user.relationship }})</text>
  16. <text class="icon" v-if="user.bindUserList && user.bindUserList.length > 0" @click.stop="show = true">&#xe6a7;切换就诊人</text>
  17. </view>
  18. <view class="welcome">欢迎使用岑溪人民医院小程序</view>
  19. </view>
  20. </view>
  21. <view class="con" v-else>
  22. <view class="nickName">你还没登录</view>
  23. <view class="welcome">欢迎使用岑溪人民医院小程序</view>
  24. </view>
  25. <view class="icon edit">&#xe62b;</view>
  26. </view>
  27. <view class="cmd animated fadeInDown">
  28. <!--医生菜单-->
  29. <view v-if="user.doctor">
  30. <view class="s_item" @click="go('/pages/follow/doctor/index?type=0')">
  31. <text class="icon ic" style="color: #03a9f4">&#xe716;</text>
  32. <text class="title">复诊提醒</text>
  33. <text class="icon arrow">&#xe62b;</text>
  34. </view>
  35. <view class="s_item" @click="go('/pages/follow/doctor/index?type=1')">
  36. <text class="icon ic" style="color: #607d8b">&#xe60b;</text>
  37. <text class="title">随访记录</text>
  38. <text class="icon arrow">&#xe62b;</text>
  39. </view>
  40. <view class="s_item" @click="go('/pages/knowledge/doctor/index')">
  41. <text class="icon ic" style="color: #ff5722">&#xe69a;</text>
  42. <text class="title">我的知识库</text>
  43. <text class="icon arrow">&#xe62b;</text>
  44. </view>
  45. <view class="s_item" @click="go('/pages/visit/doctor/selectUser')">
  46. <text class="icon ic" style="color: #03a9f4">&#xe685;</text>
  47. <text class="title">就诊记录</text>
  48. <text class="icon arrow">&#xe62b;</text>
  49. </view>
  50. <view class="s_item" @click="go('/pages/detection/doctor/selectUser')">
  51. <text class="icon ic" style="color: #ff9800">&#xe63a;</text>
  52. <text class="title">检测报告</text>
  53. <text class="icon arrow">&#xe62b;</text>
  54. </view>
  55. </view>
  56. <!--患者菜单-->
  57. <view v-else>
  58. <view class="s_item" @click="go('/pages/follow/remind')">
  59. <text class="icon ic" style="color: #03a9f4">&#xe6a3;</text>
  60. <text class="title">复诊提醒</text>
  61. <text class="icon arrow">&#xe62b;</text>
  62. <view class="bage" v-if="user.remind > 0">{{ user.remind > 99 ? '99+' : user.remind }}</view>
  63. </view>
  64. <view class="s_item" @click="go('/pages/follow/index')">
  65. <text class="icon ic" style="color: #607d8b">&#xe60b;</text>
  66. <text class="title">我的随访</text>
  67. <text class="icon arrow">&#xe62b;</text>
  68. <view class="bage" v-if="user.follow > 0">{{ user.follow > 99 ? '99+' : user.follow }}</view>
  69. </view>
  70. <view class="s_item" @click="go('/pages/visit/index')">
  71. <text class="icon ic" style="color: #03a9f4">&#xe685;</text>
  72. <text class="title">就诊记录</text>
  73. <text class="icon arrow">&#xe62b;</text>
  74. </view>
  75. <view class="s_item" @click="go('/pages/detection/index')">
  76. <text class="icon ic" style="color: #ff9800">&#xe63a;</text>
  77. <text class="title">检测报告</text>
  78. <text class="icon arrow">&#xe62b;</text>
  79. </view>
  80. </view>
  81. <button class="s_item" open-type="share" hover-class="none">
  82. <text class="icon ic" style="color: #f44336">&#xe7c4;</text>
  83. <text class="title">分享应用</text>
  84. <text class="icon arrow">&#xe62b;</text>
  85. </button>
  86. <button class="s_item" open-type="feedback" hover-class="none">
  87. <text class="icon ic" style="color: #4caf50">&#xe62c;</text>
  88. <text class="title">建议反馈</text>
  89. <text class="icon arrow">&#xe62b;</text>
  90. </button>
  91. <view class="s_item" @click="go('/pages/other/setting')">
  92. <text class="icon ic" style="color: #9e9e9e">&#xe60f;</text>
  93. <text class="title">设置</text>
  94. <text class="icon arrow">&#xe62b;</text>
  95. </view>
  96. </view>
  97. <u-action-sheet round="20" title="切换就诊人" :actions="user.bindUserList" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
  98. </view>
  99. </template>
  100. <script>
  101. export default {
  102. data() {
  103. return {
  104. ip: this.http.ip,
  105. patientId: '',
  106. user: {},
  107. show: false
  108. };
  109. },
  110. onShow() {
  111. /* this.user = {
  112. token: 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImI3ZjVlNDYwLThjY2YtNDkxZi1hNTBjLWI1MjQzNDUzNjFkZiJ9.VTDBJ3929h8qGWMZFkfq-dQAkWOptIfQk7f5CaIahgltFV4QACgf3QBabcswisGTMQZaJMkxt5uCzjv3AkN48w'
  113. };
  114. uni.setStorageSync('user', this.user); */
  115. this.user = this.getUser();
  116. if (this.hasLogin() && !this.user.doctor) {
  117. this.getUserInfo();
  118. }
  119. },
  120. onLoad(e) {
  121. if (e.patientId) {
  122. this.http.request({
  123. url: '/app/user/bind/change/' + e.patientId,
  124. success: (res) => {
  125. this.getUserInfo();
  126. }
  127. });
  128. }
  129. },
  130. methods: {
  131. getUserInfo() {
  132. this.http.request({
  133. url: '/app/user/info',
  134. success: (res) => {
  135. this.user = res.data.data;
  136. if (this.user.follow > 0) {
  137. setTimeout(() => {
  138. this.$refs.uNotify.show({ top: -30, message: '你有' + this.user.follow + '条随访待填写', fontSize: 15, duration: 5000 });
  139. }, 1500);
  140. }
  141. }
  142. });
  143. },
  144. //切换就诊人
  145. selectClick(e) {
  146. uni.showModal({
  147. title: '提示',
  148. content: '确定切换就诊人',
  149. success: (res) => {
  150. if (res.confirm) {
  151. //通知模板订阅消息
  152. uni.requestSubscribeMessage({
  153. tmplIds: ['1Jvx8F22na-tG2Q6HFX_3vRtbiv7zZko6NwX8ICIFXc', 'S6JARkInVBjID8QMpgZdSHNyxeMDZQq7lur8YrNK0oY'],
  154. complete: (c) => {
  155. this.http.request({
  156. url: '/app/user/bind/change/' + e.id,
  157. success: (res) => {
  158. this.getUserInfo();
  159. }
  160. });
  161. }
  162. });
  163. }
  164. }
  165. });
  166. },
  167. go(url) {
  168. if (this.hasLogin()) {
  169. uni.navigateTo({ url: url });
  170. } else {
  171. uni.navigateTo({ url: '/pages/user/login' });
  172. }
  173. }
  174. },
  175. onShareAppMessage: function (res) {
  176. return {
  177. title: '岑溪人民医院小程序',
  178. path: '/pages/index/index',
  179. imageUrl: '../../static/favicon.png',
  180. success: (res) => {},
  181. fail: (res) => {}
  182. };
  183. }
  184. };
  185. </script>
  186. <style lang="scss">
  187. .main {
  188. padding: 5px 15px 25px 15px;
  189. .user {
  190. overflow: hidden;
  191. image {
  192. float: left;
  193. width: 60px;
  194. height: 60px;
  195. border-radius: 50%;
  196. }
  197. .head {
  198. width: 40px;
  199. height: 60px;
  200. border-radius: 3px;
  201. }
  202. .con {
  203. float: left;
  204. padding-left: 15px;
  205. .nickName {
  206. padding-top: 5px;
  207. .relationship {
  208. color: #7c7c7c;
  209. font-size: 13px;
  210. padding-left: 3px;
  211. }
  212. .icon {
  213. padding-left: 6px;
  214. font-size: 13px;
  215. color: $main-color;
  216. }
  217. }
  218. .welcome {
  219. font-size: 14px;
  220. padding-top: 5px;
  221. color: #989898;
  222. }
  223. }
  224. .edit {
  225. float: right;
  226. margin-top: 14px;
  227. }
  228. }
  229. button {
  230. border-radius: 0px;
  231. line-height: 1;
  232. font-size: 15px;
  233. }
  234. }
  235. </style>