index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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" :text="userInfo.nickname" />
  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/follow/my-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. <FlexCol :flex="1" center>
  48. <FlexRow :gap="10" center>
  49. <Image src="https://xy.wenlvti.net/app_static/images/village/IconFruit.png" width="30rpx" height="30rpx" mode="aspectFill" />
  50. <Text fontConfig="lightGoldTitle">{{ userInfo?.fruit || 0 }}</Text>
  51. <Width :size="12" />
  52. <FrameButton size="small" text="充值" @click="navTo('/pages/home/village/bless/recharge')" />
  53. </FlexRow>
  54. <Text fontConfig="subText">我的乡源果</Text>
  55. </FlexCol>
  56. <FlexCol :flex="1" center>
  57. <FlexRow :gap="10" center>
  58. <Touchable direction="row" align="center" :gap="10" @click="navTo('/pages/dig/about/point')">
  59. <Icon icon="help-filling" color="primary" :size="40" />
  60. </Touchable>
  61. <Text fontConfig="lightGoldTitle">{{ volunteerInfo?.points || 0 }}</Text>
  62. </FlexRow>
  63. <Text fontConfig="subText">文化积分</Text>
  64. </FlexCol>
  65. </BoxMid>
  66. <ProvideVar :vars="{
  67. CellBackground: 'background.tertiary',
  68. CellBottomBorder: false,
  69. }">
  70. <CellGroup round>
  71. <Cell v-if="userInfo" icon="https://xy.wenlvti.net/app_static/images/mine/IconMyArticle.png" title="我的投稿" showArrow touchable @click="navTo('/pages/dig/forms/submits', {
  72. villageVolunteerId: volunteerInfo?.id || 0
  73. })" />
  74. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconMyRecord.png" title="赐福记录" showArrow touchable @click="requireLogin(() => navTo('/pages/home/village/bless/my-orders'), '登录后查看我的福泽记录哦')" />
  75. <Cell icon="share" :iconProps="{ color: '#833e27' }" title="分享记录" showArrow touchable @click="navTo('/pages/home/village/task/share-reward')" />
  76. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconMyReward.png" title="兑换记录" showArrow touchable @click="goStoreList" />
  77. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconAbout.png" title="关于我们" showArrow touchable @click="navTo('/pages/home/about/about')" />
  78. <button open-type="contact" class="remove-button-style">
  79. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconContract.png" title="联系客服" showArrow touchable />
  80. </button>
  81. <Cell v-if="userInfo" icon="https://xy.wenlvti.net/app_static/images/mine/IconQuit.png" title="退出登录" showArrow touchable @click="doLogout" />
  82. </CellGroup>
  83. </ProvideVar>
  84. <DebugButton />
  85. <Height :height="140" />
  86. </FlexCol>
  87. </template>
  88. <script setup lang="ts">
  89. import { computed, onMounted } from 'vue';
  90. import { navTo } from '@/components/utils/PageAction';
  91. import { confirm } from '@/components/dialog/CommonRoot';
  92. import { useAuthStore } from '@/store/auth';
  93. import { useRequireLogin } from '@/common/composeabe/RequireLogin';
  94. import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
  95. import { useWebPassToken } from '../article/web/webPassToken';
  96. import { useVolunteerInfo } from '../home/village/composeabe/VolunteerInfo';
  97. import CellGroup from '@/components/basic/CellGroup.vue';
  98. import Cell from '@/components/basic/Cell.vue';
  99. import Image from '@/components/basic/Image.vue';
  100. import H4 from '@/components/typography/H4.vue';
  101. import Text from '@/components/basic/Text.vue';
  102. import Touchable from '@/components/feedback/Touchable.vue';
  103. import FlexCol from '@/components/layout/FlexCol.vue';
  104. import AppCofig from '@/common/config/AppCofig';
  105. import VillageApi from '@/api/inhert/VillageApi';
  106. import DebugButton from './debug/DebugButton.vue';
  107. import FlexRow from '@/components/layout/FlexRow.vue';
  108. import Icon from '@/components/basic/Icon.vue';
  109. import HomeLargeTitle from '@/common/components/parts/HomeLargeTitle.vue';
  110. import ProvideVar from '@/components/theme/ProvideVar.vue';
  111. import Grid from '@/components/layout/grid/Grid.vue';
  112. import GridItem from '@/components/layout/grid/GridItem.vue';
  113. import BoxMid from '@/common/components/box/BoxMid.vue';
  114. import FrameButton from '@/common/components/FrameButton.vue';
  115. import Width from '@/components/layout/space/Width.vue';
  116. import Height from '@/components/layout/space/Height.vue';
  117. const UserHead = 'https://mncdn.wenlvti.net/app_static/xiangyuan/images/user/avatar.png';
  118. const authStore = useAuthStore();
  119. const userInfo = computed(() => authStore.isLogged ? authStore.userInfo : null);
  120. const { volunteerInfo } = useVolunteerInfo();
  121. const { requireLogin } = useRequireLogin();
  122. const { finalUrl: storeOrderFinalUrl } = useWebPassToken('https://xycdn.wenlvti.net/assets/addons/yunexamine/h5/', '/pages/gift/order');
  123. const { finalUrl: storeFinalUrl } = useWebPassToken('https://xycdn.wenlvti.net/assets/addons/yunexamine/h5/', '/pages/gift/index');
  124. function goUserProfile() {
  125. userInfo.value ? navTo('/pages/user/update/profile') : navTo('/pages/user/login');
  126. }
  127. function doLogout() {
  128. confirm({
  129. content: '您确定要退出登录吗?',
  130. }).then((res) => {
  131. if (res) {
  132. authStore.logout();
  133. if (AppCofig.requireLogin)
  134. uni.reLaunch({ url: '/pages/user/login' });
  135. }
  136. });
  137. }
  138. function goStoreList() {
  139. requireLogin(() => navTo('/pages/article/web/ewebview', {
  140. url: storeOrderFinalUrl.value
  141. }), '登录后查看我的哦');
  142. }
  143. function goStore() {
  144. requireLogin(() => navTo('/pages/article/web/ewebview', {
  145. url: storeFinalUrl.value
  146. }), '登录后查看我的哦');
  147. }
  148. onMounted(() => {
  149. if (authStore.isLogged)
  150. authStore.refreshUserInfo();
  151. });
  152. </script>