wenWuPage.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view class="box">
  3. <u-navbar title="厦门文物" :placeholder="true" bgColor="rgba(255,255,255,0)" :leftIconSize="0" titleStyle="font-weight:bold;color:#000000"></u-navbar>
  4. <view class="" style="width: 92%; margin: auto">
  5. <u-swiper
  6. :list="swiperList"
  7. bgColor="transparent"
  8. keyName="image"
  9. :height="160"
  10. :indicator="true"
  11. radius="5"
  12. :autoplay="true"
  13. :circular="true"
  14. indicatorStyle="bottom: 10px"
  15. indicatorMode="dot"
  16. indicatorActiveColor="#fff"
  17. indicatorInactiveColor="rgba(255, 255, 255, 0.35)"
  18. ></u-swiper>
  19. </view>
  20. <view style="width: 92%; margin: auto">
  21. <!-- <view class="ranking_menu">
  22. <scroll-view scroll-x style="display: flex; white-space: nowrap" class="">
  23. <view @click="menuTab(index)" v-for="(item, index) in menuList" :key="item.index" class="ranking_item" :class="{ active: tab == index }">
  24. {{ item.title }}
  25. </view>
  26. </scroll-view>
  27. </view> -->
  28. <view class="ban_box">
  29. <!-- 厦门文物 -->
  30. <view class="">
  31. <view class="tit_box">
  32. <view class="tit">厦门文物</view>
  33. <view class="" style="display: flex; align-items: center">
  34. <view style="width: 60rpx; margin-right: 20rpx; height: 80rpx; text-align: center; line-height: 80rpx" @click="periphery">
  35. <uni-icons type="location" size="20"></uni-icons>
  36. </view>
  37. <view class="tit2" style="height: 80rpx; line-height: 80rpx" @click="$common.navigateTo('/index_fenbao/GuanLi/gengDuoFC')">查看更多</view>
  38. </view>
  39. </view>
  40. <view class="rw_box" style="">
  41. <view @click="openBuildingInfo(item.id)" class="zj_box" v-for="item in recommendList" :key="item.id" style="position: relative">
  42. <view class="tx_box">
  43. <image style="border-radius: 15rpx; width: 300rpx; height: 185rpx" mode="aspectFill" :src="item.image"></image>
  44. </view>
  45. <view>
  46. <!-- <view style="font-size: 28rpx; color: #444444">{{ item.age }}</view> -->
  47. </view>
  48. <view class="ww_tit" style="display: flex; justify-content: space-between; align-items: center">
  49. <view class="" style="width: 160rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis">
  50. {{ item.title }}
  51. </view>
  52. <view class="" style="width: 120rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis">
  53. {{ item.cr_type_text }}
  54. </view>
  55. </view>
  56. <u-badge type="primary" max="99" :value="item.district" :absolute="true" :offset="[5, 5]"></u-badge>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 文物故事 -->
  61. <view class="">
  62. <view class="tit_box" @click="$common.navigateTo('/xueYuan_fenbao/wenWu/GengDuoGuShi')">
  63. <view class="tit">文物故事</view>
  64. <view class="tit2">查看更多</view>
  65. </view>
  66. <view class="gg_box">
  67. <view @click="$common.navigateTo('/xueYuan_fenbao/wenWu/guShi?id=' + item.id)" class="gg_item" v-for="item in CulturalRelics" :key="item.id">
  68. <view class="" style="display: flex; align-items: center">
  69. <image :src="item.image" style="margin-right: 30rpx; width: 128rpx; height: 128rpx; border-radius: 6rpx"></image>
  70. <view class="">
  71. <view>
  72. <view class="rw_tit1">{{ item.title }}</view>
  73. <!-- <view class="rw_tit2">精彩瞬间</view> -->
  74. <view class="rw_tit2">精彩故事</view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="">
  79. <image style="width: 40rpx; height: 40rpx" src="/static/img/more.png"></image>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 人物故事 -->
  85. <view class="">
  86. <view class="tit_box" @click="$common.navigateTo('/xueYuan_fenbao/wenWu/GengDuoRenWu')">
  87. <view class="tit">人物故事</view>
  88. <view class="tit2">查看更多</view>
  89. </view>
  90. <view class="rw_box" style="">
  91. <view @click="expertDetails(item.id)" class="zj_box" v-for="item in characterList" :key="item.id">
  92. <view class="tx_box">
  93. <image style="border-radius: 15rpx; width: 300rpx; height: 210rpx" mode="scaleToFill" :src="item.image"></image>
  94. </view>
  95. <view style="width: 95%; display: flex; justify-content: space-between; align-items: center">
  96. <view class="tiwen">{{ item.title }}</view>
  97. <view style="font-size: 28rpx; color: #444444">{{ item.age }}</view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <!-- 视频 -->
  103. <view class="">
  104. <view class="tit_box" @click="$common.navigateTo('/xueYuan_fenbao/wenWu/GengDuoShiPin')">
  105. <view class="tit">文物视频</view>
  106. <view class="tit2">查看更多</view>
  107. </view>
  108. <view class="rw_box" style="">
  109. <view
  110. @click="$common.navigateTo('/xueYuan_fenbao/wenWu/ShiPin?id=' + item.id)"
  111. class="zj_box"
  112. v-for="item in CulturalVideo"
  113. :key="item.id"
  114. style="position: relative"
  115. >
  116. <view class="before_box">
  117. <image style="border-radius: 15rpx; width: 300rpx; height: 185rpx" mode="aspectFill" :src="item.image"></image>
  118. <image src="../../static/img/play.png" style="z-index: 2; position: absolute; top: 56rpx; left: 100rpx; width: 80rpx; height: 80rpx"></image>
  119. </view>
  120. <view class="ww_tit">{{ item.title }}</view>
  121. <u-badge type="primary" max="99" :value="item.region_text" :absolute="true" :offset="[5, 5]"></u-badge>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. </template>
  129. <script>
  130. let that;
  131. export default {
  132. data() {
  133. return {
  134. tab: 11,
  135. swiperList: [],
  136. menuList: [],
  137. characterList: [] /*人物 */,
  138. recommendList: [] /* 文物 */,
  139. CulturalRelics: [] /* 文物故事 */,
  140. CulturalVideo: [] /* 文物视频 */
  141. };
  142. },
  143. onLoad(option) {
  144. that = this;
  145. this.getCategoryOnlyChildList();
  146. this.getMainBodyColumnContentList();
  147. this.getContentList();
  148. this.getrelicList();
  149. this.loadGlobalFont();
  150. this.getIndexBanner();
  151. },
  152. methods: {
  153. // 轮播
  154. getIndexBanner() {
  155. this.$api.getIndexBanner({ main_body_id: 1 }, function (res) {
  156. that.swiperList = res.data.filter((item) => {
  157. return item.title == '厦门文物轮播图';
  158. });
  159. });
  160. },
  161. getCategoryOnlyChildList() {
  162. this.$api.getCategoryOnlyChildList({ main_body_id: 1, pid: '5' }, function (res) {
  163. if (res.code == 1) {
  164. that.menuList = res.data;
  165. } else {
  166. console.log(res);
  167. }
  168. });
  169. },
  170. // 文物故事视频
  171. getMainBodyColumnContentList() {
  172. this.$api.getMainBodyColumnContentList({ main_body_id: 1, model_id: 11 }, function (res) {
  173. // console.log(res, '文物');
  174. let foundCulturalStory = false;
  175. let foundCulturalVideo = false;
  176. res.data.forEach((item) => {
  177. if (!foundCulturalStory && item.name === '文物故事') {
  178. that.CulturalRelics = item.content_list;
  179. foundCulturalStory = true;
  180. } else if (!foundCulturalVideo && item.name === '文物视频') {
  181. that.CulturalVideo = item.content_list;
  182. foundCulturalVideo = true;
  183. }
  184. // 如果两个条件都满足,可以提前结束循环
  185. if (foundCulturalStory && foundCulturalVideo) {
  186. return;
  187. }
  188. });
  189. });
  190. },
  191. // 人物故事
  192. getContentList() {
  193. this.$api.getContentList({ page: 1, pageSize: 4, main_body_id: 1, model_id: 7, main_body_column_id: 39 }, function (res) {
  194. console.log(res, '人物');
  195. that.characterList = res.data;
  196. });
  197. },
  198. // 厦门文物
  199. getrelicList() {
  200. this.$api.getContentList({ main_body_id: 1, model_id: 1, page: 1, pageSize: '8' }, function (res) {
  201. // console.log(res, 666666666);
  202. that.recommendList = [...that.recommendList, ...res.data];
  203. });
  204. },
  205. // 周边文物
  206. periphery() {
  207. uni.getLocation({
  208. type: 'gcj02',
  209. success: function (res) {
  210. // console.log('当前位置的经度:' + res.longitude);
  211. // console.log('当前位置的纬度:' + res.latitude);
  212. uni.navigateTo({
  213. url: `/index_fenbao/fuWu/diTu/diTu?longitude=${res.longitude}&latitude=${res.latitude}&pageSize=${'100'}`
  214. });
  215. }
  216. });
  217. },
  218. // 人物详情
  219. expertDetails(id) {
  220. uni.navigateTo({
  221. url: '/xueYuan_fenbao/wenWu/renWuXiangQing?id=' + id
  222. });
  223. },
  224. // 文详情
  225. openBuildingInfo(id) {
  226. uni.navigateTo({
  227. url: '/index_fenbao/GuanLi/XiangQing?id=' + id
  228. });
  229. },
  230. menuTab(i) {
  231. this.tab = i;
  232. },
  233. // 加载字体
  234. loadGlobalFont() {
  235. try {
  236. uni.loadFontFace({
  237. family: 'MyGlobalFont', // 自定义字体名
  238. source: 'url("https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/songTi.ttf")',
  239. success() {
  240. console.log('全局字体加载成功');
  241. }
  242. });
  243. } catch (error) {
  244. console.error('全局字体加载异常', error);
  245. }
  246. }
  247. }
  248. };
  249. </script>
  250. <style>
  251. .box {
  252. height: auto;
  253. width: 100%;
  254. /* padding-bottom: 50rpx; */
  255. /* background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xmww_bgt.png');
  256. background-repeat: no-repeat;
  257. background-size: auto; */
  258. background-image: url('https://huli-app.wenlvti.net/app_static/minnanhun/image/gj_bg.png');
  259. background-repeat: repeat-y;
  260. background-size: 100%;
  261. font-family: 'MyGlobalFont';
  262. }
  263. /deep/.u-swiper-indicator__wrapper__dot--active {
  264. width: 5px !important;
  265. }
  266. .active {
  267. background-image: url('/static/img/tab.png');
  268. background-size: 100% 100%;
  269. }
  270. .ranking_item {
  271. display: inline-block;
  272. width: 200rpx;
  273. height: 62rpx;
  274. }
  275. .ranking_menu {
  276. width: 92%;
  277. margin: auto;
  278. margin-top: 40rpx;
  279. display: flex;
  280. justify-content: space-around;
  281. font-size: 30rpx;
  282. color: rgba(68, 68, 68, 0.6);
  283. text-align: center;
  284. line-height: 60rpx;
  285. font-family: 'MyGlobalFont';
  286. }
  287. .ban_box {
  288. margin-top: 40rpx;
  289. /* display: flex;
  290. justify-content: space-between; */
  291. }
  292. .tit_box {
  293. height: 60rpx;
  294. margin-top: 40rpx;
  295. display: flex;
  296. align-items: center;
  297. justify-content: space-between;
  298. }
  299. .tit {
  300. font-size: 36rpx;
  301. color: #444444;
  302. font-weight: 600;
  303. font-family: 'MyGlobalFont';
  304. }
  305. .tit2 {
  306. font-size: 28rpx;
  307. color: rgba(68, 68, 68, 0.6);
  308. }
  309. .zj_box {
  310. margin-top: 20rpx;
  311. }
  312. .tiwen {
  313. width: 134rpx;
  314. height: 52rpx;
  315. font-size: 30rpx;
  316. color: #444444;
  317. margin-top: 10rpx;
  318. }
  319. .ww_tit {
  320. /* width: 260rpx; */
  321. font-size: 30rpx;
  322. color: #444444;
  323. white-space: nowrap;
  324. overflow: hidden;
  325. text-overflow: ellipsis;
  326. }
  327. .gg_box {
  328. /* width: 670rpx; */
  329. margin: auto;
  330. margin-top: 20rpx;
  331. padding: 20rpx;
  332. border: 2rpx solid #ebc9a9;
  333. background-color: #ffffff;
  334. border-radius: 10rpx;
  335. }
  336. .gg_item {
  337. display: flex;
  338. align-items: center;
  339. justify-content: space-between;
  340. margin-top: 25rpx;
  341. width: 630rpx;
  342. /* height: 80rpx; */
  343. }
  344. .rw_tit1 {
  345. font-size: 30rpx;
  346. color: #444444;
  347. line-height: 44rpx;
  348. }
  349. .rw_tit2 {
  350. font-size: 26rpx;
  351. color: rgba(68, 68, 68, 0.4);
  352. line-height: 40rpx;
  353. }
  354. .rw_box {
  355. width: 100%;
  356. margin: auto;
  357. margin-top: 30rpx;
  358. display: flex;
  359. flex-wrap: wrap;
  360. padding-bottom: 20rpx;
  361. justify-content: space-around;
  362. border-radius: 10rpx;
  363. border: 2rpx solid #ebc9a9;
  364. background-color: #ffffff;
  365. }
  366. .before_box {
  367. position: relative;
  368. width: 300rpx;
  369. height: 185rpx;
  370. }
  371. .before_box::before {
  372. content: '';
  373. display: block;
  374. position: absolute;
  375. top: 0;
  376. left: 0;
  377. width: 100%;
  378. height: 100%;
  379. z-index: 1;
  380. background: linear-gradient(0deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 100%);
  381. }
  382. </style>