diff --git a/components.d.ts b/components.d.ts index ddd3db7..3057c17 100644 --- a/components.d.ts +++ b/components.d.ts @@ -21,6 +21,19 @@ declare module 'vue' { NModal: typeof import('naive-ui')['NModal'] NNotificationProvider: typeof import('naive-ui')['NNotificationProvider'] NotPassed: typeof import('./src/components/NotPassed.vue')['default'] + NPopover: typeof import('naive-ui')['NPopover'] + NPopselect: typeof import('naive-ui')['NPopselect'] + NProgress: typeof import('naive-ui')['NProgress'] + NScrollbar: typeof import('naive-ui')['NScrollbar'] + NSelect: typeof import('naive-ui')['NSelect'] + NSlider: typeof import('naive-ui')['NSlider'] + NSpace: typeof import('naive-ui')['NSpace'] + NSpin: typeof import('naive-ui')['NSpin'] + NSwitch: typeof import('naive-ui')['NSwitch'] + NTag: typeof import('naive-ui')['NTag'] + NTooltip: typeof import('naive-ui')['NTooltip'] + NUpload: typeof import('naive-ui')['NUpload'] + NUploadDragger: typeof import('naive-ui')['NUploadDragger'] Quill: typeof import('./src/components/RichEditor/Quill.vue')['default'] Robot: typeof import('./src/components/Robot/index.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/layout/components/Header/RecycleModal.vue b/src/layout/components/Header/RecycleModal.vue index 46688d4..0a061f0 100644 --- a/src/layout/components/Header/RecycleModal.vue +++ b/src/layout/components/Header/RecycleModal.vue @@ -66,6 +66,15 @@ const viewLabel = computed(() => { return item?.label }) +const maxHeight = computed(() => { + let height = "800"; + const screenWidth = window.screen.width; + if(screenWidth <= 1920) { + height = "600"; + } + return height + 'px'; +}) + const masonryRef = ref(null) const el = ref(null) const elwc = ref(null) @@ -383,7 +392,8 @@ async function onChange() { // orderbyname: val, orderByUptime: timeRange.value } - pagination.pageNo = 1 + pagination.pageNo = 1; + canloadMore = true; const list = await featchList() listData.value = list layout() @@ -399,7 +409,8 @@ async function onChangeView() { // orderbyname: val, orderBySimilarity: similarRange.value } - pagination.pageNo = 1 + pagination.pageNo = 1; + canloadMore = true; const list = await featchList() listData.value = list layout() @@ -601,13 +612,13 @@ watch(() => show.value, watch(() => pagination.pageNo, (newVal, oldVal) => { + console.log("加载了22222222222222222---------------------------", newVal, oldVal, canloadMore); if(newVal == oldVal) { return } if((newVal == 1 || newVal == 2) && canloadMore) { setTimeout(() => { nextTick(() => { - console.log("加载了22222222222222222---------------------------", newVal); loading = false loadMore(); }) @@ -695,7 +706,7 @@ watch(() => pagination.pageNo, -
+
({ + systemConfig: null, customConfig: null, asideValue: null, listKey: 0, + searchValue: "", + isAllowDownload: true, + timeNum: 0, + filterConfig: [], }), getters: { + getSystemConfig(): AsideConfig | null { + return this.systemConfig + }, getCustomConfig(): string[] | null { return this.customConfig }, getAsideValue(): any { return this.asideValue }, + getSearchValue(): any { + return this.searchValue + }, + getIsAllowDownload(): any { + return this.isAllowDownload + }, + getTimeNum(): any { + return this.timeNum + }, + getFilterConfig(): any { + return this.filterConfig + }, }, actions: { + setSystemConfig(config: AsideConfig) { + this.systemConfig = config + console.log("systemConfig----------", config); + }, setAsideValue(value) { this.asideValue = value }, setListKey() { this.listKey = new Date().getTime() }, + setSearchValue(value) { + this.searchValue = value + }, + setIsAllowDownload(value) { + this.isAllowDownload = value + }, + setTimeNum(value) { + this.timeNum = value + }, + // 设置个性化配置 + setCustomConfig(value) { + this.customConfig = value + }, + setFilterConfig(value) { + this.filterConfig = value + }, + // 获取系统配置信息 + async fetchConfig() { + const response = await getConfig() + console.log("response.data----------", response.data); + this.setSystemConfig(response.data) + return response.data + }, + // // 获取终审个性化配置 + // async fetchCustomConfig() { + // const res = await getFilter(1) + // const { data } = res + // const list = data && data.searchcount ? data.searchcount.split(',') : []; + // console.log("listkey---------------", list); + // this.customConfig = list + // return list + // }, // 获取终审个性化配置 async fetchCustomConfig() { - const res = await getFilter(1) - const { data } = res - const list = data && data.searchcount ? data.searchcount.split(',') : [] + let list: any = []; + let tempAsideMap = cloneDeep(asideMap); + Object.keys(tempAsideMap).map(key => { + if(!tempAsideMap[key].isDefaultFilter) { + list.push(key); + } + }); + console.log("listkey---------------", list); this.customConfig = list return list }, diff --git a/src/views/final/aside/Aside.vue b/src/views/final/aside/Aside.vue index af48f26..79c70cd 100644 --- a/src/views/final/aside/Aside.vue +++ b/src/views/final/aside/Aside.vue @@ -22,6 +22,8 @@ import type { AsideEntity } from "@/config/aside"; import { asideMap } from "@/config/final"; import type { AsideConfig } from "/#/api"; import emitter from "@/utils/mitt"; +import { getFilterList } from "@/api/home/main"; +import { cloneDeep, isEqual } from "lodash-es"; const emit = defineEmits(["inputChange"]); const finalStore = useFinal(); @@ -31,6 +33,16 @@ const asideValue: Record = reactive({}); const asideVisible: Partial> = reactive({}); // 当前显示的模块,按照数组顺序显示 const showItems = shallowRef<{ key: string; config: AsideEntity }[]>([]); +const initAsideValueRef = ref(null); // 所有左侧模块的值(初始值) +const customObjRef = ref(null); // 获取高级筛选获取的值 +const customTempObjRef = ref(null); // 获取高级筛选获取的值(作对比) + +initAsideValueRef.value = cloneDeep(asideMap); + +onBeforeMount(async () => { + finalStore.fetchConfig(); + finalStore.fetchCustomConfig(); +}); Object.keys(asideMap).forEach((key) => { const { defaultValue, inFilterList } = asideMap[key]; @@ -99,38 +111,40 @@ onBeforeMount(async () => { finalStore.fetchCustomConfig(); }); -finalStore.$subscribe(() => { - const customConfig = finalStore.getCustomConfig; - - if (customConfig === null) return; - - const showKeys: string[] = [...customConfig]; - const defaultKeys = Object.keys(asideMap).filter( - (key) => asideMap[key].isDefaultFilter - ); - showKeys.unshift(...defaultKeys); - - Object.keys(asideMap).forEach((key) => { - // 设置显示的或者默认显示的 - if (key.startsWith("iz")) - asideVisible[key] = - asideMap[key] && (showKeys.includes(key) || asideMap[key].isDefaultFilter); +nextTick(()=>{ + finalStore.$subscribe(() => { + const customConfig = finalStore.getCustomConfig; + console.log("customConfig111111111---------------", customConfig); + if (customConfig === null) return; + + const showKeys: string[] = [...customConfig]; + const defaultKeys = Object.keys(asideMap).filter( + (key) => asideMap[key].isDefaultFilter + ); + showKeys.unshift(...defaultKeys); + + Object.keys(asideMap).forEach((key) => { + // 设置显示的或者默认显示的 + if (key.startsWith("iz")) + asideVisible[key] = + asideMap[key] && (showKeys.includes(key) || asideMap[key].isDefaultFilter); + }); + + const items = showKeys.reduce((acc, key) => { + if (asideMap[key]) { + const config = { + key, + config: asideMap[key], + }; + return [...acc, config]; + } else { + return acc; + } + }, []); + console.log("showItems111111111---------------", items); + showItems.value = items; }); - - const items = showKeys.reduce((acc, key) => { - if (asideMap[key]) { - const config = { - key, - config: asideMap[key], - }; - return [...acc, config]; - } else { - return acc; - } - }, []); - - showItems.value = items; -}); +}) watch(asideVisible, (newVal) => { Object.keys(asideValue).forEach((key) => { @@ -159,8 +173,22 @@ function scrollHandler(key: string) { element?.scrollIntoView(true); } -function filterHandler(searchId: string) { +async function filterHandler(searchId: string) { emitter.emit("filter-final", searchId); + const res = await getFilterList({ userSearchId: searchId }); + // console.log("顾虑结果", res); + if (res.code == "OK") { + let obj = res.data; + customObjRef.value = res.data; + let showKeys: any[] = []; + Object.keys(obj).map((key) => { + if (asideMap.hasOwnProperty(key)) { + showKeys.push(key); + } + }); + console.log("showKeys1111111111111111", showKeys); + finalStore.setCustomConfig(showKeys); + } } function editFilter(filter: any) { diff --git a/src/views/final/comp/CustomFilterModalVue.vue b/src/views/final/comp/CustomFilterModalVue.vue index fd81a3b..2c4f9d2 100644 --- a/src/views/final/comp/CustomFilterModalVue.vue +++ b/src/views/final/comp/CustomFilterModalVue.vue @@ -1,18 +1,43 @@