my.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <layout-page>
  3. <view class="ss-p-b-30">
  4. <view class="text-center" @tap="handleTap">
  5. <img :src="getUserAvatar(baseInfo?.avatar, baseInfo?.sex)" alt="" class="img-box">
  6. <view v-if="!useUserStore.isLogin" class="font-weight-bold font-size-20">点击登录</view>
  7. <view v-else class="font-weight-bold font-size-20">{{ baseInfo?.name || userInfo?.phone }}</view>
  8. </view>
  9. <view style="padding: 40rpx 0;">
  10. <resume-status></resume-status>
  11. </view>
  12. <view class="d-flex">
  13. <view v-for="(item, index) in itemList" :key="index" @tap="handleToLink(item)" class="parent">
  14. <view class="d-flex justify-space-between">
  15. <view>
  16. <view class="colors">
  17. <span>查看更多</span>
  18. <uni-icons color="#c8c5c4" type="right" size="15" class="ml"/>
  19. </view>
  20. <view class="size-16">{{ item.title }}</view>
  21. </view>
  22. <view>
  23. <uni-icons color="#00897B" :type="item.icon" size="45"/>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view style="height: 10rpx; background-color: #f8f8fa;"></view>
  29. <view class="card">
  30. <uni-list>
  31. <uni-list-item v-for="item in list" :clickable="true" :key="item.title" :title="item.title" showArrow :rightText="item.rightTex || ''" @click="handleToLink(item)"></uni-list-item>
  32. </uni-list>
  33. </view>
  34. <button v-if="useUserStore.isLogin" class="send-button" @tap="handleLogout">退出登录</button>
  35. <uni-popup ref="popup" type="dialog">
  36. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="系统提示" content="确认退出账号?" @confirm="handleLogoutConfirm"
  37. @close="handleLogoutClose"></uni-popup-dialog>
  38. </uni-popup>
  39. </view>
  40. </layout-page>
  41. </template>
  42. <script setup>
  43. import { ref, computed } from 'vue'
  44. import ResumeStatus from '@/components/ResumeStatus'
  45. import { userStore } from '@/store/user'
  46. import { getUserAvatar } from '@/utils/avatar'
  47. import { getAccessToken } from '@/utils/request'
  48. import layoutPage from '@/layout'
  49. import { showAuthModal } from '@/hooks/useModal'
  50. const useUserStore = userStore()
  51. const baseInfo = computed(() => useUserStore?.baseInfo)
  52. const userInfo = computed(() => useUserStore?.userInfo)
  53. const popup = ref()
  54. const itemList = [
  55. { title: "面试管理", path: "/pagesA/interview/index", icon: "list" },
  56. { title:'谁看过我', path:'/pagesA/seenMe/index', icon:'staff' }
  57. ]
  58. const list = [
  59. { title: '附件简历', path: '/pagesA/resume/index' },
  60. { title: '我的收藏', path: '/pagesA/collect/index' },
  61. { title: '前往门墩儿甄选商城', appId: 'wx6decdf12f9e7a061' },
  62. { title: '切换为招聘者', rightTex: '我要招人' }
  63. ]
  64. // 列表跳转
  65. const handleToLink = (item) => {
  66. if (item.appId) {
  67. uni.navigateToMiniProgram({
  68. appId: item.appId,
  69. // extraData: {} // 要传递的数据
  70. })
  71. return
  72. }
  73. if (!item.path) return
  74. if (!getAccessToken()) {
  75. uni.showToast({
  76. title: '请先登录',
  77. icon: 'none'
  78. })
  79. showAuthModal()
  80. return
  81. }
  82. uni.navigateTo({
  83. url: item.path
  84. })
  85. }
  86. // 登录
  87. const handleTap = () => {
  88. if (!useUserStore.isLogin) {
  89. showAuthModal()
  90. return
  91. }
  92. uni.navigateTo({
  93. url: '/pagesA/info/index'
  94. })
  95. }
  96. // 退出登录
  97. const handleLogout = () => {
  98. popup.value.open()
  99. }
  100. const handleLogoutClose = () => {
  101. popup.value.close()
  102. }
  103. const handleLogoutConfirm = () => {
  104. useUserStore.handleLogout()
  105. }
  106. </script>
  107. <style scoped lang="scss">
  108. .img-box {
  109. width: 150rpx;
  110. height: 150rpx;
  111. border: 2rpx solid #ccc;
  112. border-radius: 50%;
  113. }
  114. ::v-deep .uni-list-item{
  115. height: 140rpx !important;
  116. line-height: 140rpx !important;
  117. }
  118. ::v-deep .uni-list-item__content-title{
  119. font-size: 32rpx !important;
  120. font-weight: 500;
  121. }
  122. .colors{
  123. font-size: 24rpx;
  124. color: #606266;
  125. }
  126. .size-16{
  127. color: #3f424f;
  128. font-size: 32rpx;
  129. margin: 13rpx 0 5rpx 0;
  130. }
  131. .parent{
  132. width: 50%;
  133. border: 1px solid #f4f4f4;
  134. border-radius: 10rpx;
  135. margin: 0 30rpx 20rpx 30rpx;
  136. padding: 20rpx;
  137. }
  138. .parent:first-child{
  139. margin: 0 0 20rpx 30rpx;
  140. }
  141. </style>