index.vue 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="index">
  3. <CommonRoot>
  4. <StatusBarSpace backgroundColor="transparent" />
  5. <NavBar
  6. :title="title"
  7. :titleScroll="false"
  8. backgroundColor="transparent"
  9. textColor="white"
  10. align="left"
  11. />
  12. <HomeIndex v-if="tabIndex === 0" @goDiscover="tabIndex = 1" />
  13. <DiscoverIndex v-else-if="tabIndex === 1" />
  14. <DigIndex v-else-if="tabIndex === 2" />
  15. <StoreIndex v-else-if="tabIndex === 3" />
  16. <UserIndex v-else-if="tabIndex === 4" @goSubmit="tabIndex = 2" />
  17. <TabBar
  18. v-model:selectedTabIndex="tabIndex"
  19. fixed
  20. xbarSpace
  21. >
  22. <TabBarItem icon="/static/images/tabs/home.png" activeIcon="/static/images/tabs/home-active.png" text="首页" />
  23. <TabBarItem icon="/static/images/tabs/discover.png" activeIcon="/static/images/tabs/discover-active.png" text="发现" />
  24. <TabBarItem icon="/static/images/tabs/dig.png" hump :humpHeight="[ 10, 10 ]" :humpSpace="[20,20]" :iconSize="140" />
  25. <TabBarItem icon="/static/images/tabs/store.png" activeIcon="/static/images/tabs/store-active.png" text="知识库" />
  26. <TabBarItem icon="/static/images/tabs/user.png" activeIcon="/static/images/tabs/user-active.png" text="我的" />
  27. </TabBar>
  28. </CommonRoot>
  29. </view>
  30. </template>
  31. <script setup lang="ts">
  32. import { computed, ref } from 'vue';
  33. import StatusBarSpace from '@/components/layout/space/StatusBarSpace.vue';
  34. import NavBar from '@/components/nav/NavBar.vue';
  35. import TabBar from '@/components/nav/TabBar.vue';
  36. import TabBarItem from '@/components/nav/TabBarItem.vue';
  37. import DigIndex from './dig/index.vue';
  38. import UserIndex from './user/index.vue';
  39. import HomeIndex from './home/index.vue';
  40. import DiscoverIndex from './home/discover/index.vue';
  41. import StoreIndex from './home/store/index.vue';
  42. import CommonRoot from '@/components/dialog/CommonRoot.vue';
  43. import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
  44. const title = computed(() => {
  45. switch (tabIndex.value) {
  46. case 0:
  47. return '首页·村社文化资源挖掘平台';
  48. case 1:
  49. return '发现·村社文化资源挖掘平台';
  50. case 2:
  51. return '挖掘·村社文化资源挖掘平台';
  52. case 3:
  53. return '知识库·村社文化资源挖掘平台';
  54. case 4:
  55. return '我的·村社文化资源挖掘平台';
  56. }
  57. return '';
  58. });
  59. const tabIndex = ref(0);
  60. onShareAppMessage(() => {
  61. return {
  62. title: '村社文化资源挖掘平台',
  63. path: '/pages/index',
  64. imageUrl: 'https://mn.wenlvti.net/app_static/xiangyuan/images/index-post.jpg',
  65. }
  66. })
  67. onShareTimeline(() => {
  68. return {
  69. title: '村社文化资源挖掘平台',
  70. path: '/pages/index',
  71. imageUrl: 'https://mn.wenlvti.net/app_static/xiangyuan/images/index-post.jpg',
  72. }
  73. })
  74. </script>
  75. <style scoped>
  76. .index {
  77. background-position: top left;
  78. background-size: 100% auto;
  79. background-repeat: no-repeat;
  80. background-image: url('@/static/images/BackgroundMask.jpg');
  81. overflow-x: hidden;
  82. }
  83. </style>