my.vue 3.7 KB

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