优化一些问题和代码

This commit is contained in:
zhuoda
2023-04-06 22:48:07 +08:00
parent f2d098d5d1
commit e2c6a83125
20 changed files with 257 additions and 89 deletions

View File

@@ -46,14 +46,15 @@
//监听退出登录方法
async function onLogout() {
localClear();
clearAllCoolies();
useUserStore().logout();
try {
await loginApi.logout();
} catch (e) {
smartSentry.captureError(e);
} finally {
localClear();
clearAllCoolies();
useUserStore().logout();
location.reload();
}
}

View File

@@ -22,7 +22,7 @@
<template #icon>
<component :is="$antIcons[item.icon]" />
</template>
{{ item.menuName }}
{{ menuNameAdapter(item.menuName) }}
</a-menu-item>
</template>
</template>
@@ -64,6 +64,11 @@
return parentMenuList.value.map((e) => e.name);
});
// 展开菜单的顶级目录名字适配,只展示两个字为好
function menuNameAdapter(name){
return name.substr(0,2);
}
//监听路由的变化,进行更新菜单展开项目
watch(
currentRoute,

View File

@@ -77,34 +77,34 @@
// ------------------ 意见反馈 --------------------------
let feedbackMessageList = ref([]);
onMounted(() => {
// 默认先查询一次
// 先查询多一些意见反馈
queryFeedbackList();
scroll();
// 更换显示
scheduleShowFeedback();
});
let scrollInterval = null;
let swiper = 1;
let scheduleShowInterval = null;
let scheduleShowIndex = 0;
function scroll() {
if (scrollInterval != null) {
function scheduleShowFeedback() {
if (scheduleShowInterval != null) {
return;
}
scrollInterval = setInterval(() => {
if (currentPage >= pages) {
currentPage = 1;
}
if (pages == 0 || feedbackList.length == 0) {
scheduleShowInterval = setInterval(() => {
if (feedbackList.length == 0) {
return;
}
let initValue = (currentPage - 1) * 2;
feedbackMessageList.value[0] = feedbackList[initValue];
if (feedbackList[initValue + 1]) {
feedbackMessageList.value[1] = feedbackList[initValue + 1];
// 显示两条意见反馈
for (let i = 0; i < 2; i++) {
if (scheduleShowIndex >= feedbackList.length) {
scheduleShowIndex = 0;
}
feedbackMessageList.value[i] = feedbackList[scheduleShowIndex];
scheduleShowIndex++;
}
swiper = currentPage - 1;
currentPage++;
}, 2000);
}, 3000);
}
// 总页数
@@ -121,7 +121,7 @@
};
let result = await feedbackApi.queryFeedback(param);
feedbackList = result.data.list;
pages = Math.ceil(result.data.total / 2);
pages = Math.ceil(feedbackList.length / 2);
} catch (e) {
smartSentry.captureError(e);
}
@@ -143,9 +143,9 @@
//SmartAdmin中 router的name 就是 后端存储menu的id
let menuId = -1;
try {
if(currentRoute.name === HOME_PAGE_NAME){
if (currentRoute.name === HOME_PAGE_NAME) {
menuId = 0;
}else{
} else {
menuId = _.toNumber(currentRoute.name);
}
} catch (e) {
@@ -163,7 +163,7 @@
<style scoped lang="less">
.help-doc-wrapper {
border-left:1px solid #ededed;
border-left: 1px solid #ededed;
height: 100vh;
padding: 0 10px;

View File

@@ -103,6 +103,17 @@
const helpDocFlag = computed(() => useAppConfigStore().$state.helpDocFlag);
// 是否显示页脚
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
// 多余高度
const dueHeight = computed(() => {
let due = 40;
if (useAppConfigStore().$state.pageTagFlag) {
due = due + 40;
}
if (useAppConfigStore().$state.footerFlag) {
due = due + 40;
}
return due;
});
//是否隐藏菜单
const collapsed = ref(false);
@@ -222,10 +233,11 @@
}
.admin-layout-content {
background-color: inherit;
min-height: auto;
position: relative;
padding: 10px 10px 0px 10px;
height: v-bind('pageTagFlag ? "calc(100% - 80px)": "calc(100% - 40px)"');
height: calc(100% - v-bind(dueHeight)px);
overflow-x: hidden;
}
}

View File

@@ -97,6 +97,17 @@
const helpDocFlag = computed(() => useAppConfigStore().$state.helpDocFlag);
// 是否显示页脚
const footerFlag = computed(() => useAppConfigStore().$state.footerFlag);
// 多余高度
const dueHeight = computed(() => {
let due = 40;
if (useAppConfigStore().$state.pageTagFlag) {
due = due + 40;
}
if (useAppConfigStore().$state.footerFlag) {
due = due + 40;
}
return due;
});
//是否隐藏菜单
const collapsed = ref(false);
@@ -223,11 +234,12 @@
}
.admin-layout-content {
background-color: inherit;
min-height: auto;
position: relative;
overflow-x: hidden;
padding: 10px 10px 0px 10px;
height: v-bind('pageTagFlag ? "calc(100% - 80px)": "calc(100% - 40px)"');
height: calc(100% - v-bind(dueHeight)px);
}
}