1
0

index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. this.http.request({
  141. url: '/app/user/bind/change/' + e.id,
  142. success: (res) => {
  143. this.getUserInfo();
  144. }
  145. });
  146. }
  147. }
  148. });
  149. },
  150. go(url) {
  151. if (this.hasLogin()) {
  152. uni.navigateTo({ url: url });
  153. } else {
  154. uni.navigateTo({ url: '/pages/user/login' });
  155. }
  156. }
  157. },
  158. onShareAppMessage: function (res) {
  159. return {
  160. title: '岑溪人民医院小程序',
  161. path: '/pages/index/index',
  162. imageUrl: '../../static/favicon.png',
  163. success: (res) => {},
  164. fail: (res) => {}
  165. };
  166. }
  167. };
  168. </script>
  169. <style lang="scss">
  170. .main {
  171. padding: 5px 15px 25px 15px;
  172. .user {
  173. overflow: hidden;
  174. image {
  175. float: left;
  176. width: 60px;
  177. height: 60px;
  178. border-radius: 50%;
  179. }
  180. .head {
  181. width: 40px;
  182. height: 60px;
  183. border-radius: 3px;
  184. }
  185. .con {
  186. float: left;
  187. padding-left: 15px;
  188. .nickName {
  189. padding-top: 5px;
  190. .relationship {
  191. color: #7c7c7c;
  192. font-size: 13px;
  193. padding-left: 3px;
  194. }
  195. .icon {
  196. padding-left: 6px;
  197. font-size: 13px;
  198. color: $main-color;
  199. }
  200. }
  201. .welcome {
  202. font-size: 14px;
  203. padding-top: 5px;
  204. color: #989898;
  205. }
  206. }
  207. .edit {
  208. float: right;
  209. margin-top: 14px;
  210. }
  211. }
  212. button {
  213. border-radius: 0px;
  214. line-height: 1;
  215. font-size: 15px;
  216. }
  217. }
  218. </style>