my.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. import { onShow } from '@dcloudio/uni-app'
  51. // 设置自定义tabbar选中值
  52. onShow(() => {
  53. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  54. const currentTabBar = currentPage?.getTabBar?.();
  55. // 设置当前tab页的下标index
  56. currentTabBar?.setData({ selected: 4 });
  57. })
  58. const useUserStore = userStore()
  59. const baseInfo = computed(() => useUserStore?.baseInfo)
  60. const userInfo = computed(() => useUserStore?.userInfo)
  61. const popup = ref()
  62. const itemList = [
  63. { title: "面试管理", path: "/pagesA/interview/index", icon: "list" },
  64. { title:'谁看过我', path:'/pagesA/seenMe/index', icon:'staff' }
  65. ]
  66. const list = [
  67. { title: '附件简历', path: '/pagesA/resume/index' },
  68. { title: '我的收藏', path: '/pagesA/collect/index' },
  69. { title: '前往门墩儿甄选商城', appId: 'wx6decdf12f9e7a061' },
  70. { title: '切换为招聘者', rightTex: '我要招人' }
  71. ]
  72. // 列表跳转
  73. const handleToLink = (item) => {
  74. if (item.appId) {
  75. uni.navigateToMiniProgram({
  76. appId: item.appId,
  77. // extraData: {} // 要传递的数据
  78. })
  79. return
  80. }
  81. if (!item.path) return
  82. if (!getAccessToken()) {
  83. uni.showToast({
  84. title: '请先登录',
  85. icon: 'none'
  86. })
  87. showAuthModal()
  88. return
  89. }
  90. uni.navigateTo({
  91. url: item.path
  92. })
  93. }
  94. // 登录
  95. const handleTap = () => {
  96. if (!useUserStore.isLogin) {
  97. showAuthModal()
  98. return
  99. }
  100. uni.navigateTo({
  101. url: '/pagesA/info/index'
  102. })
  103. }
  104. // 退出登录
  105. const handleLogout = () => {
  106. popup.value.open()
  107. }
  108. const handleLogoutClose = () => {
  109. popup.value.close()
  110. }
  111. const handleLogoutConfirm = () => {
  112. useUserStore.handleLogout()
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .img-box {
  117. width: 150rpx;
  118. height: 150rpx;
  119. border: 2rpx solid #ccc;
  120. border-radius: 50%;
  121. }
  122. ::v-deep .uni-list-item{
  123. height: 140rpx !important;
  124. line-height: 140rpx !important;
  125. }
  126. ::v-deep .uni-list-item__content-title{
  127. font-size: 32rpx !important;
  128. font-weight: 500;
  129. }
  130. .colors{
  131. font-size: 24rpx;
  132. color: #606266;
  133. }
  134. .size-16{
  135. color: #3f424f;
  136. font-size: 32rpx;
  137. margin: 13rpx 0 5rpx 0;
  138. }
  139. .parent{
  140. width: 50%;
  141. border: 1px solid #f4f4f4;
  142. border-radius: 10rpx;
  143. margin: 0 30rpx 20rpx 30rpx;
  144. padding: 20rpx;
  145. }
  146. .parent:first-child{
  147. margin: 0 0 20rpx 30rpx;
  148. }
  149. </style>