Skip to content

Commit

Permalink
fix: 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Yolo-00 committed Aug 26, 2024
1 parent c0846fb commit e05d655
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/components/VCharts/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ interface VeChartsProps {
getChangeData?: (params?: any) => EChartsOption; // 处理接口返回数据 ==> 非必传
isRealTimeUpdate?: boolean; // 是否实时更新 ==> 非必传(默认为false)
realTime?: number; // 实时更新时间间隔 ==> 非必传(默认为5分钟,单位秒)
isEmpty?: boolean; // 是否展示缺省页 ==> 非必传(默认为false)
}
const props = withDefaults(defineProps<VeChartsProps>(), {
width: 500,
height: 500,
realTime: 300,
isRealTimeUpdate: false
isRealTimeUpdate: false,
isEmpty: false
});
const { initOptions, getApi, getChangeData, realTime, isRealTimeUpdate } = props;
Expand Down Expand Up @@ -124,8 +126,8 @@ onBeforeUnmount(() => {

<template>
<div>
<div v-if="isData" :id="echartsID" :style="myChartStyle"></div>
<div :style="myChartStyle" v-if="!isData" v-loading="loading" class="flex items-center justify-center">
<div v-if="isData || !isEmpty" :id="echartsID" :style="myChartStyle"></div>
<div :style="myChartStyle" v-if="!isData && isEmpty" v-loading="loading" class="flex items-center justify-center">
<slot><el-empty description="暂无数据" /></slot>
</div>
</div>
Expand Down
20 changes: 11 additions & 9 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { debounce } from "lodash";
// components
import PuzzleVerify from "@/components/PuzzleVerify/index";
// api
import { loginApi } from "@/api/modules/login";
// import { loginApi } from "@/api/modules/login";
const router = useRouter();
const { setLanguage } = useLanguage();
Expand All @@ -42,14 +42,16 @@ const handleLogin = debounce(() => {
formRef.value?.validate(res => {
if (!res) return;
puzzleVerifyRef.value.open(() => {
loginApi({
loginName: formData.account,
password: formData.password
}).then(res => {
globalStore.setToken(res.data.accessToken);
router.replace("/");
// globalStore.setUserInfo();
});
globalStore.setToken(new Date().getTime().toString());
router.replace("/");
// loginApi({
// loginName: formData.account,
// password: formData.password
// }).then(res => {
// globalStore.setToken(res.data.accessToken);
// router.replace("/");
// // globalStore.setUserInfo();
// });
});
});
}, 500);
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
outDir: "dist",
rollupOptions: {
output: {
compact: true,
// * 分包策略
manualChunks: (id: string) => {
if (id.includes("node_modules")) return "vendor";
Expand Down

0 comments on commit e05d655

Please sign in to comment.