index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="main">
  3. <view class="user" @click="go('/pages/user/info')">
  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">{{ user.nickName ? user.nickName : '个人用户' }}</view>
  7. <view class="welcome">欢迎使用岑溪人民医院小程序</view>
  8. </view>
  9. <view class="con" v-else>
  10. <view class="nickName">你还没登录</view>
  11. <view class="welcome">欢迎使用岑溪人民医院小程序</view>
  12. </view>
  13. <view class="icon edit">&#xe62b;</view>
  14. </view>
  15. <view class="cmd">
  16. <view class="s_item" @click="go('/pages/help/my')">
  17. <text class="icon ic" style="color: #03a9f4">&#xe685;</text>
  18. <text class="title">我的体检</text>
  19. <text class="icon arrow">&#xe62b;</text>
  20. </view>
  21. <view class="s_item" @click="go('/pages/follow/index')">
  22. <text class="icon ic" style="color: #607d8b">&#xe60b;</text>
  23. <text class="title">我的回访</text>
  24. <text class="icon arrow">&#xe62b;</text>
  25. </view>
  26. <view class="s_item" @click="go('/pages/help/my')">
  27. <text class="icon ic" style="color: #f44336">&#xe7c4;</text>
  28. <text class="title">分享应用</text>
  29. <text class="icon arrow">&#xe62b;</text>
  30. </view>
  31. <view class="s_item" @click="go('/pages/help/my')">
  32. <text class="icon ic" style="color: #4caf50">&#xe62c;</text>
  33. <text class="title">建议反馈</text>
  34. <text class="icon arrow">&#xe62b;</text>
  35. </view>
  36. <view class="s_item" @click="go('/pages/other/setting')">
  37. <text class="icon ic" style="color: #9e9e9e">&#xe60f;</text>
  38. <text class="title">设置</text>
  39. <text class="icon arrow">&#xe62b;</text>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. ip: this.http.ip,
  49. user: {},
  50. show: false
  51. };
  52. },
  53. onShow() {
  54. /* this.user = {
  55. token: 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImQ3YmZjZjVkLTgxZTgtNGJjMi04MjA1LTE5ZTY3NzdhNzEyMSJ9._pm56LMt6uOsjee2AlZOKdESEEj9axkz62-T74YsHeifH78cn2BouBDSCl-lDPpvOWmJOs1-CZS44oCUeBGlhw'
  56. };
  57. uni.setStorageSync('user', this.user); */
  58. if (this.hasLogin()) {
  59. this.getUserInfo();
  60. } else {
  61. this.user = {};
  62. }
  63. },
  64. methods: {
  65. getUserInfo() {
  66. this.http.request({
  67. url: '/app/user/info',
  68. success: (res) => {
  69. this.user = res.data.data;
  70. }
  71. });
  72. },
  73. go(url) {
  74. if (this.hasLogin()) {
  75. uni.navigateTo({ url: url });
  76. } else {
  77. uni.navigateTo({ url: '/pages/user/login' });
  78. }
  79. }
  80. },
  81. onShareAppMessage: function (res) {
  82. return {
  83. title: '岑溪人民医院小程序',
  84. path: '/pages/index/index',
  85. imageUrl: 'https://chenglantimes.com/prod-api/profile/upload/2024/06/16/blob_20240616055022A009.jpeg',
  86. success: (res) => {},
  87. fail: (res) => {}
  88. };
  89. }
  90. };
  91. </script>
  92. <style lang="scss">
  93. .main {
  94. padding: 5px 15px 25px 15px;
  95. .user {
  96. overflow: hidden;
  97. image {
  98. float: left;
  99. width: 60px;
  100. height: 60px;
  101. border-radius: 50%;
  102. }
  103. .con {
  104. float: left;
  105. padding-left: 15px;
  106. .nickName {
  107. padding-top: 5px;
  108. }
  109. .welcome {
  110. font-size: 14px;
  111. padding-top: 5px;
  112. color: #989898;
  113. .icon {
  114. padding-right: 3px;
  115. }
  116. }
  117. }
  118. .edit {
  119. float: right;
  120. margin-top: 14px;
  121. }
  122. }
  123. }
  124. </style>