my.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 style="margin-top: 80rpx;">
  9. <uni-grid :column="4" :show-border="false">
  10. <uni-grid-item :index="0" v-for="(val, index) in grid" :key="index" class="text-center">
  11. <uni-icons :type="val.icon" size="40" color="#00897B"></uni-icons>
  12. <text class="font-size-13 color-999 mt-5">{{ val.title }}</text>
  13. </uni-grid-item>
  14. </uni-grid>
  15. </view>
  16. <view style="height: 10rpx; background-color: #f8f8fa;"></view>
  17. <view class="card">
  18. <uni-list>
  19. <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>
  20. </uni-list>
  21. </view>
  22. <button v-if="useUserStore.isLogin" class="send-button" @tap="handleLogout">退出登录</button>
  23. <uni-popup ref="popup" type="dialog">
  24. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="系统提示" content="确认退出账号?" @confirm="handleLogoutConfirm"
  25. @close="handleLogoutClose"></uni-popup-dialog>
  26. </uni-popup>
  27. </view>
  28. </template>
  29. <script setup>
  30. import { ref, computed } from 'vue'
  31. import { userStore } from '@/store/user'
  32. import { getUserAvatar } from '@/utils/avatar'
  33. const useUserStore = userStore()
  34. const userInfo = computed(() => {
  35. return useUserStore.userInfo
  36. })
  37. const popup = ref()
  38. const grid = [
  39. { title: '全部', icon: 'list' },
  40. { title: '被查看', icon: 'eye-filled' },
  41. { title: '面试邀约', icon: 'auth-filled' },
  42. { title: '不合适', icon: 'closeempty' }
  43. ]
  44. const list = [
  45. { title:'我的简历', path:'/pagesA/resume/index' },
  46. { title:'职位收藏', path:'/pagesA/collect/position' },
  47. { title:'切换为招聘者', rightTex: '我要招人' }
  48. ]
  49. // 列表跳转
  50. const handleToLink = (item) => {
  51. if (item.path) {
  52. uni.navigateTo({
  53. url: item.path
  54. })
  55. }
  56. }
  57. // 登录
  58. const handleLogin = () => {
  59. uni.navigateTo({
  60. url: '/pages/login/index'
  61. })
  62. }
  63. // 退出登录
  64. const handleLogout = () => {
  65. popup.value.open()
  66. }
  67. const handleLogoutClose = () => {
  68. popup.value.close()
  69. }
  70. const handleLogoutConfirm = () => {
  71. useUserStore.handleLogout()
  72. }
  73. </script>
  74. <style scoped lang="scss">
  75. .img-box {
  76. width: 150rpx;
  77. height: 150rpx;
  78. border: 2rpx solid #ccc;
  79. border-radius: 50%;
  80. }
  81. ::v-deep .uni-list-item{
  82. height: 140rpx !important;
  83. line-height: 140rpx !important;
  84. }
  85. ::v-deep .uni-list-item__content-title{
  86. font-size: 32rpx !important;
  87. font-weight: 500;
  88. }
  89. </style>