meixioacomponent 0.9.57 → 0.9.59
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/lib/config/uploadRequest.d.ts +1 -1
- package/lib/config/uploadRequest.d.ts.map +1 -1
- package/lib/config/uploadRequest.js +6 -5
- package/lib/meixioacomponent.common.js +7 -6
- package/lib/meixioacomponent.umd.js +7 -6
- package/lib/meixioacomponent.umd.min.js +2 -2
- package/package.json +1 -1
- package/packages/config/uploadRequest.ts +8 -5
- package/packages/utils/upload.js +1 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const _default: (params: any, uploadProgressFn: any, sourceToken: any) => Promise<unknown>;
|
|
1
|
+
declare const _default: (params: any, uploadProgressFn: any, sourceToken: any, oss: any) => Promise<unknown>;
|
|
2
2
|
export default _default;
|
|
3
3
|
//# sourceMappingURL=uploadRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadRequest.d.ts","sourceRoot":"","sources":["../../packages/config/uploadRequest.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"uploadRequest.d.ts","sourceRoot":"","sources":["../../packages/config/uploadRequest.ts"],"names":[],"mappings":";AAOA,wBAuFC"}
|
|
@@ -13,7 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const axios_1 = __importDefault(require("axios"));
|
|
16
|
-
|
|
16
|
+
const utils_js_1 = require("../utils/utils.js");
|
|
17
|
+
exports.default = (params, uploadProgressFn, sourceToken, oss) => {
|
|
17
18
|
const ossInstance = (data, uploadProgressFn) => {
|
|
18
19
|
// 创建 axios 实例
|
|
19
20
|
const instance = axios_1.default.create({
|
|
@@ -26,7 +27,6 @@ exports.default = (params, uploadProgressFn, sourceToken) => {
|
|
|
26
27
|
};
|
|
27
28
|
// 响应异常拦截处理器
|
|
28
29
|
const resErrorHandler = (error) => {
|
|
29
|
-
console.log(error);
|
|
30
30
|
// Message.error(`网络超时,请稍后重试`);
|
|
31
31
|
// return errorHandler(error);
|
|
32
32
|
throw error;
|
|
@@ -37,8 +37,10 @@ exports.default = (params, uploadProgressFn, sourceToken) => {
|
|
|
37
37
|
config.headers['Content-Type'] = 'multipart/form-data';
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
config.headers['type'] = 'application/octet-stream';
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
if (!oss) {
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
config.headers['authorization'] = `Bearer ${(0, utils_js_1.GetToken)('token')}`;
|
|
43
|
+
}
|
|
42
44
|
config.onUploadProgress = (progressEvent) => {
|
|
43
45
|
if (uploadProgressFn) {
|
|
44
46
|
// @ts-ignore
|
|
@@ -63,7 +65,6 @@ exports.default = (params, uploadProgressFn, sourceToken) => {
|
|
|
63
65
|
cancelToken: sourceToken.token,
|
|
64
66
|
}, uploadProgressFn)
|
|
65
67
|
.then((res) => {
|
|
66
|
-
console.log(res);
|
|
67
68
|
const { status } = res;
|
|
68
69
|
if (status == 200) {
|
|
69
70
|
const { data } = res;
|
|
@@ -19323,7 +19323,7 @@ class Upload {
|
|
|
19323
19323
|
params.append('url', this.url);
|
|
19324
19324
|
}
|
|
19325
19325
|
try {
|
|
19326
|
-
let uploadEdUrl = await uploadRequest_default()(params, this.uploadProgressFn, this.cancelToken);
|
|
19326
|
+
let uploadEdUrl = await uploadRequest_default()(params, this.uploadProgressFn, this.cancelToken, isOss);
|
|
19327
19327
|
this.state = 1;
|
|
19328
19328
|
resolve(uploadEdUrl);
|
|
19329
19329
|
} catch (error) {
|
|
@@ -105709,7 +105709,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
105709
105709
|
};
|
|
105710
105710
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
105711
105711
|
const axios_1 = __importDefault(__webpack_require__(97218));
|
|
105712
|
-
|
|
105712
|
+
const utils_js_1 = __webpack_require__(76691);
|
|
105713
|
+
exports["default"] = (params, uploadProgressFn, sourceToken, oss) => {
|
|
105713
105714
|
const ossInstance = (data, uploadProgressFn) => {
|
|
105714
105715
|
// 创建 axios 实例
|
|
105715
105716
|
const instance = axios_1.default.create({
|
|
@@ -105722,7 +105723,6 @@ exports["default"] = (params, uploadProgressFn, sourceToken) => {
|
|
|
105722
105723
|
};
|
|
105723
105724
|
// 响应异常拦截处理器
|
|
105724
105725
|
const resErrorHandler = (error) => {
|
|
105725
|
-
console.log(error);
|
|
105726
105726
|
// Message.error(`网络超时,请稍后重试`);
|
|
105727
105727
|
// return errorHandler(error);
|
|
105728
105728
|
throw error;
|
|
@@ -105733,8 +105733,10 @@ exports["default"] = (params, uploadProgressFn, sourceToken) => {
|
|
|
105733
105733
|
config.headers['Content-Type'] = 'multipart/form-data';
|
|
105734
105734
|
// @ts-ignore
|
|
105735
105735
|
config.headers['type'] = 'application/octet-stream';
|
|
105736
|
-
|
|
105737
|
-
|
|
105736
|
+
if (!oss) {
|
|
105737
|
+
// @ts-ignore
|
|
105738
|
+
config.headers['authorization'] = `Bearer ${(0, utils_js_1.GetToken)('token')}`;
|
|
105739
|
+
}
|
|
105738
105740
|
config.onUploadProgress = (progressEvent) => {
|
|
105739
105741
|
if (uploadProgressFn) {
|
|
105740
105742
|
// @ts-ignore
|
|
@@ -105759,7 +105761,6 @@ exports["default"] = (params, uploadProgressFn, sourceToken) => {
|
|
|
105759
105761
|
cancelToken: sourceToken.token,
|
|
105760
105762
|
}, uploadProgressFn)
|
|
105761
105763
|
.then((res) => {
|
|
105762
|
-
console.log(res);
|
|
105763
105764
|
const { status } = res;
|
|
105764
105765
|
if (status == 200) {
|
|
105765
105766
|
const { data } = res;
|
|
@@ -19333,7 +19333,7 @@ class Upload {
|
|
|
19333
19333
|
params.append('url', this.url);
|
|
19334
19334
|
}
|
|
19335
19335
|
try {
|
|
19336
|
-
let uploadEdUrl = await uploadRequest_default()(params, this.uploadProgressFn, this.cancelToken);
|
|
19336
|
+
let uploadEdUrl = await uploadRequest_default()(params, this.uploadProgressFn, this.cancelToken, isOss);
|
|
19337
19337
|
this.state = 1;
|
|
19338
19338
|
resolve(uploadEdUrl);
|
|
19339
19339
|
} catch (error) {
|
|
@@ -105719,7 +105719,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
105719
105719
|
};
|
|
105720
105720
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
105721
105721
|
const axios_1 = __importDefault(__webpack_require__(97218));
|
|
105722
|
-
|
|
105722
|
+
const utils_js_1 = __webpack_require__(75634);
|
|
105723
|
+
exports["default"] = (params, uploadProgressFn, sourceToken, oss) => {
|
|
105723
105724
|
const ossInstance = (data, uploadProgressFn) => {
|
|
105724
105725
|
// 创建 axios 实例
|
|
105725
105726
|
const instance = axios_1.default.create({
|
|
@@ -105732,7 +105733,6 @@ exports["default"] = (params, uploadProgressFn, sourceToken) => {
|
|
|
105732
105733
|
};
|
|
105733
105734
|
// 响应异常拦截处理器
|
|
105734
105735
|
const resErrorHandler = (error) => {
|
|
105735
|
-
console.log(error);
|
|
105736
105736
|
// Message.error(`网络超时,请稍后重试`);
|
|
105737
105737
|
// return errorHandler(error);
|
|
105738
105738
|
throw error;
|
|
@@ -105743,8 +105743,10 @@ exports["default"] = (params, uploadProgressFn, sourceToken) => {
|
|
|
105743
105743
|
config.headers['Content-Type'] = 'multipart/form-data';
|
|
105744
105744
|
// @ts-ignore
|
|
105745
105745
|
config.headers['type'] = 'application/octet-stream';
|
|
105746
|
-
|
|
105747
|
-
|
|
105746
|
+
if (!oss) {
|
|
105747
|
+
// @ts-ignore
|
|
105748
|
+
config.headers['authorization'] = `Bearer ${(0, utils_js_1.GetToken)('token')}`;
|
|
105749
|
+
}
|
|
105748
105750
|
config.onUploadProgress = (progressEvent) => {
|
|
105749
105751
|
if (uploadProgressFn) {
|
|
105750
105752
|
// @ts-ignore
|
|
@@ -105769,7 +105771,6 @@ exports["default"] = (params, uploadProgressFn, sourceToken) => {
|
|
|
105769
105771
|
cancelToken: sourceToken.token,
|
|
105770
105772
|
}, uploadProgressFn)
|
|
105771
105773
|
.then((res) => {
|
|
105772
|
-
console.log(res);
|
|
105773
105774
|
const { status } = res;
|
|
105774
105775
|
if (status == 200) {
|
|
105775
105776
|
const { data } = res;
|