123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <template>
- <div class="quality">
- <div class="main">
- <div class="top">
- <h2>{{ Mylangue ? "精品典藏" : "Collections" }}</h2>
- <i class="el-icon-close" @click="$emit('close')"></i>
- </div>
- <div class="conten">
- <div class="search" @keyup.enter="pageChange(1)">
- <el-input
- v-model="input"
- :placeholder="Mylangue ? '请输入藏品名称...' : 'Enter title here'"
- suffix-icon="el-icon-search"
- ></el-input>
- <el-button
- type="primary"
- size="small"
- style="margin-left: 15px"
- @click="pageChange(1)"
- >{{ Mylangue ? "搜索" : "Search" }}</el-button
- >
- <el-button size="small" @click="reset">{{
- Mylangue ? "重置" : "Reset"
- }}</el-button>
- </div>
- <!-- 没有数据 -->
- <div class="noneInfo" v-if="data.length === 0">
- <p>{{ Mylangue ? "暂无数据..." : "no data..." }}</p>
- </div>
- <!-- 内容 -->
- <div class="rowAll" v-else>
- <div
- class="row"
- :title="item.name"
- v-for="item in data"
- :key="item.id"
- >
- <img v-lazy="`/data/goods/${item.id}.jpg`" alt="" />
- <p>{{ item.name }}</p>
- </div>
- </div>
- <!-- 分页 -->
- <div class="pagination" v-if="!isMobile">
- <el-pagination
- layout="prev,pager,next,jumper"
- :page-size="8"
- :current-page="formData.pageNum"
- @current-change="currentChange"
- :total="total"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { qualityData, qualityDataEn } from "./quality";
- export default {
- name: "quality",
- components: {},
- data() {
- //这里存放数据
- return {
- input: "",
- formData: {
- pageNum: 1,
- pageSize: 8,
- },
- dataAll: [],
- data: [],
- total: 0,
- };
- },
- //监听属性 类似于data概念
- computed: {},
- //监控data中的数据变化
- watch: {},
- //方法集合
- methods: {
- // 点击重置
- reset() {
- this.input = "";
- this.pageChange(1);
- },
- // 分页器方法
- currentChange(val) {
- this.pageChange(val);
- },
- // 封装一个控制分页的方法
- pageChange(i) {
- let temp = this.dataAll.filter((v) => v.name.includes(this.input));
- this.total = temp.length;
- if (this.isMobile) this.data = [...temp];
- else this.data = temp.slice((i - 1) * 8, i * 8);
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- // 控制分页器的英文版文字
- if (!this.Mylangue) {
- // 英文版
- this.dataAll = qualityDataEn;
- let dom = document.getElementsByClassName("el-pagination__jump");
- if (dom && dom[0]) {
- dom[0].childNodes[0].nodeValue = "Jump to";
- dom[0].childNodes[2].nodeValue = "page";
- }
- } else this.dataAll = qualityData;
- this.pageChange(1);
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='less' scoped>
- ::-webkit-scrollbar-thumb {
- outline: 2px solid #165491;
- }
- .quality {
- background-color: rgba(0, 0, 0, 0.5);
- position: fixed;
- top: 0;
- left: 0;
- z-index: 9999;
- width: 100vw;
- height: 100vh;
- .main {
- padding: 20px;
- padding-top: 100px;
- border-radius: 3px;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- z-index: 9999;
- width: 1100px;
- height: 800px;
- background: url("../../../assets/img/bg.png");
- background-size: 100% 100%;
- }
- .top {
- margin-bottom: 20px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- color: #165491;
- font-weight: 700;
- font-size: 22px;
- & > i {
- cursor: pointer;
- font-size: 30px;
- }
- }
- .conten {
- padding: 30px 20px;
- border-radius: 3px;
- width: 100%;
- height: 610px;
- background-color: rgba(22, 84, 145, 0.5);
- .search {
- display: flex;
- width: 500px;
- margin: 0 auto;
- /deep/.el-input__icon {
- line-height: 30px;
- color: #165491;
- font-size: 18px;
- }
- }
- .noneInfo {
- margin-top: 40px;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #fff;
- font-size: 30px;
- height: 420px;
- }
- .rowAll {
- margin-top: 40px;
- display: flex;
- flex-wrap: wrap;
- height: 420px;
- .row {
- cursor: pointer;
- margin-right: 10px;
- margin-bottom: 20px;
- overflow: hidden;
- border-radius: 5px;
- background-color: #fff;
- width: 247px;
- height: 190px;
- & > img {
- width: 247px;
- height: 150px;
- object-fit: cover;
- }
- & > p {
- width: 95%;
- background: url("../../../assets/img/come.png") no-repeat right center;
- padding: 0 30px 0 10px;
- height: 40px;
- line-height: 40px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #999999;
- font-size: 16px;
- }
- &:nth-of-type(4n) {
- margin-right: 0;
- }
- &:hover {
- background-color: #165491;
- & > p {
- background: url("../../../assets/img/comeAc.png") no-repeat right
- center;
- color: #fff;
- }
- }
- }
- }
- .pagination {
- margin-top: 20px;
- width: 100%;
- display: flex;
- justify-content: center;
- }
- }
- }
- @media only screen and (max-width: 800px) {
- .quality {
- .main {
- top: 60px;
- transform: translate(-50%, 0);
- max-height: 640px;
- width: 100%;
- max-width: 350px;
- height: calc(100vh - 150px);
- background: url("../../../assets/imgM/bg.png");
- background-size: 100% 100%;
- padding-top: 70px;
- }
- .top {
- margin-bottom: 5px;
- }
- .conten {
- height: calc(100% - 30px);
- padding: 10px;
- .search {
- width: 100%;
- button {
- width: 56px !important;
- padding: 5px 8px !important;
- }
- }
- .noneInfo {
- margin-top: 20px;
- height: calc(100% - 42px);
- }
- .rowAll {
- justify-content: center;
- margin-top: 20px;
- height: calc(100% - 42px);
- overflow-y: auto;
- .row {
- margin-right: 0;
- margin-bottom: 10px;
- }
- }
- }
- }
- }
- </style>
|