cloud-web-corejs 1.1.0-dev.78 → 1.1.0-dev.79
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
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
<span v-if="item.value" class="error-detail-value">{{ item.value }}</span>
|
|
29
30
|
</div>
|
|
30
31
|
</div>
|
|
32
|
+
<p v-else-if="showTextFlag && plainText" class="error-detail-plain error-plain-text">{{ text2 }}</p>
|
|
31
33
|
<p v-else-if="showTextFlag" class="error-detail-plain" v-html="text2"></p>
|
|
32
34
|
<a class="error-detail-toggle" href="javascript:void(0);" @click="showTextFlag = !showTextFlag">{{
|
|
33
35
|
!showTextFlag
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
<p class="name">{{ title }}</p>
|
|
57
59
|
<p class="txt">{{ errorTitle }}</p>
|
|
58
60
|
<template v-if="!showTextFlag">
|
|
59
|
-
<p class="txt">{{ text1 }}</p>
|
|
61
|
+
<p class="txt" :class="{ 'error-plain-text': plainText }">{{ text1 }}</p>
|
|
60
62
|
</template>
|
|
61
63
|
<div v-if="showTextFlag && structuredDetail" class="error-detail-list">
|
|
62
64
|
<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 }">
|
|
@@ -64,6 +66,7 @@
|
|
|
64
66
|
<span v-if="item.value" class="error-detail-value">{{ item.value }}</span>
|
|
65
67
|
</div>
|
|
66
68
|
</div>
|
|
69
|
+
<p class="txt error-plain-text" v-else-if="showTextFlag && plainText">{{ text2 }}</p>
|
|
67
70
|
<p class="txt" v-else-if="showTextFlag" v-html="text2"></p>
|
|
68
71
|
<el-link @click="showTextFlag = !showTextFlag" class="link-underline" :underline="false" type="primary">{{
|
|
69
72
|
!showTextFlag
|
|
@@ -179,6 +182,11 @@ export default {
|
|
|
179
182
|
margin-top: 12px;
|
|
180
183
|
}
|
|
181
184
|
|
|
185
|
+
.error-plain-text {
|
|
186
|
+
white-space: pre-line;
|
|
187
|
+
word-break: break-word;
|
|
188
|
+
}
|
|
189
|
+
|
|
182
190
|
.error-detail-plain {
|
|
183
191
|
line-height: 1.65;
|
|
184
192
|
word-break: break-word;
|
|
@@ -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;
|