index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="home-container page-home d-flex flex-col bg-base">
  3. <Image
  4. innerClass="main-banner position-absolute"
  5. width="100%"
  6. :src="pageContentDefine?.props.homeBanner"
  7. mode="widthFix"
  8. />
  9. <view class="content d-flex flex-col wing-l">
  10. <view class="shadow-base radius-l border-all-base main-banner-box mb-25">
  11. <Image
  12. innerClass="logo"
  13. src="https://mncdn.wenlvti.net/app_static/minnan/images/home/MainLogo1.png"
  14. :width="140"
  15. :height="85"
  16. />
  17. <view>
  18. <text class="title">{{pageContentDefine?.props.title || ''}}</text>
  19. <text>{{pageContentDefine?.props.subTitle || ''}}</text>
  20. </view>
  21. <Image
  22. innerClass="footer"
  23. src="https://mncdn.wenlvti.net/app_static/minnan/images/home/MainBanner2.png"
  24. :width="280"
  25. mode="widthFix"
  26. />
  27. </view>
  28. <view class="position-relative d-flex flex-row flex-wrap justify-between mt-25 row-gap-sss">
  29. <HomeButton
  30. v-for="item in pageContentDefine?.props.homeButtons || []"
  31. :key="item.title"
  32. :title="item.title"
  33. :icon="item.icon"
  34. :size="item.size"
  35. :buttonStyle="item.style"
  36. @click="navTo(item.link)"
  37. />
  38. </view>
  39. <!-- 分栏 -->
  40. <CommonCategoryBlocks :categoryDefine="categoryDefine" />
  41. </view>
  42. </view>
  43. <Tabbar v-if="!isEditorPreview" :current="0" />
  44. </template>
  45. <script setup lang="ts">
  46. import { computed, inject } from 'vue';
  47. import { onShareTimeline, onShareAppMessage } from '@dcloudio/uni-app';
  48. import { navTo } from '@/components/utils/PageAction';
  49. import { injectCommonCategory } from '../article/data/CommonCategoryGlobalLoader';
  50. import { CommonCategoryListTabNestCategoryDataToContent, type IHomeCommonCategoryHomeDefine } from '../article/data/CommonCategoryDefine';
  51. import Tabbar from '@/common/components/tabs/Tabbar.vue';
  52. import Image from '@/components/basic/Image.vue';
  53. import HomeButton from '../parts/HomeButton.vue';
  54. import CommonCategoryBlocks from '../article/data/CommonCategoryBlocks.vue';
  55. import type { CategoryDefine } from '../article/data/CommonCategoryBlocks';
  56. const commonCategory = injectCommonCategory();
  57. const pageDefine = computed(() => commonCategory.value.page.find((p) => p.name === 'home'));
  58. const pageContentDefine = computed(() => pageDefine.value?.content as IHomeCommonCategoryHomeDefine);
  59. const isEditorPreview = inject('editorPreviewMark', false);
  60. const categoryDefine = computed(() => pageContentDefine.value?.props.categorys
  61. .filter((item) => item.visible !== false)
  62. .map((item) => {
  63. return {
  64. ...item,
  65. showTitle: item.showTitle !== false,
  66. title: item.text,
  67. content: CommonCategoryListTabNestCategoryDataToContent(
  68. item.data, item
  69. ),
  70. type: item.type as CategoryDefine['type'],
  71. }
  72. })
  73. );
  74. onShareTimeline(() => {
  75. return {};
  76. })
  77. onShareAppMessage(() => {
  78. return {};
  79. })
  80. </script>
  81. <style lang="scss">
  82. .page-home {
  83. .main-banner {
  84. top: -100rpx;
  85. }
  86. .content {
  87. margin-top: 400rpx;
  88. }
  89. .map-tags {
  90. left: 0;
  91. top: 0;
  92. padding: 15rpx 0;
  93. font-size: 25rpx;
  94. .tag-bar {
  95. padding: 0 20rpx;
  96. view {
  97. display: flex;
  98. flex-direction: row;
  99. align-items: center;
  100. flex-shrink: 0;
  101. border-radius: 40rpx;
  102. padding: 10rpx 15rpx;
  103. background-color: #f7f3e8;
  104. color: #d9492e;
  105. margin-right: 10rpx;
  106. .iconfont {
  107. margin-right: 8rpx;
  108. }
  109. &.active {
  110. background-color: #d9492e;
  111. color: #f7f3e8;
  112. }
  113. }
  114. }
  115. }
  116. ::v-deep .grid4-item {
  117. width: 320rpx;
  118. .tag {
  119. top: 2rpx;
  120. right: 2rpx;
  121. z-index: 20;
  122. }
  123. }
  124. .main-banner-box {
  125. position: relative;
  126. display: flex;
  127. flex-direction: row;
  128. align-items: center;
  129. justify-content: space-around;
  130. overflow: hidden;
  131. background: linear-gradient(180deg, #E5CDAB 0%, #F0E3D6 100%), #F7F3E8;
  132. padding: 50rpx 20rpx;
  133. font-family: "SongtiSCBlack";
  134. color: #432A04;
  135. > view {
  136. display: flex;
  137. flex-direction: column;
  138. margin-left: -30rpx;
  139. }
  140. .logo {
  141. margin-left: -10rpx;
  142. margin-right: 0rpx;
  143. }
  144. .title {
  145. font-size: 40rpx;
  146. }
  147. text {
  148. font-size: 35rpx;
  149. margin-top: 10rpx;
  150. }
  151. .more {
  152. margin-top: 30rpx;
  153. padding: 10rpx 18rpx;
  154. width: 180rpx;
  155. &.badge {
  156. background-image: url('https://mncdn.wenlvti.net/app_static/minnan/images/home/MainBanner.png');
  157. background-size: 100% auto;
  158. background-repeat: no-repeat;
  159. }
  160. text {
  161. font-family: initial;
  162. font-size: 30rpx;
  163. }
  164. }
  165. .footer {
  166. position: absolute;
  167. right: -80rpx;
  168. bottom: -10rpx;
  169. width: 180rpx;
  170. z-index: 2;
  171. height: auto;
  172. opacity: 0.15;
  173. }
  174. }
  175. }
  176. </style>