my.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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/resume/index' },
  69. { title: '面试管理', path: '/pagesA/interview/index' },
  70. { title: '门墩儿商城', appId: 'wx6decdf12f9e7a061' },
  71. { title: '我要招聘', key: 'recruit' }
  72. ]
  73. // 列表跳转
  74. const handleToLink = (item) => {
  75. if (item.appId) {
  76. uni.navigateToMiniProgram({
  77. appId: item.appId,
  78. // extraData: {} // 要传递的数据
  79. })
  80. return
  81. }
  82. if (item.key === 'recruit') {
  83. uni.showToast({
  84. title: '请前往网页版门墩儿招聘',
  85. icon: 'none'
  86. })
  87. }
  88. if (!item.path) return
  89. if (!getAccessToken()) {
  90. uni.showToast({
  91. title: '请先登录',
  92. icon: 'none'
  93. })
  94. showAuthModal()
  95. return
  96. }
  97. uni.navigateTo({
  98. url: item.path
  99. })
  100. }
  101. // 登录
  102. const handleTap = () => {
  103. if (!useUserStore.isLogin) {
  104. showAuthModal()
  105. return
  106. }
  107. uni.navigateTo({
  108. url: '/pagesA/info/index'
  109. })
  110. }
  111. // 退出登录
  112. const handleLogout = () => {
  113. popup.value.open()
  114. }
  115. const handleLogoutClose = () => {
  116. popup.value.close()
  117. }
  118. const handleLogoutConfirm = () => {
  119. useUserStore.handleLogout()
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .pb-120 {
  124. padding-bottom: 120rpx;
  125. }
  126. .img-box {
  127. width: 150rpx;
  128. height: 150rpx;
  129. border: 2rpx solid #ccc;
  130. border-radius: 50%;
  131. }
  132. :deep(.uni-list-item) {
  133. height: 120rpx !important;
  134. line-height: 120rpx !important;
  135. }
  136. :deep(.uni-list-item__content-title) {
  137. font-size: 32rpx !important;
  138. font-weight: 500;
  139. }
  140. .colors{
  141. font-size: 24rpx;
  142. color: #606266;
  143. }
  144. .size-16{
  145. color: #3f424f;
  146. font-size: 32rpx;
  147. margin: 13rpx 0 5rpx 0;
  148. }
  149. .itemText {
  150. color: #3f424f;
  151. font-size: 36rpx;
  152. }
  153. .parent{
  154. width: 50%;
  155. border: 1px solid #f4f4f4;
  156. border-radius: 10rpx;
  157. margin: 0 30rpx 20rpx 30rpx;
  158. padding: 20rpx;
  159. }
  160. .parent:first-child{
  161. margin: 0 0 20rpx 30rpx;
  162. }
  163. </style>