@king-one/antdv 1.0.98 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/es/components/pro-upload/src/hooks/useUpload.mjs +32 -30
- package/dist/lib/components/pro-upload/src/hooks/useUpload.js +1 -1
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/types/components/pro-upload/src/hooks/useUpload.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,51 +1,53 @@
|
|
|
1
1
|
import { message as o } from "ant-design-vue";
|
|
2
|
-
import { useHttp as
|
|
2
|
+
import { useHttp as p } from "./useHttp.mjs";
|
|
3
3
|
function m(c) {
|
|
4
|
-
const r =
|
|
4
|
+
const r = p(c);
|
|
5
5
|
return {
|
|
6
6
|
// 文件上传
|
|
7
|
-
uploadFile: (
|
|
7
|
+
uploadFile: (s) => new Promise(async (a, t) => {
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
10
|
-
params: { business:
|
|
9
|
+
const e = await r.getUploadUrl({
|
|
10
|
+
params: { business: s.business }
|
|
11
11
|
});
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const l = await r.uploadFileApi(
|
|
16
|
-
l.status === 0 ? (o.success("文件上传成功~"),
|
|
12
|
+
if (e.status === 0) {
|
|
13
|
+
const i = e.data, n = new FormData();
|
|
14
|
+
n.append("file", s.file);
|
|
15
|
+
const l = await r.uploadFileApi(i, n);
|
|
16
|
+
l.status === 0 ? (o.success("文件上传成功~"), a(l.data)) : (o.error(l.msg), t(l));
|
|
17
17
|
} else
|
|
18
|
-
o.error(
|
|
19
|
-
} catch (
|
|
20
|
-
console.log(
|
|
18
|
+
o.error(e.msg), t(e);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.log(e), o.error("文件上传失败,请联系管理员进行查看!"), t(e);
|
|
21
21
|
}
|
|
22
22
|
}),
|
|
23
23
|
// 文件下载
|
|
24
|
-
downloadFile: (
|
|
24
|
+
downloadFile: (s) => new Promise(async (a, t) => {
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
window.open(
|
|
26
|
+
const e = s[0], i = await r.getDownloadUrlApi(s);
|
|
27
|
+
if (i.status === 0) {
|
|
28
|
+
const n = i.data[e];
|
|
29
|
+
window.open(n), a(!0);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
} catch (
|
|
33
|
-
t(
|
|
31
|
+
a(!1);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
t(e);
|
|
34
34
|
}
|
|
35
35
|
}),
|
|
36
36
|
// 获取图片的url
|
|
37
|
-
getImgUrl: (
|
|
38
|
-
const
|
|
39
|
-
|
|
37
|
+
getImgUrl: (s) => new Promise(async (a, t) => {
|
|
38
|
+
const e = await r.getDownloadUrlApi(s);
|
|
39
|
+
e.status === 0 ? a(e.data) : t(e);
|
|
40
40
|
}),
|
|
41
41
|
// 获取文件详情
|
|
42
|
-
getFileDetails: async (
|
|
43
|
-
r.getFileDetailApi({ fileIds:
|
|
44
|
-
|
|
45
|
-
}).catch((
|
|
46
|
-
o.error(
|
|
42
|
+
getFileDetails: async (s) => new Promise(async (a, t) => {
|
|
43
|
+
r.getFileDetailApi({ fileIds: s }).then((e) => {
|
|
44
|
+
e.status === 0 ? a(e) : (o.error(e.msg), t(e));
|
|
45
|
+
}).catch((e) => {
|
|
46
|
+
o.error(e), t(e);
|
|
47
47
|
});
|
|
48
|
-
})
|
|
48
|
+
}),
|
|
49
|
+
// 删除文件
|
|
50
|
+
removeFiel: async (s) => await r.deleteFileApi({ params: { fileId: s } })
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("ant-design-vue"),c=require("./useHttp.js");function d(u){const r=c.useHttp(u);return{uploadFile:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("ant-design-vue"),c=require("./useHttp.js");function d(u){const r=c.useHttp(u);return{uploadFile:s=>new Promise(async(a,t)=>{try{const e=await r.getUploadUrl({params:{business:s.business}});if(e.status===0){const n=e.data,i=new FormData;i.append("file",s.file);const l=await r.uploadFileApi(n,i);l.status===0?(o.message.success("文件上传成功~"),a(l.data)):(o.message.error(l.msg),t(l))}else o.message.error(e.msg),t(e)}catch(e){console.log(e),o.message.error("文件上传失败,请联系管理员进行查看!"),t(e)}}),downloadFile:s=>new Promise(async(a,t)=>{try{const e=s[0],n=await r.getDownloadUrlApi(s);if(n.status===0){const i=n.data[e];window.open(i),a(!0)}a(!1)}catch(e){t(e)}}),getImgUrl:s=>new Promise(async(a,t)=>{const e=await r.getDownloadUrlApi(s);e.status===0?a(e.data):t(e)}),getFileDetails:async s=>new Promise(async(a,t)=>{r.getFileDetailApi({fileIds:s}).then(e=>{e.status===0?a(e):(o.message.error(e.msg),t(e))}).catch(e=>{o.message.error(e),t(e)})}),removeFiel:async s=>await r.deleteFileApi({params:{fileId:s}})}}exports.useUpload=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=
|
|
1
|
+
@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=69058) format("woff2"),url(fonts/iconfont.woff?t=65842) format("woff"),url(fonts/iconfont.ttf?t=20993) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-upload-icon:before{content:"\e617"}.icon-king-title-icon:before{content:"\e680"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--king-color-white:#ffffff;--king-color-primary:#409eff;--king-color-success:#67c23a;--king-color-warning:#e6a23c;--king-color-danger:#f56c6c;--king-color-error:#f56c6c;--king-color-info:#909399;--king-transition-duration:0.3s}.king-button--primary{--king-button-text-color:var(--king-color-primary)}.king-button--success{--king-button-text-color:var(--king-color-success)}.king-button--warning{--king-button-text-color:var(--king-color-warning)}.king-button--danger{--king-button-text-color:var(--king-color-danger)}.king-button--error{--king-button-text-color:var(--king-color-error)}.king-button--info{--king-button-text-color:var(--king-color-info)}.king-button{color:var(--king-button-text-color)}.king-scrollbar{overflow:hidden;position:relative;z-index:auto;height:100%;width:100%}.king-scrollbar .king-scrollbar-container{width:100%;overflow:scroll;height:100%;min-height:inherit;max-height:inherit;scrollbar-width:none}.king-scrollbar .king-scrollbar-content{width:-moz-fit-content;width:fit-content}.king-scrollbar .king-scrollbar-rail{position:absolute}.king-scrollbar .king-scrollbar-rail--vertical{right:0;width:5px;top:2px;bottom:2px;right:4px}.king-scrollbar .king-scrollbar-rail--horizontal{bottom:2px;height:5px;left:2px;right:2px}.king-scrollbar .king-scrollbar-rail__scrollbar--vertical{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;width:100%;cursor:pointer}.king-scrollbar .king-scrollbar-rail__scrollbar--horizontal{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;height:100%;cursor:pointer}.v-vl-items{width:-moz-fit-content;width:fit-content}.king-scale-virtual-list{width:100%;height:100%}.king-scale-virtual-list .king-scale-virtual-list-container{margin:0 auto;position:relative}.king-scale-virtual-list .king-scale-vittual-wrapper{width:-moz-fit-content;width:fit-content;margin:0 auto;position:absolute;left:50%}.king-pro-title{border-bottom:1px solid #ccc;font-weight:500;display:flex;align-items:center}.king-pro-title .icon{margin-right:10px}.king-pro-title--unborder{border:none}.king-pro-modal .ant-modal-content{padding:0}.king-pro-modal .ant-modal-header{height:56px;padding-left:32px;padding-right:24px;display:flex;justify-content:space-between;align-items:center;background:#f1f7ff;border-bottom:1px solid #e6e8ea}.king-pro-modal .ant-modal-body{padding:10px 20px;max-height:80vh;overflow:auto}.king-pro-modal .ant-modal-footer{height:56px;display:flex;padding:0 16px;justify-content:flex-end;align-items:center;border-top:1px solid #e6e8ea}.king-pro-modal .ant-modal-title{flex:1}.king-pro-modal .pro-modal-title{cursor:move;width:100%}.king-pro-area-select{width:100%}@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=
|
|
1
|
+
:root{--king-color-white:#ffffff;--king-color-primary:#409eff;--king-color-success:#67c23a;--king-color-warning:#e6a23c;--king-color-danger:#f56c6c;--king-color-error:#f56c6c;--king-color-info:#909399;--king-transition-duration:0.3s}.king-button--primary{--king-button-text-color:var(--king-color-primary)}.king-button--success{--king-button-text-color:var(--king-color-success)}.king-button--warning{--king-button-text-color:var(--king-color-warning)}.king-button--danger{--king-button-text-color:var(--king-color-danger)}.king-button--error{--king-button-text-color:var(--king-color-error)}.king-button--info{--king-button-text-color:var(--king-color-info)}.king-button{color:var(--king-button-text-color)}.king-scrollbar{overflow:hidden;position:relative;z-index:auto;height:100%;width:100%}.king-scrollbar .king-scrollbar-container{width:100%;overflow:scroll;height:100%;min-height:inherit;max-height:inherit;scrollbar-width:none}.king-scrollbar .king-scrollbar-content{width:-moz-fit-content;width:fit-content}.king-scrollbar .king-scrollbar-rail{position:absolute}.king-scrollbar .king-scrollbar-rail--vertical{right:0;width:5px;top:2px;bottom:2px;right:4px}.king-scrollbar .king-scrollbar-rail--horizontal{bottom:2px;height:5px;left:2px;right:2px}.king-scrollbar .king-scrollbar-rail__scrollbar--vertical{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;width:100%;cursor:pointer}.king-scrollbar .king-scrollbar-rail__scrollbar--horizontal{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;height:100%;cursor:pointer}.v-vl-items{width:-moz-fit-content;width:fit-content}.king-scale-virtual-list{width:100%;height:100%}.king-scale-virtual-list .king-scale-virtual-list-container{margin:0 auto;position:relative}.king-scale-virtual-list .king-scale-vittual-wrapper{width:-moz-fit-content;width:fit-content;margin:0 auto;position:absolute;left:50%}.king-pro-title{border-bottom:1px solid #ccc;font-weight:500;display:flex;align-items:center}.king-pro-title .icon{margin-right:10px}.king-pro-title--unborder{border:none}.king-pro-modal .ant-modal-content{padding:0}.king-pro-modal .ant-modal-header{height:56px;padding-left:32px;padding-right:24px;display:flex;justify-content:space-between;align-items:center;background:#f1f7ff;border-bottom:1px solid #e6e8ea}.king-pro-modal .ant-modal-body{padding:10px 20px;max-height:80vh;overflow:auto}.king-pro-modal .ant-modal-footer{height:56px;display:flex;padding:0 16px;justify-content:flex-end;align-items:center;border-top:1px solid #e6e8ea}.king-pro-modal .ant-modal-title{flex:1}.king-pro-modal .pro-modal-title{cursor:move;width:100%}.king-pro-area-select{width:100%}@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=66780) format("woff2"),url(fonts/iconfont.woff?t=90554) format("woff"),url(fonts/iconfont.ttf?t=36547) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-upload-icon:before{content:"\e617"}.icon-king-title-icon:before{content:"\e680"}.king-cover-scrollbar{height:100%;width:100%;overflow:hidden;position:relative}.king-cover-scrollbar .king-cover-scrollbar-container{height:100%;width:100%;overflow:scroll;scrollbar-width:none}.king-cover-scrollbar .king-cover-scrollbar-rail{width:5px;top:2px;bottom:2px;position:absolute}.king-cover-scrollbar .king-cover-scrollbar-rail__scrollbar--vertical{position:absolute;border-radius:5px;width:100%;cursor:pointer}.king-pro-contract-view{position:relative;display:flex}.king-pro-contract-view .king-pro-contract-view__content{flex:1}.king-pro-contract-view .king-pro-contract-view__content-item{border:1px solid #f0f0f0;position:relative;box-shadow:0 2px 10px 0 rgba(0,0,0,.1)}.king-pro-contract-view>.ant-spin{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
2
|
import { IUploadFileConfig } from '../types';
|
|
3
|
-
import { UploadFileResType, FileDetailType } from './resType';
|
|
3
|
+
import { UploadFileResType, FileDetailType, ResponseType } from './resType';
|
|
4
4
|
export declare function useUpload(httpConfig: AxiosInstance): {
|
|
5
5
|
uploadFile: (config: IUploadFileConfig) => Promise< UploadFileResType>;
|
|
6
6
|
downloadFile: (config: string[]) => Promise<boolean>;
|
|
@@ -8,4 +8,5 @@ export declare function useUpload(httpConfig: AxiosInstance): {
|
|
|
8
8
|
getFileDetails: (config: string[]) => Promise<ReturnType<(config: {
|
|
9
9
|
fileIds: string[];
|
|
10
10
|
}) => Promise< FileDetailType>>>;
|
|
11
|
+
removeFiel: (fileId: string) => Promise< ResponseType>;
|
|
11
12
|
};
|