mine.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view>
  3. <u-navbar class="u-navbar-box" title="我的" placeholder bgColor="transparent" left-icon-size="0" />
  4. <view class="top-box">
  5. <u-image class="bg-box" width="690rpx" height="270rpx" src="/static/mine/user-center-bg.png" />
  6. <div class="avatar-name">
  7. <up-avatar size="116rpx" :src="vuex_user.avatar" defaultUrl="/static/mine/avatar-def.png"
  8. bgColor="#305BFF" />
  9. <!-- <u-image class="avatar" width="116rpx" bgColor="transparent" height="116rpx"
  10. src="/static/mine/avatar-def.png" /> -->
  11. <view style="margin-left: 30rpx;">
  12. <view class="name">{{user.nickName}}</view>
  13. <view class="roles">{{handleRolesText()}}</view>
  14. </view>
  15. </div>
  16. <div class="abs-right">
  17. <u-image bgColor="transparent" width="220rpx" height="258rpx" src="/static/mine/user-center-img.png" />
  18. </div>
  19. </view>
  20. <u-cell-group :border="false" :customStyle="{background: '#fff', margin: '30rpx', borderRadius: '20rpx'}">
  21. <u-cell icon="setting-fill" title="我的申请" isLink url="/pages/subpack/pages/application/list">
  22. <template #icon>
  23. <u-image src="/static/mine/task.png" bgColor="transparent" width="36rpx" height="36rpx" />
  24. </template>
  25. </u-cell>
  26. <u-cell icon="integral-fill" title="个人信息" isLink :border="false" url="/pages/subpack/pages/myInfo/info">
  27. <template #icon>
  28. <u-image src="/static/mine/myself.png" bgColor="transparent" width="36rpx" height="36rpx" />
  29. </template>
  30. </u-cell>
  31. <u-cell icon="integral-fill" title="用户协议" isLink :border="false" url="/pages/subpack/pages/protocol/list">
  32. <template #icon>
  33. <u-image src="/static/mine/myself.png" bgColor="transparent" width="36rpx" height="36rpx" />
  34. </template>
  35. </u-cell>
  36. </u-cell-group>
  37. </view>
  38. </template>
  39. <script setup>
  40. import {
  41. onMounted,
  42. ref
  43. } from 'vue';
  44. import {
  45. useStore
  46. } from 'vuex';
  47. import {
  48. onLoad
  49. } from '@dcloudio/uni-app'
  50. // 获取 Vuex store 实例
  51. const store = useStore();
  52. const user = ref({
  53. nickName: ' ',
  54. roles: []
  55. })
  56. const roleKV = {
  57. common: '普通角色',
  58. admin: '超级管理员',
  59. village: '乡镇民政所',
  60. area: '区民政局',
  61. company: '护理公司',
  62. nurse: '护理员'
  63. }
  64. function handleRolesText() {
  65. let roles = user.value.roles;
  66. let roleText = [];
  67. roles.map(item => {
  68. if (roleKV.hasOwnProperty(item)) {
  69. roleText.push(roleKV[item]);
  70. }
  71. })
  72. return roleText.join(',');
  73. }
  74. onMounted(() => {
  75. console.log('store=>', store.state);
  76. user.value = store.state.vuex_user;
  77. })
  78. </script>
  79. <style>
  80. page {
  81. background-color: #F6F8FD;
  82. }
  83. </style>
  84. <style lang="scss" scoped>
  85. :deep(.u-image) {
  86. display: flex;
  87. align-items: center;
  88. justify-content: center;
  89. }
  90. :deep(.u-navbar__content__title) {
  91. font-weight: bold;
  92. font-size: 36rpx;
  93. color: #222222;
  94. }
  95. .u-navbar-box {
  96. background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
  97. }
  98. .top-box {
  99. position: relative;
  100. margin: 30rpx;
  101. .avatar-name {
  102. position: absolute;
  103. top: 77rpx;
  104. left: 40rpx;
  105. display: flex;
  106. align-items: center;
  107. .name {
  108. font-weight: bold;
  109. font-size: 40rpx;
  110. color: #000000;
  111. }
  112. .roles {
  113. font-size: 28rpx;
  114. margin-top: 10rpx;
  115. color: #000000;
  116. }
  117. }
  118. .abs-right {
  119. position: absolute;
  120. bottom: 20rpx;
  121. right: 40rpx;
  122. }
  123. }
  124. </style>