index.vue 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. :defaultImage="UserHead"
  14. :failedImage="UserHead"
  15. mode="aspectFill"
  16. class="avatar"
  17. width="100rpx"
  18. height="100rpx"
  19. :showFailed="false"
  20. round
  21. />
  22. <H4 v-if="userInfo">{{ userInfo.nickname }}</H4>
  23. <H4 v-else text="请登录" />
  24. <H4 v-if="userInfo">{{ userInfo.mobile }}</H4>
  25. </Touchable>
  26. <Height :height="50" />
  27. <CellGroup round>
  28. <Cell icon="/static/images/user/icon-edit.png" title="我的投稿" showArrow touchable @click="navTo('/pages/dig/forms/submits')" />
  29. <Cell icon="/static/images/user/icon-profile.png" title="编辑资料" showArrow touchable @click="goUserProfile" />
  30. <Cell icon="/static/images/user/icon-function.png" title="关于我们" showArrow touchable @click="navTo('/pages/home/about/about')" />
  31. <button open-type="contact" class="remove-button-style">
  32. <Cell icon="/static/images/user/icon-service.png" title="联系客服" showArrow touchable />
  33. </button>
  34. <Cell icon="/static/images/user/icon-chat.png" title="商务合作" showArrow touchable @click="navTo('/pages/home/about/contract')" />
  35. <Cell v-if="userInfo" icon="/static/images/user/icon-quit.png" title="退出登录" showArrow touchable @click="doLogout" />
  36. </CellGroup>
  37. <Touchable direction="column" center :padding="40" :gap="10" @click="showBuildInfo">
  38. <Text
  39. color="text.second"
  40. :fontSize="22"
  41. :text="`软件版本 ${AppCofig.version}`"
  42. />
  43. </Touchable>
  44. </FlexCol>
  45. </template>
  46. <script setup lang="ts">
  47. import { useAuthStore } from '@/store/auth';
  48. import { computed } from 'vue';
  49. import { navTo } from '@/components/utils/PageAction';
  50. import { alert, confirm } from '@/components/dialog/CommonRoot';
  51. import UserHead from '@/static/images/user/avatar.png';
  52. import CellGroup from '@/components/basic/CellGroup.vue';
  53. import Cell from '@/components/basic/Cell.vue';
  54. import Image from '@/components/basic/Image.vue';
  55. import H4 from '@/components/typography/H4.vue';
  56. import Height from '@/components/layout/space/Height.vue';
  57. import Touchable from '@/components/feedback/Touchable.vue';
  58. import FlexCol from '@/components/layout/FlexCol.vue';
  59. import Text from '@/components/basic/Text.vue';
  60. import AppCofig from '@/common/config/AppCofig';
  61. import { DateUtils } from '@imengyu/imengyu-utils';
  62. const authStore = useAuthStore();
  63. const userInfo = computed(() => authStore.userInfo);
  64. const buildTime = `${__BUILD_TIMESTAMP__}`
  65. const buildInfo = `${__BUILD_GUID__}`
  66. function showBuildInfo() {
  67. alert({
  68. title: '关于程序',
  69. content: '版本: ' + AppCofig.version +
  70. '\n构建时间:' + DateUtils.formatDate(new Date(parseInt(buildTime)), 'yyyy-MM-dd HH:mm:ss') +
  71. ' (' + buildTime + ')' +
  72. '\n构建GUID:' + buildInfo,
  73. })
  74. }
  75. function goUserProfile() {
  76. userInfo.value ? navTo('/pages/user/update/profile') : navTo('/pages/user/login');
  77. }
  78. function doLogout() {
  79. confirm({
  80. content: '您确定要退出登录吗?',
  81. }).then((res) => {
  82. if (res) {
  83. authStore.logout();
  84. uni.reLaunch({ url: '/pages/user/login' });
  85. }
  86. });
  87. }
  88. </script>