cloud-web-corejs 1.0.322 → 1.0.324
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/package.json
CHANGED
|
@@ -15,10 +15,16 @@ function msg(options) {
|
|
|
15
15
|
if (!currentMsg) {
|
|
16
16
|
initInstance();
|
|
17
17
|
}
|
|
18
|
+
const envelope = {
|
|
19
|
+
time: "",
|
|
20
|
+
type: "",
|
|
21
|
+
_errorMsg: null,
|
|
22
|
+
errorLabel: "",
|
|
23
|
+
};
|
|
18
24
|
if (typeof options === "string") {
|
|
19
|
-
currentMsg
|
|
25
|
+
Object.assign(currentMsg, envelope, { content: options });
|
|
20
26
|
} else if (typeof options === "object") {
|
|
21
|
-
Object.assign(currentMsg, options);
|
|
27
|
+
Object.assign(currentMsg, envelope, options);
|
|
22
28
|
}
|
|
23
29
|
return currentMsg
|
|
24
30
|
.showMsgBox()
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
<div class="cont">
|
|
16
16
|
<p>{{ errorTitle }}</p>
|
|
17
17
|
<template v-if="!showTextFlag">
|
|
18
|
-
<p v-
|
|
18
|
+
<p v-if="plainText" class="error-plain-text">{{ text1 }}</p>
|
|
19
|
+
<p v-else v-html="text1"></p>
|
|
19
20
|
</template>
|
|
20
21
|
<div v-if="showTextFlag && structuredDetail" class="error-detail-list">
|
|
21
22
|
<div v-for="(item, index) in detailItems" :key="index" class="error-detail-row" :class="{ 'is-summary': item.isSummary, 'is-section': item.isSection, 'is-cause': item.isCause }">
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
<span v-if="item.value" class="error-detail-value">{{ item.value }}</span>
|
|
24
25
|
</div>
|
|
25
26
|
</div>
|
|
27
|
+
<p v-else-if="showTextFlag && plainText" class="error-detail-plain error-plain-text">{{ text2 }}</p>
|
|
26
28
|
<p v-else-if="showTextFlag" class="error-detail-plain" v-html="text2"></p>
|
|
27
29
|
<a class="error-detail-toggle" href="javascript:void(0);" @click="showTextFlag = !showTextFlag">{{
|
|
28
30
|
!showTextFlag
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
<p class="name">{{ title }}</p>
|
|
52
54
|
<p class="txt">{{ errorTitle }}</p>
|
|
53
55
|
<template v-if="!showTextFlag">
|
|
54
|
-
<p class="txt">{{ text1 }}</p>
|
|
56
|
+
<p class="txt" :class="{ 'error-plain-text': plainText }">{{ text1 }}</p>
|
|
55
57
|
</template>
|
|
56
58
|
<div v-if="showTextFlag && structuredDetail" class="error-detail-list">
|
|
57
59
|
<div v-for="(item, index) in detailItems" :key="index" class="error-detail-row" :class="{ 'is-summary': item.isSummary, 'is-section': item.isSection, 'is-cause': item.isCause }">
|
|
@@ -59,6 +61,7 @@
|
|
|
59
61
|
<span v-if="item.value" class="error-detail-value">{{ item.value }}</span>
|
|
60
62
|
</div>
|
|
61
63
|
</div>
|
|
64
|
+
<p class="txt error-plain-text" v-else-if="showTextFlag && plainText">{{ text2 }}</p>
|
|
62
65
|
<p class="txt" v-else-if="showTextFlag" v-html="text2"></p>
|
|
63
66
|
<a href="javascript:void(0);" @click="showTextFlag = !showTextFlag">{{
|
|
64
67
|
!showTextFlag
|
|
@@ -121,6 +124,7 @@ export default {
|
|
|
121
124
|
.error-detail-label { color: #606266; font-weight: 600; }
|
|
122
125
|
.error-detail-value { min-width: 0; color: #606266; }
|
|
123
126
|
.error-detail-toggle { display: inline-block; margin-top: 12px; }
|
|
127
|
+
.error-plain-text { white-space: pre-line; word-break: break-word; }
|
|
124
128
|
.error-detail-plain { line-height: 1.65; word-break: break-word; }
|
|
125
129
|
.pop-tipsBox.error .error-detail-list {
|
|
126
130
|
max-height: 42vh; overflow: auto; text-align: left;
|
|
@@ -34,6 +34,9 @@ tmixins = {
|
|
|
34
34
|
showWrap: false,
|
|
35
35
|
showTextFlag: false,
|
|
36
36
|
displayErrorLabel: "",
|
|
37
|
+
plainText: false,
|
|
38
|
+
type: "",
|
|
39
|
+
time: "",
|
|
37
40
|
zIndex: null,
|
|
38
41
|
};
|
|
39
42
|
},
|
|
@@ -71,7 +74,19 @@ tmixins = {
|
|
|
71
74
|
},
|
|
72
75
|
getShowText(text) {
|
|
73
76
|
if (!text) return text;
|
|
74
|
-
|
|
77
|
+
const value = String(text);
|
|
78
|
+
if (this.plainText) {
|
|
79
|
+
return value.replace(/<br\s*\/?>/gi, "\n");
|
|
80
|
+
}
|
|
81
|
+
return value.replace(/(\r\n|\n|\r)/gm, "<br />");
|
|
82
|
+
},
|
|
83
|
+
isServerResponse() {
|
|
84
|
+
if (this._errorMsg || this.errorLabel) return false;
|
|
85
|
+
if (this.content == null || this.content === "") return false;
|
|
86
|
+
if (this.type == null || this.type === "") return false;
|
|
87
|
+
const hasTime = this.time != null && String(this.time).trim() !== "";
|
|
88
|
+
const hasServerRmid = /^\d+$/.test(String(this.rmid || "").trim());
|
|
89
|
+
return hasTime || hasServerRmid;
|
|
75
90
|
},
|
|
76
91
|
getHttpStatusCode(detailItems) {
|
|
77
92
|
const item = (detailItems || []).find((row) => row.label === "状态码");
|
|
@@ -99,6 +114,7 @@ tmixins = {
|
|
|
99
114
|
});
|
|
100
115
|
},
|
|
101
116
|
showMsgBox: function () {
|
|
117
|
+
this.plainText = this.isServerResponse();
|
|
102
118
|
this.removeEnterEvent();
|
|
103
119
|
this.addEnterEvent();
|
|
104
120
|
var content = this.content;
|
|
@@ -102,11 +102,6 @@ tmixins = {
|
|
|
102
102
|
editFileSuffix: null,
|
|
103
103
|
beforeUploadFlag: false,
|
|
104
104
|
uploadUrl: null,
|
|
105
|
-
|
|
106
|
-
access_key_id: "HPUAQ1TAFXWGOKSNKCGW", // 你的ak
|
|
107
|
-
secret_access_key: "Ns1nwPwikK67Acbhj3wlfUambjbdroqpk0TFv7qg", // 你的sk
|
|
108
|
-
server: "https://obs.cn-south-1.myhuaweicloud.com", // 你的endPoint 记得加入https://
|
|
109
|
-
Bucket: "gztw-file01", // 你的桶名
|
|
110
105
|
};
|
|
111
106
|
},
|
|
112
107
|
beforeDestroy() {
|
package/src/utils/request.js
CHANGED
|
@@ -42,6 +42,40 @@ function isBinaryRequestBody(data) {
|
|
|
42
42
|
return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(data);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function isAbsoluteHttpUrl(url) {
|
|
46
|
+
return /^(https?:)?\/\//i.test(String(url || ""));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function toOrigin(url) {
|
|
50
|
+
try {
|
|
51
|
+
return new URL(String(url), window.location.href).origin;
|
|
52
|
+
} catch (e) {
|
|
53
|
+
return "";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 相对地址走当前 baseURL,视为本系统后台。绝对地址只有和后台同源才加密。
|
|
58
|
+
function isOwnBackendRequest(config) {
|
|
59
|
+
const rawUrl = String((config && config.url) || "");
|
|
60
|
+
let targetOrigin = "";
|
|
61
|
+
if (isAbsoluteHttpUrl(rawUrl)) {
|
|
62
|
+
targetOrigin = toOrigin(rawUrl);
|
|
63
|
+
} else {
|
|
64
|
+
const baseUrl =
|
|
65
|
+
config && config.baseURL != null && config.baseURL !== ""
|
|
66
|
+
? config.baseURL
|
|
67
|
+
: configUtil.baseUrl || "";
|
|
68
|
+
targetOrigin = isAbsoluteHttpUrl(baseUrl)
|
|
69
|
+
? toOrigin(baseUrl)
|
|
70
|
+
: window.location.origin;
|
|
71
|
+
}
|
|
72
|
+
const ownBase = configUtil.baseUrl || "";
|
|
73
|
+
const ownOrigin = isAbsoluteHttpUrl(ownBase)
|
|
74
|
+
? toOrigin(ownBase)
|
|
75
|
+
: window.location.origin;
|
|
76
|
+
return !!targetOrigin && targetOrigin === ownOrigin;
|
|
77
|
+
}
|
|
78
|
+
|
|
45
79
|
// 调用方已经 stringify 成对象或数组文本时直接加密,避免再包一层字符串。
|
|
46
80
|
function aesPlainText(data, useEmptyObject) {
|
|
47
81
|
if (typeof data === "string") {
|
|
@@ -89,7 +123,11 @@ service.interceptors.request.use(
|
|
|
89
123
|
);
|
|
90
124
|
}
|
|
91
125
|
const canEncryptBody = !isBinaryRequestBody(config.data);
|
|
92
|
-
if (
|
|
126
|
+
if (
|
|
127
|
+
settingConfig.requestAesEnabled === true &&
|
|
128
|
+
canEncryptBody &&
|
|
129
|
+
isOwnBackendRequest(config)
|
|
130
|
+
) {
|
|
93
131
|
config.data = wrapAesBody(config.data, true);
|
|
94
132
|
config.headers["Content-Type"] = "application/json;charset=UTF-8";
|
|
95
133
|
} else if (
|