展品维保小程序前端代码接口
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.

216 lines
4.8 KiB

  1. <template>
  2. <view class="user-container">
  3. <!-- 顶部背景区域 -->
  4. <view class="header-bg" @click="goLogin">
  5. <!-- 用户信息区域 -->
  6. <view class="user-info">
  7. <view class="avatar-section">
  8. <image class="avatar" :src="userInfo.headImage || '/static/默认头像.png'" mode="aspectFill"></image>
  9. </view>
  10. <view class="info-section">
  11. <text class="username">{{userInfo.nickName}}</text>
  12. <text class="user-id">ID:{{userInfo.id}}</text>
  13. </view>
  14. </view>
  15. </view>
  16. <!-- 常用功能模块 -->
  17. <view class="function-card">
  18. <view class="card-title">
  19. <text class="title-text" >常用功能</text>
  20. </view>
  21. <view class="function-list">
  22. <!-- 基本信息 -->
  23. <view class="function-item" @click="goToBasicInfo">
  24. <view class="item-left">
  25. <uv-icon name="account" size="28" color="#C70019"></uv-icon>
  26. <text class="item-text">基本信息</text>
  27. </view>
  28. <uv-icon name="arrow-right" size="24" color="#000"></uv-icon>
  29. </view>
  30. <!-- 用户协议和隐私政策 -->
  31. <view class="function-item" @click="showPrivacyPolicy">
  32. <view class="item-left">
  33. <uv-icon name="file-text" size="28" color="#C70019"></uv-icon>
  34. <text class="item-text">用户协议和隐私政策</text>
  35. </view>
  36. <uv-icon name="arrow-right" size="24" color="#000"></uv-icon>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 用户协议和隐私政策弹窗 -->
  41. <uv-modal ref="privacyModal" title="用户协议和隐私政策" :show-cancel-button="false" confirm-text="我知道了" confirm-color="#C70019">
  42. <view class="privacy-content">
  43. <!-- 如果是富文本 -->
  44. <rich-text :nodes="configParamTextarea('app_agreement')">
  45. </rich-text>
  46. </view>
  47. </uv-modal>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. userInfo: {
  55. headImage: '/static/默认头像.png',
  56. nickName: '请先登录',
  57. id: 'XXXXX'
  58. }
  59. }
  60. },
  61. onShow() {
  62. // 如果没登陆过 就别登了
  63. if (uni.getStorageSync('token')) {
  64. this.getUserInfo();
  65. }
  66. },
  67. methods: {
  68. // 跳转登录页面
  69. goLogin() {
  70. uni.navigateTo({
  71. url: '/subPages/login/login'
  72. })
  73. },
  74. // 跳转到基本信息页面
  75. goToBasicInfo() {
  76. uni.navigateTo({
  77. url: '/subPages/user/profile'
  78. })
  79. },
  80. // 获取用户信息
  81. async getUserInfo() {
  82. const res = await this.$api.user.queryUser();
  83. if (res.code === 200) {
  84. this.userInfo = res.result;
  85. }
  86. },
  87. // 显示隐私政策弹窗
  88. showPrivacyPolicy() {
  89. this.$refs.privacyModal.open()
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .privacy-content {
  96. padding: 20rpx;
  97. .privacy-section {
  98. margin-bottom: 30rpx;
  99. .section-title {
  100. font-size: 32rpx;
  101. font-weight: bold;
  102. color: #333;
  103. display: block;
  104. margin-bottom: 20rpx;
  105. }
  106. .section-text {
  107. font-size: 28rpx;
  108. color: #666;
  109. line-height: 1.6;
  110. display: block;
  111. margin-bottom: 15rpx;
  112. }
  113. }
  114. }
  115. .user-container {
  116. min-height: 100vh;
  117. background: #f5f5f5;
  118. position: relative;
  119. }
  120. .header-bg {
  121. height: 513rpx;
  122. background: linear-gradient(156deg, #f56073 15%, #c70019 61%, #ffacb6 100%);
  123. position: relative;
  124. padding: 0 46rpx;
  125. .user-info {
  126. display: flex;
  127. align-items: center;
  128. padding-top: 177rpx;
  129. .avatar-section {
  130. margin-right: 22rpx;
  131. .avatar {
  132. width: 120rpx;
  133. height: 120rpx;
  134. border-radius: 60rpx;
  135. // border: 4rpx solid rgba(255, 255, 255, 0.3);
  136. }
  137. }
  138. .info-section {
  139. flex: 1;
  140. .username {
  141. display: block;
  142. font-size: 30rpx;
  143. // font-weight: bold;
  144. color: #fff;
  145. margin-bottom: 12rpx;
  146. }
  147. .user-id {
  148. font-size: 28rpx;
  149. color: #fff;
  150. }
  151. }
  152. }
  153. }
  154. .function-card {
  155. width: 88%;
  156. height: 709rpx;
  157. background: #ffffff;
  158. border-radius: 16rpx;
  159. margin: -152rpx auto 0;
  160. position: relative;
  161. z-index: 2;
  162. padding: 57rpx 28rpx;
  163. .card-title {
  164. // margin-bottom: 40rpx;
  165. .title-text {
  166. font-size: 32rpx;
  167. font-weight: bold;
  168. color: $primary-text-color;
  169. }
  170. }
  171. .function-list {
  172. .function-item {
  173. display: flex;
  174. align-items: center;
  175. justify-content: space-between;
  176. margin-top:44rpx ;
  177. border-bottom: 1rpx solid #f0f0f0;
  178. .item-left {
  179. display: flex;
  180. align-items: center;
  181. .item-text {
  182. font-size: 28rpx;
  183. color: $primary-text-color;
  184. margin-left: 14rpx;
  185. }
  186. }
  187. }
  188. }
  189. }
  190. </style>