fix:相关漏洞修复
This commit is contained in:
1 parent
0e66d461a7
commit
766bdea32a
6 files changed
+370
-294
No files matched your search
@@ -28,74 +28,77 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="layoutBreadcrumbSearch">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
|
||||
import { useI18n } from "vue-i18n"
|
||||
import { useTagsViewRoutes } from "/@/stores/tagsViewRoutes"
|
||||
|
||||
// 定义变量内容
|
||||
const storesTagsViewRoutes = useTagsViewRoutes();
|
||||
const { tagsViewRoutes } = storeToRefs(storesTagsViewRoutes);
|
||||
const layoutMenuAutocompleteRef = ref();
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const storesTagsViewRoutes = useTagsViewRoutes()
|
||||
const { tagsViewRoutes } = storeToRefs(storesTagsViewRoutes)
|
||||
const layoutMenuAutocompleteRef = ref()
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const state = reactive<SearchState>({
|
||||
isShowSearch: false,
|
||||
menuQuery: '',
|
||||
menuQuery: "",
|
||||
tagsViewList: [],
|
||||
});
|
||||
})
|
||||
|
||||
// 搜索弹窗打开
|
||||
const openSearch = () => {
|
||||
state.menuQuery = '';
|
||||
state.isShowSearch = true;
|
||||
initTageView();
|
||||
state.menuQuery = ""
|
||||
state.isShowSearch = true
|
||||
initTageView()
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
layoutMenuAutocompleteRef.value.focus();
|
||||
});
|
||||
});
|
||||
};
|
||||
layoutMenuAutocompleteRef.value.focus()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 搜索弹窗关闭
|
||||
const closeSearch = () => {
|
||||
state.isShowSearch = false;
|
||||
};
|
||||
state.isShowSearch = false
|
||||
}
|
||||
// 菜单搜索数据过滤
|
||||
const menuSearch = (queryString: string, cb: Function) => {
|
||||
let results = queryString ? state.tagsViewList.filter(createFilter(queryString)) : state.tagsViewList;
|
||||
cb(results);
|
||||
};
|
||||
let results = queryString ? state.tagsViewList.filter(createFilter(queryString)) : state.tagsViewList
|
||||
cb(results)
|
||||
}
|
||||
// 菜单搜索过滤
|
||||
const createFilter = (queryString: string) => {
|
||||
return (restaurant: RouteItem) => {
|
||||
return restaurant.path.toLowerCase().indexOf(queryString.toLowerCase()) > -1 || t(restaurant!.name!).indexOf(queryString.toLowerCase()) > -1;
|
||||
};
|
||||
};
|
||||
return (
|
||||
restaurant.path.toLowerCase().indexOf(queryString.toLowerCase()) > -1 || t(restaurant!.name!).indexOf(queryString.toLowerCase()) > -1
|
||||
)
|
||||
}
|
||||
}
|
||||
// 初始化菜单数据
|
||||
const initTageView = () => {
|
||||
if (state.tagsViewList.length > 0) return false;
|
||||
if (state.tagsViewList.length > 0) return false
|
||||
tagsViewRoutes.value.map((v: RouteItem) => {
|
||||
if (!v.meta?.isHide) state.tagsViewList.push({ ...v });
|
||||
});
|
||||
};
|
||||
if (!v.meta?.isHide) state.tagsViewList.push({ ...v })
|
||||
})
|
||||
}
|
||||
// 当前菜单选中时
|
||||
const onHandleSelect = (item: RouteItem) => {
|
||||
let { path, redirect } = item;
|
||||
if (item.meta?.isLink && !item.meta?.isIframe) window.open(item.meta?.isLink);
|
||||
else if (redirect) router.push(redirect);
|
||||
else router.push(path);
|
||||
closeSearch();
|
||||
};
|
||||
let { path, redirect } = item
|
||||
if (item.meta?.isLink && !item.meta?.isIframe) {
|
||||
// window.open(item.meta?.isLink)
|
||||
} else if (redirect) router.push(redirect)
|
||||
else router.push(path)
|
||||
closeSearch()
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openSearch,
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.layout-search-dialog {
|
||||
position: relative;
|
||||
:deep(.el-dialog) {
|
||||
width: 560px;
|
||||
width: 560px;
|
||||
.el-dialog__header,
|
||||
.el-dialog__body {
|
||||
display: none;
|
||||
@@ -108,8 +111,8 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
:deep(.el-autocomplete) {
|
||||
position: absolute;
|
||||
width: 560px;
|
||||
position: absolute;
|
||||
width: 560px;
|
||||
top: 53vh;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
@@ -14,31 +14,34 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="layoutLinkView">
|
||||
import { verifyUrl } from '/@/utils/toolsValidate';
|
||||
import { verifyUrl } from "/@/utils/toolsValidate"
|
||||
|
||||
// 定义变量内容
|
||||
const route = useRoute();
|
||||
const route = useRoute()
|
||||
const state = reactive<LinkViewState>({
|
||||
title: '',
|
||||
isLink: '',
|
||||
});
|
||||
title: "",
|
||||
isLink: "",
|
||||
})
|
||||
|
||||
// 立即前往
|
||||
const onGotoFullPage = () => {
|
||||
if (verifyUrl(<string>state.isLink)) window.open(state.isLink);
|
||||
else window.open(`${state.isLink}`);
|
||||
};
|
||||
if (verifyUrl(<string>state.isLink)) {
|
||||
window.open(state.isLink)
|
||||
} else {
|
||||
window.open(`${state.isLink}`)
|
||||
}
|
||||
}
|
||||
// 监听路由的变化,设置内容
|
||||
watch(
|
||||
() => route.path,
|
||||
() => {
|
||||
state.title = <string>route.name;
|
||||
state.isLink = <string>route.meta.isLink;
|
||||
state.title = <string>route.name
|
||||
state.isLink = <string>route.meta.isLink
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
},
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -56,7 +59,7 @@ watch(
|
||||
color: var(--el-color-primary);
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50px;
|
||||
top: 0;
|
||||
|
||||
Reference in new issue
Block a user