@@ -136,15 +130,11 @@
@@ -160,18 +150,29 @@ import { mapGetters } from "vuex";
export default {
name: "cl-upload-space",
+ components: {
+ Category,
+ FileItem
+ },
+
+ provide() {
+ return {
+ space: this
+ };
+ },
+
props: {
// 上传的地址
action: String,
// 选择图片的长度
limit: {
type: Number,
- default: 9,
+ default: 9
},
// 最大允许上传文件大小(MB)
limitSize: {
type: Number,
- default: 10,
+ default: 10
},
// 是否禁用
disabled: Boolean,
@@ -188,20 +189,11 @@ export default {
// 是否显示按钮
showButton: {
type: Boolean,
- default: true,
- },
+ default: true
+ }
},
- components: {
- Category,
- FileItem,
- },
-
- provide() {
- return {
- space: this,
- };
- },
+ emits: ["update:modelValue", "confirm"],
data() {
return {
@@ -209,15 +201,15 @@ export default {
loading: false,
category: {
id: null,
- visible: true,
+ visible: true
},
selection: [],
list: [],
pagination: {
page: 1,
size: 12,
- total: 0,
- },
+ total: 0
+ }
};
},
@@ -230,7 +222,7 @@ export default {
isSelected() {
return !isEmpty(this.selection);
- },
+ }
},
watch: {
@@ -238,8 +230,8 @@ export default {
immediate: true,
handler(val) {
this.category.visible = val ? false : true;
- },
- },
+ }
+ }
},
methods: {
@@ -267,7 +259,7 @@ export default {
.add({
url: res.data,
type: item.type,
- classifyId: item.classifyId,
+ classifyId: item.classifyId
})
.then((res) => {
item.loading = false;
@@ -297,7 +289,7 @@ export default {
uid,
classifyId: this.category.id,
loading: true,
- progress: "0%",
+ progress: "0%"
});
},
@@ -322,7 +314,7 @@ export default {
...this.pagination,
...params,
classifyId: this.category.id,
- type: this.accept,
+ type: this.accept
})
.then((res) => {
this.pagination = res.pagination;
@@ -370,7 +362,7 @@ export default {
const ids = selection.map((e) => e.id);
this.$confirm("此操作将删除文件, 是否继续?", "提示", {
- type: "warning",
+ type: "warning"
})
.then(() => {
this.$message.success("删除成功");
@@ -386,15 +378,15 @@ export default {
// 删除请求
this.$service.space.info
.delete({
- ids,
+ ids
})
.catch((err) => {
this.$message.error(err);
});
})
.catch(() => null);
- },
- },
+ }
+ }
};
diff --git a/src/core/utils/index.ts b/src/core/utils/index.ts
index 0a5d420..8a7eb23 100644
--- a/src/core/utils/index.ts
+++ b/src/core/utils/index.ts
@@ -66,19 +66,14 @@ export function cloneDeep(obj: any) {
}
export function clone(obj: any) {
- return Object.create(
- Object.getPrototypeOf(obj),
- Object.getOwnPropertyDescriptors(obj)
- );
+ return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
}
export function deepMerge(a: any, b: any) {
let k;
for (k in b) {
a[k] =
- a[k] && a[k].toString() === "[object Object]"
- ? deepMerge(a[k], b[k])
- : (a[k] = b[k]);
+ a[k] && a[k].toString() === "[object Object]" ? deepMerge(a[k], b[k]) : (a[k] = b[k]);
}
return a;
}
@@ -97,14 +92,7 @@ export function getUrlParam(name: string) {
export function isPc() {
const userAgentInfo = navigator.userAgent;
- const Agents = [
- "Android",
- "iPhone",
- "SymbianOS",
- "Windows Phone",
- "iPad",
- "iPod",
- ];
+ const Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
let flag = true;
for (let v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
@@ -132,9 +120,7 @@ export function getBrowser() {
let tag = "";
const isTocuh =
- "ontouchstart" in window ||
- ua.indexOf("touch") !== -1 ||
- ua.indexOf("mobile") !== -1;
+ "ontouchstart" in window || ua.indexOf("touch") !== -1 || ua.indexOf("mobile") !== -1;
if (isTocuh) {
if (ua.indexOf("ipad") !== -1) {
tag = "pad";
@@ -173,10 +159,7 @@ export function getBrowser() {
}
// 操作平台
- const plat =
- ua.indexOf("android") > 0
- ? "android"
- : navigator.platform.toLowerCase();
+ const plat = ua.indexOf("android") > 0 ? "android" : navigator.platform.toLowerCase();
// 屏幕信息
let screen = "full";
@@ -220,7 +203,7 @@ export function getBrowser() {
isIOS,
isPC,
isMini,
- screen,
+ screen
};
}
@@ -234,7 +217,7 @@ export function href(path: string, newWindow?: boolean) {
let url = "";
if (routerMode == "history") {
- url = origin + path;
+ url = origin + import.meta.env.BASE_URL + path.substr(1);
} else {
url = origin + search + "#" + path;
}
@@ -254,9 +237,9 @@ export function deepTree(list: Array
) {
const newList: Array = [];
const map: any = {};
- list.forEach((e) => (map[e.id] = e));
+ list.forEach(e => (map[e.id] = e));
- list.forEach((e) => {
+ list.forEach(e => {
const parent = map[e.parentId];
if (parent) {
@@ -267,7 +250,7 @@ export function deepTree(list: Array) {
});
const fn = (list: Array) => {
- list.map((e) => {
+ list.map(e => {
if (e.children instanceof Array) {
e.children = orderBy(e.children, "orderNum");
@@ -286,7 +269,7 @@ export function revDeepTree(list: Array = []) {
let id = 0;
const deep = (list: Array, parentId: any) => {
- list.forEach((e) => {
+ list.forEach(e => {
if (!e.id) {
e.id = id++;
}
diff --git a/src/crud/assets/index.scss b/src/crud/assets/index.scss
index 5054d92..13032bd 100644
--- a/src/crud/assets/index.scss
+++ b/src/crud/assets/index.scss
@@ -345,8 +345,7 @@
position: absolute;
bottom: -1px;
left: 0;
- transition: transform 0.3s ease-in-out,
- width 0.2s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
+ transition: transform 0.3s ease-in-out, width 0.2s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
}
}
diff --git a/src/crud/components/context-menu/context-menu.tsx b/src/crud/components/context-menu/context-menu.tsx
index 7752caf..d467d2d 100644
--- a/src/crud/components/context-menu/context-menu.tsx
+++ b/src/crud/components/context-menu/context-menu.tsx
@@ -123,12 +123,12 @@ export default defineComponent({
}
}
- onMounted(function() {
+ onMounted(function () {
if (visible.value) {
// 添加到 body 下
document.body.appendChild(refs.value["context-menu"]);
// 关闭事件
- (document.documentElement || document.body).addEventListener("mousedown", e => {
+ (document.documentElement || document.body).addEventListener("mousedown", (e) => {
const el = refs.value["context-menu"];
if (!contains(el, e.target) && el != e.target) {
close();
@@ -156,7 +156,7 @@ export default defineComponent({
return (
-
+
@@ -50,34 +50,34 @@
border: false,
'default-sort': {
prop: 'ud',
- order: 'descending',
- },
+ order: 'descending'
+ }
}"
:context-menu="false"
:columns="[
{
label: '排名',
prop: 'index',
- width: 60,
+ width: 60
},
{
label: '搜索关键词',
prop: 'keyWord',
- 'min-width': 100,
+ 'min-width': 100
},
{
label: '用户数',
prop: 'users',
- 'min-width': 100,
+ 'min-width': 100
},
{
label: '周涨幅',
prop: 'ud',
sortable: 'custom',
- 'min-width': 100,
- },
+ 'min-width': 100
+ }
]"
- >
+ />