index.vue 5.6 KB

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