my.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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" :key="item.title" :title="item.title" link showArrow :rightText="item.rightTex || ''"></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:'' },
  46. { title:'职位订阅', path:'' },
  47. { title:'意见反馈', path:'' },
  48. { title:'切换为招聘者', path:'', rightTex: '我要招人' }
  49. ]
  50. const handleLogin = () => {
  51. uni.navigateTo({
  52. url: '/pages/login/index'
  53. })
  54. }
  55. const handleLogout = () => {
  56. popup.value.open()
  57. }
  58. const handleLogoutClose = () => {
  59. popup.value.close()
  60. }
  61. const handleLogoutConfirm = () => {
  62. useUserStore.handleLogout()
  63. }
  64. </script>
  65. <style scoped lang="scss">
  66. .img-box {
  67. width: 150rpx;
  68. height: 150rpx;
  69. border: 2rpx solid #ccc;
  70. border-radius: 50%;
  71. }
  72. ::v-deep .uni-list-item{
  73. height: 140rpx !important;
  74. line-height: 140rpx !important;
  75. }
  76. ::v-deep .uni-list-item__content-title{
  77. font-size: 32rpx !important;
  78. font-weight: 500;
  79. }
  80. </style>