index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. <!-- 分栏 -->
  11. <view class="shadow-base radius-l bg-base p-3">
  12. <!--
  13. 点击介绍
  14. @click="navTo('introduction')"
  15. -->
  16. <view
  17. class="main-banner-box mb-25"
  18. >
  19. <Image
  20. innerClass="logo"
  21. src="https://mncdn.wenlvti.net/app_static/minnan/images/home/MainLogo1.png"
  22. :width="140"
  23. :height="85"
  24. />
  25. <view>
  26. <text class="title">{{pageContentDefine?.props.title || ''}}</text>
  27. <text>{{pageContentDefine?.props.subTitle || ''}}</text>
  28. </view>
  29. <Image
  30. innerClass="footer"
  31. src="https://mncdn.wenlvti.net/app_static/minnan/images/home/MainBanner2.png"
  32. :width="280"
  33. mode="widthFix"
  34. />
  35. </view>
  36. <view class="position-relative d-flex flex-row flex-wrap justify-between mt-25 row-gap-sss">
  37. <HomeButton
  38. v-for="item in pageContentDefine?.props.homeButtons || []"
  39. :key="item.title"
  40. :title="item.title"
  41. :icon="item.icon"
  42. :size="item.size"
  43. @click="navTo(item.link[0], item.link[1] as Record<string, unknown>)"
  44. />
  45. </view>
  46. <view class="position-relative d-flex flex-row flex-wrap justify-between mt-3">
  47. <Box1AudioPlay
  48. class="w-100"
  49. :title="indexAudioPlayer.currentTitle.value"
  50. :image="indexAudioPlayer.currentItem?.value?.image"
  51. :playState="indexAudioPlayer.isPlaying.value"
  52. :playTime="indexAudioPlayer.timeString.value"
  53. @playPauseClick="indexAudioPlayer.playpause"
  54. @arrowClick="handleGoAudioList"
  55. @nextClick="indexAudioPlayer.next"
  56. @prevClick="indexAudioPlayer.prev"
  57. @click="handleGoAudioList"
  58. />
  59. </view>
  60. </view>
  61. <CommonCategoryBlocks :categoryDefine="categoryDefine" />
  62. </view>
  63. </view>
  64. <Tabbar :current="0" />
  65. </template>
  66. <script setup lang="ts">
  67. import { computed } from 'vue';
  68. import { onShareTimeline, onShareAppMessage } from '@dcloudio/uni-app';
  69. import { navTo } from '@/components/utils/PageAction';
  70. import { useSimpleListAudioPlayer } from '@/common/composeabe/SimpleAudioPlayer';
  71. import { injectCommonCategory } from '../article/data/CommonCategoryGlobalLoader';
  72. import { CommonCategoryListTabNestCategoryDataToContent, type IHomeCommonCategoryHomeDefine } from '../article/data/CommonCategoryDefine';
  73. import CommonContent, { GetContentListParams } from '@/api/CommonContent';
  74. import Tabbar from '@/common/components/tabs/Tabbar.vue';
  75. import Box1AudioPlay from '@/pages/parts/Box1AudioPlay.vue';
  76. import Image from '@/components/basic/Image.vue';
  77. import HomeButton from '../parts/HomeButton.vue';
  78. import CommonCategoryBlocks, { type CategoryDefine } from '../article/data/CommonCategoryBlocks.vue';
  79. const commonCategory = injectCommonCategory();
  80. const pageDefine = computed(() => commonCategory.value.page.find((p) => p.name === 'home'));
  81. const pageContentDefine = computed(() => pageDefine.value?.content as IHomeCommonCategoryHomeDefine);
  82. const categoryDefine = computed(() => pageContentDefine.value?.props.categorys
  83. .filter((item) => item.visible !== false)
  84. .map((item) => {
  85. return {
  86. ...item,
  87. showTitle: item.showTitle !== false,
  88. title: item.text,
  89. content: CommonCategoryListTabNestCategoryDataToContent(
  90. item.data, item
  91. ),
  92. type: item.type as CategoryDefine['type'],
  93. }
  94. })
  95. );
  96. const indexAudioPlayer = useSimpleListAudioPlayer(async () => {
  97. return (await CommonContent.getContentList(new GetContentListParams()
  98. .setModelId(5)
  99. .setMainBodyColumnId(321)
  100. , 1, 10)).list.map((p) => {
  101. return {
  102. id: p.id,
  103. title: p.title,
  104. image: p.thumbnail || p.image,
  105. src: p.audio as string,
  106. }
  107. });
  108. })
  109. function handleGoAudioList() {
  110. navTo('/pages/inhert/language/list')
  111. }
  112. onShareTimeline(() => {
  113. return {};
  114. })
  115. onShareAppMessage(() => {
  116. return {};
  117. })
  118. </script>
  119. <style lang="scss">
  120. .page-home {
  121. .main-banner {
  122. top: 0rpx;
  123. }
  124. .content {
  125. margin-top: 400rpx;
  126. }
  127. .map-tags {
  128. left: 0;
  129. top: 0;
  130. padding: 15rpx 0;
  131. font-size: 25rpx;
  132. .tag-bar {
  133. padding: 0 20rpx;
  134. view {
  135. display: flex;
  136. flex-direction: row;
  137. align-items: center;
  138. flex-shrink: 0;
  139. border-radius: 40rpx;
  140. padding: 10rpx 15rpx;
  141. background-color: #f7f3e8;
  142. color: #d9492e;
  143. margin-right: 10rpx;
  144. .iconfont {
  145. margin-right: 8rpx;
  146. }
  147. &.active {
  148. background-color: #d9492e;
  149. color: #f7f3e8;
  150. }
  151. }
  152. }
  153. }
  154. ::v-deep .grid4-item {
  155. width: 320rpx;
  156. .tag {
  157. top: 2rpx;
  158. right: 2rpx;
  159. z-index: 20;
  160. }
  161. }
  162. .main-banner-box {
  163. position: relative;
  164. display: flex;
  165. flex-direction: row;
  166. align-items: center;
  167. justify-content: space-between;
  168. overflow: hidden;
  169. border-radius: 15rpx;
  170. background: linear-gradient(180deg, #E5CDAB 0%, #F0E3D6 100%), #F7F3E8;
  171. padding: 30rpx 20rpx;
  172. font-family: "SongtiSCBlack";
  173. color: #432A04;
  174. > view {
  175. display: flex;
  176. flex-direction: column;
  177. margin-left: -30rpx;
  178. }
  179. .logo {
  180. margin-left: -10rpx;
  181. margin-right: 0rpx;
  182. }
  183. .title {
  184. font-size: 40rpx;
  185. }
  186. text {
  187. font-size: 35rpx;
  188. margin-top: 10rpx;
  189. }
  190. .more {
  191. margin-top: 30rpx;
  192. padding: 10rpx 18rpx;
  193. width: 180rpx;
  194. &.badge {
  195. background-image: url('https://mncdn.wenlvti.net/app_static/minnan/images/home/MainBanner.png');
  196. background-size: 100% auto;
  197. background-repeat: no-repeat;
  198. }
  199. text {
  200. font-family: initial;
  201. font-size: 30rpx;
  202. }
  203. }
  204. .footer {
  205. position: absolute;
  206. right: -80rpx;
  207. bottom: -10rpx;
  208. width: 180rpx;
  209. z-index: 2;
  210. height: auto;
  211. opacity: 0.15;
  212. }
  213. }
  214. }
  215. </style>