refactor: ♻️ 移除 log 和完善 mock 接口

This commit is contained in:
hxr
2024-01-10 23:43:59 +08:00
parent a7233960e3
commit 06c448ebbc
10 changed files with 970 additions and 140 deletions

View File

@@ -79,7 +79,6 @@ const tagsViewStore = useTagsViewStore();
const appStore = useAppStore();
const { visitedViews } = storeToRefs(tagsViewStore);
console.log("visitedViews", visitedViews);
const settingsStore = useSettingsStore();
const layout = computed(() => settingsStore.layout);
@@ -142,14 +141,11 @@ function filterAffixTags(routes: RouteRecordRaw[], basePath = "/") {
let tags: TagView[] = [];
routes.forEach(processRoute);
console.log("filterAffixTags", tags);
return tags;
}
function initTags() {
const tags: TagView[] = filterAffixTags(permissionStore.routes);
console.log("initTags", tags);
affixTags.value = tags;
for (const tag of tags) {
// Must have tag name
@@ -160,7 +156,6 @@ function initTags() {
}
function addTags() {
console.log("addTags", visitedViews);
if (route.meta.title) {
tagsViewStore.addView({
name: route.name as string,
@@ -174,7 +169,6 @@ function addTags() {
}
function moveToCurrentTag() {
console.log("moveToCurrentTag", visitedViews);
// 使用 nextTick() 的目的是确保在更新 tagsView 组件之前scrollPaneRef 对象已经滚动到了正确的位置。
nextTick(() => {
for (const tag of visitedViews.value) {

View File

@@ -4,13 +4,10 @@ export const useTagsViewStore = defineStore("tagsView", () => {
const visitedViews = ref<TagView[]>([]);
const cachedViews = ref<string[]>([]);
console.log("first visitedViews", visitedViews, "cachedViews", cachedViews);
/**
* 添加已访问视图到已访问视图列表中
*/
function addVisitedView(view: TagView) {
console.log("addVisitedView", visitedViews, view);
// 如果已经存在于已访问的视图列表中,则不再添加
if (visitedViews.value.some((v) => v.fullPath === view.fullPath)) {
return;
@@ -28,7 +25,6 @@ export const useTagsViewStore = defineStore("tagsView", () => {
* 添加缓存视图到缓存视图列表中
*/
function addCachedView(view: TagView) {
console.log("addCachedView", visitedViews, view);
const viewName = view.name;
// 如果缓存视图名称已经存在于缓存视图列表中,则不再添加
if (cachedViews.value.includes(viewName)) {
@@ -90,7 +86,6 @@ export const useTagsViewStore = defineStore("tagsView", () => {
}
function updateVisitedView(view: TagView) {
console.log("updateVisitedView", visitedViews, view);
for (let v of visitedViews.value) {
if (v.path === view.path) {
v = Object.assign(v, view);
@@ -100,7 +95,6 @@ export const useTagsViewStore = defineStore("tagsView", () => {
}
function addView(view: TagView) {
console.log("addView", visitedViews, view);
addVisitedView(view);
addCachedView(view);
}

View File

@@ -182,7 +182,6 @@ function openMenuDialog(row: RolePageVO) {
getRoleMenuIds(roleId)
.then(({ data }) => {
const checkedMenuIds = data;
console.log("勾选权限", checkedMenuIds);
checkedMenuIds.forEach((menuId) =>
menuRef.value.setChecked(menuId, true, false)
);

View File

@@ -291,7 +291,6 @@ function downloadTemplate() {
/** Excel文件 Change */
function handleFileChange(file: any) {
importData.file = file.raw;
console.log(importData.file);
}
/** Excel文件 Exceed */