mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-16 16:42:50 +00:00
解决兼容警告问题
This commit is contained in:
parent
6df3f8e086
commit
eef160a6ba
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "front-next",
|
"name": "front-next",
|
||||||
"version": "5.7.7",
|
"version": "5.7.8",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host",
|
"dev": "vite --host",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/lang-javascript": "^6.0.1",
|
"@codemirror/lang-javascript": "^6.0.1",
|
||||||
"@codemirror/theme-one-dark": "^6.0.0",
|
"@codemirror/theme-one-dark": "^6.0.0",
|
||||||
"@cool-vue/crud": "^5.3.2",
|
"@cool-vue/crud": "^5.3.5",
|
||||||
"@element-plus/icons-vue": "^2.0.6",
|
"@element-plus/icons-vue": "^2.0.6",
|
||||||
"@vueuse/core": "^8.9.4",
|
"@vueuse/core": "^8.9.4",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
|
|||||||
@ -48,9 +48,7 @@ router.href = function (path) {
|
|||||||
router.append = function (data) {
|
router.append = function (data) {
|
||||||
const list = isArray(data) ? data : [data];
|
const list = isArray(data) ? data : [data];
|
||||||
|
|
||||||
list.forEach((e) => {
|
list.forEach((d) => {
|
||||||
const d = { ...e };
|
|
||||||
|
|
||||||
if (!d.name) {
|
if (!d.name) {
|
||||||
d.name = d.path.substring(1);
|
d.name = d.path.substring(1);
|
||||||
}
|
}
|
||||||
@ -73,7 +71,7 @@ router.append = function (data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.isPage) {
|
if (d.isPage) {
|
||||||
router.addRoute(d);
|
router.addRoute(d);
|
||||||
} else {
|
} else {
|
||||||
router.addRoute("index", d);
|
router.addRoute("index", d);
|
||||||
@ -81,6 +79,11 @@ router.append = function (data) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 找路由
|
||||||
|
router.find = function (path: string) {
|
||||||
|
return router.getRoutes().find((e) => e.path == path);
|
||||||
|
};
|
||||||
|
|
||||||
let lock = false;
|
let lock = false;
|
||||||
|
|
||||||
// 错误监听
|
// 错误监听
|
||||||
@ -100,9 +103,9 @@ router.onError((err: any) => {
|
|||||||
// 注册
|
// 注册
|
||||||
async function register(path: string) {
|
async function register(path: string) {
|
||||||
// 当前路由是否存在
|
// 当前路由是否存在
|
||||||
const d = router.getRoutes().find((e) => e.path == path);
|
const f = Boolean(router.find(path));
|
||||||
|
|
||||||
if (!d) {
|
if (!f) {
|
||||||
const { menu } = useBase();
|
const { menu } = useBase();
|
||||||
|
|
||||||
// 等待加载
|
// 等待加载
|
||||||
@ -143,25 +146,27 @@ async function register(path: string) {
|
|||||||
if (r) {
|
if (r) {
|
||||||
router.append(r);
|
router.append(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
return r?.path || "/404";
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return { route: router.find(path), isReg: !f };
|
||||||
}
|
}
|
||||||
|
|
||||||
// 路由守卫
|
// 路由守卫
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
// 注册路由
|
|
||||||
const path = await register(to.path);
|
|
||||||
|
|
||||||
if (path) {
|
|
||||||
// 重定向
|
|
||||||
next({ ...to, path });
|
|
||||||
} else {
|
|
||||||
// 数据缓存
|
// 数据缓存
|
||||||
const { user, process } = useBase();
|
const { user, process } = useBase();
|
||||||
|
|
||||||
|
// 预先注册路由
|
||||||
|
const { isReg, route } = await register(to.path);
|
||||||
|
|
||||||
|
// 组件不存在、路由不存在
|
||||||
|
if (!route?.components) {
|
||||||
|
next(user.token ? "/404" : "/login");
|
||||||
|
} else {
|
||||||
|
// 注册后重定向
|
||||||
|
if (isReg) {
|
||||||
|
next({ ...to, path: route.path });
|
||||||
|
} else {
|
||||||
// 登录成功
|
// 登录成功
|
||||||
if (user.token) {
|
if (user.token) {
|
||||||
// 在登录页
|
// 在登录页
|
||||||
@ -184,6 +189,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
|
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export { router };
|
export { router };
|
||||||
|
|||||||
@ -124,6 +124,8 @@ request.interceptors.response.use(
|
|||||||
const { status, config } = error.response;
|
const { status, config } = error.response;
|
||||||
const { user } = useBase();
|
const { user } = useBase();
|
||||||
|
|
||||||
|
console.log(config);
|
||||||
|
|
||||||
if (status == 401) {
|
if (status == 401) {
|
||||||
user.logout();
|
user.logout();
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/cool/types/index.d.ts
vendored
1
src/cool/types/index.d.ts
vendored
@ -28,6 +28,7 @@ export declare interface Module extends ModuleConfig {
|
|||||||
|
|
||||||
export declare interface Router extends VueRouter {
|
export declare interface Router extends VueRouter {
|
||||||
href(path: string): void;
|
href(path: string): void;
|
||||||
|
find(path: string): RouteRecordRaw | undefined;
|
||||||
append(data: any[] | any): void;
|
append(data: any[] | any): void;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ export const Loading = {
|
|||||||
this.resolve();
|
this.resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
wait() {
|
async wait() {
|
||||||
return this.next;
|
return this.next;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export default defineComponent({
|
|||||||
props: {
|
props: {
|
||||||
modelValue: [String, Number],
|
modelValue: [String, Number],
|
||||||
options: {
|
options: {
|
||||||
type: Array,
|
type: [Array, Object],
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
prop: String
|
prop: String
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
v-model="form.username"
|
v-model="form.username"
|
||||||
placeholder="请输入用户名"
|
placeholder="请输入用户名"
|
||||||
maxlength="20"
|
maxlength="20"
|
||||||
auto-complete="off"
|
autocomplete="on"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -23,7 +23,7 @@
|
|||||||
type="password"
|
type="password"
|
||||||
placeholder="请输入密码"
|
placeholder="请输入密码"
|
||||||
maxlength="20"
|
maxlength="20"
|
||||||
auto-complete="off"
|
autocomplete="off"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -33,7 +33,6 @@
|
|||||||
v-model="form.verifyCode"
|
v-model="form.verifyCode"
|
||||||
placeholder="图片验证码"
|
placeholder="图片验证码"
|
||||||
maxlength="4"
|
maxlength="4"
|
||||||
auto-complete="off"
|
|
||||||
@keyup.enter="toLogin"
|
@keyup.enter="toLogin"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useCool } from "/@/cool";
|
import { service } from "/@/cool";
|
||||||
|
|
||||||
export const useMessageStore = defineStore("chat-message", () => {
|
export const useMessageStore = defineStore("chat-message", () => {
|
||||||
const { service } = useCool();
|
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useCool } from "/@/cool";
|
import { service } from "/@/cool";
|
||||||
|
|
||||||
export const useSessionStore = defineStore("chat-session", () => {
|
export const useSessionStore = defineStore("chat-session", () => {
|
||||||
const { service } = useCool();
|
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,6 @@ const chartOption = reactive({
|
|||||||
radius: ["50%", "60%"],
|
radius: ["50%", "60%"],
|
||||||
center: ["50%", "40%"],
|
center: ["50%", "40%"],
|
||||||
avoidLabelOverlap: false,
|
avoidLabelOverlap: false,
|
||||||
hoverAnimation: false,
|
|
||||||
label: {
|
label: {
|
||||||
show: false,
|
show: false,
|
||||||
position: "center"
|
position: "center"
|
||||||
@ -54,10 +53,8 @@ const chartOption = reactive({
|
|||||||
{ value: 500, name: "手表" }
|
{ value: 500, name: "手表" }
|
||||||
],
|
],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
|
||||||
borderColor: "#fff",
|
borderColor: "#fff",
|
||||||
borderWidth: 4
|
borderWidth: 4
|
||||||
}
|
|
||||||
},
|
},
|
||||||
roundCap: 1
|
roundCap: 1
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,10 +55,8 @@ const chartOption = reactive({
|
|||||||
type: "bar",
|
type: "bar",
|
||||||
data: [81, 24, 77, 13, 87, 92, 68, 55],
|
data: [81, 24, 77, 13, 87, 92, 68, 55],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
|
||||||
color: "#4165d7"
|
color: "#4165d7"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "bar",
|
type: "bar",
|
||||||
@ -67,9 +65,7 @@ const chartOption = reactive({
|
|||||||
barGap: "-100%",
|
barGap: "-100%",
|
||||||
data: [100, 100, 100, 100, 100, 100, 100, 100],
|
data: [100, 100, 100, 100, 100, 100, 100, 100],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
|
||||||
color: "#f1f1f9"
|
color: "#f1f1f9"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
zlevel: -1
|
zlevel: -1
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,6 @@ const chartOption = reactive({
|
|||||||
"1322"
|
"1322"
|
||||||
],
|
],
|
||||||
areaStyle: {
|
areaStyle: {
|
||||||
normal: {
|
|
||||||
color: new echarts.graphic.LinearGradient(
|
color: new echarts.graphic.LinearGradient(
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -103,19 +102,14 @@ const chartOption = reactive({
|
|||||||
],
|
],
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
|
||||||
color: "#4165d7"
|
color: "#4165d7"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
normal: {
|
|
||||||
width: 2
|
width: 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -151,7 +151,6 @@ const chartOption = reactive({
|
|||||||
"1322"
|
"1322"
|
||||||
],
|
],
|
||||||
areaStyle: {
|
areaStyle: {
|
||||||
normal: {
|
|
||||||
color: new echarts.graphic.LinearGradient(
|
color: new echarts.graphic.LinearGradient(
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -169,19 +168,14 @@ const chartOption = reactive({
|
|||||||
],
|
],
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
|
||||||
color: "#4165d7"
|
color: "#4165d7"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
normal: {
|
|
||||||
width: 2
|
width: 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -76,10 +76,8 @@ const chartOption = reactive<any>({
|
|||||||
type: "bar",
|
type: "bar",
|
||||||
data: [],
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
|
||||||
color: "#4165d7"
|
color: "#4165d7"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "bar",
|
type: "bar",
|
||||||
@ -88,9 +86,7 @@ const chartOption = reactive<any>({
|
|||||||
barGap: "-100%",
|
barGap: "-100%",
|
||||||
data: [],
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
|
||||||
color: "#f1f1f9"
|
color: "#f1f1f9"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
zlevel: -1
|
zlevel: -1
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { computed, reactive } from "vue";
|
import { computed, reactive } from "vue";
|
||||||
import { isDev, useCool } from "/@/cool";
|
import { isDev, service } from "/@/cool";
|
||||||
|
|
||||||
declare interface Data {
|
declare interface Data {
|
||||||
[key: string]: Array<{ label: string; value: any }>;
|
[key: string]: Array<{ label: string; value: any }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useDictStore = defineStore("dict", () => {
|
export const useDictStore = defineStore("dict", () => {
|
||||||
const { service } = useCool();
|
|
||||||
|
|
||||||
// 对象数据
|
// 对象数据
|
||||||
const data = reactive<Data>({});
|
const data = reactive<Data>({});
|
||||||
|
|
||||||
|
|||||||
@ -166,11 +166,11 @@ const Table = useTable({
|
|||||||
"order-desc"
|
"order-desc"
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
{ label: "名称", prop: "name", align: "left" },
|
{ label: "名称", prop: "name", align: "left", minWidth: 200 },
|
||||||
{ label: "排序", prop: "orderNum", sortable: "custom", width: 100 },
|
{ label: "排序", prop: "orderNum", sortable: "custom", width: 100 },
|
||||||
{ label: "备注", prop: "remark", showOverflowTooltip: true },
|
{ label: "备注", prop: "remark", showOverflowTooltip: true, minWidth: 150 },
|
||||||
{ label: "创建时间", prop: "createTime", sortable: "custom" },
|
{ label: "创建时间", prop: "createTime", sortable: "custom", minWidth: 160 },
|
||||||
{ label: "更新时间", prop: "updateTime", sortable: "custom" },
|
{ label: "更新时间", prop: "updateTime", sortable: "custom", minWidth: 160 },
|
||||||
{
|
{
|
||||||
type: "op",
|
type: "op",
|
||||||
width: 250,
|
width: 250,
|
||||||
|
|||||||
@ -171,7 +171,11 @@ const props = defineProps({
|
|||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
drag: Boolean,
|
drag: Boolean,
|
||||||
disabled: Boolean
|
disabled: Boolean,
|
||||||
|
|
||||||
|
// 穿透值
|
||||||
|
isEdit: null,
|
||||||
|
scope: null
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["update:modelValue", "upload", "success", "error", "progress"]);
|
const emit = defineEmits(["update:modelValue", "upload", "success", "error", "progress"]);
|
||||||
|
|||||||
35
yarn.lock
35
yarn.lock
@ -1052,17 +1052,17 @@
|
|||||||
style-mod "^4.0.0"
|
style-mod "^4.0.0"
|
||||||
w3c-keyname "^2.2.4"
|
w3c-keyname "^2.2.4"
|
||||||
|
|
||||||
"@cool-vue/crud@^5.3.2":
|
"@cool-vue/crud@^5.3.5":
|
||||||
version "5.3.2"
|
version "5.3.5"
|
||||||
resolved "https://registry.npmjs.org/@cool-vue/crud/-/crud-5.3.2.tgz#61b01eb012688a0539e5939958cd9fb2bf60513a"
|
resolved "https://registry.npmjs.org/@cool-vue/crud/-/crud-5.3.5.tgz#350d7b307ce1d0445b78f179ec2d0f16eb91b99c"
|
||||||
integrity sha512-tHmF6OGjGvoOCPTSzgFKv6x3UvFLDKq5NIneHx1jeoJwPE422lWHd/CeBr/tLq7pvFrRMsKWhlvD6moyfZDiQA==
|
integrity sha512-xWwxv2zQCYGt4GqHg1vDEsiv2sGhJCKYKjxDW6hTo5O/oNuzm8uVcWGVGKyYn5y8//F8wcmod4Kk1L/OvdvS5w==
|
||||||
dependencies:
|
dependencies:
|
||||||
array.prototype.flat "^1.2.4"
|
array.prototype.flat "^1.2.4"
|
||||||
core-js "^3.21.1"
|
core-js "^3.21.1"
|
||||||
element-plus "^2.2.11"
|
element-plus "^2.2.12"
|
||||||
merge "^2.1.1"
|
merge "^2.1.1"
|
||||||
mitt "^3.0.0"
|
mitt "^3.0.0"
|
||||||
vue "^3.2.31"
|
vue "^3.2.37"
|
||||||
|
|
||||||
"@ctrl/tinycolor@^3.4.1":
|
"@ctrl/tinycolor@^3.4.1":
|
||||||
version "3.4.1"
|
version "3.4.1"
|
||||||
@ -2467,6 +2467,27 @@ element-plus@^2.2.11:
|
|||||||
memoize-one "^6.0.0"
|
memoize-one "^6.0.0"
|
||||||
normalize-wheel-es "^1.2.0"
|
normalize-wheel-es "^1.2.0"
|
||||||
|
|
||||||
|
element-plus@^2.2.12:
|
||||||
|
version "2.2.12"
|
||||||
|
resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.2.12.tgz#b6c4e298e02ba9b904d70daa54def27b2de8c43c"
|
||||||
|
integrity sha512-g/hIHj3b+dND2R3YRvyvCJtJhQvR7lWvXqhJaoxaQmajjNWedoe4rttxG26fOSv9YCC2wN4iFDcJHs70YFNgrA==
|
||||||
|
dependencies:
|
||||||
|
"@ctrl/tinycolor" "^3.4.1"
|
||||||
|
"@element-plus/icons-vue" "^2.0.6"
|
||||||
|
"@floating-ui/dom" "^0.5.4"
|
||||||
|
"@popperjs/core" "npm:@sxzz/popperjs-es@^2.11.7"
|
||||||
|
"@types/lodash" "^4.14.182"
|
||||||
|
"@types/lodash-es" "^4.17.6"
|
||||||
|
"@vueuse/core" "^8.7.5"
|
||||||
|
async-validator "^4.2.5"
|
||||||
|
dayjs "^1.11.3"
|
||||||
|
escape-html "^1.0.3"
|
||||||
|
lodash "^4.17.21"
|
||||||
|
lodash-es "^4.17.21"
|
||||||
|
lodash-unified "^1.0.2"
|
||||||
|
memoize-one "^6.0.0"
|
||||||
|
normalize-wheel-es "^1.2.0"
|
||||||
|
|
||||||
emojis-list@^3.0.0:
|
emojis-list@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78"
|
resolved "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78"
|
||||||
@ -4718,7 +4739,7 @@ vue-router@^4.1.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@vue/devtools-api" "^6.1.4"
|
"@vue/devtools-api" "^6.1.4"
|
||||||
|
|
||||||
vue@^3.2.31, vue@^3.2.37:
|
vue@^3.2.37:
|
||||||
version "3.2.37"
|
version "3.2.37"
|
||||||
resolved "https://registry.npmjs.org/vue/-/vue-3.2.37.tgz#da220ccb618d78579d25b06c7c21498ca4e5452e"
|
resolved "https://registry.npmjs.org/vue/-/vue-3.2.37.tgz#da220ccb618d78579d25b06c7c21498ca4e5452e"
|
||||||
integrity sha512-bOKEZxrm8Eh+fveCqS1/NkG/n6aMidsI6hahas7pa0w/l7jkbssJVsRhVDs07IdDq7h9KHswZOgItnwJAgtVtQ==
|
integrity sha512-bOKEZxrm8Eh+fveCqS1/NkG/n6aMidsI6hahas7pa0w/l7jkbssJVsRhVDs07IdDq7h9KHswZOgItnwJAgtVtQ==
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user