mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 06:02:38 +08:00
调整图片上传样式
This commit is contained in:
parent
e622e50f22
commit
5945fb80ba
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "front-next",
|
||||
"version": "5.1.5",
|
||||
"version": "5.1.6",
|
||||
"scripts": {
|
||||
"dev": "vite --host",
|
||||
"build": "vite build",
|
||||
|
@ -5,7 +5,7 @@ import { isArray, isEmpty } from "lodash";
|
||||
|
||||
// 获取标签名
|
||||
function getNames(v: any) {
|
||||
return Object.getOwnPropertyNames(v.constructor.prototype).filter(
|
||||
return [...Object.getOwnPropertyNames(v.constructor.prototype), ...Object.keys(v)].filter(
|
||||
(e) => !["namespace", "constructor", "request", "permission"].includes(e)
|
||||
);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import { href, storage } from "/@/cool/utils";
|
||||
import { useBaseStore } from "/$/base";
|
||||
|
||||
axios.defaults.timeout = 30000;
|
||||
axios.defaults.withCredentials = true;
|
||||
axios.defaults.withCredentials = false;
|
||||
|
||||
NProgress.configure({
|
||||
showSpinner: false
|
||||
|
@ -294,13 +294,14 @@ export default defineComponent({
|
||||
d = list.value[0] || {};
|
||||
}
|
||||
|
||||
// 权限
|
||||
const prem = service.base.sys.department._permission;
|
||||
|
||||
ContextMenu.open(e, {
|
||||
list: [
|
||||
{
|
||||
label: "新增",
|
||||
hidden:
|
||||
(n && n.level >= props.level) ||
|
||||
!service.base.sys.department.permission.add,
|
||||
hidden: (n && n.level >= props.level) || !prem.add,
|
||||
callback(done) {
|
||||
rowEdit({
|
||||
name: "",
|
||||
@ -312,7 +313,7 @@ export default defineComponent({
|
||||
},
|
||||
{
|
||||
label: "编辑",
|
||||
hidden: !service.base.sys.department.permission.update,
|
||||
hidden: !prem.update,
|
||||
callback(done) {
|
||||
rowEdit(d);
|
||||
done();
|
||||
@ -320,7 +321,7 @@ export default defineComponent({
|
||||
},
|
||||
{
|
||||
label: "删除",
|
||||
hidden: !d.parentId || !service.base.sys.department.permission.delete,
|
||||
hidden: !d.parentId || !prem.delete,
|
||||
callback(done) {
|
||||
rowDel(d);
|
||||
done();
|
||||
|
@ -89,8 +89,8 @@
|
||||
<template #header>
|
||||
<el-upload
|
||||
ref="Upload"
|
||||
class="un-drag"
|
||||
action=""
|
||||
class="un-drag"
|
||||
:accept="accept"
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeUpload"
|
||||
@ -108,7 +108,7 @@
|
||||
</template>
|
||||
|
||||
<template v-else-if="type == 'file'">
|
||||
<div>
|
||||
<div class="cl-upload__btn">
|
||||
<el-button type="success">{{ text }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@ -308,7 +308,7 @@ async function httpRequest(req: any, item?: any) {
|
||||
const data = new FormData();
|
||||
|
||||
for (const i in params) {
|
||||
if (i != "host") {
|
||||
if (!["host", "publicDomain", "fileKey", "uploadUrl", "preview"].includes(i)) {
|
||||
data.append(i, params[i]);
|
||||
}
|
||||
}
|
||||
@ -344,7 +344,7 @@ async function httpRequest(req: any, item?: any) {
|
||||
if (mode === "local") {
|
||||
item.url = res;
|
||||
} else {
|
||||
item.url = `${params.host}/${fileName}`;
|
||||
item.url = `${params.preview}/${fileName}`;
|
||||
}
|
||||
|
||||
emit("success", item);
|
||||
@ -352,10 +352,12 @@ async function httpRequest(req: any, item?: any) {
|
||||
update();
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage.error(err.message);
|
||||
item.error = err.message;
|
||||
emit("error", item);
|
||||
reject(err);
|
||||
if (mode == "local") {
|
||||
ElMessage.error(err.message);
|
||||
item.error = err.message;
|
||||
emit("error", item);
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -364,7 +366,16 @@ async function httpRequest(req: any, item?: any) {
|
||||
host: "/admin/base/comm/upload"
|
||||
});
|
||||
} else {
|
||||
service.base.comm.upload().then(next).catch(reject);
|
||||
service.base.comm
|
||||
.upload()
|
||||
.then((res) => {
|
||||
next({
|
||||
host: res.uploadUrl,
|
||||
preview: res.host || res.publicDomain,
|
||||
...res
|
||||
});
|
||||
})
|
||||
.catch(reject);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
@ -464,7 +475,13 @@ defineExpose({
|
||||
}
|
||||
|
||||
.un-drag {
|
||||
margin-right: 5px;
|
||||
.cl-upload__item {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.cl-upload__btn {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
&--file {
|
||||
@ -473,7 +490,6 @@ defineExpose({
|
||||
|
||||
.un-drag {
|
||||
width: 100%;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -531,6 +547,7 @@ defineExpose({
|
||||
color: #333;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
|
||||
&:hover {
|
||||
border-color: currentColor;
|
||||
|
Loading…
Reference in New Issue
Block a user