index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <FlexCol :padding="[40,30,50,30]" gap="gap.md">
  3. <HomeLargeTitle title="我的" />
  4. <Touchable
  5. direction="row"
  6. align="center"
  7. justify="space-between"
  8. touchable
  9. :gap="25"
  10. :padding="[0,30]"
  11. @click="goUserProfile"
  12. >
  13. <FlexRow align="center" :gap="25">
  14. <Image
  15. :src="userInfo?.avatar || UserHead"
  16. :defaultImage="UserHead"
  17. :failedImage="UserHead"
  18. mode="aspectFill"
  19. class="avatar"
  20. width="75rpx"
  21. height="75rpx"
  22. :showFailed="false"
  23. round
  24. />
  25. <H4 v-if="userInfo">{{ userInfo.nickname }}</H4>
  26. <H4 v-else>欢迎登录</H4>
  27. </FlexRow>
  28. <Icon icon="arrow-right" size="30" />
  29. </Touchable>
  30. <ProvideVar :vars="{
  31. GridItemIconSize: 90,
  32. GridItemBackgroundColor: 'transparent',
  33. GridItemPaddingHorizontal: 0,
  34. }">
  35. <Grid :borderGrid="false" :mainAxisCount="4">
  36. <GridItem title="我的关注" icon="https://xy.wenlvti.net/app_static/images/mine/IconLevel.png" touchable @click="requireLogin(() => navTo('/pages/home/village/follows'), '登录后查看我的关注哦')" />
  37. <GridItem title="我的订单" icon="https://xy.wenlvti.net/app_static/images/mine/IconArchive.png" touchable @click="requireLogin(() => navTo('/pages/home/village/orders'), '登录后查看我的订单哦')" />
  38. <GridItem title="任务中心" icon="https://xy.wenlvti.net/app_static/images/mine/IconTask.png" touchable @click="navTo('/pages/home/village/task/index')" />
  39. <GridItem title="兑换商城" icon="https://xy.wenlvti.net/app_static/images/mine/IconShop.png" touchable @click="goStore" />
  40. </Grid>
  41. </ProvideVar>
  42. <BoxMid
  43. v-if="authStore.isLogged"
  44. :padding="[40,20]"
  45. direction="row"
  46. >
  47. <FlexRow :flex="1" :gap="10" center>
  48. <Text>我的乡源果: </Text>
  49. <Text fontConfig="lightGoldTitle">{{ userInfo?.fruit || 0 }}</Text>
  50. <FrameButton size="small" text="充值" @click="navTo('/pages/home/village/bless/recharge')" />
  51. </FlexRow>
  52. <FlexRow :flex="1" :gap="10" center>
  53. <Touchable direction="row" align="center" :gap="10" @click="navTo('/pages/dig/about/point')">
  54. <Text>文化积分:</Text>
  55. <Icon icon="help-filling" color="primary" :size="40" />
  56. </Touchable>
  57. <Text fontConfig="lightGoldTitle">{{ volunteerInfoLoader.content.value?.points || 0 }}</Text>
  58. </FlexRow>
  59. </BoxMid>
  60. <ProvideVar :vars="{
  61. CellBackground: 'background.tertiary',
  62. CellBottomBorder: false,
  63. }">
  64. <CellGroup round>
  65. <Cell v-if="userInfo" icon="https://xy.wenlvti.net/app_static/images/mine/IconMyArticle.png" title="我的投稿" showArrow touchable @click="navTo('/pages/dig/forms/submits', {
  66. villageVolunteerId: volunteerInfoLoader.content.value?.id || 0
  67. })" />
  68. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconMyRecord.png" title="福泽记录" showArrow touchable @click="requireLogin(() => navTo('/pages/home/village/bless/my-orders'), '登录后查看我的福泽记录哦')" />
  69. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconMyReward.png" title="兑换记录" showArrow touchable @click="goStoreList" />
  70. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconAbout.png" title="关于我们" showArrow touchable @click="navTo('/pages/home/about/about')" />
  71. <button open-type="contact" class="remove-button-style">
  72. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconContract.png" title="联系客服" showArrow touchable />
  73. </button>
  74. <Cell v-if="userInfo" icon="https://xy.wenlvti.net/app_static/images/mine/IconQuit.png" title="退出登录" showArrow touchable @click="doLogout" />
  75. </CellGroup>
  76. </ProvideVar>
  77. <DebugButton />
  78. </FlexCol>
  79. </template>
  80. <script setup lang="ts">
  81. import { computed, onMounted } from 'vue';
  82. import { navTo } from '@/components/utils/PageAction';
  83. import { confirm } from '@/components/dialog/CommonRoot';
  84. import { useAuthStore } from '@/store/auth';
  85. import { useRequireLogin } from '@/common/composeabe/RequireLogin';
  86. import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
  87. import { toast } from '@/components/utils/DialogAction';
  88. import CellGroup from '@/components/basic/CellGroup.vue';
  89. import Cell from '@/components/basic/Cell.vue';
  90. import Image from '@/components/basic/Image.vue';
  91. import H4 from '@/components/typography/H4.vue';
  92. import Text from '@/components/basic/Text.vue';
  93. import Height from '@/components/layout/space/Height.vue';
  94. import Touchable from '@/components/feedback/Touchable.vue';
  95. import FlexCol from '@/components/layout/FlexCol.vue';
  96. import AppCofig from '@/common/config/AppCofig';
  97. import VillageApi from '@/api/inhert/VillageApi';
  98. import DebugButton from './debug/DebugButton.vue';
  99. import FlexRow from '@/components/layout/FlexRow.vue';
  100. import Icon from '@/components/basic/Icon.vue';
  101. import HomeLargeTitle from '@/common/components/parts/HomeLargeTitle.vue';
  102. import ProvideVar from '@/components/theme/ProvideVar.vue';
  103. import Grid from '@/components/layout/grid/Grid.vue';
  104. import GridItem from '@/components/layout/grid/GridItem.vue';
  105. import BoxMid from '@/common/components/box/BoxMid.vue';
  106. import FrameButton from '@/common/components/FrameButton.vue';
  107. const UserHead = 'https://mncdn.wenlvti.net/app_static/xiangyuan/images/user/avatar.png';
  108. const authStore = useAuthStore();
  109. const userInfo = computed(() => authStore.isLogged ? authStore.userInfo : null);
  110. const volunteerInfoLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerInfo(), true);
  111. const { requireLogin } = useRequireLogin();
  112. function goUserProfile() {
  113. userInfo.value ? navTo('/pages/user/update/profile') : navTo('/pages/user/login');
  114. }
  115. function doLogout() {
  116. confirm({
  117. content: '您确定要退出登录吗?',
  118. }).then((res) => {
  119. if (res) {
  120. authStore.logout();
  121. if (AppCofig.requireLogin)
  122. uni.reLaunch({ url: '/pages/user/login' });
  123. }
  124. });
  125. }
  126. function goStoreList() {
  127. requireLogin(() => navTo('/pages/article/web/ewebview', {
  128. url: 'https://xy.wenlvti.net/app_static/yunexamine/index.html#/pages/gift/order'
  129. }), '登录后查看我的哦');
  130. }
  131. function goStore() {
  132. requireLogin(() => navTo('/pages/article/web/ewebview', {
  133. url: 'https://xy.wenlvti.net/app_static/yunexamine/index.html#/pages/gift/index'
  134. }), '登录后查看我的哦');
  135. }
  136. onMounted(() => {
  137. if (authStore.isLogged)
  138. authStore.refreshUserInfo();
  139. });
  140. </script>