mine.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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="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. // 获取 Vuex store 实例
  48. const store = useStore();
  49. const user = ref({
  50. nickName: ' ',
  51. roles: []
  52. })
  53. const roleKV = {
  54. common: '普通角色',
  55. admin: '超级管理员',
  56. village: '乡镇民政所',
  57. area: '区民政局',
  58. company: '护理公司',
  59. nurse: '护理员'
  60. }
  61. function handleRolesText() {
  62. let roles = user.value.roles;
  63. let roleText = [];
  64. roles.map(item=>{
  65. if(roleKV.hasOwnProperty(item)){
  66. roleText.push(roleKV[item]);
  67. }
  68. })
  69. return roleText.join(',');
  70. }
  71. onMounted(() => {
  72. console.log('store=>', store.state);
  73. user.value = store.state.vuex_user;
  74. })
  75. </script>
  76. <style>
  77. page {
  78. background-color: #F6F8FD;
  79. }
  80. </style>
  81. <style lang="scss" scoped>
  82. :deep(.u-image) {
  83. display: flex;
  84. align-items: center;
  85. justify-content: center;
  86. }
  87. :deep(.u-navbar__content__title) {
  88. font-weight: bold;
  89. font-size: 36rpx;
  90. color: #222222;
  91. }
  92. .u-navbar-box {
  93. background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
  94. }
  95. .top-box {
  96. position: relative;
  97. margin: 30rpx;
  98. .avatar-name {
  99. position: absolute;
  100. top: 77rpx;
  101. left: 40rpx;
  102. display: flex;
  103. align-items: center;
  104. .name {
  105. font-weight: bold;
  106. font-size: 40rpx;
  107. color: #000000;
  108. }
  109. .roles {
  110. font-size: 28rpx;
  111. margin-top: 10rpx;
  112. color: #000000;
  113. }
  114. }
  115. .abs-right {
  116. position: absolute;
  117. bottom: 20rpx;
  118. right: 40rpx;
  119. }
  120. }
  121. </style>