wenWuPage.vue 12 KB

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