cloud-web-corejs 1.0.322 → 1.0.323

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.322",
4
+ "version": "1.0.323",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "check:package-resources": "node build/check-package-resources.js",
@@ -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.content = options;
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-html="text1"></p>
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
- return text.replace(/(\r\n|\n|\r)/gm, "<br />");
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() {