home.vue 19 KB

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