@jx3box/jx3box-common-ui 6.1.5 → 6.1.6
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/index.js +1 -5
- package/package.json +1 -1
- package/src/App.vue +1 -9
- package/service/resource.js +0 -20
- package/src/GameText.vue +0 -144
package/index.js
CHANGED
|
@@ -31,8 +31,6 @@ import zlpBy from "./src/filters/zlpBy.vue";
|
|
|
31
31
|
import Thx from './src/single/Thx.vue'
|
|
32
32
|
import WikiPanel from './src/wiki/WikiPanel.vue'
|
|
33
33
|
|
|
34
|
-
import GameText from './src/GameText.vue'
|
|
35
|
-
|
|
36
34
|
const components = {
|
|
37
35
|
Header,
|
|
38
36
|
Breadcrumb,
|
|
@@ -66,9 +64,7 @@ const components = {
|
|
|
66
64
|
clientBy,
|
|
67
65
|
zlpBy,
|
|
68
66
|
|
|
69
|
-
WikiPanel
|
|
70
|
-
|
|
71
|
-
GameText
|
|
67
|
+
WikiPanel
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
const install = function (Vue, Option) {
|
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -110,11 +110,6 @@
|
|
|
110
110
|
<Avatar :id="8" url="" :size="avatar_size" frame="" />
|
|
111
111
|
</div>
|
|
112
112
|
</el-tab-pane>
|
|
113
|
-
<el-tab-pane label="游戏描述" name="GameText">
|
|
114
|
-
<div>
|
|
115
|
-
<game-text :text="text"></game-text>
|
|
116
|
-
</div>
|
|
117
|
-
</el-tab-pane>
|
|
118
113
|
</el-tabs>
|
|
119
114
|
|
|
120
115
|
<RightSidebar>
|
|
@@ -178,8 +173,6 @@ import WikiPanel from "./wiki/WikiPanel.vue";
|
|
|
178
173
|
import WikiRevisions from "./wiki/WikiRevisions.vue";
|
|
179
174
|
import WikiComments from "./wiki/WikiComments.vue";
|
|
180
175
|
|
|
181
|
-
import GameText from "./GameText.vue";
|
|
182
|
-
|
|
183
176
|
import axios from "axios";
|
|
184
177
|
import { __server } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
185
178
|
import { wiki } from "@jx3box/jx3box-common/js/wiki";
|
|
@@ -233,8 +226,7 @@ export default {
|
|
|
233
226
|
WikiRevisions,
|
|
234
227
|
WikiComments,
|
|
235
228
|
|
|
236
|
-
UserPop
|
|
237
|
-
GameText,
|
|
229
|
+
UserPop
|
|
238
230
|
},
|
|
239
231
|
data: function () {
|
|
240
232
|
return {
|
package/service/resource.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: X3ZvaWQ
|
|
3
|
-
* @Date: 2022-08-20 22:17:27
|
|
4
|
-
* @LastEditors: X3ZvaWQ
|
|
5
|
-
* @LastEditTime: 2022-08-20 23:13:38
|
|
6
|
-
* @Description:
|
|
7
|
-
*/
|
|
8
|
-
import { $node } from "@jx3box/jx3box-common/js/https";
|
|
9
|
-
const $ = $node();
|
|
10
|
-
|
|
11
|
-
/* import axios from 'axios'
|
|
12
|
-
const $ = axios.create({
|
|
13
|
-
baseURL: 'http://localhost:7002/',
|
|
14
|
-
}) */
|
|
15
|
-
|
|
16
|
-
function getResource(id, client = 'std') {
|
|
17
|
-
return $.get(`/resource/${client}/${id}`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { getResource };
|
package/src/GameText.vue
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: X3ZvaWQ
|
|
3
|
-
* @Date: 2022-08-20 20:23:57
|
|
4
|
-
* @LastEditors: X3ZvaWQ
|
|
5
|
-
* @LastEditTime: 2022-08-20 23:12:34
|
|
6
|
-
* @Description: 用于渲染游戏内Text标签的文本
|
|
7
|
-
-->
|
|
8
|
-
<template>
|
|
9
|
-
<span v-html="html"></span>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
import { extractTextContent, getLink } from "@jx3box/jx3box-common/js/utils";
|
|
14
|
-
import { getResource } from "../service/resource";
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
name: "GameText",
|
|
18
|
-
props: {
|
|
19
|
-
text: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: "",
|
|
22
|
-
},
|
|
23
|
-
client: {
|
|
24
|
-
type: String,
|
|
25
|
-
default: "std",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
data: function () {
|
|
29
|
-
return {
|
|
30
|
-
html: "",
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
methods: {
|
|
34
|
-
/**
|
|
35
|
-
* 渲染某一个单独的Text标签成Span或链接
|
|
36
|
-
* @param {*} school_id
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
renderItemHtml: function (item) {
|
|
40
|
-
let content = item.text;
|
|
41
|
-
let style = ``;
|
|
42
|
-
let link = null;
|
|
43
|
-
content = content.replace(/\n/g, "<br />").replace(/\\/g, "");
|
|
44
|
-
if ([item.r, item.g, item.b].every((v) => v != undefined && v > 0)) {
|
|
45
|
-
style = `color: rgb(${item.r}, ${item.g}, ${item.b});`;
|
|
46
|
-
} else if (item.font != undefined) {
|
|
47
|
-
const fonts = require("../assets/data/game_font.json");
|
|
48
|
-
for (let color in fonts) {
|
|
49
|
-
if (fonts[color].includes(item.font)) {
|
|
50
|
-
style = `color: ${color};`;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (item.name == "iteminfolink" && item.script) {
|
|
56
|
-
let item_type = item.script?.match(/this\.dwTabType=(\d+)/i)?.[1];
|
|
57
|
-
let item_index = item.script?.match(/this\.dwIndex=(\d+)/i)?.[1];
|
|
58
|
-
if (item_type && item_index) {
|
|
59
|
-
let item_id = `${item_type}_${item_index}`;
|
|
60
|
-
link = getLink("item", item_id);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (link) {
|
|
64
|
-
return `<a style="${style} text-decoration: none;" target="_blank" href="${link}">${content}</a>`;
|
|
65
|
-
} else {
|
|
66
|
-
return `<span style="${style}">${content}</span>`;
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* 将一段游戏内文本转换为Html
|
|
71
|
-
* @param {Object[]} texts 标签对象
|
|
72
|
-
*/
|
|
73
|
-
renderTextHtml: function (Text) {
|
|
74
|
-
let result = Text;
|
|
75
|
-
const matches = Text.match(/<Text>(.*?)<\/text>/gimsy);
|
|
76
|
-
if (!matches) return Text;
|
|
77
|
-
for (let match of matches) {
|
|
78
|
-
let text = extractTextContent(match);
|
|
79
|
-
let html = this.renderItemHtml(text[0]);
|
|
80
|
-
result = result.replace(match, html);
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* 获取形如<BUFF 110 1 desc>的资源字段并转换
|
|
86
|
-
*/
|
|
87
|
-
renderResource: function () {
|
|
88
|
-
const matches = this.html.match(/<BUFF (\d+) (\d+) (.*?)>/gim);
|
|
89
|
-
if (!matches) return;
|
|
90
|
-
for (let match of matches) {
|
|
91
|
-
let [, id, level, type] = match.match(/<BUFF (\d+) (\d+) (.*?)>/i);
|
|
92
|
-
type = type.toLowerCase();
|
|
93
|
-
let type_map = {
|
|
94
|
-
desc: "Desc",
|
|
95
|
-
time: "Interval",
|
|
96
|
-
};
|
|
97
|
-
getResource(`buff.${id}_${level}`, this.client)
|
|
98
|
-
.then((res) => {
|
|
99
|
-
let data = res.data;
|
|
100
|
-
let attr = type_map[type] || type;
|
|
101
|
-
let value = data[attr];
|
|
102
|
-
if (typeof value == "number" && type == "time") {
|
|
103
|
-
let time = value / 16;
|
|
104
|
-
if (time > 60) {
|
|
105
|
-
time = `${Math.floor(time / 60)}分钟`;
|
|
106
|
-
} else {
|
|
107
|
-
time = `${time}秒`;
|
|
108
|
-
}
|
|
109
|
-
this.html = this.html.replace(match, time);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (!value) return;
|
|
113
|
-
let _matches = value.match(/<BUFF ([0-9a-zA-Z]+)>/gi);
|
|
114
|
-
if (!_matches) this.html = this.html.replace(match, value);
|
|
115
|
-
for (let _match of _matches) {
|
|
116
|
-
let [, _attr] = _match.match(/<BUFF ([0-9a-zA-Z]+)>/i);
|
|
117
|
-
for (let i = 1; i < 15; i++) {
|
|
118
|
-
if (data[`BeginAttrib${i}`] == _attr) {
|
|
119
|
-
value = value.replace(_match, data[`BeginValue${i}A`]);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
this.html = this.html.replace(match, value);
|
|
124
|
-
})
|
|
125
|
-
.catch((err) => {
|
|
126
|
-
console.log(err);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
watch: {
|
|
132
|
-
text: {
|
|
133
|
-
immediate: true,
|
|
134
|
-
handler: function (val) {
|
|
135
|
-
this.html = this.renderTextHtml(val);
|
|
136
|
-
this.renderResource();
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
</script>
|
|
142
|
-
|
|
143
|
-
<style>
|
|
144
|
-
</style>
|