home.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template>
  2. <view class="home-container page-home d-flex flex-col bg-base">
  3. <image
  4. class="w-100 position-absolute"
  5. src="https://mn.wenlvti.net/app_static/minnan/images/home/BackgroundBanner.jpg"
  6. mode="widthFix"
  7. />
  8. <view class="content d-flex flex-col wing-l">
  9. <!-- 分栏 -->
  10. <view class="shadow-l radius-l bg-base p-3">
  11. <view
  12. class="main-banner-box"
  13. @click="navTo('home/introduction')"
  14. >
  15. <text class="title">闽南文化生态保护区(厦门市)</text>
  16. <text>世界闽南文化交流中心</text>
  17. <view class="more">
  18. <text>查看详情</text>
  19. </view>
  20. <image
  21. class="footer"
  22. src="https://mn.wenlvti.net/app_static/minnan/images/home/MainBanner2.png"
  23. mode="widthFix"
  24. />
  25. </view>
  26. <view class="position-relative d-flex flex-row flex-wrap justify-between mt-3">
  27. <view
  28. v-for="(tab, k) in subTabs1"
  29. :key="k"
  30. class="d-flex flex-column align-center width-1-5 mt-2"
  31. @click="tab.onClick"
  32. >
  33. <image class="width-100" :src="tab.icon" mode="widthFix" />
  34. <text class="color-second-text mt-2 size-base text-align-center">{{ tab.name }}</text>
  35. </view>
  36. <Box1AudioPlay
  37. class="w-100 mt-3 mb-3"
  38. :title="indexAudioPlayer.currentTitle.value"
  39. :image="indexAudioPlayer.currentItem?.value?.image"
  40. :playState="indexAudioPlayer.isPlaying.value"
  41. :playTime="indexAudioPlayer.timeString.value"
  42. @playPauseClick="indexAudioPlayer.playpause"
  43. @nextClick="indexAudioPlayer.next"
  44. @prevClick="indexAudioPlayer.prev"
  45. @arrowClick="handleGoAudioList"
  46. />
  47. <view
  48. v-for="(tab, k) in subTabs2"
  49. :key="k"
  50. class="d-flex flex-column align-center width-1-5 mt-2"
  51. @click="tab.onClick"
  52. >
  53. <image class="width-100" :src="tab.icon" mode="widthFix" />
  54. <text class="color-second-text mt-2 size-base text-align-center">{{ tab.name }}</text>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 数据统计 -->
  59. <SimplePageContentLoader :loader="statsLoader">
  60. <view v-if="statsLoader.content.value" class="d-flex flex-col mt-3 pt-3 b-3 b-0order-all-light-light-primary">
  61. <view class="d-flex flex-row">
  62. <StatsText
  63. class="border-right-forth"
  64. :title="statsLoader.content.value[0].title"
  65. :data="statsLoader.content.value[0].datas"
  66. />
  67. <StatsText
  68. :title="statsLoader.content.value[1].title"
  69. :data="statsLoader.content.value[1].datas"
  70. />
  71. </view>
  72. <StatsText
  73. class="border-top-forth pt-2 mt-3"
  74. :data="statsLoader.content.value[2].datas"
  75. />
  76. </view>
  77. </SimplePageContentLoader>
  78. <!-- 文化地图 -->
  79. <HomeTitle title="文化地图" />
  80. <view class="position-relative radius-l overflow-hidden">
  81. <map
  82. id="map"
  83. class="w-100 height-400"
  84. :markers="mapLoader.content.value || []"
  85. :enable-zoom="false"
  86. :enable-scroll="false"
  87. :scale="15"
  88. @click="navTo('inhert/map/index', { tab: mapTab })"
  89. />
  90. <scroll-view class="map-tags position-absolute" :scroll-x="true">
  91. <view class="tag-bar d-flex flex-row flex-nowrap">
  92. <view :class="mapTab == 1 ? 'active' : ''" @click="mapTab=1">
  93. <text class="iconfont icon-read" />
  94. 非遗项目
  95. </view>
  96. <view :class="mapTab == 2 ? 'active' : ''" @click="mapTab=2">
  97. <text class="iconfont icon-task-trip" />
  98. 非遗传习所
  99. </view>
  100. <view :class="mapTab == 3 ? 'active' : ''" @click="mapTab=3">
  101. <text class="iconfont icon-task-buliding" />
  102. 文物古迹
  103. </view>
  104. <view :class="mapTab == 4 ? 'active' : ''" @click="mapTab=4">
  105. <text class="iconfont icon-place" />
  106. 传统村落
  107. </view>
  108. <view :class="mapTab == 5 ? 'active' : ''" @click="mapTab=5">
  109. <text class="iconfont icon-task-environment-3" />
  110. 闽南文化景区
  111. </view>
  112. </view>
  113. </scroll-view>
  114. </view>
  115. <!-- 近期活动 -->
  116. <!-- <HomeTitle title="近期活动" />
  117. <SimplePageContentLoader :loader="activityLoader">
  118. <view
  119. class="d-flex flex-col shadow-l radius-l bg-base p-3"
  120. v-for="(item, k) in activityLoader.content.value"
  121. :key="k"
  122. >
  123. <image
  124. class="w-100 radius-base"
  125. :src="item.thumbnail || item.image"
  126. mode="widthFix"
  127. />
  128. <view class="d-flex flex-row justify-between mt-3">
  129. <text class="color-primary size-l">{{ item.title }}</text>
  130. <text class="color-primary">剩余名额:{{item.count}}</text>
  131. </view>
  132. <view class="d-flex flex-row justify-between align-center mt-3">
  133. <view class="d-flex flex-one flex-col">
  134. <view class="d-flex flex-row align-center">
  135. <image :src="IconLocation" class="width-30 height-30 mr-3" />
  136. <text class="color-second size-l">{{ item.location }}</text>
  137. </view>
  138. <text class="color-second">
  139. <text class="iconfont icon-time mr-2" />
  140. {{ item.time }}
  141. </text>
  142. </view>
  143. <view class="width-1-5">
  144. <u-button shape="circle" type="primary">立即报名</u-button>
  145. </view>
  146. </view>
  147. </view>
  148. </SimplePageContentLoader> -->
  149. <!-- 精彩推荐 -->
  150. <HomeTitle title="精彩推荐" />
  151. <SimplePageContentLoader :loader="recommendLoader">
  152. <view class="d-flex flex-row justify-between flex-wrap">
  153. <view
  154. v-for="(tab, k) in recommendLoader.content.value"
  155. :key="k"
  156. class="grid4-item position-relative mb-3"
  157. @click="handleGoDetails(tab)"
  158. >
  159. <text
  160. class="tag bg-mask-white color-primary radius-l p-1 position-absolute size-s text-lines-1"
  161. >
  162. {{ tab.title }}
  163. </text>
  164. <image
  165. class="w-100 height-250 radius-base"
  166. :src="tab.thumbnail || tab.image || AppCofig.defaultImage"
  167. mode="aspectFill"
  168. />
  169. </view>
  170. </view>
  171. </SimplePageContentLoader>
  172. </view>
  173. </view>
  174. <tabbar :current="0"></tabbar>
  175. </template>
  176. <script setup lang="ts">
  177. const MainBoxIcon1 = 'https://mn.wenlvti.net/app_static/minnan/images/home/MainBoxIcon1.png';
  178. const MainBoxIcon2 = 'https://mn.wenlvti.net/app_static/minnan/images/home/MainBoxIcon2.png';
  179. const MainBoxIcon3 = 'https://mn.wenlvti.net/app_static/minnan/images/home/MainBoxIcon3.png';
  180. const MainBoxIcon4 = 'https://mn.wenlvti.net/app_static/minnan/images/home/MainBoxIcon4.png';
  181. const MainBoxIcon5 = 'https://mn.wenlvti.net/app_static/minnan/images/home/MainBoxIcon5.png';
  182. const MainBoxIcon6 = 'https://mn.wenlvti.net/app_static/minnan/images/home/MainBoxIcon6.png';
  183. const MainBoxIcon7 = 'https://mn.wenlvti.net/app_static/minnan/images/home/MainBoxIcon7.png';
  184. const MainBoxIcon8 = 'https://mn.wenlvti.net/app_static/minnan/images/home/MainBoxIcon8.png';
  185. const ImageTest = 'https://mn.wenlvti.net/app_static/minnan/images/home/ImageTest.jpg';
  186. import { ref, watch } from 'vue';
  187. import { navTo } from '@/common/utils/PageAction';
  188. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  189. import { useSimpleListAudioPlayer } from '@/common/composeabe/SimpleAudioPlayer';
  190. import CommonContent, { GetContentListParams } from '@/api/CommonContent';
  191. import UnmoveableContent from '@/api/inheritor/UnmoveableContent';
  192. import SeminarContent from '@/api/inheritor/SeminarContent';
  193. import ProjectsContent from '@/api/inheritor/ProjectsContent';
  194. import ProductsContent from '@/api/inheritor/ProductsContent';
  195. import AppCofig from '@/common/config/AppCofig';
  196. import VillageApi from '@/api/inhert/VillageApi';
  197. import ScenicSpotContent from '@/api/fusion/ScenicSpotContent';
  198. import IndexContent from '@/api/introduction/IndexContent';
  199. import StatsText from './parts/StatsText.vue';
  200. import HomeTitle from '@/pages/parts/HomeTitle.vue';
  201. import Tabbar from '@/common/components/tabs/tabbar.vue';
  202. import Box1AudioPlay from '@/pages/parts/Box1AudioPlay.vue';
  203. import SimplePageContentLoader from "@/common/components/SimplePageContentLoader.vue";
  204. const subTabs1 = [
  205. {
  206. name: '闽南语',
  207. icon: MainBoxIcon1,
  208. onClick: () => navTo('/pages/article/common/list', {
  209. title: '闽南语',
  210. mainBodyColumnId: '257,235,237,210',
  211. modelId: 5,
  212. itemType: 'article-common',
  213. detailsPage: '/pages/video/details',
  214. })
  215. },
  216. {
  217. name: '闽南美食',
  218. icon: MainBoxIcon2,
  219. onClick: () => navTo('/pages/article/common/list', {
  220. title: '闽南美食',
  221. mainBodyColumnId: 103,
  222. modelId: 8,
  223. itemType: 'article-common',
  224. detailsPage: '/pages/article/details',
  225. })
  226. },
  227. { name: '历史人物', icon: MainBoxIcon3, onClick: () => navTo('/pages/introduction/character') },
  228. {
  229. name: '民俗信俗',
  230. icon: MainBoxIcon4,
  231. onClick: () => navTo('/pages/article/common/list', {
  232. title: '民俗信俗',
  233. mainBodyColumnId: 299,
  234. modelId: 18,
  235. itemType: 'article-common',
  236. detailsPage: '/pages/article/details',
  237. })
  238. },
  239. ]
  240. const subTabs2 = [
  241. {
  242. name: '非遗项目',
  243. icon: MainBoxIcon6 ,
  244. onClick: () => navTo('/pages/inhert/intangible/list')
  245. },
  246. {
  247. name: '文物古迹',
  248. icon: MainBoxIcon5 ,
  249. onClick: () => navTo('/pages/inhert/artifact/list')
  250. },
  251. {
  252. name: '老字号',
  253. icon: MainBoxIcon7 ,
  254. onClick: () => navTo('/pages/inhert/old/list')
  255. },
  256. {
  257. name: '传统村落',
  258. icon: MainBoxIcon8 ,
  259. onClick: () => navTo('/pages/inhert/village/list')
  260. },
  261. ]
  262. const mapCtx = uni.createMapContext('map');
  263. const mapTab = ref(1);
  264. const mapLoader = useSimpleDataLoader(async () => {
  265. let list ;
  266. switch (mapTab.value) {
  267. default:
  268. case 1:
  269. list = (await ProjectsContent.getContentList(new GetContentListParams(), 1, 6)).list
  270. break;
  271. case 2:
  272. list = (await SeminarContent.getContentList(new GetContentListParams(), 1, 6)).list
  273. break;
  274. case 3:
  275. list = (await UnmoveableContent.getContentList(new GetContentListParams(), 1, 6)).list
  276. break;
  277. case 4:
  278. list = (await VillageApi.getVallageList()).slice(1, 10)
  279. break;
  280. case 5:
  281. list = (await ScenicSpotContent.getContentList(new GetContentListParams(), 1, 6)).list
  282. break;
  283. }
  284. const res = list.map((p) => {
  285. return {
  286. ...p,
  287. id: p.id,
  288. longitude: Number(p.longitude),
  289. latitude: Number(p.latitude),
  290. iconPath: p.thumbnail,
  291. width: 40,
  292. height: 40,
  293. };
  294. });
  295. mapCtx.includePoints({
  296. points: res.map(p => {
  297. if (!p.longitude || !p.latitude) {
  298. p.longitude = AppCofig.defaultLonLat[0];
  299. p.latitude = AppCofig.defaultLonLat[1];
  300. }
  301. return {
  302. latitude: p.latitude,
  303. longitude: p.longitude,
  304. }
  305. }),
  306. padding: [20, 20, 20, 20],
  307. });
  308. return res;
  309. }, true, undefined, true);
  310. watch(mapTab, () => mapLoader.loadData(undefined, true));
  311. const indexAudioPlayer = useSimpleListAudioPlayer(async () => {
  312. return (await CommonContent.getContentList(new GetContentListParams()
  313. .setModelId(5)
  314. .setMainBodyColumnId(313)
  315. , 1, 6)).list.sort(() => Math.random()>0.5?-1:1).map((p) => {
  316. return {
  317. id: p.id,
  318. title: p.title,
  319. image: p.thumbnail || p.image,
  320. src: p.audio as string,
  321. }
  322. });
  323. })
  324. function handleGoAudioList() {
  325. navTo('/pages/article/common/list', {
  326. title: '闽南原创歌曲',
  327. mainBodyColumnId: 313,
  328. modelId: 5,
  329. itemType: 'article-common',
  330. detailsPage: '/pages/video/details',
  331. })
  332. }
  333. const activityLoader = useSimpleDataLoader(async () => {
  334. //TODO: 活动接口
  335. return [
  336. {
  337. title: '茶艺传承工坊',
  338. image: ImageTest,
  339. count: 8,
  340. content: '这是一个活动的内容',
  341. time: '2025年06月16日 12:00',
  342. location: '湖里创新园',
  343. link: '/pages/article/details',
  344. }
  345. ]
  346. })
  347. const recommendLoader = useSimpleDataLoader(async () => {
  348. const list = [];
  349. list.push(...(await ProjectsContent.getContentList(new GetContentListParams(), 1, 6)).list.map((p) => {
  350. p.itemType = 'intangible';
  351. return p;
  352. }));
  353. list.push(...(await CommonContent.getContentList(new GetContentListParams()
  354. .setModelId(1)
  355. , 1, 6)).list.map((p) => {
  356. p.itemType = 'artifact';
  357. return p;
  358. }));
  359. list.push(...(await ProductsContent.getContentList(new GetContentListParams(), 1, 6)).list.map((p) => {
  360. p.itemType = 'intangible';
  361. return p;
  362. }));
  363. return list;
  364. });
  365. const statsLoader = useSimpleDataLoader(async () => {
  366. const data = (await IndexContent.getStats());
  367. console.log(data);
  368. const semiCount = (await SeminarContent.getContentList(new GetContentListParams(), 1, 6)).total;
  369. const unmoveableCount = (await UnmoveableContent.getContentList(new GetContentListParams(), 1, 6)).total;
  370. const villageCount = (await VillageApi.getVallageList()).length;
  371. return [
  372. {
  373. title: '非遗项目',
  374. type: '1',
  375. datas: data.ichData.map((item: any) => {
  376. return {
  377. title: item.level_text,
  378. value: item.total,
  379. onClick: () => navTo('/pages/inhert/intangible/list', { tab: 0, level: item.level_text }),
  380. }
  381. })
  382. },
  383. {
  384. title: '非遗传承人',
  385. type: '2',
  386. datas: data.inheritorData.map((item: any) => {
  387. return {
  388. title: item.title,
  389. value: item.total,
  390. onClick: () => navTo('/pages/inhert/inheritor/list', { level: item.title }),
  391. }
  392. })
  393. },
  394. {
  395. datas: [
  396. {
  397. title: '非遗传习所',
  398. value: semiCount,
  399. onClick: () => navTo('/pages/inhert/map/index', { tab: 1 }),
  400. },
  401. {
  402. title: '传统村落',
  403. value: villageCount,
  404. onClick: () => navTo('/pages/inhert/village/list'),
  405. },
  406. {
  407. title: '文物古迹',
  408. value: unmoveableCount,
  409. onClick: () => navTo('/pages/inhert/artifact/list'),
  410. },
  411. ],
  412. },
  413. {
  414. title: '不可移动文物',
  415. type: '3',
  416. datas: data.crData.map((item: any) => {
  417. return {
  418. title: item.title,
  419. value: item.total
  420. }
  421. })
  422. },
  423. {
  424. title: '闽南文化重要相关文物古迹',
  425. type: '2',
  426. datas: data.minnanCr.map((item: any) => {
  427. return {
  428. title: item.title,
  429. value: item.total
  430. }
  431. })
  432. },
  433. {
  434. title: '重要相关历史风貌区',
  435. type: '1',
  436. datas: data.historyData.map((item: any) => {
  437. return {
  438. title: item.title,
  439. value: item.total
  440. }
  441. })
  442. },
  443. {
  444. title: '传习中心',
  445. type: '3',
  446. datas: data.ichCenter.map((item: any) => {
  447. return {
  448. title: item.title,
  449. value: item.total
  450. }
  451. })
  452. },
  453. ]
  454. });
  455. function handleGoDetails(item: any) {
  456. switch (item.itemType) {
  457. case 'artifact':
  458. navTo('/pages/inhert/artifact/details', { id: item.id });
  459. break;
  460. case 'intangible':
  461. navTo('/pages/inhert/intangible/details', { id: item.id });
  462. break;
  463. default:
  464. navTo('/pages/article/details', { id: item.id });
  465. break;
  466. }
  467. }
  468. </script>
  469. <style lang="scss">
  470. .page-home {
  471. .map-tags {
  472. left: 0;
  473. top: 0;
  474. padding: 15rpx 0;
  475. font-size: 25rpx;
  476. .tag-bar {
  477. padding: 0 20rpx;
  478. view {
  479. display: flex;
  480. flex-direction: row;
  481. align-items: center;
  482. flex-shrink: 0;
  483. border-radius: 40rpx;
  484. padding: 10rpx 15rpx;
  485. background-color: #f7f3e8;
  486. color: #d9492e;
  487. margin-right: 10rpx;
  488. .iconfont {
  489. margin-right: 8rpx;
  490. }
  491. &.active {
  492. background-color: #d9492e;
  493. color: #f7f3e8;
  494. }
  495. }
  496. }
  497. }
  498. .grid4-item {
  499. width: 320rpx;
  500. .tag {
  501. top: 2rpx;
  502. right: 2rpx;
  503. }
  504. }
  505. .main-banner-box {
  506. position: relative;
  507. display: flex;
  508. flex-direction: column;
  509. overflow: hidden;
  510. border-radius: 15rpx;
  511. background: linear-gradient(180deg, #E5CDAB 0%, #F0E3D6 100%), #F7F3E8;
  512. padding: 20rpx;
  513. font-family: "SongtiSCBlack";
  514. color: #432A04;
  515. .title {
  516. font-size: 40rpx;
  517. }
  518. text {
  519. font-size: 35rpx;
  520. margin-top: 10rpx;
  521. }
  522. .more {
  523. margin-top: 30rpx;
  524. padding: 10rpx 20rpx;
  525. width: 150rpx;
  526. background-image: url('https://mn.wenlvti.net/app_static/minnan/images/home/MainBanner.png');
  527. background-size: 100% auto;
  528. background-repeat: no-repeat;
  529. text {
  530. font-family: initial;
  531. font-size: 30rpx;
  532. }
  533. }
  534. .footer {
  535. position: absolute;
  536. right: 0;
  537. bottom: 0;
  538. width: 370rpx;
  539. z-index: 2;
  540. height: auto;
  541. }
  542. }
  543. }
  544. </style>