seven.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <div class="seven">
  3. <div class="comTit">{{ tit }}</div>
  4. <div class="comMani">
  5. <div class="row" v-for="item in data" :key="item.id">
  6. <img v-lazy="baseURL + imgSrc(item)" alt="" />
  7. <div class="txt">
  8. <p :title="item.txt1"><span>编号:</span>{{ item.txt1 }}</p>
  9. <p :title="item.txt2"><span>类型:</span>{{ item.txt2 }}</p>
  10. </div>
  11. <div class="txt">
  12. <p :title="item.name"><span>名称:</span>{{ item.name }}</p>
  13. <p :title="item.txt3"><span>年代:</span>{{ item.txt3 }}</p>
  14. </div>
  15. <!-- 详情按钮 -->
  16. <div class="detailBtn" @click="lookDetail(item)"></div>
  17. </div>
  18. </div>
  19. <!-- 点击详情出来的弹窗 -->
  20. <div class="detailBox" v-if="detailShow">
  21. <div class="detailMain">
  22. <div class="detailCon">
  23. <!-- 文字 -->
  24. <div class="detailTxt">
  25. <div class="detailTxtS">
  26. <p class="detailp" :title="detailData.name">
  27. <span class="detailSpan">名称:</span>{{ detailData.name }}
  28. </p>
  29. <p class="detailp" :title="detailData.txt1">
  30. <span class="detailSpan">编号:</span>{{ detailData.txt1 }}
  31. </p>
  32. </div>
  33. <div class="detailTxtS">
  34. <p class="detailp" :title="detailData.txt2">
  35. <span class="detailSpan">类型:</span>{{ detailData.txt2 }}
  36. </p>
  37. <p class="detailp" :title="detailData.txt3">
  38. <span class="detailSpan">年代:</span>{{ detailData.txt3 }}
  39. </p>
  40. </div>
  41. <div class="detailPP">
  42. <span class="detailSpan">简介:</span
  43. ><i v-html="detailData.txt4"></i>
  44. </div>
  45. </div>
  46. <!-- 图片 -->
  47. <div class="detailImg">
  48. <div class="swiper-container detailImgSon">
  49. <div class="swiper-wrapper detailImgSon">
  50. <div
  51. class="swiper-slide detailImgSon"
  52. v-for="item in detailData.imgList"
  53. @click="$emit('openLook', baseURL + item.filePath, 'img')"
  54. :key="item.id"
  55. >
  56. <img
  57. class="detailImgSonImg"
  58. v-lazy="baseURL + item.filePath"
  59. alt=""
  60. />
  61. </div>
  62. </div>
  63. <!-- Add Pagination -->
  64. <!-- <div class="swiper-pagination"></div> -->
  65. </div>
  66. </div>
  67. <!-- 关闭按钮 -->
  68. <div class="detailClose" @click="detailShow = false"></div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import Swiper from "./data/swiper.js";
  76. import "./data/swiper.css";
  77. import axios from "@/utils/request";
  78. export default {
  79. name: "seven",
  80. props: {
  81. tit: {
  82. type: String,
  83. },
  84. data: {
  85. type: Array,
  86. default: () => [],
  87. },
  88. },
  89. components: {},
  90. data() {
  91. //这里存放数据
  92. return {
  93. baseURL: "",
  94. detailShow: false,
  95. detailData: {},
  96. imgInd: 0,
  97. };
  98. },
  99. //监听属性 类似于data概念
  100. computed: {},
  101. //监控data中的数据变化
  102. watch: {
  103. detailShow(val) {
  104. if (val) {
  105. this.$nextTick(() => {
  106. new Swiper(".detailImg .swiper-container", {
  107. slidesPerView: 3,
  108. spaceBetween: 0,
  109. centeredSlides: true,
  110. initialSlide: this.imgInd,
  111. // pagination: {
  112. // el: '.swiper-pagination',
  113. // clickable: true,
  114. // },
  115. });
  116. });
  117. }
  118. },
  119. },
  120. //方法集合
  121. methods: {
  122. imgSrc(item) {
  123. return item.imgList.find((v) => v.id === item.imgActive).filePath;
  124. },
  125. lookDetail(item) {
  126. this.imgInd=0
  127. item.imgList.forEach((v,i)=>{
  128. if(v.id===item.imgActive) this.imgInd=i
  129. })
  130. this.detailData = item;
  131. this.detailShow = true;
  132. },
  133. },
  134. //生命周期 - 创建完成(可以访问当前this实例)
  135. created() {
  136. // 获取服务器前缀地址
  137. this.baseURL = axios.defaults.baseURL;
  138. },
  139. //生命周期 - 挂载完成(可以访问DOM元素)
  140. mounted() {},
  141. beforeCreate() {}, //生命周期 - 创建之前
  142. beforeMount() {}, //生命周期 - 挂载之前
  143. beforeUpdate() {}, //生命周期 - 更新之前
  144. updated() {}, //生命周期 - 更新之后
  145. beforeDestroy() {}, //生命周期 - 销毁之前
  146. destroyed() {}, //生命周期 - 销毁完成
  147. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  148. };
  149. </script>
  150. <style lang='less' scoped>
  151. @import "./data/swiper.css";
  152. .swiper-container {
  153. width: 100%;
  154. height: 100%;
  155. overflow: visible !important;
  156. }
  157. .swiper-slide img {
  158. cursor: pointer;
  159. width: 100%;
  160. height: 100%;
  161. object-fit: cover;
  162. }
  163. .swiper-slide {
  164. transition: all 0.3s;
  165. opacity: 0.5;
  166. }
  167. .swiper-slide-active {
  168. transform: scale(1.3);
  169. opacity: 1;
  170. z-index: 999;
  171. }
  172. .seven {
  173. position: relative;
  174. width: 100%;
  175. height: 100%;
  176. padding-top: 50px;
  177. .comMani::-webkit-scrollbar {
  178. /*滚动条整体样式*/
  179. width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
  180. height: 1px;
  181. }
  182. .comMani::-webkit-scrollbar-thumb {
  183. /*滚动条里面小方块*/
  184. border-radius: 10px;
  185. -webkit-box-shadow: inset 0 0 5px transparent;
  186. background: #8a7351;
  187. }
  188. .comMani::-webkit-scrollbar-track {
  189. /*滚动条里面轨道*/
  190. -webkit-box-shadow: inset 0 0 5px transparent;
  191. border-radius: 10px;
  192. background: transparent;
  193. }
  194. .comMani {
  195. overflow-y: auto;
  196. width: 100%;
  197. height: calc(100% - 155px);
  198. padding-right: 20px;
  199. .row {
  200. display: flex;
  201. position: relative;
  202. width: 100%;
  203. height: 180px;
  204. margin-bottom: 20px;
  205. padding-bottom: 20px;
  206. border-bottom: 1px solid #bfb094;
  207. & > img {
  208. min-width: 220px;
  209. width: 220px;
  210. height: 157px;
  211. object-fit: cover;
  212. margin-right: 40px;
  213. }
  214. .txt {
  215. width: 400px;
  216. color: #8a7351;
  217. display: flex;
  218. flex-direction: column;
  219. justify-content: center;
  220. margin-right: 120px;
  221. p {
  222. cursor: default;
  223. width: 400px;
  224. overflow: hidden;
  225. text-overflow: ellipsis;
  226. white-space: nowrap;
  227. height: 60px;
  228. line-height: 60px;
  229. font-size: 24px;
  230. & > span {
  231. font-weight: 700;
  232. font-family: "思源宋体";
  233. font-size: 24px;
  234. }
  235. }
  236. }
  237. .detailBtn {
  238. cursor: pointer;
  239. position: absolute;
  240. top: 0;
  241. right: 0;
  242. width: 46px;
  243. height: 44px;
  244. background: url("../assets/img/btnDe.png");
  245. background-size: 100% 100%;
  246. }
  247. }
  248. }
  249. .detailBox {
  250. position: fixed;
  251. top: 0;
  252. left: 0;
  253. width: 100%;
  254. height: 100%;
  255. z-index: 999;
  256. padding-top: 100px;
  257. &::before {
  258. content: "";
  259. position: absolute;
  260. left: 0;
  261. top: 0;
  262. width: 100%;
  263. height: 100%;
  264. backdrop-filter: blur(20px);
  265. z-index: -2;
  266. }
  267. .detailMain {
  268. position: absolute;
  269. bottom: 0;
  270. left: 0;
  271. width: 100%;
  272. height: calc(100% - 100px);
  273. .detailCon {
  274. overflow: hidden;
  275. padding: 30px 60px;
  276. position: absolute;
  277. top: 50%;
  278. left: 50%;
  279. transform: translate(-50%, -50%);
  280. background-color: rgba(0, 0, 0, 0.8);
  281. width: 1300px;
  282. height: 700px;
  283. .detailClose {
  284. cursor: pointer;
  285. top: -7px;
  286. right: 104px;
  287. position: absolute;
  288. width: 66px;
  289. height: 105px;
  290. background: url("../assets/img/close.png");
  291. background-size: 100% 100%;
  292. }
  293. .detailTxt {
  294. color: #fff;
  295. font-size: 18px;
  296. .detailTxtS {
  297. display: flex;
  298. .detailp {
  299. margin-bottom: 12px;
  300. cursor: pointer;
  301. width: 400px;
  302. overflow: hidden;
  303. text-overflow: ellipsis;
  304. white-space: nowrap;
  305. margin-right: 100px;
  306. .detailSpan {
  307. font-family: "思源宋体";
  308. font-size: 20px;
  309. }
  310. }
  311. }
  312. .detailPP::-webkit-scrollbar {
  313. /*滚动条整体样式*/
  314. width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
  315. height: 1px;
  316. }
  317. .detailPP::-webkit-scrollbar-thumb {
  318. /*滚动条里面小方块*/
  319. border-radius: 10px;
  320. -webkit-box-shadow: inset 0 0 5px transparent;
  321. background: #c7b080;
  322. }
  323. .detailPP::-webkit-scrollbar-track {
  324. /*滚动条里面轨道*/
  325. -webkit-box-shadow: inset 0 0 5px transparent;
  326. border-radius: 10px;
  327. background: transparent;
  328. }
  329. .detailPP {
  330. height: 200px;
  331. overflow-y: auto;
  332. i {
  333. font-style: normal;
  334. }
  335. .detailSpan {
  336. font-family: "思源宋体";
  337. font-size: 20px;
  338. }
  339. }
  340. }
  341. .detailImg {
  342. margin-top: 50px;
  343. height: 280px;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. </style>