|
@@ -2,22 +2,43 @@
|
|
|
<div class="aside">
|
|
|
<transition name="fade">
|
|
|
<div class="vlist" v-if="isShow">
|
|
|
- <img class="guanbi" @click="isShow=false" :src="require('@/assets/images/icon/guanbi.png')" alt="">
|
|
|
-
|
|
|
- <div class="vtitle">{{currentId === 'museum' ? '博物馆列表' : '虚拟场景列表'}}</div>
|
|
|
+ <img
|
|
|
+ class="guanbi"
|
|
|
+ @click="isShow = false"
|
|
|
+ :src="require('@/assets/images/icon/guanbi.png')"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+
|
|
|
+ <div class="vtitle">
|
|
|
+ {{ currentId === "museum" ? "博物馆列表" : "虚拟场景列表" }}
|
|
|
+ </div>
|
|
|
<div class="search">
|
|
|
- <input v-model="searchkey" type="text" placeholder="请输入关键字查询">
|
|
|
- <img @click="search" :src="require('@/assets/images/icon/search_red.png')" alt="">
|
|
|
+ <input
|
|
|
+ v-model="searchkey"
|
|
|
+ type="text"
|
|
|
+ placeholder="请输入关键字查询"
|
|
|
+ />
|
|
|
+ <img
|
|
|
+ @click="search"
|
|
|
+ :src="require('@/assets/images/icon/search_red.png')"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
</div>
|
|
|
|
|
|
<div class="list">
|
|
|
- <p class="gd" @click="router.push({name:'gdmuseum'})">广东省博物馆</p>
|
|
|
+ <p class="gd" @click="router.push({ name: 'gdmuseum' })">
|
|
|
+ 广东省博物馆
|
|
|
+ </p>
|
|
|
<section>
|
|
|
<ul v-if="list.length > 0">
|
|
|
<li v-for="(sub, idx) in list" :key="idx">
|
|
|
<p :id="'aside-list-sidebar-' + sub.type">{{ sub.type }}</p>
|
|
|
<ul v-if="sub.arr.length > 0">
|
|
|
- <li @click="onClickItem(son)" v-for="(son, sonidx) in sub.arr" :key="sonidx">
|
|
|
+ <li
|
|
|
+ @click="onClickItem(son)"
|
|
|
+ v-for="(son, sonidx) in sub.arr"
|
|
|
+ :key="sonidx"
|
|
|
+ >
|
|
|
{{ son.name }}
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -28,7 +49,11 @@
|
|
|
|
|
|
<div class="sidebar">
|
|
|
<ul>
|
|
|
- <li v-for="(item, i) in charStrs" :key="i" @click="onClickSidebarItem(item)">
|
|
|
+ <li
|
|
|
+ v-for="(item, i) in charStrs"
|
|
|
+ :key="i"
|
|
|
+ @click="onClickSidebarItem(item)"
|
|
|
+ >
|
|
|
{{ item }}
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -37,117 +62,128 @@
|
|
|
<div class="sanjiao"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
</transition>
|
|
|
|
|
|
<ul class="select">
|
|
|
- <li @click="onClickSelect({id:'museum'})" :class="{ active: currentId == 'museum' }">
|
|
|
+ <li
|
|
|
+ @click="onClickSelect({ id: 'museum' })"
|
|
|
+ :class="{ active: currentId == 'museum' }"
|
|
|
+ >
|
|
|
<span></span>
|
|
|
<span>博物馆</span>
|
|
|
</li>
|
|
|
- <li @click="onClickSelect({id:'scene'})" :class="{ active: currentId == 'scene' }">
|
|
|
+ <li
|
|
|
+ @click="onClickSelect({ id: 'scene' })"
|
|
|
+ :class="{ active: currentId == 'scene' }"
|
|
|
+ >
|
|
|
<span></span>
|
|
|
<span>虚拟场景</span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, onMounted, computed,watch, nextTick } from "vue";
|
|
|
-import { getMuseumList,getExhibitionList } from "@/config/api";
|
|
|
-
|
|
|
+import { ref, onMounted, computed, watch, nextTick } from "vue";
|
|
|
+import { getMuseumList, getExhibitionList } from "@/config/api";
|
|
|
+import { defineExpose } from "vue";
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
-const isShow = ref(false)
|
|
|
-const currentId = ref('museum')
|
|
|
-const searchkey = ref('')
|
|
|
+const isShow = ref(false);
|
|
|
+const currentId = ref("museum");
|
|
|
+const searchkey = ref("");
|
|
|
|
|
|
-const charStrs = ref('')
|
|
|
+const charStrs = ref("");
|
|
|
|
|
|
const list = ref([]);
|
|
|
|
|
|
const emit = defineEmits(["changeMap"]);
|
|
|
|
|
|
-const onClickSelect = (data) => {
|
|
|
-
|
|
|
-emit('changeMap',data.id)
|
|
|
|
|
|
- isShow.value = true
|
|
|
- currentId.value = data.id
|
|
|
+// 给父组件调用 打开 列表
|
|
|
+const openIsShow =()=>{
|
|
|
+ isShow.value = true;
|
|
|
}
|
|
|
+
|
|
|
+const onClickSelect = (data) => {
|
|
|
+ emit("changeMap", data.id);
|
|
|
+
|
|
|
+ isShow.value = true;
|
|
|
+ currentId.value = data.id;
|
|
|
+};
|
|
|
const onClickSidebarItem = (item) => {
|
|
|
- const targetNode = document.getElementById('aside-list-sidebar-' + item)
|
|
|
+ const targetNode = document.getElementById("aside-list-sidebar-" + item);
|
|
|
if (targetNode) {
|
|
|
- targetNode.scrollIntoView()
|
|
|
+ targetNode.scrollIntoView();
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
-const onClickItem = data => {
|
|
|
- if (currentId.value=='museum') {
|
|
|
- router.push({name:'exhibition',query:{id:data.id}})
|
|
|
- }else{
|
|
|
- router.push({name:'zhanlan',params:{id:data.id}})
|
|
|
+const onClickItem = (data) => {
|
|
|
+ if (currentId.value == "museum") {
|
|
|
+ router.push({ name: "exhibition", query: { id: data.id } });
|
|
|
+ } else {
|
|
|
+ router.push({ name: "zhanlan", params: { id: data.id } });
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-const getList = () => {
|
|
|
- let getData = currentId.value == 'museum' ? getMuseumList : getExhibitionList
|
|
|
- list.value = []
|
|
|
- getData({
|
|
|
- "cityId": '',
|
|
|
- "pageNum": 1,
|
|
|
- "pageSize": 1000,
|
|
|
- "searchKey": searchkey.value
|
|
|
- }, data => {
|
|
|
- console.log(data);
|
|
|
-
|
|
|
- data.data.records.forEach(item => {
|
|
|
- let ele = list.value.findIndex(sub => sub.type == item.initial.toUpperCase())
|
|
|
- if (ele < 0) {
|
|
|
- list.value.push({
|
|
|
- type: item.initial.toUpperCase(),
|
|
|
- arr: [
|
|
|
- { ...item }
|
|
|
- ],
|
|
|
- })
|
|
|
- } else {
|
|
|
- list.value[ele].arr.push({ ...item })
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- list.value = list.value.sort((a, b) => {
|
|
|
- if (a.type < b.type) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
- if (a.type > b.type) {
|
|
|
- return 1;
|
|
|
- }
|
|
|
- return 0;
|
|
|
- })
|
|
|
-
|
|
|
- charStrs.value = list.value.map(item => item.type)
|
|
|
- })
|
|
|
-}
|
|
|
+};
|
|
|
+
|
|
|
+const getList = (cityId = "") => {
|
|
|
+ let getData = currentId.value == "museum" ? getMuseumList : getExhibitionList;
|
|
|
+ list.value = [];
|
|
|
+ getData(
|
|
|
+ {
|
|
|
+ cityId: cityId,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1000,
|
|
|
+ searchKey: searchkey.value,
|
|
|
+ },
|
|
|
+ (data) => {
|
|
|
+
|
|
|
+ data.data.records.forEach((item) => {
|
|
|
+ let ele = list.value.findIndex(
|
|
|
+ (sub) => sub.type == item.initial.toUpperCase()
|
|
|
+ );
|
|
|
+ if (ele < 0) {
|
|
|
+ list.value.push({
|
|
|
+ type: item.initial.toUpperCase(),
|
|
|
+ arr: [{ ...item }],
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ list.value[ele].arr.push({ ...item });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
-const search = ()=>{
|
|
|
- getList()
|
|
|
-}
|
|
|
+ list.value = list.value.sort((a, b) => {
|
|
|
+ if (a.type < b.type) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (a.type > b.type) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ });
|
|
|
|
|
|
-watch(currentId,()=>{
|
|
|
- getList()
|
|
|
-})
|
|
|
+ charStrs.value = list.value.map((item) => item.type);
|
|
|
+ }
|
|
|
+ );
|
|
|
+};
|
|
|
+defineExpose({
|
|
|
+ getList,
|
|
|
+ openIsShow
|
|
|
+});
|
|
|
|
|
|
+const search = () => {
|
|
|
+ getList();
|
|
|
+};
|
|
|
|
|
|
+watch(currentId, () => {
|
|
|
+ getList();
|
|
|
+});
|
|
|
|
|
|
onMounted(() => {
|
|
|
- getList()
|
|
|
-})
|
|
|
-
|
|
|
+ getList();
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -180,7 +216,6 @@ onMounted(() => {
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
.list {
|
|
|
background-color: #fffef6;
|
|
|
border-radius: 5px;
|
|
@@ -195,11 +230,13 @@ onMounted(() => {
|
|
|
font-size: 16px;
|
|
|
}
|
|
|
|
|
|
- >section {
|
|
|
+ > section {
|
|
|
height: 95%;
|
|
|
overflow-y: auto;
|
|
|
- &::-webkit-scrollbar { display: none; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
|
|
|
- >p {
|
|
|
+ &::-webkit-scrollbar {
|
|
|
+ display: none;
|
|
|
+ } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
|
|
|
+ > p {
|
|
|
color: var(--main-color);
|
|
|
font-size: 16px;
|
|
|
font-weight: bold;
|
|
@@ -220,17 +257,17 @@ onMounted(() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- >ul {
|
|
|
- >li {
|
|
|
+ > ul {
|
|
|
+ > li {
|
|
|
margin: 14px 0;
|
|
|
cursor: pointer;
|
|
|
|
|
|
- >p {
|
|
|
+ > p {
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
- >ul {
|
|
|
- >li {
|
|
|
+ > ul {
|
|
|
+ > li {
|
|
|
color: #999999;
|
|
|
margin: 10px 0;
|
|
|
}
|
|
@@ -257,7 +294,7 @@ onMounted(() => {
|
|
|
right: 10px;
|
|
|
top: 18px;
|
|
|
|
|
|
- >ul {
|
|
|
+ > ul {
|
|
|
text-align: center;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
@@ -265,7 +302,7 @@ onMounted(() => {
|
|
|
align-items: center;
|
|
|
height: 100%;
|
|
|
|
|
|
- >li {
|
|
|
+ > li {
|
|
|
color: #999999;
|
|
|
font-size: 12px;
|
|
|
cursor: pointer;
|
|
@@ -287,18 +324,18 @@ onMounted(() => {
|
|
|
width: 100%;
|
|
|
height: 40px;
|
|
|
border-radius: 8px;
|
|
|
- background: #EBEAE7;
|
|
|
+ background: #ebeae7;
|
|
|
margin-top: 16px;
|
|
|
position: relative;
|
|
|
|
|
|
- >input {
|
|
|
+ > input {
|
|
|
line-height: 40px;
|
|
|
text-align: left;
|
|
|
width: 100%;
|
|
|
padding: 0 40px 0 10px;
|
|
|
}
|
|
|
|
|
|
- >img {
|
|
|
+ > img {
|
|
|
position: absolute;
|
|
|
right: 10px;
|
|
|
top: 50%;
|
|
@@ -320,13 +357,13 @@ onMounted(() => {
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
|
|
|
- >li {
|
|
|
+ > li {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
margin: 0 10px;
|
|
|
cursor: pointer;
|
|
|
|
|
|
- >span {
|
|
|
+ > span {
|
|
|
margin-right: 6px;
|
|
|
display: inline-block;
|
|
|
|
|
@@ -340,7 +377,7 @@ onMounted(() => {
|
|
|
}
|
|
|
|
|
|
&.active {
|
|
|
- >span {
|
|
|
+ > span {
|
|
|
&:first-of-type {
|
|
|
&::before {
|
|
|
content: "";
|
|
@@ -358,6 +395,5 @@ onMounted(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
</style>
|