1
0

index.vue 6.3 KB

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