mine.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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" style="z-index: 9;">
  7. <up-avatar size="116rpx" :src="computeAvatarUrl" 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. <!-- 县民政 -->
  22. <u-cell v-if="vuex_user.roles.includes('village')" title="护理申请" isLink url="/pages/subpack/pages/application/list">
  23. <template #icon>
  24. <u-image src="/static/mine/task.png" bgColor="transparent" width="36rpx" height="36rpx" />
  25. </template>
  26. </u-cell>
  27. <!-- 县民政 -->
  28. <u-cell v-if="vuex_user.roles.includes('village')" title="业务评分" isLink url="/pages/subpack/pages/application/list">
  29. <template #icon>
  30. <u-image src="/static/mine/task.png" bgColor="transparent" width="36rpx" height="36rpx" />
  31. </template>
  32. </u-cell>
  33. <!-- 区民政 -->
  34. <u-cell v-if="vuex_user.roles.includes('area')" title="护理审核" isLink url="/pages/subpack/pages/application/list">
  35. <template #icon>
  36. <u-image src="/static/mine/task.png" bgColor="transparent" width="36rpx" height="36rpx" />
  37. </template>
  38. </u-cell>
  39. <!-- 护理人员 -->
  40. <u-cell v-if="vuex_user.roles.includes('nurse')" title="护理打卡" isLink url="/pages/subpack/pages/application/list">
  41. <template #icon>
  42. <u-image src="/static/mine/task.png" bgColor="transparent" width="36rpx" height="36rpx" />
  43. </template>
  44. </u-cell>
  45. <!-- 护理公司 -->
  46. <u-cell v-if="vuex_user.roles.includes('company')" title="护理指派" isLink url="/pages/subpack/pages/application/list">
  47. <template #icon>
  48. <u-image src="/static/mine/task.png" bgColor="transparent" width="36rpx" height="36rpx" />
  49. </template>
  50. </u-cell>
  51. <u-cell icon="integral-fill" title="个人信息" isLink :border="false" url="/pages/subpack/pages/myInfo/info">
  52. <template #icon>
  53. <u-image src="/static/mine/myself.png" bgColor="transparent" width="36rpx" height="36rpx" />
  54. </template>
  55. </u-cell>
  56. <u-cell icon="integral-fill" title="用户协议" isLink :border="false" url="/pages/subpack/pages/protocol/list">
  57. <template #icon>
  58. <u-image src="/static/mine/myself.png" bgColor="transparent" width="36rpx" height="36rpx" />
  59. </template>
  60. </u-cell>
  61. </u-cell-group>
  62. </view>
  63. </template>
  64. <script setup>
  65. import {
  66. onMounted,
  67. ref,
  68. computed,
  69. getCurrentInstance
  70. } from 'vue';
  71. import {
  72. useStore
  73. } from 'vuex';
  74. import {
  75. onLoad,
  76. onShow
  77. } from '@dcloudio/uni-app'
  78. const {
  79. proxy
  80. } = getCurrentInstance();
  81. // 获取 Vuex store 实例
  82. const store = useStore();
  83. const user = ref({
  84. nickName: ' ',
  85. roles: []
  86. })
  87. const roleKV = {
  88. common: '普通角色',
  89. admin: '超级管理员',
  90. village: '乡镇民政所',
  91. area: '区民政局',
  92. company: '护理公司',
  93. nurse: '护理员'
  94. }
  95. const computeAvatarUrl = computed(() => {
  96. // console.log('proxy.vuex_user.avatar', proxy.vuex_user.avatar);
  97. // console.log('proxy.vuex_user.avatar', uni.$u.http.config.baseURL);
  98. return uni.$u.http.config.baseURL + proxy.vuex_user.avatar
  99. })
  100. function handleRolesText() {
  101. let roles = user.value.roles;
  102. let roleText = [];
  103. roles.map(item => {
  104. if (roleKV.hasOwnProperty(item)) {
  105. roleText.push(roleKV[item]);
  106. }
  107. })
  108. return roleText.join(',');
  109. }
  110. onShow(() => {
  111. // console.log('store=>', store.state);
  112. user.value = store.state.vuex_user;
  113. })
  114. </script>
  115. <style>
  116. page {
  117. background-color: #F6F8FD;
  118. }
  119. </style>
  120. <style lang="scss" scoped>
  121. :deep(.u-image) {
  122. display: flex;
  123. align-items: center;
  124. justify-content: center;
  125. }
  126. :deep(.u-navbar__content__title) {
  127. font-weight: bold;
  128. font-size: 36rpx;
  129. color: #222222;
  130. }
  131. .u-navbar-box {
  132. background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
  133. }
  134. .top-box {
  135. position: relative;
  136. margin: 30rpx;
  137. .avatar-name {
  138. position: absolute;
  139. top: 77rpx;
  140. left: 40rpx;
  141. display: flex;
  142. align-items: center;
  143. .name {
  144. font-weight: bold;
  145. font-size: 40rpx;
  146. color: #000000;
  147. }
  148. .roles {
  149. font-size: 28rpx;
  150. margin-top: 10rpx;
  151. color: #000000;
  152. }
  153. }
  154. .abs-right {
  155. position: absolute;
  156. bottom: 20rpx;
  157. right: 40rpx;
  158. }
  159. }
  160. </style>