index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="main">
  3. <view class="user" @click="go('/pages/user/bind/index')">
  4. <image :src="user.avatar ? ip + user.avatar : '../../static/favicon.png'" class="head"></image>
  5. <view class="con" v-if="user.id">
  6. <view class="nickName">
  7. {{ user.patientName ? user.patientName : '还未绑定就诊人' }}
  8. <text class="icon" v-if="user.bindUserList.length > 1" @click.stop="show = true">&#xe6a7;</text>
  9. </view>
  10. <view class="welcome">欢迎使用岑溪人民医院小程序</view>
  11. </view>
  12. <view class="con" v-else>
  13. <view class="nickName">你还没登录</view>
  14. <view class="welcome">欢迎使用岑溪人民医院小程序</view>
  15. </view>
  16. <view class="icon edit">&#xe62b;</view>
  17. </view>
  18. <view class="cmd">
  19. <view class="s_item" @click="go('/pages/help/my')">
  20. <text class="icon ic" style="color: #03a9f4">&#xe685;</text>
  21. <text class="title">我的体检</text>
  22. <text class="icon arrow">&#xe62b;</text>
  23. </view>
  24. <view class="s_item" @click="go('/pages/follow/index')">
  25. <text class="icon ic" style="color: #607d8b">&#xe60b;</text>
  26. <text class="title">我的回访</text>
  27. <text class="icon arrow">&#xe62b;</text>
  28. </view>
  29. <view class="s_item" @click="go('/pages/help/my')">
  30. <text class="icon ic" style="color: #f44336">&#xe7c4;</text>
  31. <text class="title">分享应用</text>
  32. <text class="icon arrow">&#xe62b;</text>
  33. </view>
  34. <view class="s_item" @click="go('/pages/help/my')">
  35. <text class="icon ic" style="color: #4caf50">&#xe62c;</text>
  36. <text class="title">建议反馈</text>
  37. <text class="icon arrow">&#xe62b;</text>
  38. </view>
  39. <view class="s_item" @click="go('/pages/other/setting')">
  40. <text class="icon ic" style="color: #9e9e9e">&#xe60f;</text>
  41. <text class="title">设置</text>
  42. <text class="icon arrow">&#xe62b;</text>
  43. </view>
  44. </view>
  45. <u-action-sheet round="20" :actions="user.bindUserList" key="patientName" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. ip: this.http.ip,
  53. user: {},
  54. show: false
  55. };
  56. },
  57. onShow() {
  58. /* this.user = {
  59. token: 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjE3MTkwODMzLWNiNDgtNDkxMC1iZjE1LTEzNDYzMDNkZDI0YSJ9.AWgnb6GT20QIb8DxUwqt0LHaPmfb9WXKlCM1xm20AyOHpnCUtYdf1sCO47gReeIjVKm1MGBoTytUV5YxE5buew'
  60. };
  61. uni.setStorageSync('user', this.user); */
  62. if (this.hasLogin()) {
  63. this.getUserInfo();
  64. } else {
  65. this.user = {};
  66. }
  67. },
  68. methods: {
  69. getUserInfo() {
  70. this.http.request({
  71. url: '/app/user/info',
  72. success: (res) => {
  73. this.user = res.data.data;
  74. }
  75. });
  76. },
  77. //切换就诊人
  78. selectClick(e) {
  79. uni.showModal({
  80. title: '提示',
  81. content: '确定切换就诊人',
  82. success: (res) => {
  83. if (res.confirm) {
  84. this.http.request({
  85. url: '/app/user/bind/change/' + e.id,
  86. success: (res) => {
  87. this.getUserInfo();
  88. }
  89. });
  90. }
  91. }
  92. });
  93. },
  94. go(url) {
  95. if (this.hasLogin()) {
  96. uni.navigateTo({ url: url });
  97. } else {
  98. uni.navigateTo({ url: '/pages/user/login' });
  99. }
  100. }
  101. },
  102. onShareAppMessage: function (res) {
  103. return {
  104. title: '岑溪人民医院小程序',
  105. path: '/pages/index/index',
  106. imageUrl: 'https://chenglantimes.com/prod-api/profile/upload/2024/06/16/blob_20240616055022A009.jpeg',
  107. success: (res) => {},
  108. fail: (res) => {}
  109. };
  110. }
  111. };
  112. </script>
  113. <style lang="scss">
  114. .main {
  115. padding: 5px 15px 25px 15px;
  116. .user {
  117. overflow: hidden;
  118. image {
  119. float: left;
  120. width: 60px;
  121. height: 60px;
  122. border-radius: 50%;
  123. }
  124. .con {
  125. float: left;
  126. padding-left: 15px;
  127. .nickName {
  128. padding-top: 5px;
  129. }
  130. .welcome {
  131. font-size: 14px;
  132. padding-top: 5px;
  133. color: #989898;
  134. .icon {
  135. padding-right: 3px;
  136. }
  137. }
  138. }
  139. .edit {
  140. float: right;
  141. margin-top: 14px;
  142. }
  143. }
  144. }
  145. </style>