1
0

index.vue 6.5 KB

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