|
@@ -1,28 +1,192 @@
|
|
|
<!-- -->
|
|
|
<template>
|
|
|
- <div class="antique">
|
|
|
- <div class="main"></div>
|
|
|
+ <div class="antique" :class="{ full: modelShow }">
|
|
|
+ <div class="main">
|
|
|
+ <div class="top">
|
|
|
+ <div class="left">
|
|
|
+ <div>类型:</div>
|
|
|
+ <div
|
|
|
+ v-for="item in topData"
|
|
|
+ :key="item.name"
|
|
|
+ :class="{ active: item.type === formData.type }"
|
|
|
+ @click="cutType(item.type)"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="search el-icon-search" @click="inputShow = true"></div>
|
|
|
+ <div class="input" v-show="inputShow" @keyup.enter="mySearch">
|
|
|
+ <div class="searBtn" @click="mySearch"></div>
|
|
|
+ <el-input
|
|
|
+ ref="myInput"
|
|
|
+ suffix-icon="el-icon-search"
|
|
|
+ v-model="formData.searchKey"
|
|
|
+ placeholder="请输入搜索内容"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 内容 -->
|
|
|
+ <div class="conten">
|
|
|
+ <!-- 没有数据的时候 -->
|
|
|
+ <div class="hint" v-if="myArr.length === 0">
|
|
|
+ <img src="@/assets/img/serachNull.png" alt="" />
|
|
|
+ <p>暂时没有数据</p>
|
|
|
+ <p>请试一下其他关键字</p>
|
|
|
+ </div>
|
|
|
+ <div class="contenBox" v-else>
|
|
|
+ <div
|
|
|
+ class="row"
|
|
|
+ @click="lookInfo(item)"
|
|
|
+ v-for="item in myArr"
|
|
|
+ :key="item.id"
|
|
|
+ >
|
|
|
+ <img :src="baseURL + item.thumb" alt="" />
|
|
|
+ <p>{{ item.name }}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<!-- 关闭按钮 -->
|
|
|
- <div class="close" @click="$emit('close')"></div>
|
|
|
+ <div class="close" @click="$emit('close')" v-show="!modelShow"></div>
|
|
|
+ <!-- 模型和图片 -->
|
|
|
+ <div class="model" v-if="modelShow">
|
|
|
+ <div class="ifrCon" ref="ifrCon">
|
|
|
+ <!-- 全屏显示的标题 -->
|
|
|
+ <div class="fullTitle" v-if="fullscreen">{{ txtInfo.name }}</div>
|
|
|
+ <img
|
|
|
+ :src="baseURL + txtInfo.thumb"
|
|
|
+ alt=""
|
|
|
+ v-if="formData.type === 'img'"
|
|
|
+ />
|
|
|
+ <iframe :src="mySrc" frameborder="0" v-else></iframe>
|
|
|
+ <!-- 全屏按钮 -->
|
|
|
+ <div
|
|
|
+ class="fullM"
|
|
|
+ :class="{ fullX: fullscreen }"
|
|
|
+ @click="screen"
|
|
|
+ v-if="formData.type === 'model'"
|
|
|
+ >
|
|
|
+ <img src="@/assets/img/close.png" alt="" v-if="fullscreen" />
|
|
|
+ <img src="@/assets/img/tab3Full.png" alt="" v-else />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="rightTxt">
|
|
|
+ <h3>{{ txtInfo.name }}</h3>
|
|
|
+ <div>{{ txtInfo.description }}</div>
|
|
|
+ </div>
|
|
|
+ <!-- 返回按钮 -->
|
|
|
+ <div class="close" @click="modelShow = false"></div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import axios from "@/utils/request";
|
|
|
+import { goodList } from "@/utils/api";
|
|
|
+
|
|
|
export default {
|
|
|
name: "antique",
|
|
|
components: {},
|
|
|
data() {
|
|
|
//这里存放数据
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ inputShow: false,
|
|
|
+ baseURL: "",
|
|
|
+ topData: [
|
|
|
+ { name: "全部", type: "" },
|
|
|
+ { name: "精品图片", type: "img" },
|
|
|
+ { name: "三维模型", type: "model" },
|
|
|
+ ],
|
|
|
+ formData: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 99999,
|
|
|
+ searchKey: "",
|
|
|
+ type: "",
|
|
|
+ },
|
|
|
+ myArr: [],
|
|
|
+ // 有关三维模型的数据
|
|
|
+ mySrc: "",
|
|
|
+ modelShow: false,
|
|
|
+ fullscreen: false,
|
|
|
+ txtInfo: {},
|
|
|
+ };
|
|
|
},
|
|
|
//监听属性 类似于data概念
|
|
|
computed: {},
|
|
|
//监控data中的数据变化
|
|
|
- watch: {},
|
|
|
+ watch: {
|
|
|
+ inputShow(val) {
|
|
|
+ if (val) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.myInput.focus();
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
//方法集合
|
|
|
- methods: {},
|
|
|
+ methods: {
|
|
|
+ lookInfo(item) {
|
|
|
+ this.txtInfo = item;
|
|
|
+ // 三维模型
|
|
|
+ this.mySrc = "4dage/Model.html?m=" + item.filePath;
|
|
|
+ this.modelShow = true;
|
|
|
+ },
|
|
|
+ // 点击模型全屏
|
|
|
+ screen() {
|
|
|
+ const element = this.$refs.ifrCon; // 获取容器
|
|
|
+ if (this.fullscreen) {
|
|
|
+ // 如果已经全屏了就退出全屏
|
|
|
+
|
|
|
+ if (document.exitFullscreen) {
|
|
|
+ document.exitFullscreen();
|
|
|
+ } else if (document.webkitCancelFullScreen) {
|
|
|
+ document.webkitCancelFullScreen();
|
|
|
+ } else if (document.mozCancelFullScreen) {
|
|
|
+ document.mozCancelFullScreen();
|
|
|
+ } else if (document.msExitFullscreen) {
|
|
|
+ document.msExitFullscreen();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果不是全屏就变成全屏
|
|
|
+ if (element.requestFullscreen) {
|
|
|
+ element.requestFullscreen();
|
|
|
+ } else if (element.webkitRequestFullScreen) {
|
|
|
+ element.webkitRequestFullScreen();
|
|
|
+ } else if (element.mozRequestFullScreen) {
|
|
|
+ element.mozRequestFullScreen();
|
|
|
+ } else if (element.msRequestFullscreen) {
|
|
|
+ // IE11
|
|
|
+ element.msRequestFullscreen();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.fullscreen = !this.fullscreen;
|
|
|
+ },
|
|
|
+ mySearch() {
|
|
|
+ this.formData.pageNum = 1;
|
|
|
+ this.goodList(this.formData);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.inputShow = false;
|
|
|
+ }, 100);
|
|
|
+ },
|
|
|
+ cutType(type) {
|
|
|
+ this.formData.type = type;
|
|
|
+ this.goodList(this.formData);
|
|
|
+ },
|
|
|
+ // 封装获取列表函数
|
|
|
+ async goodList(data) {
|
|
|
+ const res = await goodList(data);
|
|
|
+ this.myArr = res.data.records;
|
|
|
+ },
|
|
|
+ },
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ // 获取服务器前缀地址
|
|
|
+ this.baseURL = axios.defaults.baseURL;
|
|
|
+ this.goodList(this.formData);
|
|
|
+ // 设置一个全局变量控制空格建的监听
|
|
|
+ window.myKeyBlank = true;
|
|
|
+ },
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {},
|
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
@@ -35,7 +199,106 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<style lang='less' scoped>
|
|
|
+.full {
|
|
|
+ height: 100vh !important;
|
|
|
+ z-index: 10000 !important;
|
|
|
+}
|
|
|
.antique {
|
|
|
+ .model {
|
|
|
+ padding: 15px 10px 50px;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ z-index: 99;
|
|
|
+ &::before {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background: rgba(161, 101, 59, 0.8);
|
|
|
+ backdrop-filter: blur(4px);
|
|
|
+ z-index: -1;
|
|
|
+ }
|
|
|
+ .ifrCon {
|
|
|
+ position: relative;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 60px);
|
|
|
+ text-align: center;
|
|
|
+ max-height: 60%;
|
|
|
+ iframe {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ .fullM {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: absolute;
|
|
|
+ right: 10px;
|
|
|
+ bottom: 10px;
|
|
|
+ color: #fff;
|
|
|
+ & > img {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .fullX {
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ }
|
|
|
+ & > img {
|
|
|
+ width: 100%;
|
|
|
+ max-height: 100%;
|
|
|
+ }
|
|
|
+ .fullTitle {
|
|
|
+ width: 100%;
|
|
|
+ z-index: 10;
|
|
|
+ padding: 0 10px;
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ top: 20px;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ text-align: center;
|
|
|
+ color: #774926;
|
|
|
+ font-weight: 700;
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .rightTxt::-webkit-scrollbar {
|
|
|
+ width: 4px;
|
|
|
+ }
|
|
|
+ .rightTxt::-webkit-scrollbar-thumb {
|
|
|
+ outline: 2px solid #cc946d;
|
|
|
+ }
|
|
|
+
|
|
|
+ .rightTxt {
|
|
|
+ overflow-y: auto;
|
|
|
+ padding: 10px 0;
|
|
|
+ background-color: #fff6d2;
|
|
|
+ width: 100%;
|
|
|
+ height: 40%;
|
|
|
+ & > h3 {
|
|
|
+ text-align: center;
|
|
|
+ padding: 0 15px;
|
|
|
+ color: #774926;
|
|
|
+ font-weight: 700;
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+ & > div {
|
|
|
+ margin-top: 5px;
|
|
|
+ padding: 0 15px;
|
|
|
+ word-break: break-all;
|
|
|
+ width: 100%;
|
|
|
+ color: #cc946d;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
position: fixed;
|
|
|
width: 100vw;
|
|
|
height: calc(100vh - 50px);
|
|
@@ -54,10 +317,147 @@ export default {
|
|
|
z-index: -1;
|
|
|
}
|
|
|
.main {
|
|
|
- padding: 20px;
|
|
|
+ padding: 15px 10px 0;
|
|
|
width: 100%;
|
|
|
height: calc(100% - 60px);
|
|
|
- overflow-y: auto;
|
|
|
+ .top {
|
|
|
+ width: 100%;
|
|
|
+ padding-left: 10px;
|
|
|
+ max-width: 334px;
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ height: 36px;
|
|
|
+ color: #fff6d2;
|
|
|
+ font-size: 14px;
|
|
|
+ margin: 0 auto;
|
|
|
+ .left {
|
|
|
+ display: flex;
|
|
|
+ & > div {
|
|
|
+ padding: 0 12px;
|
|
|
+ height: 36px;
|
|
|
+ line-height: 36px;
|
|
|
+ margin-right: 5px;
|
|
|
+ &:nth-of-type(1) {
|
|
|
+ padding: 0;
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .active {
|
|
|
+ background-color: #cc946d;
|
|
|
+ border-radius: 20px;
|
|
|
+ color: #774926;
|
|
|
+ pointer-events: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .input {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0px;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ .searBtn {
|
|
|
+ position: absolute;
|
|
|
+ width: 36px;
|
|
|
+ height: 36px;
|
|
|
+ right: 0;
|
|
|
+ top: 0;
|
|
|
+ z-index: 111;
|
|
|
+ }
|
|
|
+ /deep/.el-input {
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ /deep/.el-input__inner {
|
|
|
+ height: 100%;
|
|
|
+ line-height: 36px;
|
|
|
+ color: #cc946d;
|
|
|
+ border-color: transparent;
|
|
|
+ background-color: #fff6d2;
|
|
|
+ }
|
|
|
+ /deep/.el-icon-search {
|
|
|
+ line-height: 36px;
|
|
|
+ color: #cc946d;
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .search {
|
|
|
+ text-align: center;
|
|
|
+ line-height: 30px;
|
|
|
+ background-color: #fff6d2;
|
|
|
+ color: #cc946d;
|
|
|
+ font-size: 20px;
|
|
|
+ border-radius: 2px;
|
|
|
+ margin-top: 3px;
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .contenBox::-webkit-scrollbar {
|
|
|
+ width: 4px;
|
|
|
+ }
|
|
|
+ .contenBox::-webkit-scrollbar-thumb {
|
|
|
+ outline: 2px solid #cc946d;
|
|
|
+ }
|
|
|
+ .conten {
|
|
|
+ border-radius: 8px;
|
|
|
+ width: 334px;
|
|
|
+ height: calc(100% - 45px);
|
|
|
+ margin: 15px auto 0;
|
|
|
+ background-color: #fff6d2;
|
|
|
+ padding: 10px 0 10px 10px;
|
|
|
+ .contenBox {
|
|
|
+ padding-right: 10px;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ align-content: flex-start;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ .row {
|
|
|
+ margin-right: 10px;
|
|
|
+ margin-bottom: 15px;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 3px;
|
|
|
+ overflow: hidden;
|
|
|
+ width: 150px;
|
|
|
+ height: 120px;
|
|
|
+ & > img {
|
|
|
+ width: 100%;
|
|
|
+ height: 90px;
|
|
|
+ object-fit: cover;
|
|
|
+ }
|
|
|
+ &:nth-of-type(2n) {
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ & > p {
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #999999;
|
|
|
+ text-align: center;
|
|
|
+ padding: 0 10px;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .hint {
|
|
|
+ height: 100%;
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ & > img {
|
|
|
+ width: 240px;
|
|
|
+ }
|
|
|
+ & > p {
|
|
|
+ margin-top: 20px;
|
|
|
+ color: #cc946d;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
.close {
|
|
|
cursor: pointer;
|
|
@@ -70,5 +470,17 @@ export default {
|
|
|
background: url("../../../assets/img/close.png");
|
|
|
background-size: 100% 100%;
|
|
|
}
|
|
|
+ @media screen and (max-width: 350px) {
|
|
|
+ .top{
|
|
|
+ font-size: 12px !important;
|
|
|
+ }
|
|
|
+ .conten {
|
|
|
+ width: 100% !important;
|
|
|
+ }
|
|
|
+ .contenBox {
|
|
|
+ width: 100% !important;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|