home.vue 17 KB

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