index.vue 6.6 KB

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