index.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <FlexCol :padding="[40,30,50,30]">
  3. <Touchable
  4. direction="column"
  5. justify="center"
  6. align="center"
  7. touchable
  8. :gap="25"
  9. @click="goUserProfile"
  10. >
  11. <Image
  12. :src="userInfo?.avatar || UserHead"
  13. mode="aspectFill"
  14. class="avatar"
  15. width="100rpx"
  16. height="100rpx"
  17. round
  18. />
  19. <H4>{{ userInfo?.nickname || '请登录' }}</H4>
  20. <H4>{{ userInfo?.mobile }}</H4>
  21. </Touchable>
  22. <Height :height="50" />
  23. <CellGroup round>
  24. <Cell icon="/static/images/user/icon-edit.png" title="我的投稿" showArrow touchable @click="$emit('goSubmit')" />
  25. <Cell icon="/static/images/user/icon-profile.png" title="编辑资料" showArrow touchable @click="goUserProfile" />
  26. <Cell icon="/static/images/user/icon-function.png" title="关于我们" showArrow touchable />
  27. <Cell icon="/static/images/user/icon-chat.png" title="商务合作" showArrow touchable />
  28. <Cell v-if="userInfo" icon="/static/images/user/icon-quit.png" title="退出登录" showArrow touchable @click="doLogout" />
  29. </CellGroup>
  30. </FlexCol>
  31. </template>
  32. <script setup lang="ts">
  33. import { useAuthStore } from '@/store/auth';
  34. import { computed } from 'vue';
  35. import UserHead from '@/static/images/user/avatar.png';
  36. import CellGroup from '@/components/basic/CellGroup.vue';
  37. import Cell from '@/components/basic/Cell.vue';
  38. import FlexRow from '@/components/layout/FlexRow.vue';
  39. import Image from '@/components/basic/Image.vue';
  40. import Icon from '@/components/basic/Icon.vue';
  41. import H4 from '@/components/typography/H4.vue';
  42. import Width from '@/components/layout/space/Width.vue';
  43. import Height from '@/components/layout/space/Height.vue';
  44. import { confirm } from '@/components/utils/DialogAction';
  45. import { navTo } from '@/components/utils/PageAction';
  46. import Touchable from '@/components/feedback/Touchable.vue';
  47. import FlexCol from '@/components/layout/FlexCol.vue';
  48. const authStore = useAuthStore();
  49. const userInfo = computed(() => authStore.userInfo);
  50. function goUserProfile() {
  51. userInfo.value ? navTo('/pages/user/update/profile') : navTo('/pages/user/login');
  52. }
  53. function doLogout() {
  54. confirm({
  55. content: '您确定要退出登录吗?',
  56. }).then((res) => {
  57. if (res)
  58. authStore.logout();
  59. });
  60. }
  61. </script>