index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. <ImageSwiper
  67. :images="appConfig.banners.userAd?.images || []"
  68. :height="appConfig.banners.userAd?.height || 0"
  69. :width="690"
  70. mode="aspectFill"
  71. radius="radius.md"
  72. />
  73. <ProvideVar :vars="{
  74. CellBackground: 'background.tertiary',
  75. CellBottomBorder: false,
  76. }">
  77. <CellGroup round>
  78. <Cell v-if="userInfo" icon="https://xy.wenlvti.net/app_static/images/mine/IconMyArticle.png" title="我的投稿" showArrow touchable @click="navTo('/pages/dig/forms/submits', {
  79. villageVolunteerId: volunteerInfo?.id || 0
  80. })" />
  81. <Cell v-if="userInfo" icon="https://xy.wenlvti.net/app_static/images/mine/IconMyRecord.png" title="赐福记录" showArrow touchable @click="requireLogin(() => navTo('/pages/home/village/bless/my-orders'), '登录后查看我的福泽记录哦')" />
  82. <Cell v-if="userInfo" icon="share" :iconProps="{ color: '#833e27' }" title="邀请记录" showArrow touchable @click="navTo('/pages/home/village/task/share-reward')" />
  83. <Cell v-if="userInfo" icon="https://xy.wenlvti.net/app_static/images/mine/IconMyReward.png" title="兑换记录" showArrow touchable @click="goStoreList" />
  84. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconAbout.png" title="关于我们" showArrow touchable @click="navTo('/pages/home/about/about')" />
  85. <button open-type="contact" class="remove-button-style">
  86. <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconContract.png" title="联系客服" showArrow touchable />
  87. </button>
  88. <Cell v-if="userInfo" icon="https://xy.wenlvti.net/app_static/images/mine/IconQuit.png" title="退出登录" showArrow touchable @click="doLogout" />
  89. </CellGroup>
  90. </ProvideVar>
  91. <DebugButton />
  92. <Height :height="140" />
  93. </FlexCol>
  94. </template>
  95. <script setup lang="ts">
  96. import { computed, onMounted } from 'vue';
  97. import { navTo } from '@/components/utils/PageAction';
  98. import { confirm } from '@/components/dialog/CommonRoot';
  99. import { useAuthStore } from '@/store/auth';
  100. import { useRequireLogin } from '@/common/composeabe/RequireLogin';
  101. import { injectAppConfiguration } from '@/api/system/useAppConfiguration';
  102. import { useWebPassToken } from '../article/web/webPassToken';
  103. import { useVolunteerInfo } from '../home/village/composeabe/VolunteerInfo';
  104. import CellGroup from '@/components/basic/CellGroup.vue';
  105. import Cell from '@/components/basic/Cell.vue';
  106. import Image from '@/components/basic/Image.vue';
  107. import H4 from '@/components/typography/H4.vue';
  108. import Text from '@/components/basic/Text.vue';
  109. import Touchable from '@/components/feedback/Touchable.vue';
  110. import FlexCol from '@/components/layout/FlexCol.vue';
  111. import AppCofig from '@/common/config/AppCofig';
  112. import VillageApi from '@/api/inhert/VillageApi';
  113. import DebugButton from './debug/DebugButton.vue';
  114. import FlexRow from '@/components/layout/FlexRow.vue';
  115. import Icon from '@/components/basic/Icon.vue';
  116. import HomeLargeTitle from '@/common/components/parts/HomeLargeTitle.vue';
  117. import ProvideVar from '@/components/theme/ProvideVar.vue';
  118. import Grid from '@/components/layout/grid/Grid.vue';
  119. import GridItem from '@/components/layout/grid/GridItem.vue';
  120. import BoxMid from '@/common/components/box/BoxMid.vue';
  121. import FrameButton from '@/common/components/FrameButton.vue';
  122. import Width from '@/components/layout/space/Width.vue';
  123. import Height from '@/components/layout/space/Height.vue';
  124. import ImageSwiper from '@/common/components/parts/ImageSwiper.vue';
  125. const UserHead = 'https://mncdn.wenlvti.net/app_static/xiangyuan/images/user/avatar.png';
  126. const appConfig = injectAppConfiguration();
  127. const authStore = useAuthStore();
  128. const userInfo = computed(() => authStore.isLogged ? authStore.userInfo : null);
  129. const { volunteerInfo } = useVolunteerInfo();
  130. const { requireLogin } = useRequireLogin();
  131. const { finalUrl: storeOrderFinalUrl } = useWebPassToken('https://xycdn.wenlvti.net/assets/addons/yunexamine/h5/', '/pages/gift/order');
  132. const { finalUrl: storeFinalUrl } = useWebPassToken('https://xycdn.wenlvti.net/assets/addons/yunexamine/h5/', '/pages/gift/index');
  133. function goUserProfile() {
  134. userInfo.value ? navTo('/pages/user/update/profile') : navTo('/pages/user/login');
  135. }
  136. function doLogout() {
  137. confirm({
  138. content: '您确定要退出登录吗?',
  139. }).then((res) => {
  140. if (res) {
  141. authStore.logout();
  142. if (AppCofig.requireLogin)
  143. uni.reLaunch({ url: '/pages/user/login' });
  144. }
  145. });
  146. }
  147. function goStoreList() {
  148. requireLogin(() => navTo('/pages/article/web/ewebview', {
  149. url: storeOrderFinalUrl.value
  150. }), '登录后查看我的哦');
  151. }
  152. function goStore() {
  153. requireLogin(() => navTo('/pages/article/web/ewebview', {
  154. url: storeFinalUrl.value
  155. }), '登录后查看我的哦');
  156. }
  157. onMounted(() => {
  158. if (authStore.isLogged)
  159. authStore.refreshUserInfo();
  160. });
  161. </script>