index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. user: {},
  106. show: false
  107. };
  108. },
  109. onShow() {
  110. /* this.user = {
  111. token: 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImI3ZjVlNDYwLThjY2YtNDkxZi1hNTBjLWI1MjQzNDUzNjFkZiJ9.VTDBJ3929h8qGWMZFkfq-dQAkWOptIfQk7f5CaIahgltFV4QACgf3QBabcswisGTMQZaJMkxt5uCzjv3AkN48w'
  112. };
  113. uni.setStorageSync('user', this.user); */
  114. this.user = this.getUser();
  115. if (this.hasLogin() && !this.user.doctor) {
  116. this.getUserInfo();
  117. }
  118. },
  119. methods: {
  120. getUserInfo() {
  121. this.http.request({
  122. url: '/app/user/info',
  123. success: (res) => {
  124. this.user = res.data.data;
  125. if (this.user.follow > 0) {
  126. setTimeout(() => {
  127. this.$refs.uNotify.show({ top: -30, message: '你有' + this.user.follow + '条随访待填写', fontSize: 15, duration: 5000 });
  128. }, 1500);
  129. }
  130. }
  131. });
  132. },
  133. //切换就诊人
  134. selectClick(e) {
  135. uni.showModal({
  136. title: '提示',
  137. content: '确定切换就诊人',
  138. success: (res) => {
  139. if (res.confirm) {
  140. //通知模板订阅消息
  141. uni.requestSubscribeMessage({
  142. tmplIds: ['1Jvx8F22na-tG2Q6HFX_3vRtbiv7zZko6NwX8ICIFXc','S6JARkInVBjID8QMpgZdSHNyxeMDZQq7lur8YrNK0oY'],
  143. complete: (c) => {
  144. this.http.request({
  145. url: '/app/user/bind/change/' + e.id,
  146. success: (res) => {
  147. this.getUserInfo();
  148. }
  149. });
  150. }
  151. });
  152. }
  153. }
  154. });
  155. },
  156. go(url) {
  157. if (this.hasLogin()) {
  158. uni.navigateTo({ url: url });
  159. } else {
  160. uni.navigateTo({ url: '/pages/user/login' });
  161. }
  162. }
  163. },
  164. onShareAppMessage: function (res) {
  165. return {
  166. title: '岑溪人民医院小程序',
  167. path: '/pages/index/index',
  168. imageUrl: '../../static/favicon.png',
  169. success: (res) => {},
  170. fail: (res) => {}
  171. };
  172. }
  173. };
  174. </script>
  175. <style lang="scss">
  176. .main {
  177. padding: 5px 15px 25px 15px;
  178. .user {
  179. overflow: hidden;
  180. image {
  181. float: left;
  182. width: 60px;
  183. height: 60px;
  184. border-radius: 50%;
  185. }
  186. .head {
  187. width: 40px;
  188. height: 60px;
  189. border-radius: 3px;
  190. }
  191. .con {
  192. float: left;
  193. padding-left: 15px;
  194. .nickName {
  195. padding-top: 5px;
  196. .relationship {
  197. color: #7c7c7c;
  198. font-size: 13px;
  199. padding-left: 3px;
  200. }
  201. .icon {
  202. padding-left: 6px;
  203. font-size: 13px;
  204. color: $main-color;
  205. }
  206. }
  207. .welcome {
  208. font-size: 14px;
  209. padding-top: 5px;
  210. color: #989898;
  211. }
  212. }
  213. .edit {
  214. float: right;
  215. margin-top: 14px;
  216. }
  217. }
  218. button {
  219. border-radius: 0px;
  220. line-height: 1;
  221. font-size: 15px;
  222. }
  223. }
  224. </style>