my.vue 4.1 KB

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