my.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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:'切换为招聘者', rightTex: '我要招人' }
  53. ]
  54. // 列表跳转
  55. const handleToLink = (item) => {
  56. if (!item.path) return
  57. if (!getAccessToken()) {
  58. uni.showToast({
  59. title: '请先登录'
  60. })
  61. uni.navigateTo({
  62. url: '/pages/login/index'
  63. })
  64. return
  65. }
  66. uni.navigateTo({
  67. url: item.path
  68. })
  69. }
  70. // 登录
  71. const handleLogin = () => {
  72. uni.navigateTo({
  73. url: '/pages/login/index'
  74. })
  75. }
  76. // 退出登录
  77. const handleLogout = () => {
  78. popup.value.open()
  79. }
  80. const handleLogoutClose = () => {
  81. popup.value.close()
  82. }
  83. const handleLogoutConfirm = () => {
  84. useUserStore.handleLogout()
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. .img-box {
  89. width: 150rpx;
  90. height: 150rpx;
  91. border: 2rpx solid #ccc;
  92. border-radius: 50%;
  93. }
  94. ::v-deep .uni-list-item{
  95. height: 140rpx !important;
  96. line-height: 140rpx !important;
  97. }
  98. ::v-deep .uni-list-item__content-title{
  99. font-size: 32rpx !important;
  100. font-weight: 500;
  101. }
  102. .colors{
  103. font-size: 24rpx;
  104. color: #606266;
  105. }
  106. .size-16{
  107. color: #3f424f;
  108. font-size: 32rpx;
  109. margin: 13rpx 0 5rpx 0;
  110. }
  111. .parent{
  112. width: 50%;
  113. border: 1px solid #f4f4f4;
  114. border-radius: 10rpx;
  115. margin: 0 30rpx 20rpx 30rpx;
  116. padding: 20rpx;
  117. }
  118. .parent:first-child{
  119. margin: 0 0 20rpx 30rpx;
  120. }
  121. </style>