index.vue 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="index" :style="{
  3. backgroundImage: tabIndex === 4 ? `url('https://xy.wenlvti.net/app_static/images/mine/TopBanner.png')` : `url('https://xy.wenlvti.net/app_static/images/dig/TopBanner.png')`,
  4. backgroundRepeat: 'no-repeat',
  5. backgroundSize: '100% auto',
  6. backgroundPosition: 'top center',
  7. backgroundColor: themeContext.resolveThemeColor('background.primary'),
  8. }">
  9. <CommonRoot>
  10. <StatusBarSpace backgroundColor="transparent" />
  11. <NavBar
  12. :titleScroll="false"
  13. backgroundColor="transparent"
  14. textColor="whweixinite"
  15. align="left"
  16. />
  17. <HomeIndex v-show="tabIndex === 0" @goVillage="tabIndex = 1" />
  18. <VillageIndex v-if="tabIndex === 1" showSwitch />
  19. <DigIndex v-else-if="tabIndex === 2" />
  20. <DiscoverIndex v-else-if="tabIndex === 3" />
  21. <UserIndex v-else-if="tabIndex === 4" @goSubmit="tabIndex = 2" />
  22. <TabBar
  23. v-model:selectedTabIndex="tabIndex"
  24. fixed
  25. xbarSpace
  26. :innerStyle="{
  27. backgroundColor: '#ffead8',
  28. }"
  29. >
  30. <TabBarItem icon="https://xy.wenlvti.net/app_static/images/tabs/TabIconHome.png" activeIcon="https://xy.wenlvti.net/app_static/images/tabs/TabIconHomeActive.png" text="首页" :iconSize="70" />
  31. <TabBarItem icon="https://xy.wenlvti.net/app_static/images/tabs/TabIconVillage.png" activeIcon="https://xy.wenlvti.net/app_static/images/tabs/TabIconVillageActive.png" text="乡源" :iconSize="70" />
  32. <TabBarItem icon="https://xy.wenlvti.net/app_static/images/tabs/TabIconDig.png" activeIcon="https://xy.wenlvti.net/app_static/images/tabs/TabIconDigActive.png" text="挖掘" :iconSize="70" />
  33. <TabBarItem icon="https://xy.wenlvti.net/app_static/images/tabs/TabIconDiscover.png" activeIcon="https://xy.wenlvti.net/app_static/images/tabs/TabIconDiscoverActive.png" text="发现" :iconSize="70" />
  34. <TabBarItem icon="https://xy.wenlvti.net/app_static/images/tabs/TabIconMine.png" activeIcon="https://xy.wenlvti.net/app_static/images/tabs/TabIconMineActive.png" text="我的" :iconSize="70" />
  35. </TabBar>
  36. </CommonRoot>
  37. </view>
  38. </template>
  39. <script setup lang="ts">
  40. import { onMounted, ref } from 'vue';
  41. import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
  42. import { useTheme } from '@/components/theme/ThemeDefine';
  43. import StatusBarSpace from '@/components/layout/space/StatusBarSpace.vue';
  44. import NavBar from '@/components/nav/NavBar.vue';
  45. import TabBar from '@/components/nav/TabBar.vue';
  46. import TabBarItem from '@/components/nav/TabBarItem.vue';
  47. import DigIndex from './home/dig.vue';
  48. import UserIndex from './user/index.vue';
  49. import HomeIndex from './home/index.vue';
  50. import DiscoverIndex from './home/discover/index.vue';
  51. import VillageIndex from './home/village/index.vue';
  52. import CommonRoot from '@/components/dialog/CommonRoot.vue';
  53. import { isDevEnv } from '@/common/config/AppCofig';
  54. import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
  55. import { navTo } from '@/components/utils/PageAction';
  56. const tabIndex = ref(0);
  57. const themeContext = useTheme();
  58. useLoadQuerys({
  59. openLogin: false,
  60. }, (querys) => {
  61. if (querys.openLogin) {
  62. navTo('/pages/user/login');
  63. }
  64. });
  65. defineExpose({
  66. onPageBack: (name: string, data: Record<string, unknown>) => {
  67. if (data.type === 'goVillage') {
  68. tabIndex.value = 1;
  69. }
  70. }
  71. })
  72. onShareAppMessage(() => {
  73. return {
  74. title: '村社文化资源挖掘平台',
  75. path: '/pages/index',
  76. imageUrl: 'https://mn.wenlvti.net/app_static/xiangyuan/images/index-post.jpg',
  77. }
  78. })
  79. onShareTimeline(() => {
  80. return {
  81. title: '村社文化资源挖掘平台',
  82. path: '/pages/index',
  83. imageUrl: 'https://mn.wenlvti.net/app_static/xiangyuan/images/index-post.jpg',
  84. }
  85. })
  86. onMounted(() => {
  87. if (isDevEnv) {
  88. //tabIndex.value = 1;
  89. }
  90. })
  91. </script>