my.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view>
  3. <fs-avatar src="/static/images/my/my-bg.png" shape="square" width="100%" height="288rpx"></fs-avatar>
  4. <view class="my-box">
  5. <view class="layout-box radius-lg top-box">
  6. <view class="user-info" v-if="userInfo.name">
  7. <fs-avatar size="140rpx" border :src="userInfo.photo" v-if="userInfo.photo"></fs-avatar>
  8. <fs-wx-avatar v-else></fs-wx-avatar>
  9. <view class="top-box-content">
  10. <text class="vm title" style="margin-right: 10rpx;">{{userInfo.name}}</text>
  11. <fs-icon type="icon-sex-male" color="#2285FF" v-if="userInfo.sex === '1'"></fs-icon>
  12. <fs-icon type="icon-sex-female" colorType="error" v-if="userInfo.sex === '2'"></fs-icon>
  13. </view>
  14. <fs-icon
  15. class="top-box-edit"
  16. type="icon-edit"
  17. size="40rpx"
  18. link="./userInfo">
  19. </fs-icon>
  20. </view>
  21. <view v-else class="user-info">
  22. <fs-avatar size="140rpx" link="/modules/common/login/login" border>去登录</fs-avatar>
  23. </view>
  24. <view :style="{'margin-top': userInfo.name ? '80rpx' : '20rpx'}">
  25. <fs-divide-list :list="shortcutList">
  26. <template #default="{item}">
  27. <view class="top-box-hd">{{item.num || 0}}</view>
  28. <view class="content">{{item.title}}</view>
  29. </template>
  30. </fs-divide-list>
  31. </view>
  32. </view>
  33. </view>
  34. <fs-card gutter :titleStyle="{padding: '0'}">
  35. <template #title>
  36. <view class="title-hd" >常用工具</view>
  37. </template>
  38. <fs-grid :columnNum="4">
  39. <fs-grid-item v-for="item in 4">
  40. <fs-avatar src="/static/images/my/invoice.png" size="80rpx"></fs-avatar>
  41. <view class="content">我的发票</view>
  42. </fs-grid-item>
  43. </fs-grid>
  44. </fs-card>
  45. <fs-cell-group arrow border gutter>
  46. <fs-cell link="/modules/common/licensePlate/list" value="车辆管理">
  47. <template #title>
  48. <fs-icon type="icon-car" colorType="primary"></fs-icon>
  49. </template>
  50. </fs-cell>
  51. <fs-cell link="/modules/common/address/list" value="地址管理">
  52. <template #title>
  53. <fs-icon type="icon-location" colorType="primary"></fs-icon>
  54. </template>
  55. </fs-cell>
  56. <fs-cell link="/modules/common/org" value="组织架构">
  57. <template #title>
  58. <fs-icon type="icon-org" colorType="primary"></fs-icon>
  59. </template>
  60. </fs-cell>
  61. <fs-cell link="/modules/common/addrbook/list" value="通讯录">
  62. <template #title>
  63. <fs-icon type="icon-tongxunlu" colorType="primary"></fs-icon>
  64. </template>
  65. </fs-cell>
  66. <fs-cell link="/modules/common/notice" value="我的消息">
  67. <template #title>
  68. <fs-icon type="icon-notice" colorType="primary"></fs-icon>
  69. </template>
  70. </fs-cell>
  71. <fs-cell link="/modules/common/feedback" value="意见反馈">
  72. <template #title>
  73. <fs-icon type="icon-feedback" colorType="primary"></fs-icon>
  74. </template>
  75. </fs-cell>
  76. <fs-cell link="/modules/common/version" value="版本记录">
  77. <template #title>
  78. <fs-icon type="icon-version" colorType="primary"></fs-icon>
  79. </template>
  80. </fs-cell>
  81. </fs-cell-group>
  82. <fs-gutter height="60rpx"></fs-gutter>
  83. <fs-button round block @click="handleLogout">退出登录</fs-button>
  84. <fs-gutter height="60rpx"></fs-gutter>
  85. </view>
  86. </template>
  87. <script setup>
  88. import { computed, ref } from 'vue'
  89. import { useStore } from 'vuex'
  90. const store = useStore()
  91. const userInfo = computed(() => store.state.userInfo)
  92. const shortcutList = ref([
  93. {
  94. title: '我的访客',
  95. num: 10
  96. },
  97. {
  98. title: '我的访客',
  99. num: 10
  100. }
  101. ])
  102. const handleLogout = () => {
  103. store.dispatch('logout').then(res => {
  104. console.log('logout')
  105. })
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .my-box{
  110. padding: var(--gutter);
  111. margin-top: -200rpx;
  112. z-index: 100;
  113. position: relative;
  114. }
  115. .top-box{
  116. position: relative;
  117. &-edit{
  118. position: absolute;
  119. top: 64rpx;
  120. right: 0rpx;
  121. }
  122. &-hd{
  123. font-size: 23px;
  124. font-weight: bold;
  125. }
  126. &-content{
  127. padding: 10rpx 0;
  128. }
  129. }
  130. .user-info{
  131. position: absolute;
  132. z-index: 10;
  133. left: 50%;
  134. top: -70rpx;
  135. transform: translateX(-50%);
  136. text-align: center;
  137. }
  138. </style>