@jx3box/jx3box-editor 0.8.0 → 0.8.4
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/assets/js/item.js +1 -1
- package/components/BuffItem.vue +2 -2
- package/package.json +1 -1
- package/service/database.js +31 -13
- package/service/item.js +8 -6
- package/src/Article.vue +2 -1
- package/src/Buff.vue +0 -0
- package/src/BuffSimple.vue +1 -1
- package/src/Item.vue +11 -21
- package/src/Resource.vue +2 -2
- package/src/Skill.vue +0 -0
- package/service/buff.js +0 -18
- package/service/skill.js +0 -18
package/assets/js/item.js
CHANGED
|
@@ -2,11 +2,11 @@ import $ from "jquery";
|
|
|
2
2
|
|
|
3
3
|
function renderItem(vm, selector = ".e-jx3-item") {
|
|
4
4
|
let outer, inner;
|
|
5
|
-
|
|
6
5
|
$(selector).on("mouseenter", function(e) {
|
|
7
6
|
clearTimeout(outer);
|
|
8
7
|
|
|
9
8
|
vm.item_id = $(e.target).attr("data-id");
|
|
9
|
+
vm.item_client = $(e.target).attr("data-client") == 'origin' ? 2 : 1;
|
|
10
10
|
$(".c-item-pop").fadeIn();
|
|
11
11
|
|
|
12
12
|
let self_height = $(".c-item-pop").height();
|
package/components/BuffItem.vue
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import {
|
|
14
|
+
import { getBuff } from '../service/database.js'
|
|
15
15
|
export default {
|
|
16
16
|
name: 'BuffItem',
|
|
17
17
|
props: ['buff', 'buff_id'],
|
|
@@ -40,7 +40,7 @@ export default {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// 没有缓存则发起请求获取数据
|
|
43
|
-
|
|
43
|
+
getBuff(val).then(res => {
|
|
44
44
|
const data = res.data
|
|
45
45
|
const [buff] = data.list
|
|
46
46
|
// console.log(data)
|
package/package.json
CHANGED
package/service/database.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { __node, __helperUrl, __iconPath } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
3
|
-
|
|
3
|
+
import { $node } from "@jx3box/jx3box-common/js/https";
|
|
4
4
|
|
|
5
5
|
function loadResource(type, query, params) {
|
|
6
6
|
switch (type) {
|
|
7
|
-
case
|
|
7
|
+
case "item":
|
|
8
8
|
return axios
|
|
9
9
|
.get(`${__helperUrl}api/item/search`, {
|
|
10
|
-
params: {keyword: query, page: params.page, limit: params.per},
|
|
10
|
+
params: { keyword: query, page: params.page, limit: params.per },
|
|
11
11
|
headers: {
|
|
12
12
|
Accept: "application/prs.helper.v2+json",
|
|
13
|
-
|
|
13
|
+
"JX3-Client-Type": params.client == "origin" ? 2 : 1,
|
|
14
14
|
},
|
|
15
15
|
withCredentials: true,
|
|
16
16
|
})
|
|
@@ -24,7 +24,7 @@ function loadResource(type, query, params) {
|
|
|
24
24
|
default:
|
|
25
25
|
let condition = isNaN(query) ? "name" : "id";
|
|
26
26
|
return axios
|
|
27
|
-
.get(
|
|
27
|
+
.get(__node + `${type}/${condition}/${query}`, {
|
|
28
28
|
params: params,
|
|
29
29
|
})
|
|
30
30
|
.then((res) => {
|
|
@@ -56,19 +56,19 @@ function getIcons(query, params) {
|
|
|
56
56
|
let data = res.data;
|
|
57
57
|
let list = [...data.skill, ...data.buff, ...data.item];
|
|
58
58
|
// 去重
|
|
59
|
-
let _set = new Set()
|
|
59
|
+
let _set = new Set();
|
|
60
60
|
list.forEach((item) => {
|
|
61
|
-
_set.add(item.iconID)
|
|
62
|
-
})
|
|
61
|
+
_set.add(item.iconID);
|
|
62
|
+
});
|
|
63
63
|
// 重组
|
|
64
|
-
let _list = []
|
|
64
|
+
let _list = [];
|
|
65
65
|
_set.forEach((item) => {
|
|
66
66
|
_list.push({
|
|
67
67
|
iconID: item,
|
|
68
68
|
isSelected: false,
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
|
-
list = Array.from(_list)
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
list = Array.from(_list);
|
|
72
72
|
return list;
|
|
73
73
|
})
|
|
74
74
|
.catch((err) => {
|
|
@@ -76,4 +76,22 @@ function getIcons(query, params) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
function getBuff(id, client = "std", level) {
|
|
80
|
+
return $node().get("/buff/id" + id, {
|
|
81
|
+
params: {
|
|
82
|
+
client: client,
|
|
83
|
+
level: level,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getSkill(id, client = "origin", level) {
|
|
89
|
+
return $node().get("/skill/id" + id, {
|
|
90
|
+
params: {
|
|
91
|
+
client: client,
|
|
92
|
+
level: level,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { loadResource, loadStat, getIcons, getBuff, getSkill };
|
package/service/item.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import $http from "axios";
|
|
2
2
|
import {__helperUrl} from "@jx3box/jx3box-common/data/jx3box.json";
|
|
3
|
+
import {jx3ClientType} from "@jx3box/jx3box-common/js/utils";
|
|
3
4
|
|
|
4
5
|
// 获取物品
|
|
5
|
-
function get_item(item_id, jx3_client_type =
|
|
6
|
+
function get_item(item_id, jx3_client_type = null) {
|
|
6
7
|
if (!item_id) return;
|
|
8
|
+
|
|
7
9
|
return $http({
|
|
8
10
|
url: `${__helperUrl}api/item/${item_id}`,
|
|
9
11
|
headers: {
|
|
10
12
|
Accept: "application/prs.helper.v2+json",
|
|
11
|
-
|
|
13
|
+
"JX3-Client-Type": jx3_client_type === null ? jx3ClientType() : jx3_client_type,
|
|
12
14
|
},
|
|
13
15
|
withCredentials: true,
|
|
14
|
-
})
|
|
16
|
+
});
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
// 获取清单
|
|
18
|
-
function get_plan(plan_id){
|
|
20
|
+
function get_plan(plan_id) {
|
|
19
21
|
return $http({
|
|
20
22
|
url: `${__helperUrl}api/item_plan/${plan_id}`,
|
|
21
23
|
headers: {Accept: "application/prs.helper.v2+json"},
|
|
22
24
|
withCredentials: true,
|
|
23
|
-
})
|
|
25
|
+
});
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export {
|
|
28
|
+
export {get_item, get_plan};
|
package/src/Article.vue
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
:total="total"
|
|
37
37
|
></el-pagination>
|
|
38
38
|
<div class="c-item-pop" :style="item_popover_style">
|
|
39
|
-
<jx3-item :item_id="item_id" />
|
|
39
|
+
<jx3-item :item_id="item_id" :jx3ClientType="item_client" />
|
|
40
40
|
</div>
|
|
41
41
|
<!-- <gallery :images="images" :index="gallery_index" @close="index = null"></gallery> -->
|
|
42
42
|
</div>
|
|
@@ -100,6 +100,7 @@ export default {
|
|
|
100
100
|
left: 0,
|
|
101
101
|
top: 0,
|
|
102
102
|
},
|
|
103
|
+
item_client : 1,
|
|
103
104
|
// 画廊
|
|
104
105
|
gallery_index: null,
|
|
105
106
|
images: [],
|
package/src/Buff.vue
ADDED
|
File without changes
|
package/src/BuffSimple.vue
CHANGED
package/src/Item.vue
CHANGED
|
@@ -250,7 +250,7 @@ import color from "../assets/js/item/color.js";
|
|
|
250
250
|
|
|
251
251
|
export default {
|
|
252
252
|
name: "Item",
|
|
253
|
-
props: ["item", "item_id"],
|
|
253
|
+
props: ["item", "item_id","jx3ClientType"],
|
|
254
254
|
data() {
|
|
255
255
|
return {
|
|
256
256
|
source: null,
|
|
@@ -278,38 +278,28 @@ export default {
|
|
|
278
278
|
handler() {
|
|
279
279
|
if (this.item_id) {
|
|
280
280
|
// 提取本地数据
|
|
281
|
-
let
|
|
282
|
-
let
|
|
283
|
-
|
|
284
|
-
);
|
|
281
|
+
let cacheName = `item-${this.jx3ClientType}-${this.item_id}`;
|
|
282
|
+
let cache = sessionStorage.getItem(cacheName);
|
|
283
|
+
let createdCacheName = `${cacheName}-created`;
|
|
284
|
+
let createdCache = sessionStorage.getItem(createdCacheName);
|
|
285
285
|
// 查看是否存在缓存
|
|
286
286
|
if (
|
|
287
287
|
(cache === false || cache) &&
|
|
288
|
-
Math.round(new Date() / 1000) -
|
|
288
|
+
Math.round(new Date() / 1000) - createdCache <= 3600
|
|
289
289
|
) {
|
|
290
|
-
this.source =
|
|
291
|
-
cache === false ? null : JSON.parse(cache);
|
|
290
|
+
this.source = cache === false ? null : JSON.parse(cache);
|
|
292
291
|
return;
|
|
293
292
|
}
|
|
294
293
|
|
|
295
294
|
// 没有缓存则发起请求获取
|
|
296
|
-
get_item(this.item_id).then((res) => {
|
|
295
|
+
get_item(this.item_id, this.jx3ClientType).then((res) => {
|
|
297
296
|
let data = res.data;
|
|
298
297
|
if (data.code === 200) {
|
|
299
298
|
let item = data.data.item;
|
|
300
|
-
this.source =
|
|
301
|
-
JSON.stringify(item) !== "{}" ? item : null;
|
|
299
|
+
this.source = JSON.stringify(item) !== "{}" ? item : null;
|
|
302
300
|
// 记录本地数据
|
|
303
|
-
sessionStorage.setItem(
|
|
304
|
-
|
|
305
|
-
this.source
|
|
306
|
-
? JSON.stringify(this.source)
|
|
307
|
-
: false
|
|
308
|
-
);
|
|
309
|
-
sessionStorage.setItem(
|
|
310
|
-
`item-${this.source.id}-created`,
|
|
311
|
-
Math.round(new Date() / 1000)
|
|
312
|
-
);
|
|
301
|
+
sessionStorage.setItem(cacheName, this.source ? JSON.stringify(this.source) : false);
|
|
302
|
+
sessionStorage.setItem(createdCacheName, Math.round(new Date() / 1000));
|
|
313
303
|
}
|
|
314
304
|
});
|
|
315
305
|
} else if (typeof this.item_id !== "undefined") {
|
package/src/Resource.vue
CHANGED
|
@@ -400,13 +400,13 @@ export default {
|
|
|
400
400
|
selectItem: function (o, i) {
|
|
401
401
|
this.resetItems();
|
|
402
402
|
o.isSelected = true;
|
|
403
|
-
this.html = `<a class="e-jx3-item e-jx3-item-q${o.Quality}" data-id="${o.id}" data-quality="${o.Quality}" target="_blank" href="${o.Link}">[${o.Name}]</a>`;
|
|
403
|
+
this.html = `<a class="e-jx3-item e-jx3-item-q${o.Quality}" data-mode="" data-id="${o.id}" data-quality="${o.Quality}" data-client="${this.client}" data-name="" data-desc="" data-level="${o.Level}" target="_blank" href="${o.Link}">[${o.Name}]</a>`;
|
|
404
404
|
},
|
|
405
405
|
selectIcon: function (o) {
|
|
406
406
|
this.resetItems();
|
|
407
407
|
o.isSelected = true;
|
|
408
408
|
this.html = `<img class="e-jx3-icon" src="${__iconPath}${this.iconDir}/${o.iconID}.png" alt="${o.iconID}"/>`;
|
|
409
|
-
console.log(this.html);
|
|
409
|
+
// console.log(this.html);
|
|
410
410
|
},
|
|
411
411
|
resetItems: function () {
|
|
412
412
|
let data = this[this.type];
|
package/src/Skill.vue
ADDED
|
File without changes
|
package/service/buff.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import $http from 'axios'
|
|
2
|
-
import {__node} from "@jx3box/jx3box-common/data/jx3box.json"
|
|
3
|
-
|
|
4
|
-
// 获取 buff 信息
|
|
5
|
-
const get_buff = (buff_id) => {
|
|
6
|
-
if (!buff_id) return
|
|
7
|
-
return $http({
|
|
8
|
-
method: 'GET',
|
|
9
|
-
// https://node.jx3box.com/buff/id/103?strict=0&per=10&page=1
|
|
10
|
-
url: `${__node}buff/id/${buff_id}`,
|
|
11
|
-
headers: {Accept: "application/prs.helper.v2+json"},
|
|
12
|
-
withCredentials: true,
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
get_buff
|
|
18
|
-
}
|
package/service/skill.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import $http from 'axios'
|
|
2
|
-
import {__node} from "@jx3box/jx3box-common/data/jx3box.json"
|
|
3
|
-
|
|
4
|
-
// 获取 skill 信息
|
|
5
|
-
const get_skill = (skill_id) => {
|
|
6
|
-
if (!skill_id) return
|
|
7
|
-
return $http({
|
|
8
|
-
method: 'GET',
|
|
9
|
-
// https://node.jx3box.com/skill/id/103?strict=0&per=10&page=1
|
|
10
|
-
url: `${__node}skill/id/${skill_id}`,
|
|
11
|
-
headers: {Accept: "application/prs.helper.v2+json"},
|
|
12
|
-
withCredentials: true,
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
get_skill
|
|
18
|
-
}
|