index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="container">
  3. <view class="top">
  4. <image class="avatar"mode="aspectFill" :src="src"></image>
  5. <text v-if="role && role !== 'guest'" class="name">{{ userInfo.name}}</text>
  6. <button v-else type="default" :plain="true" style="border: none;" class="login" @click="register">注册</button>
  7. </view>
  8. <view class="main" v-if="role && role !== 'guest'">
  9. <uni-card>
  10. <uni-list :border="false">
  11. <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[0]" title="个人资料" link clickable @click="onClick(0)"></uni-list-item>
  12. </uni-list>
  13. </uni-card>
  14. <uni-card>
  15. <uni-list :border="false">
  16. <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[1]" title="家人代领" link clickable @click="onClick(1)"></uni-list-item>
  17. </uni-list>
  18. </uni-card>
  19. <uni-card>
  20. <uni-list :border="false">
  21. <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[2]" title="问卷调查" link clickable @click="onClick(2)"></uni-list-item>
  22. </uni-list>
  23. </uni-card>
  24. <uni-card>
  25. <uni-list :border="false">
  26. <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[3]" title="我的积分" link clickable @click="onClick(3)"></uni-list-item>
  27. </uni-list>
  28. </uni-card>
  29. <uni-card>
  30. <uni-list :border="false">
  31. <uni-list-item :showExtraIcon="true" :extra-icon="extraIconList[4]" title="意见反馈" link clickable @click="onClick(4)"></uni-list-item>
  32. </uni-list>
  33. </uni-card>
  34. <!-- <uni-card class="logoutBox">
  35. <uni-list :border="false">
  36. <uni-list-item size="mini" class="logout" title="退出登录" clickable @click="onClick(4)"></uni-list-item>
  37. </uni-list>
  38. </uni-card> -->
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import requestLogin from '../../api/login.js';
  44. export default {
  45. data() {
  46. return {
  47. extraIconList: [
  48. {
  49. color: '#ff8319',
  50. size: '22',
  51. type: 'person'
  52. },
  53. {
  54. color: '#ebc200',
  55. size: '22',
  56. type: 'home'
  57. },
  58. {
  59. color: '#429ff6',
  60. size: '22',
  61. type: 'mail-open-filled'
  62. },
  63. {
  64. color: '#4cd964',
  65. size: '22',
  66. type: 'star-filled'
  67. },
  68. {
  69. color: '#e70000',
  70. size: '22',
  71. type: 'email-filled'
  72. }
  73. ],
  74. src: 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/6acec660-4f31-11eb-a16f-5b3e54966275.jpg',
  75. userInfo: {},
  76. role: ''
  77. }
  78. },
  79. onShow() {
  80. this.userInfo = uni.getStorageSync('userinfo');
  81. this.role = uni.getStorageSync('role');
  82. },
  83. mounted() {},
  84. methods: {
  85. register() {
  86. uni.navigateTo({
  87. url: '/pages/user/index'
  88. })
  89. },
  90. onClick(e) {
  91. console.log(e);
  92. if (e == 0) {
  93. uni.navigateTo({
  94. url: '/pages/user/index'
  95. })
  96. return;
  97. }
  98. if (e == 1) {
  99. this.illness();
  100. return;
  101. }
  102. // if (e == 4) {
  103. // this.logOut();
  104. // return;
  105. // }
  106. uni.showToast({
  107. title: '敬请期待',
  108. icon: 'error',
  109. duration: 2000,
  110. });
  111. },
  112. illness() {
  113. uni.navigateTo({
  114. url: '/pages/illness/index'
  115. })
  116. },
  117. logOut() {
  118. uni.clearStorage();
  119. uni.redirectTo({
  120. url: '/pages/index/index'
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style>
  127. .container {
  128. width: 100%;
  129. }
  130. .top {
  131. height: 25vh;
  132. background-color: #fd6b18;
  133. padding-top: 10px;
  134. position: relative;
  135. z-index: 1;
  136. }
  137. .avatar {
  138. width: 70px;
  139. height: 70px;
  140. border-radius: 50%;
  141. overflow: hidden;
  142. display: block;
  143. margin: 0 auto;
  144. }
  145. .name {
  146. color: #fff;
  147. width: 100%;
  148. text-align: center;
  149. display: block;
  150. margin: 10px 0;
  151. }
  152. .login {
  153. margin: 10px auto;
  154. color: #fff !important;
  155. padding: 0;
  156. line-height: 1em;
  157. }
  158. .main {
  159. width: 90%;
  160. display: block;
  161. margin: 0 auto;
  162. margin-top: -40px;
  163. position: relative;
  164. z-index: 2;
  165. }
  166. .logoutBox {
  167. display: block;
  168. margin-top: 50px;
  169. }
  170. .logout .uni-list-item__content-title {
  171. text-align: center;
  172. }
  173. </style>