atr-components 0.2.235 → 0.2.237
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/core/pipe/oss.pipe.d.ts +1 -1
- package/core/services/upload-oss.service.d.ts +1 -1
- package/core/utils/ToolsUtil.d.ts +1 -1
- package/esm2020/core/pipe/oss.pipe.mjs +3 -3
- package/esm2020/core/services/upload-oss.service.mjs +6 -5
- package/esm2020/core/utils/ToolsUtil.mjs +8 -5
- package/fesm2015/atr-components.mjs +14 -10
- package/fesm2015/atr-components.mjs.map +1 -1
- package/fesm2020/atr-components.mjs +14 -10
- package/fesm2020/atr-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -387,14 +387,18 @@ class ToolsUtil {
|
|
|
387
387
|
}
|
|
388
388
|
return date.getFullYear() + "-" + month + "-" + strDate + " " + hours + ":" + seconds;
|
|
389
389
|
}
|
|
390
|
-
static getOssUrl(url) {
|
|
390
|
+
static getOssUrl(url, needTime = false) {
|
|
391
391
|
if (!url) {
|
|
392
392
|
return "";
|
|
393
393
|
}
|
|
394
|
+
if (needTime) {
|
|
395
|
+
url = url + "?v=" + new Date().getTime();
|
|
396
|
+
}
|
|
394
397
|
if (url.startsWith("http")) {
|
|
395
398
|
return url;
|
|
396
399
|
}
|
|
397
|
-
|
|
400
|
+
let result = atr_static_datas.OSS_URL + url;
|
|
401
|
+
return result;
|
|
398
402
|
}
|
|
399
403
|
static getStaticOssUrl(url) {
|
|
400
404
|
if (!url) {
|
|
@@ -403,8 +407,7 @@ class ToolsUtil {
|
|
|
403
407
|
if (url.startsWith("http")) {
|
|
404
408
|
return url;
|
|
405
409
|
}
|
|
406
|
-
|
|
407
|
-
return atr_static_datas.STATIC_OSS_URL + url + "?v=" + v;
|
|
410
|
+
return atr_static_datas.STATIC_OSS_URL + url;
|
|
408
411
|
}
|
|
409
412
|
static removeHtml(value) {
|
|
410
413
|
if (!value) {
|
|
@@ -1909,8 +1912,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1909
1912
|
}] });
|
|
1910
1913
|
|
|
1911
1914
|
class OssPipe {
|
|
1912
|
-
transform(value, defaultVal) {
|
|
1913
|
-
return ToolsUtil.getOssUrl(value);
|
|
1915
|
+
transform(value, defaultVal, needTime = false) {
|
|
1916
|
+
return ToolsUtil.getOssUrl(value, needTime);
|
|
1914
1917
|
}
|
|
1915
1918
|
}
|
|
1916
1919
|
OssPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: OssPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -2002,7 +2005,7 @@ class UploadOssService {
|
|
|
2002
2005
|
const success = (result) => {
|
|
2003
2006
|
if (result.status === 200) {
|
|
2004
2007
|
this.uploadData = result.data;
|
|
2005
|
-
this.customReq(file, fullUrl).subscribe((url) => {
|
|
2008
|
+
this.customReq(file, fullUrl, result.data).subscribe((url) => {
|
|
2006
2009
|
observe.next(url);
|
|
2007
2010
|
observe.unsubscribe();
|
|
2008
2011
|
});
|
|
@@ -2023,9 +2026,10 @@ class UploadOssService {
|
|
|
2023
2026
|
}, ToolsUtil.getHttpOptions()).subscribe(success, error);
|
|
2024
2027
|
});
|
|
2025
2028
|
};
|
|
2026
|
-
this.customReq = (file, fullUrl = true) => {
|
|
2029
|
+
this.customReq = (file, fullUrl = true, uploadData = null) => {
|
|
2027
2030
|
const formData = new FormData();
|
|
2028
|
-
|
|
2031
|
+
uploadData = uploadData ? uploadData : this.uploadData;
|
|
2032
|
+
for (let key in uploadData) {
|
|
2029
2033
|
if (key != 'host')
|
|
2030
2034
|
formData.append(key, this.uploadData[key]);
|
|
2031
2035
|
}
|
|
@@ -2038,7 +2042,7 @@ class UploadOssService {
|
|
|
2038
2042
|
if (event.type === HttpEventType.UploadProgress) {
|
|
2039
2043
|
}
|
|
2040
2044
|
else if (event instanceof HttpResponse) {
|
|
2041
|
-
const url = fullUrl ? (event.url +
|
|
2045
|
+
const url = fullUrl ? (event.url + uploadData.key) : uploadData.key;
|
|
2042
2046
|
observe.next(url);
|
|
2043
2047
|
observe.unsubscribe();
|
|
2044
2048
|
}
|