home.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  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/BackgroundBanner4.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/MainBoxIcon9.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/introduction/custom/list')
  237. },
  238. ];
  239. const mapCtx = uni.createMapContext('map');
  240. const mapTab = ref(1);
  241. const mapLoader = useSimpleDataLoader(async () => {
  242. let list ;
  243. switch (mapTab.value) {
  244. default:
  245. case 1:
  246. list = (await ProjectsContent.getContentList(new GetContentListParams(), 1, 6)).list
  247. break;
  248. case 2:
  249. list = (await SeminarContent.getContentList(new GetContentListParams(), 1, 6)).list
  250. break;
  251. case 3:
  252. list = (await UnmoveableContent.getContentList(new GetContentListParams(), 1, 6)).list
  253. break;
  254. case 4:
  255. list = (await VillageApi.getVallageList()).slice(1, 10)
  256. break;
  257. case 5:
  258. list = (await ScenicSpotContent.getContentList(new GetContentListParams(), 1, 6)).list
  259. break;
  260. }
  261. const res = list.map((p) => {
  262. return {
  263. ...p,
  264. id: p.id,
  265. longitude: Number(p.longitude),
  266. latitude: Number(p.latitude),
  267. iconPath: p.thumbnail,
  268. width: 40,
  269. height: 40,
  270. };
  271. });
  272. mapCtx.includePoints({
  273. points: res.map(p => {
  274. if (!p.longitude || !p.latitude) {
  275. p.longitude = AppCofig.defaultLonLat[0];
  276. p.latitude = AppCofig.defaultLonLat[1];
  277. }
  278. return {
  279. latitude: p.latitude,
  280. longitude: p.longitude,
  281. }
  282. }),
  283. padding: [20, 20, 20, 20],
  284. });
  285. return res;
  286. }, true, undefined, true);
  287. watch(mapTab, () => mapLoader.loadData(undefined, true));
  288. const indexAudioPlayer = useSimpleListAudioPlayer(async () => {
  289. return (await CommonContent.getContentList(new GetContentListParams()
  290. .setModelId(5)
  291. .setMainBodyColumnId(313)
  292. , 1, 6)).list.sort(() => Math.random()>0.5?-1:1).map((p) => {
  293. return {
  294. id: p.id,
  295. title: p.title,
  296. image: p.thumbnail || p.image,
  297. src: p.audio as string,
  298. }
  299. });
  300. })
  301. function handleGoAudioList() {
  302. navTo('/pages/article/common/list', {
  303. title: '闽南语',
  304. mainBodyColumnId: 313,
  305. modelId: 5,
  306. itemType: 'article-common',
  307. detailsPage: '/pages/video/details',
  308. })
  309. }
  310. const activityLoader = useSimpleDataLoader(async () => {
  311. //TODO: 活动接口
  312. return [
  313. {
  314. title: '茶艺传承工坊',
  315. image: ImageTest,
  316. count: 8,
  317. content: '这是一个活动的内容',
  318. time: '2025年06月16日 12:00',
  319. location: '湖里创新园',
  320. link: '/pages/article/details',
  321. }
  322. ]
  323. })
  324. const recommendLoader = useSimpleDataLoader(async () => {
  325. const list = [];
  326. list.push(...(await ProjectsContent.getContentList(new GetContentListParams(), 1, 6)).list.map((p) => {
  327. p.itemType = 'intangible';
  328. return p;
  329. }));
  330. list.push(...(await CommonContent.getContentList(new GetContentListParams()
  331. .setModelId(1)
  332. , 1, 6)).list.map((p) => {
  333. p.itemType = 'artifact';
  334. return p;
  335. }));
  336. list.push(...(await ProductsContent.getContentList(new GetContentListParams(), 1, 6)).list.map((p) => {
  337. p.itemType = 'intangible';
  338. return p;
  339. }));
  340. return list;
  341. });
  342. const statsLoader = useSimpleDataLoader(async () => {
  343. const data = (await IndexContent.getStats());
  344. console.log(data);
  345. const semiCount = (await SeminarContent.getContentList(new GetContentListParams(), 1, 6)).total;
  346. const unmoveableCount = (await UnmoveableContent.getContentList(new GetContentListParams(), 1, 6)).total;
  347. return [
  348. {
  349. title: '非遗项目',
  350. type: '1',
  351. datas: data.ichData.map((item: any) => {
  352. return {
  353. title: item.level_text,
  354. value: item.total,
  355. onClick: () => navTo('/pages/inhert/intangible/list', { tab: 0, level: item.level_text }),
  356. }
  357. })
  358. },
  359. {
  360. title: '非遗传承人',
  361. type: '2',
  362. datas: data.inheritorData.map((item: any) => {
  363. return {
  364. title: item.title,
  365. value: item.total,
  366. onClick: () => navTo('/pages/inhert/inheritor/list', { level: item.title }),
  367. }
  368. })
  369. },
  370. {
  371. datas: [
  372. {
  373. title: '传习所',
  374. value: semiCount,
  375. onClick: () => navTo('/pages/inhert/map/index', { tab: 2 }),
  376. },
  377. {
  378. title: '传统村落',
  379. value: data.villageData[0].total,
  380. onClick: () => navTo('/pages/inhert/village/list'),
  381. },
  382. {
  383. title: '文物古迹',
  384. value: unmoveableCount,
  385. onClick: () => navTo('/pages/inhert/artifact/list'),
  386. },
  387. ],
  388. },
  389. {
  390. title: '不可移动文物',
  391. type: '3',
  392. datas: data.crData.map((item: any) => {
  393. return {
  394. title: item.title,
  395. value: item.total
  396. }
  397. })
  398. },
  399. {
  400. title: '闽南文化重要相关文物古迹',
  401. type: '2',
  402. datas: data.minnanCr.map((item: any) => {
  403. return {
  404. title: item.title,
  405. value: item.total
  406. }
  407. })
  408. },
  409. {
  410. title: '重要相关历史风貌区',
  411. type: '1',
  412. datas: data.historyData.map((item: any) => {
  413. return {
  414. title: item.title,
  415. value: item.total
  416. }
  417. })
  418. },
  419. {
  420. title: '传习中心',
  421. type: '3',
  422. datas: data.ichCenter.map((item: any) => {
  423. return {
  424. title: item.title,
  425. value: item.total
  426. }
  427. })
  428. },
  429. ]
  430. });
  431. function handleGoDetails(item: any) {
  432. switch (item.itemType) {
  433. case 'artifact':
  434. navTo('/pages/inhert/artifact/details', { id: item.id });
  435. break;
  436. case 'intangible':
  437. navTo('/pages/inhert/intangible/details', { id: item.id });
  438. break;
  439. default:
  440. navTo('/pages/article/details', { id: item.id });
  441. break;
  442. }
  443. }
  444. </script>
  445. <style lang="scss">
  446. .page-home {
  447. .content {
  448. margin-top: 470rpx;
  449. }
  450. .map-tags {
  451. left: 0;
  452. top: 0;
  453. padding: 15rpx 0;
  454. font-size: 25rpx;
  455. .tag-bar {
  456. padding: 0 20rpx;
  457. view {
  458. display: flex;
  459. flex-direction: row;
  460. align-items: center;
  461. flex-shrink: 0;
  462. border-radius: 40rpx;
  463. padding: 10rpx 15rpx;
  464. background-color: #f7f3e8;
  465. color: #d9492e;
  466. margin-right: 10rpx;
  467. .iconfont {
  468. margin-right: 8rpx;
  469. }
  470. &.active {
  471. background-color: #d9492e;
  472. color: #f7f3e8;
  473. }
  474. }
  475. }
  476. }
  477. .grid4-item {
  478. width: 320rpx;
  479. .tag {
  480. top: 2rpx;
  481. right: 2rpx;
  482. }
  483. }
  484. .main-banner-box {
  485. position: relative;
  486. display: flex;
  487. flex-direction: column;
  488. overflow: hidden;
  489. border-radius: 15rpx;
  490. background: linear-gradient(180deg, #E5CDAB 0%, #F0E3D6 100%), #F7F3E8;
  491. padding: 20rpx;
  492. font-family: "SongtiSCBlack";
  493. color: #432A04;
  494. .title {
  495. font-size: 40rpx;
  496. }
  497. text {
  498. font-size: 35rpx;
  499. margin-top: 10rpx;
  500. }
  501. .more {
  502. margin-top: 30rpx;
  503. padding: 10rpx 20rpx;
  504. width: 150rpx;
  505. background-image: url('https://mn.wenlvti.net/app_static/minnan/images/home/MainBanner.png');
  506. background-size: 100% auto;
  507. background-repeat: no-repeat;
  508. text {
  509. font-family: initial;
  510. font-size: 30rpx;
  511. }
  512. }
  513. .footer {
  514. position: absolute;
  515. right: 0;
  516. bottom: 0;
  517. width: 370rpx;
  518. z-index: 2;
  519. height: auto;
  520. }
  521. }
  522. }
  523. </style>