my.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. const useUserStore = userStore()
  42. const userInfo = computed(() => useUserStore.userInfo)
  43. const popup = ref()
  44. const itemList = [
  45. { title: "面试管理", path: "/pagesA/interview/index", icon: "list" },
  46. { title:'谁看过我', path:'/pagesA/seenMe/index', icon:'staff' }
  47. ]
  48. const list = [
  49. { title:'我的简历', path:'/pagesA/resume/index' },
  50. { title:'职位收藏', path:'/pagesA/collect/position' },
  51. { title:'切换为招聘者', rightTex: '我要招人' }
  52. ]
  53. // 列表跳转
  54. const handleToLink = (item) => {
  55. if (item.path) {
  56. uni.navigateTo({
  57. url: item.path
  58. })
  59. }
  60. }
  61. // 登录
  62. const handleLogin = () => {
  63. uni.navigateTo({
  64. url: '/pages/login/index'
  65. })
  66. }
  67. // 退出登录
  68. const handleLogout = () => {
  69. popup.value.open()
  70. }
  71. const handleLogoutClose = () => {
  72. popup.value.close()
  73. }
  74. const handleLogoutConfirm = () => {
  75. useUserStore.handleLogout()
  76. }
  77. </script>
  78. <style scoped lang="scss">
  79. .img-box {
  80. width: 150rpx;
  81. height: 150rpx;
  82. border: 2rpx solid #ccc;
  83. border-radius: 50%;
  84. }
  85. ::v-deep .uni-list-item{
  86. height: 140rpx !important;
  87. line-height: 140rpx !important;
  88. }
  89. ::v-deep .uni-list-item__content-title{
  90. font-size: 32rpx !important;
  91. font-weight: 500;
  92. }
  93. .colors{
  94. font-size: 24rpx;
  95. color: #606266;
  96. }
  97. .size-16{
  98. color: #3f424f;
  99. font-size: 32rpx;
  100. margin: 13rpx 0 5rpx 0;
  101. }
  102. .parent{
  103. width: 50%;
  104. border: 1px solid #f4f4f4;
  105. border-radius: 10rpx;
  106. margin: 0 30rpx 20rpx 30rpx;
  107. padding: 20rpx;
  108. }
  109. .parent:first-child{
  110. margin: 0 0 20rpx 30rpx;
  111. }
  112. </style>