my.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <layout-page>
  3. <view class="pb-120">
  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 0 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-around align-center">
  15. <uni-icons color="#00897B" :type="item.icon" size="30"/>
  16. <text class="itemText">{{ item.title }}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view style="height: 20rpx; background-color: #f8f8fa;"></view>
  21. <view class="card">
  22. <uni-list>
  23. <uni-list-item
  24. v-for="item in list"
  25. :clickable="true"
  26. :key="item.title"
  27. :title="item.title"
  28. showArrow
  29. :rightText="item.rightTex || ''"
  30. @click="handleToLink(item)"
  31. >
  32. </uni-list-item>
  33. </uni-list>
  34. </view>
  35. <button v-if="useUserStore.isLogin" class="send-button" @tap="handleLogout">退出登录</button>
  36. <uni-popup ref="popup" type="dialog">
  37. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="系统提示" content="确认退出账号?" @confirm="handleLogoutConfirm"
  38. @close="handleLogoutClose"></uni-popup-dialog>
  39. </uni-popup>
  40. </view>
  41. </layout-page>
  42. </template>
  43. <script setup>
  44. import { ref, computed } from 'vue'
  45. import ResumeStatus from '@/components/ResumeStatus'
  46. import { userStore } from '@/store/user'
  47. import { getUserAvatar } from '@/utils/avatar'
  48. import { getAccessToken } from '@/utils/request'
  49. import layoutPage from '@/layout'
  50. import { showAuthModal } from '@/hooks/useModal'
  51. import { onShow } from '@dcloudio/uni-app'
  52. // 设置自定义tabbar选中值
  53. onShow(() => {
  54. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  55. const currentTabBar = currentPage?.getTabBar?.();
  56. // 设置当前tab页的下标index
  57. currentTabBar?.setData({ selected: 4 });
  58. })
  59. const useUserStore = userStore()
  60. const baseInfo = computed(() => useUserStore?.baseInfo)
  61. const userInfo = computed(() => useUserStore?.userInfo)
  62. const popup = ref()
  63. const itemList = [
  64. { title: "我的关注", path: "/pagesA/collect/index", icon: "list" },
  65. { title:'关注我的', path:'/pagesA/seenMe/index', icon:'staff' }
  66. ]
  67. const list = [
  68. { title: '在线简历', path: '/pagesA/resumeOnline/index' },
  69. { title: '附件简历', path: '/pagesA/resume/index' },
  70. { title: '面试管理', path: '/pagesA/interview/index' },
  71. { title: '门墩甄选', appId: 'wx6decdf12f9e7a061' },
  72. { title: '我要招聘', key: 'recruit' }
  73. ]
  74. // 列表跳转
  75. const handleToLink = (item) => {
  76. if (item.appId) {
  77. uni.navigateToMiniProgram({
  78. appId: item.appId,
  79. // extraData: {} // 要传递的数据
  80. })
  81. return
  82. }
  83. if (item.key === 'recruit') {
  84. uni.showToast({
  85. title: '请前往网页版门墩招聘',
  86. icon: 'none'
  87. })
  88. }
  89. if (!item.path) return
  90. if (!getAccessToken()) {
  91. uni.showToast({
  92. title: '请先登录',
  93. icon: 'none'
  94. })
  95. showAuthModal()
  96. return
  97. }
  98. uni.navigateTo({
  99. url: item.path
  100. })
  101. }
  102. // 登录
  103. const handleTap = () => {
  104. if (!useUserStore.isLogin) {
  105. showAuthModal()
  106. return
  107. }
  108. uni.navigateTo({
  109. url: '/pagesA/info/index'
  110. })
  111. }
  112. // 退出登录
  113. const handleLogout = () => {
  114. popup.value.open()
  115. }
  116. const handleLogoutClose = () => {
  117. popup.value.close()
  118. }
  119. const handleLogoutConfirm = () => {
  120. useUserStore.handleLogout()
  121. }
  122. </script>
  123. <style scoped lang="scss">
  124. .pb-120 {
  125. padding-bottom: 120rpx;
  126. }
  127. .img-box {
  128. width: 150rpx;
  129. height: 150rpx;
  130. border: 2rpx solid #ccc;
  131. border-radius: 50%;
  132. }
  133. :deep(.uni-list-item) {
  134. height: 120rpx !important;
  135. line-height: 120rpx !important;
  136. }
  137. :deep(.uni-list-item__content-title) {
  138. font-size: 32rpx !important;
  139. font-weight: 500;
  140. }
  141. .colors{
  142. font-size: 24rpx;
  143. color: #606266;
  144. }
  145. .size-16{
  146. color: #3f424f;
  147. font-size: 32rpx;
  148. margin: 13rpx 0 5rpx 0;
  149. }
  150. .itemText {
  151. color: #3f424f;
  152. font-size: 36rpx;
  153. }
  154. .parent{
  155. width: 50%;
  156. border: 1px solid #f4f4f4;
  157. border-radius: 10rpx;
  158. margin: 0 30rpx 20rpx 30rpx;
  159. padding: 20rpx;
  160. }
  161. .parent:first-child{
  162. margin: 0 0 20rpx 30rpx;
  163. }
  164. </style>