my.vue 3.6 KB

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