|
@@ -0,0 +1,491 @@
|
|
|
+<!-- -->
|
|
|
+<template>
|
|
|
+ <div class="Three">
|
|
|
+ <div class="main">
|
|
|
+ <div class="bottomSm"></div>
|
|
|
+ <div
|
|
|
+ class="bacXian"
|
|
|
+ @mousedown.stop="mousedown"
|
|
|
+ @mousemove.stop="mousemove"
|
|
|
+ @mouseup.stop="mouseup"
|
|
|
+ >
|
|
|
+ <div class="centen">
|
|
|
+ <div class="rowTop">
|
|
|
+ <div class="row" @click.stop="look3D(i)" v-for="i in 12" :key="i">
|
|
|
+ <img v-lazy="require('@/assets/img/Home/demo.png')" alt="" />
|
|
|
+ <div class="name">民国时期谢士炎烈士用过的墨盒1</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="rowTop rowFloo">
|
|
|
+ <div class="row" @click.stop="look3D(i)" v-for="i in 12" :key="i">
|
|
|
+ <img v-lazy="require('@/assets/img/Home/demo.png')" alt="" />
|
|
|
+ <div class="name">民国时期谢士炎烈士用过的墨盒2</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 点击3D出来的盒子 -->
|
|
|
+ <div class="Threebox" :class="{ show: modelShow }">
|
|
|
+ <div class="model">
|
|
|
+ <div class="close" @click="(modelShow = false), (move = false)">
|
|
|
+ <img src="../../../assets/img/Goods/close.png" alt="" />
|
|
|
+ </div>
|
|
|
+ <div class="modelll">
|
|
|
+ <img v-lazy="require('@/assets/img/Home/demo.png')" alt="" />
|
|
|
+ </div>
|
|
|
+ <div class="modelrr">
|
|
|
+ <h3>民国时期邓中夏烈士读书时期用的煤油灯</h3>
|
|
|
+ <p>年代:中华民国(1912~1949)</p>
|
|
|
+ <p>类别:其他</p>
|
|
|
+ <p>级别:二级</p>
|
|
|
+ <p>质地:玻璃</p>
|
|
|
+ <p>尺寸:17.5*9.2cm</p>
|
|
|
+ <div class="btnn" @click="modelBoxShow = true">查看三维文物</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modelBox" v-if="modelBoxShow">
|
|
|
+ <iframe
|
|
|
+ src="https://4dscene.4dage.com/culturalrelics/NSRDYT/Model2.html?m=nsr01"
|
|
|
+ frameborder="0"
|
|
|
+ ></iframe>
|
|
|
+ <h3>民国时期邓中夏烈士读书时期用的煤油灯</h3>
|
|
|
+ <div
|
|
|
+ class="close"
|
|
|
+ @click="(modelBoxShow = false), (modelShow = false), (move = false)"
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "Three",
|
|
|
+ //import引入的组件需要注入到对象中才能使用
|
|
|
+ components: {},
|
|
|
+ data() {
|
|
|
+ //这里存放数据
|
|
|
+ return {
|
|
|
+ move: false,
|
|
|
+ moveX: 0,
|
|
|
+ elDom: null,
|
|
|
+ TimeSrool: null,
|
|
|
+ Time2: null,
|
|
|
+ // 点击文物出来
|
|
|
+ modelShow: false,
|
|
|
+ modelBoxShow: false,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ //监听属性 类似于data概念
|
|
|
+ computed: {},
|
|
|
+ //监控data中的数据变化
|
|
|
+ watch: {
|
|
|
+ modelShow(val) {
|
|
|
+ if (!val) {
|
|
|
+ clearInterval(this.Time2);
|
|
|
+ this.Time2 = setTimeout(() => {
|
|
|
+ if (this.modelShow) return;
|
|
|
+ clearInterval(this.TimeSrool);
|
|
|
+ this.TimeSrool = setInterval(() => {
|
|
|
+ const clientWidth = this.elDom.clientWidth;
|
|
|
+ const scrollLeft = this.elDom.scrollLeft;
|
|
|
+ const scrollWidth = this.elDom.scrollWidth;
|
|
|
+ if (clientWidth + scrollLeft >= scrollWidth)
|
|
|
+ this.elDom.scrollLeft = 0;
|
|
|
+ else this.elDom.scrollLeft = this.elDom.scrollLeft + 1;
|
|
|
+ }, 40);
|
|
|
+ }, 5000);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ move(val) {
|
|
|
+ let rowDom = document.querySelectorAll(".rowTop");
|
|
|
+ if (!val) {
|
|
|
+ clearInterval(this.Time2);
|
|
|
+ this.Time2 = setTimeout(() => {
|
|
|
+ if (this.modelShow) return;
|
|
|
+ clearInterval(this.TimeSrool);
|
|
|
+ this.TimeSrool = setInterval(() => {
|
|
|
+ const clientWidth = this.elDom.clientWidth;
|
|
|
+ const scrollLeft = this.elDom.scrollLeft;
|
|
|
+ const scrollWidth = this.elDom.scrollWidth;
|
|
|
+ if (clientWidth + scrollLeft >= scrollWidth)
|
|
|
+ this.elDom.scrollLeft = 0;
|
|
|
+ else this.elDom.scrollLeft = this.elDom.scrollLeft + 1;
|
|
|
+ }, 40);
|
|
|
+ }, 5000);
|
|
|
+ setTimeout(() => {
|
|
|
+ rowDom.forEach((v) => {
|
|
|
+ v.style.pointerEvents = "auto";
|
|
|
+ });
|
|
|
+ }, 200);
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ rowDom.forEach((v) => {
|
|
|
+ v.style.pointerEvents = "none";
|
|
|
+ });
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ //方法集合
|
|
|
+ methods: {
|
|
|
+ // 给主页面分享点击的时候调用的方法
|
|
|
+ moveShareCut(val) {
|
|
|
+ if (val) {
|
|
|
+ clearInterval(this.Time2);
|
|
|
+ clearInterval(this.TimeSrool);
|
|
|
+ } else {
|
|
|
+ clearInterval(this.Time2);
|
|
|
+ this.Time2 = setTimeout(() => {
|
|
|
+ if (this.modelShow) return;
|
|
|
+ clearInterval(this.TimeSrool);
|
|
|
+ this.TimeSrool = setInterval(() => {
|
|
|
+ const clientWidth = this.elDom.clientWidth;
|
|
|
+ const scrollLeft = this.elDom.scrollLeft;
|
|
|
+ const scrollWidth = this.elDom.scrollWidth;
|
|
|
+ if (clientWidth + scrollLeft >= scrollWidth)
|
|
|
+ this.elDom.scrollLeft = 0;
|
|
|
+ else this.elDom.scrollLeft = this.elDom.scrollLeft + 1;
|
|
|
+ }, 40);
|
|
|
+ }, 5000);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ look3D(id) {
|
|
|
+ this.modelShow = true;
|
|
|
+ },
|
|
|
+ mousedown(e) {
|
|
|
+ this.move = true;
|
|
|
+ //获取x坐标和y坐标
|
|
|
+ this.moveX = e.clientX;
|
|
|
+ clearInterval(this.TimeSrool);
|
|
|
+ },
|
|
|
+ mousemove(e) {
|
|
|
+ if (this.move) {
|
|
|
+ //获取x和y
|
|
|
+ let nx = e.clientX;
|
|
|
+ let nl = this.moveX - nx;
|
|
|
+ this.elDom.scrollLeft = this.elDom.scrollLeft + nl / 10;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mouseup(e) {
|
|
|
+ this.move = false;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ //生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ created() {},
|
|
|
+ //生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
+ mounted() {
|
|
|
+ let boxDom = document.querySelector(".bacXian");
|
|
|
+ boxDom.style.width = 300 * 12 + "px";
|
|
|
+ this.elDom = document.querySelector(".main");
|
|
|
+
|
|
|
+ this.Time2 = setTimeout(() => {
|
|
|
+ if (this.modelShow) return;
|
|
|
+ clearInterval(this.TimeSrool);
|
|
|
+ this.TimeSrool = setInterval(() => {
|
|
|
+ const clientWidth = this.elDom.clientWidth;
|
|
|
+ const scrollLeft = this.elDom.scrollLeft;
|
|
|
+ const scrollWidth = this.elDom.scrollWidth;
|
|
|
+ if (clientWidth + scrollLeft >= scrollWidth) this.elDom.scrollLeft = 0;
|
|
|
+ else this.elDom.scrollLeft = this.elDom.scrollLeft + 1;
|
|
|
+ }, 40);
|
|
|
+ }, 5000);
|
|
|
+ },
|
|
|
+ beforeCreate() {}, //生命周期 - 创建之前
|
|
|
+ beforeMount() {}, //生命周期 - 挂载之前
|
|
|
+ beforeUpdate() {}, //生命周期 - 更新之前
|
|
|
+ updated() {}, //生命周期 - 更新之后
|
|
|
+
|
|
|
+ //销毁事件
|
|
|
+ beforeDestroy() {
|
|
|
+ clearInterval(this.TimeSrool);
|
|
|
+ },
|
|
|
+ destroyed() {}, //生命周期 - 销毁完成
|
|
|
+ activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang='less' scoped>
|
|
|
+.Three {
|
|
|
+ padding-bottom: 10px;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 140px);
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ z-index: 10;
|
|
|
+ .bottomSm {
|
|
|
+ cursor: default;
|
|
|
+ z-index: 15;
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 30px;
|
|
|
+ }
|
|
|
+ .Threebox {
|
|
|
+ opacity: 0;
|
|
|
+ pointer-events: none;
|
|
|
+ transition: opacity 0.5s;
|
|
|
+ position: fixed;
|
|
|
+ z-index: 20;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ backdrop-filter: blur(4px);
|
|
|
+ .model {
|
|
|
+ border-bottom: 6px solid #cea763;
|
|
|
+ border-top: 6px solid #cea763;
|
|
|
+ position: absolute;
|
|
|
+ width: 700px;
|
|
|
+ height: 460px;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ background-image: url("../../../assets/img/Goods/modelBac.png");
|
|
|
+ background-size: 100% 100%;
|
|
|
+ display: flex;
|
|
|
+ padding: 60px 70px 60px 40px;
|
|
|
+ .close {
|
|
|
+ position: absolute;
|
|
|
+ cursor: pointer;
|
|
|
+ top: 10px;
|
|
|
+ right: 10px;
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ & > img {
|
|
|
+ width: 40px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .modelll {
|
|
|
+ width: 340px;
|
|
|
+ height: 100%;
|
|
|
+ border: 1px solid #d8b275;
|
|
|
+ padding: 15px;
|
|
|
+ img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ object-fit: contain;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .modelrr {
|
|
|
+ position: relative;
|
|
|
+ width: 360px;
|
|
|
+ height: 100%;
|
|
|
+ padding: 0 15px 0 50px;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 14px;
|
|
|
+ h3 {
|
|
|
+ font-size: 20px;
|
|
|
+ color: #cea763;
|
|
|
+ line-height: 28px;
|
|
|
+ }
|
|
|
+ p {
|
|
|
+ margin: 15px 0;
|
|
|
+ }
|
|
|
+ .btnn {
|
|
|
+ cursor: pointer;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 40px;
|
|
|
+ width: 140px;
|
|
|
+ height: 50px;
|
|
|
+ border-radius: 24px;
|
|
|
+ background-color: #d8b275;
|
|
|
+ line-height: 50px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 16px;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .modelBox {
|
|
|
+ position: absolute;
|
|
|
+ z-index: 10;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background-image: url("../../../assets/img/Goods/GoodsBac.png");
|
|
|
+ background-size: 100% 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ iframe {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ h3 {
|
|
|
+ position: absolute;
|
|
|
+ width: 260px;
|
|
|
+ top: 44px;
|
|
|
+ left: 40px;
|
|
|
+ color: #930909;
|
|
|
+ font-size: 20px;
|
|
|
+ line-height: 26px;
|
|
|
+ }
|
|
|
+ .close {
|
|
|
+ position: absolute;
|
|
|
+ width: 60px;
|
|
|
+ height: 60px;
|
|
|
+ cursor: pointer;
|
|
|
+ top: 44px;
|
|
|
+ right: 40px;
|
|
|
+ background-image: url("../../../assets/img/Goods/close2.png");
|
|
|
+ background-size: 100% 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .show {
|
|
|
+ opacity: 1;
|
|
|
+ pointer-events: auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .main::-webkit-scrollbar {
|
|
|
+ /*滚动条整体样式*/
|
|
|
+ width: 0px; /*高宽分别对应横竖滚动条的尺寸*/
|
|
|
+ height: 6px;
|
|
|
+ }
|
|
|
+ .main::-webkit-scrollbar-thumb {
|
|
|
+ /*滚动条里面小方块*/
|
|
|
+ border-radius: 10px;
|
|
|
+ box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
|
+ background: #930909;
|
|
|
+ }
|
|
|
+ .main::-webkit-scrollbar-track {
|
|
|
+ /*滚动条里面轨道*/
|
|
|
+ box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
|
+ border-radius: 10px;
|
|
|
+ background: #d8b275;
|
|
|
+ }
|
|
|
+ .main {
|
|
|
+ cursor: grab;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ overflow-x: auto;
|
|
|
+
|
|
|
+ .bacXian {
|
|
|
+ height: 100%;
|
|
|
+ position: relative;
|
|
|
+ .centen {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ min-width: 100vw;
|
|
|
+ height: 2px;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ background-color: #930909;
|
|
|
+ .rowTop {
|
|
|
+ position: absolute;
|
|
|
+ top: -200px;
|
|
|
+ left: -60px;
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ .row {
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ width: 300px;
|
|
|
+ text-align: center;
|
|
|
+ &::after {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ top: 110px;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ height: 90px;
|
|
|
+ width: 2px;
|
|
|
+ background-color: #930909;
|
|
|
+ }
|
|
|
+ &::before {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ top: 196px;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 8px;
|
|
|
+ height: 8px;
|
|
|
+ background-color: #930909;
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+ .name {
|
|
|
+ position: absolute;
|
|
|
+ top: 142px;
|
|
|
+ left: 50%;
|
|
|
+ width: 100%;
|
|
|
+ height: 60px;
|
|
|
+ padding: 0 10px 0 15px;
|
|
|
+ color: #666666;
|
|
|
+ font-size: 14px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ word-wrap: break-word;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+ &:nth-of-type(2n) {
|
|
|
+ top: -100px;
|
|
|
+ &::after {
|
|
|
+ height: 190px;
|
|
|
+ }
|
|
|
+ &::before {
|
|
|
+ top: 296px;
|
|
|
+ }
|
|
|
+ .name {
|
|
|
+ top: 240px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ img {
|
|
|
+ pointer-events: none;
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ object-fit: contain;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .rowFloo {
|
|
|
+ top: auto;
|
|
|
+ bottom: -200px;
|
|
|
+ left: 80px;
|
|
|
+ .row {
|
|
|
+ &::after {
|
|
|
+ content: "";
|
|
|
+ top: auto;
|
|
|
+ bottom: 110px;
|
|
|
+ }
|
|
|
+ &::before {
|
|
|
+ top: auto;
|
|
|
+ bottom: 196px;
|
|
|
+ }
|
|
|
+ .name {
|
|
|
+ top: auto;
|
|
|
+ bottom: 142px;
|
|
|
+ border-top: 2px solid #930909;
|
|
|
+ }
|
|
|
+ &:nth-of-type(2n) {
|
|
|
+ top: auto;
|
|
|
+ bottom: -100px;
|
|
|
+ &::before {
|
|
|
+ top: auto;
|
|
|
+ bottom: 296px;
|
|
|
+ }
|
|
|
+ .name {
|
|
|
+ top: auto;
|
|
|
+ bottom: 242px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &:last-child {
|
|
|
+ .name {
|
|
|
+ width: 60%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|