风险测评小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

228 lines
4.8 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="page__view">
  3. <view class="bg"></view>
  4. <view class="main">
  5. <view class="flex user">
  6. <!-- 用户信息 -->
  7. <template v-if="isLogin">
  8. <view class="user-avatar">
  9. <image class="user-avatar-img" :src="userInfo.headImage" mode="scaleToFill"></image>
  10. </view>
  11. <view class="user-info">
  12. <view class="user-info-name">{{ userInfo.nickName }}</view>
  13. <view class="user-info-desc">{{ `ID:${userInfo.id}` }}</view>
  14. </view>
  15. </template>
  16. <template v-else>
  17. <view class="user-avatar">
  18. <image class="user-avatar-img" src="@/static/image/avatar-default.png" mode="scaleToFill"></image>
  19. </view>
  20. <view class="user-info">
  21. <view class="user-info-tips">暂未登录 请先登录</view>
  22. </view>
  23. </template>
  24. </view>
  25. <!-- 用户菜单 -->
  26. <template v-if="isLogin">
  27. <view class="card">
  28. <view class="card-header">常用功能</view>
  29. <view class="card-content menu">
  30. <view class="flex flex-column menu-item" v-for="item in list" :key="item.id" @click="onClick(item)">
  31. <image class="icon" :src="item.icon" mode="widthFix"></image>
  32. <view>{{ item.label }}</view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <!-- 用户登陆 -->
  38. <template v-else>
  39. <view class="login">
  40. <button class="btn" @click="$utils.toLogin">立即登录</button>
  41. <view class="tips">暂未登录 请先登录</view>
  42. </view>
  43. </template>
  44. </view>
  45. <tabber select="center" />
  46. </view>
  47. </template>
  48. <script>
  49. import { mapState } from 'vuex'
  50. import tabber from '@/components/base/tabbar.vue'
  51. export default {
  52. components: {
  53. tabber,
  54. },
  55. data() {
  56. return {
  57. list: [
  58. { id: '001', label: '我的答题', icon: '/static/image/icon-center-test.png', path: '/pages_order/test/list' },
  59. { id: '002', label: '咨询客服', icon: '/static/image/icon-center-service.png', path: '/pages_order/service/index' },
  60. { id: '003', label: '意见反馈', icon: '/static/image/icon-center-feedback.png', path: '/pages_order/feedback/index' },
  61. { id: '004', label: '个人信息', icon: '/static/image/icon-center-userinfo.png', path: '/pages_order/auth/infoModify' },
  62. { id: '008', label: '退出登录', icon: '/static/image/icon-center-logout.png', key: 'logout' },
  63. ],
  64. }
  65. },
  66. computed: {
  67. ...mapState(['userInfo', 'configList']),
  68. isLogin() {
  69. return this.userInfo && this.userInfo.id
  70. }
  71. },
  72. onShow() {
  73. if(uni.getStorageSync('token')){
  74. this.$store.commit('getUserInfo')
  75. }
  76. },
  77. methods: {
  78. onClick(target) {
  79. const { key, path } = target
  80. switch(key) {
  81. case 'logout':
  82. this.$store.commit('logout')
  83. break
  84. default:
  85. path && this.$utils.navigateTo(path)
  86. break
  87. }
  88. },
  89. },
  90. }
  91. </script>
  92. <style scoped lang="scss">
  93. .page__view {
  94. background: #F5F5F5;
  95. }
  96. .bg {
  97. width: 100%;
  98. height: 501rpx;
  99. background: linear-gradient(160deg, #014FA2 36%, #4C8FD6);
  100. }
  101. .main {
  102. width: 100%;
  103. position: absolute;
  104. top: 0;
  105. left: 0;
  106. padding: 216rpx 13rpx 26rpx 13rpx;
  107. box-sizing: border-box;
  108. }
  109. .user {
  110. padding: 0 33rpx;
  111. column-gap: 22rpx;
  112. &-avatar {
  113. flex: none;
  114. width: 118rpx;
  115. height: 118rpx;
  116. border-radius: 50%;
  117. overflow: hidden;
  118. &-img {
  119. width: 100%;
  120. height: 100%;
  121. }
  122. }
  123. &-info {
  124. flex: 1;
  125. color: #FFFFFF;
  126. &-name {
  127. font-size: 30rpx;
  128. }
  129. &-desc {
  130. margin-top: 12rpx;
  131. font-size: 28rpx;
  132. }
  133. &-tips {
  134. font-size: 30rpx;
  135. }
  136. }
  137. }
  138. .card {
  139. margin-top: 83rpx;
  140. width: 100%;
  141. min-height: 652rpx;
  142. padding: 32rpx 30rpx;
  143. box-sizing: border-box;
  144. background: #FFFFFF;
  145. border-radius: 16rpx;
  146. &-header {
  147. font-size: 32rpx;
  148. font-weight: 600;
  149. color: #000000;
  150. }
  151. &-content {
  152. margin-top: 73rpx;
  153. }
  154. }
  155. .menu {
  156. width: 100%;
  157. display: grid;
  158. grid-template-columns: repeat(4, 1fr);
  159. column-gap: 73rpx;
  160. row-gap: 93rpx;
  161. &-item {
  162. min-width: 0;
  163. row-gap: 10rpx;
  164. font-size: 28rpx;
  165. white-space: nowrap;
  166. color: #000000;
  167. .icon {
  168. width: 50rpx;
  169. height: auto;
  170. }
  171. }
  172. }
  173. .login {
  174. margin-top: 307rpx;
  175. width: 100%;
  176. padding: 0 128rpx;
  177. box-sizing: border-box;
  178. .btn {
  179. padding: 16rpx 0;
  180. font-family: PingFang SC;
  181. font-weight: 500;
  182. font-size: 36rpx;
  183. line-height: 1.4;
  184. color: #FFFFFF;
  185. background: #014FA2;
  186. border-radius: 41rpx;
  187. }
  188. .tips {
  189. margin-top: 16rpx;
  190. text-align: center;
  191. font-family: PingFang SC;
  192. font-weight: 400;
  193. font-size: 26rpx;
  194. line-height: 1.4;
  195. color: #A3A3A3;
  196. }
  197. }
  198. </style>