|
@@ -2,7 +2,11 @@
|
|
<div class="collections">
|
|
<div class="collections">
|
|
<div class="slebar">
|
|
<div class="slebar">
|
|
<div class="sleft">
|
|
<div class="sleft">
|
|
- <ui-select :options="museumList" :placeholder="'请选择'" v-model="currentMuseum">
|
|
|
|
|
|
+ <ui-select
|
|
|
|
+ :options="museumList"
|
|
|
|
+ :placeholder="'请选择'"
|
|
|
|
+ v-model="currentMuseum"
|
|
|
|
+ >
|
|
<template v-slot:option="{ raw }">
|
|
<template v-slot:option="{ raw }">
|
|
<div>{{ raw.label }}</div>
|
|
<div>{{ raw.label }}</div>
|
|
</template>
|
|
</template>
|
|
@@ -14,64 +18,99 @@
|
|
</template>
|
|
</template>
|
|
</ui-select>
|
|
</ui-select>
|
|
|
|
|
|
- <ui-select :options="types" :placeholder="'藏品种类'" v-model="currentType">
|
|
|
|
|
|
+ <ui-select
|
|
|
|
+ :options="types"
|
|
|
|
+ :placeholder="'藏品种类'"
|
|
|
|
+ v-model="currentType"
|
|
|
|
+ >
|
|
<template v-slot:option="{ raw }">
|
|
<template v-slot:option="{ raw }">
|
|
<div>{{ raw.label }}</div>
|
|
<div>{{ raw.label }}</div>
|
|
</template>
|
|
</template>
|
|
</ui-select>
|
|
</ui-select>
|
|
|
|
|
|
- <ui-search v-model="searchKey" :placeholder="'请输入藏品名称1'"></ui-search>
|
|
|
|
|
|
+ <ui-search
|
|
|
|
+ v-model="searchKey"
|
|
|
|
+ :placeholder="'请输入藏品名称'"
|
|
|
|
+ ></ui-search>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="sright">
|
|
<div class="sright">
|
|
<div>分类:</div>
|
|
<div>分类:</div>
|
|
<ul>
|
|
<ul>
|
|
- <li @click="menuActive = item.id" :class="{ active: menuActive == item.id }" v-for="(item, i) in menu"
|
|
|
|
- :key="i">
|
|
|
|
|
|
+ <li
|
|
|
|
+ @click="menuActive = item.id"
|
|
|
|
+ :class="{ active: menuActive == item.id }"
|
|
|
|
+ v-for="(item, i) in menu"
|
|
|
|
+ :key="i"
|
|
|
|
+ >
|
|
{{ item.name }}
|
|
{{ item.name }}
|
|
</li>
|
|
</li>
|
|
</ul>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <div v-if="list" class="masonry" v-infinite-scroll="getData" infinite-scroll-disabled="busy"
|
|
|
|
- :infinite-scroll-immediate-check="true" infinite-scroll-distance="30" v-masonry="containerId" fit-width="true"
|
|
|
|
- gutter="40" initLayout="true" transition-duration="0.3s" item-selector=".item">
|
|
|
|
- <div @click="onClickCollection(item)" v-masonry-tile class="item" :class="{ odd: index % 2 != 0 }"
|
|
|
|
- v-for="(item, index) in list" :key="index">
|
|
|
|
|
|
+ <div
|
|
|
|
+ v-if="list && list.length > 0"
|
|
|
|
+ class="masonry"
|
|
|
|
+ v-infinite-scroll="getData"
|
|
|
|
+ infinite-scroll-disabled="busy"
|
|
|
|
+ :infinite-scroll-immediate-check="true"
|
|
|
|
+ infinite-scroll-distance="30"
|
|
|
|
+ v-masonry="containerId"
|
|
|
|
+ fit-width="true"
|
|
|
|
+ gutter="40"
|
|
|
|
+ initLayout="true"
|
|
|
|
+ transition-duration="0.3s"
|
|
|
|
+ item-selector=".item"
|
|
|
|
+ >
|
|
|
|
+ <div
|
|
|
|
+ @click="onClickCollection(item)"
|
|
|
|
+ v-masonry-tile
|
|
|
|
+ class="item"
|
|
|
|
+ :class="{ odd: index % 2 != 0 }"
|
|
|
|
+ v-for="(item, index) in list"
|
|
|
|
+ :key="index"
|
|
|
|
+ >
|
|
<div class="itemimg">
|
|
<div class="itemimg">
|
|
<div :style="`background-image:url(${item.thumb})`"></div>
|
|
<div :style="`background-image:url(${item.thumb})`"></div>
|
|
</div>
|
|
</div>
|
|
- <p>{{ item.name }}</p>
|
|
|
|
|
|
+ <p class="goodBotInfo">{{ item.name }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <div class="searNone" v-else>
|
|
|
|
+ <img src="@/assets/images/resource/searNone.svg" alt="" />
|
|
|
|
+ <p>暂时没有数据</p>
|
|
|
|
+ <p>请试一下其他关键字</p>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
<transition name="fade">
|
|
<transition name="fade">
|
|
- <teleport to='body'>
|
|
|
|
|
|
+ <teleport to="body">
|
|
<showCollection v-if="activeCollection" :item="activeCollection" />
|
|
<showCollection v-if="activeCollection" :item="activeCollection" />
|
|
</teleport>
|
|
</teleport>
|
|
</transition>
|
|
</transition>
|
|
-
|
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { defineProps, onMounted, watch, nextTick, ref } from "vue";
|
|
import { defineProps, onMounted, watch, nextTick, ref } from "vue";
|
|
-import { getCollectionList, getMuseumList, getAge, getType } from "@/config/api";
|
|
|
|
|
|
+import {
|
|
|
|
+ getCollectionList,
|
|
|
|
+ getMuseumList,
|
|
|
|
+ getAge,
|
|
|
|
+ getType,
|
|
|
|
+} from "@/config/api";
|
|
import showCollection from "@/components/showCollection/index.vue";
|
|
import showCollection from "@/components/showCollection/index.vue";
|
|
import emitter from "@/mitt/index";
|
|
import emitter from "@/mitt/index";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
props: ["currentMuseumItem"],
|
|
props: ["currentMuseumItem"],
|
|
setup(props) {
|
|
setup(props) {
|
|
-
|
|
|
|
const containerId = ref("vuemasonry");
|
|
const containerId = ref("vuemasonry");
|
|
const currentMuseum = ref("");
|
|
const currentMuseum = ref("");
|
|
|
|
|
|
const museumList = ref([]);
|
|
const museumList = ref([]);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// const props = defineProps({
|
|
// const props = defineProps({
|
|
// currentMuseumItem: {
|
|
// currentMuseumItem: {
|
|
// type: Object,
|
|
// type: Object,
|
|
@@ -81,19 +120,16 @@ export default {
|
|
// },
|
|
// },
|
|
// });
|
|
// });
|
|
|
|
|
|
-
|
|
|
|
const searchKey = ref("");
|
|
const searchKey = ref("");
|
|
const currentAge = ref("");
|
|
const currentAge = ref("");
|
|
const currentType = ref("");
|
|
const currentType = ref("");
|
|
|
|
|
|
-
|
|
|
|
- const busy = ref(false)
|
|
|
|
|
|
+ const busy = ref(false);
|
|
|
|
|
|
const ages = ref([]);
|
|
const ages = ref([]);
|
|
|
|
|
|
const types = ref([]);
|
|
const types = ref([]);
|
|
|
|
|
|
-
|
|
|
|
const menu = ref([
|
|
const menu = ref([
|
|
{
|
|
{
|
|
id: "",
|
|
id: "",
|
|
@@ -120,110 +156,131 @@ export default {
|
|
const menuActive = ref("");
|
|
const menuActive = ref("");
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- getAge(data => {
|
|
|
|
- ages.value = data.data.data.map(item => {
|
|
|
|
|
|
+ getAge((data) => {
|
|
|
|
+ ages.value = data.data.data.map((item) => {
|
|
return {
|
|
return {
|
|
...item,
|
|
...item,
|
|
label: item.name,
|
|
label: item.name,
|
|
- value: item.id
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ value: item.id,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
|
|
- getType(data => {
|
|
|
|
- types.value = data.data.data.map(item => {
|
|
|
|
- return {
|
|
|
|
- ...item,
|
|
|
|
- label: item.name,
|
|
|
|
- value: item.id
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- getMuseumList({
|
|
|
|
- "cityId": '',
|
|
|
|
- "pageNum": 1,
|
|
|
|
- "pageSize": 1000,
|
|
|
|
- }, data => {
|
|
|
|
- museumList.value = data.data.records.map(item => {
|
|
|
|
|
|
+ getType((data) => {
|
|
|
|
+ types.value = data.data.data.map((item) => {
|
|
return {
|
|
return {
|
|
...item,
|
|
...item,
|
|
label: item.name,
|
|
label: item.name,
|
|
- value: item.id
|
|
|
|
|
|
+ value: item.id,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ getMuseumList(
|
|
|
|
+ {
|
|
|
|
+ cityId: "",
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 1000,
|
|
|
|
+ },
|
|
|
|
+ (data) => {
|
|
|
|
+ museumList.value = data.data.records
|
|
|
|
+ .map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ ...item,
|
|
|
|
+ label: item.name,
|
|
|
|
+ value: item.id,
|
|
|
|
+ };
|
|
|
|
+ })
|
|
|
|
+ .filter((item) => {
|
|
|
|
+ return item.name !== "广东省博物馆";
|
|
|
|
+ });
|
|
|
|
+ if (!props.currentMuseumItem) {
|
|
|
|
+ currentMuseum.value = museumList.value[0].value;
|
|
|
|
+ } else {
|
|
|
|
+ currentMuseum.value = props.currentMuseumItem.id;
|
|
}
|
|
}
|
|
- }).filter(item => {
|
|
|
|
- return item.name !== '广东省博物馆'
|
|
|
|
- })
|
|
|
|
- if (!props.currentMuseumItem) {
|
|
|
|
- currentMuseum.value = museumList.value[0].value
|
|
|
|
- } else {
|
|
|
|
- currentMuseum.value = props.currentMuseumItem.id
|
|
|
|
}
|
|
}
|
|
- })
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- return { ages, types, currentMuseum, menu, currentAge, menuActive, currentType, searchKey, busy, museumList }
|
|
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
|
|
|
|
+ return {
|
|
|
|
+ ages,
|
|
|
|
+ types,
|
|
|
|
+ currentMuseum,
|
|
|
|
+ menu,
|
|
|
|
+ currentAge,
|
|
|
|
+ menuActive,
|
|
|
|
+ currentType,
|
|
|
|
+ searchKey,
|
|
|
|
+ busy,
|
|
|
|
+ museumList,
|
|
|
|
+ };
|
|
},
|
|
},
|
|
components: { showCollection },
|
|
components: { showCollection },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- activeCollection: '',
|
|
|
|
|
|
+ activeCollection: "",
|
|
list: [],
|
|
list: [],
|
|
paging: {
|
|
paging: {
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
showSize: 4,
|
|
showSize: 4,
|
|
current: 1,
|
|
current: 1,
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ };
|
|
},
|
|
},
|
|
|
|
|
|
watch: {
|
|
watch: {
|
|
searchKey() {
|
|
searchKey() {
|
|
- this.getData(true)
|
|
|
|
|
|
+ this.getData(true);
|
|
},
|
|
},
|
|
currentAge() {
|
|
currentAge() {
|
|
- this.getData(true)
|
|
|
|
|
|
+ this.getData(true);
|
|
},
|
|
},
|
|
currentType() {
|
|
currentType() {
|
|
- this.getData(true)
|
|
|
|
|
|
+ this.getData(true);
|
|
},
|
|
},
|
|
currentMuseum() {
|
|
currentMuseum() {
|
|
- this.getData(true)
|
|
|
|
- this.$emit('updateMuseum', this.museumList.find((item => item.id == this.currentMuseum)))
|
|
|
|
|
|
+ this.getData(true);
|
|
|
|
+ this.$emit(
|
|
|
|
+ "updateMuseum",
|
|
|
|
+ this.museumList.find((item) => item.id == this.currentMuseum)
|
|
|
|
+ );
|
|
},
|
|
},
|
|
menuActive() {
|
|
menuActive() {
|
|
- this.getData(true)
|
|
|
|
- }
|
|
|
|
|
|
+ this.getData(true);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
getData(reset) {
|
|
getData(reset) {
|
|
if (reset) {
|
|
if (reset) {
|
|
- this.list = []
|
|
|
|
- this.busy = false
|
|
|
|
|
|
+ this.list = [];
|
|
|
|
+ this.busy = false;
|
|
}
|
|
}
|
|
- getCollectionList({
|
|
|
|
- "ageId": this.currentAge,
|
|
|
|
- "museumId": this.currentMuseum,
|
|
|
|
- "type": this.menuActive,
|
|
|
|
- "pageNum": this.paging.pageNum,
|
|
|
|
- "pageSize": this.paging.pageSize,
|
|
|
|
- "searchKey": this.searchKey,
|
|
|
|
- "textureId": this.currentType,
|
|
|
|
- }, data => {
|
|
|
|
- if (data.data.total <= this.list.length) {
|
|
|
|
- this.busy = true
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- this.list = this.list.concat(data.data.records)
|
|
|
|
- this.paging.pageNum += 1
|
|
|
|
|
|
+ getCollectionList(
|
|
|
|
+ {
|
|
|
|
+ ageId: this.currentAge,
|
|
|
|
+ museumId: this.currentMuseum,
|
|
|
|
+ type: this.menuActive,
|
|
|
|
+ pageNum: this.paging.pageNum,
|
|
|
|
+ pageSize: this.paging.pageSize,
|
|
|
|
+ searchKey: this.searchKey,
|
|
|
|
+ textureId: this.currentType,
|
|
|
|
+ },
|
|
|
|
+ (data) => {
|
|
|
|
+ if (data.data.total <= this.list.length) {
|
|
|
|
+ this.busy = true;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.list = this.list.concat(data.data.records);
|
|
|
|
+ this.paging.pageNum += 1;
|
|
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.$redrawVueMasonry(this.containerId);
|
|
|
|
- });
|
|
|
|
- })
|
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$redrawVueMasonry(this.containerId);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
|
|
// console.log(this);
|
|
// console.log(this);
|
|
// this.list = this.list.concat([]);
|
|
// this.list = this.list.concat([]);
|
|
@@ -233,14 +290,14 @@ export default {
|
|
// });
|
|
// });
|
|
},
|
|
},
|
|
onClickCollection(data) {
|
|
onClickCollection(data) {
|
|
- this.activeCollection = data
|
|
|
|
|
|
+ this.activeCollection = data;
|
|
console.log(this.activeCollection);
|
|
console.log(this.activeCollection);
|
|
- }
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- emitter.on('closeCollection', () => {
|
|
|
|
- this.activeCollection = ''
|
|
|
|
- })
|
|
|
|
|
|
+ emitter.on("closeCollection", () => {
|
|
|
|
+ this.activeCollection = "";
|
|
|
|
+ });
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -269,11 +326,11 @@ export default {
|
|
align-items: center;
|
|
align-items: center;
|
|
color: #333;
|
|
color: #333;
|
|
|
|
|
|
- >ul {
|
|
|
|
|
|
+ > ul {
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
|
|
- >li {
|
|
|
|
|
|
+ > li {
|
|
text-align: center;
|
|
text-align: center;
|
|
margin: 0 10px;
|
|
margin: 0 10px;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
@@ -308,7 +365,7 @@ export default {
|
|
height: calc(100% - 60px);
|
|
height: calc(100% - 60px);
|
|
width: 100%;
|
|
width: 100%;
|
|
|
|
|
|
- >div {
|
|
|
|
|
|
+ > div {
|
|
height: 100%;
|
|
height: 100%;
|
|
width: 100%;
|
|
width: 100%;
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|