@jx3box/jx3box-editor 1.2.0 → 1.2.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.
@@ -29,18 +29,19 @@
29
29
 
30
30
  .u-item {
31
31
  .db;
32
- border: 1px solid @border-hr;
32
+ border: 2px solid @border-hr;
33
33
  background: #fafbfc;
34
34
  margin-bottom: 10px;
35
35
  padding: 10px 10px 10px 70px;
36
36
  min-height: 60px;
37
- .r(3px);
37
+ .r(6px);
38
38
  &:hover {
39
39
  background-color: #e7f9ff;
40
40
  }
41
41
  &.on {
42
42
  border-color: #34d058;
43
43
  background-color: #fff;
44
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
44
45
  // &:hover{
45
46
  // border:1px dashed #ddd;
46
47
  // background-color:#eee;
@@ -95,7 +96,7 @@
95
96
  .mb(5px);
96
97
  .db;
97
98
 
98
- .u-map, .u-life, {
99
+ .u-map, .u-life {
99
100
  .mr(20px)
100
101
  }
101
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-editor",
3
- "version": "1.2.0",
3
+ "version": "1.2.4",
4
4
  "description": "JX3BOX Article & Editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -41,6 +41,7 @@
41
41
  "axios": "^0.19.2",
42
42
  "core-js": "^3.6.5",
43
43
  "csslab": "^4.0.3",
44
+ "dayjs": "^1.10.7",
44
45
  "element-ui": "^2.13.2",
45
46
  "hevue-img-preview": "^5.0.0",
46
47
  "highlight.js": "^11.3.1",
package/service/item.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { $helper } from "@jx3box/jx3box-common/js/https";
2
2
 
3
3
  // 获取物品
4
- function get_item(item_id, client_id) {
4
+ function get_item(item_id, client) {
5
5
  if (!item_id) return;
6
-
7
6
  let options = {
8
- url: `api/item/${item_id}`,
7
+ url: `/api/item/${item_id}`,
8
+ params : {
9
+ client
10
+ }
9
11
  };
10
-
11
- return $helper({ mute: true,client_id : client_id })(options);
12
+ return $helper({ mute: true })(options);
12
13
  }
13
14
 
14
15
  // 获取清单
package/src/Item.vue CHANGED
@@ -22,7 +22,7 @@
22
22
  <div
23
23
  v-if="parseInt(source.MaxExistTime) > 0"
24
24
  class="u-max-exist-time"
25
- v-text="'存在时间:' + second_format(source.MaxExistTime)"
25
+ v-text="'限时时间:' + showDuration(source.MaxExistTime)"
26
26
  ></div>
27
27
  <!-- 最大拥有数 -->
28
28
  <div
@@ -242,36 +242,53 @@
242
242
 
243
243
  <script>
244
244
  import { get_item } from "../service/item.js";
245
- import second_format from "../assets/js/item/second_format.js";
245
+
246
246
  import attribute_percent from "../assets/js/item/attribute_percent.js";
247
247
  import bind from "../assets/js/item/bind.js";
248
248
  import color from "../assets/js/item/color.js";
249
249
  import { iconLink } from "@jx3box/jx3box-common/js/utils";
250
250
 
251
+ import second_format from "../assets/js/item/second_format.js";
252
+ import dayjs from 'dayjs';
253
+ import duration from 'dayjs/plugin/duration'
254
+ dayjs.extend(duration);
255
+
251
256
  export default {
252
257
  name: "Item",
253
- props: ["item", "item_id", "jx3ClientType"],
258
+ props: ["item", "item_id", "jx3ClientType","client"],
254
259
  data() {
255
260
  return {
256
261
  source: null,
257
262
  };
258
263
  },
259
264
  computed : {
265
+ // 兼容旧版传值
266
+ env_client_id : function (){
267
+ return location.href.includes('origin') ? 2 : 1
268
+ },
260
269
  client_id : function (){
261
- return this.jx3ClientType || 1
270
+ return this.jx3ClientType || this.env_client_id
271
+ },
272
+ client_by_id : function (){
273
+ return this.client_id == 1 ? 'std' : 'origin'
262
274
  },
263
- client : function (){
264
- return this.client_id == 1 ? 'std' : 'origin'
275
+ // 新版传值
276
+ final_client : function (){
277
+ return this.client || this.client_by_id
265
278
  },
266
279
  cache_key : function (){
267
- return `item-${this.client}-${this.item_id}`
280
+ return `item-${this.final_client}-${this.item_id}`
268
281
  },
269
282
  },
270
283
  methods: {
271
284
  iconLink : function (id){
272
- return iconLink(id,this.client)
285
+ return iconLink(id,this.final_client)
273
286
  },
274
287
  second_format,
288
+ showDuration : function (val){
289
+ val = Number(val)
290
+ return val && dayjs.duration(val).asDays().toFixed(0) + '天';
291
+ },
275
292
  attribute_percent,
276
293
  bind,
277
294
  color,
@@ -303,7 +320,7 @@ export default {
303
320
 
304
321
  // 服务端拉取
305
322
  }else{
306
- get_item(this.item_id, this.client_id).then((res) => {
323
+ get_item(this.item_id, this.final_client).then((res) => {
307
324
  let data = res.data;
308
325
  if (data.code === 200) {
309
326
  let item = data.data.item;
@@ -326,4 +343,4 @@ export default {
326
343
 
327
344
  <style lang="less">
328
345
  @import "../assets/css/module/item.less";
329
- </style>
346
+ </style>
package/src/Resource.vue CHANGED
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="c-resource">
3
3
  <!-- 上传触发按钮 -->
4
- <el-button class="u-switch" type="primary" @click="openDialog" :disabled="!enable"> <img class="u-icon" svg-inline src="../assets/img/jx3.svg" />剑三资源 </el-button>
4
+ <el-button class="u-switch" type="primary" @click="openDialog" :disabled="!enable"> <img class="u-icon" svg-inline src="../assets/img/jx3.svg" />插入资源 </el-button>
5
5
 
6
6
  <!-- 弹出界面 -->
7
7
  <el-dialog class="c-large-dialog" title="剑三数据库" :visible.sync="dialogVisible">
@@ -97,15 +97,19 @@
97
97
  <i class="el-icon-s-data"></i> 共找到 <b>{{ item.length }}</b> 条记录
98
98
  </p>
99
99
  <ul class="m-resource-list" v-if="item.length">
100
- <li v-for="(o, i) in item" :key="i" class="u-item" :class="{ on: o.isSelected }" @click="selectItem(o, i)" ref="item">
101
- <span class="u-id">ID:{{ o.id }}</span>
102
- <img class="u-pic" :title="'IconID:' + o.IconID" :src="iconURL(o.IconID)" />
103
- <span class="u-name">{{ o.Name }}</span>
104
- <span class="u-content" v-html="o.DescHtml"></span>
105
- <span class="u-remark">
106
- {{ o.Requirement }}
107
- </span>
108
- </li>
100
+ <el-popover popper-class="m-item-pop" :visible-arrow="false" trigger="hover" placement="left" v-for="(o, i) in item" :key="i">
101
+ <li slot="reference" class="u-item" :class="{ on: o.isSelected }" @click="selectItem(o, i)" ref="item">
102
+ <span class="u-id">ID:{{ o.id }}</span>
103
+ <img class="u-pic" :title="'IconID:' + o.IconID" :src="iconURL(o.IconID)" />
104
+ <span class="u-name">{{ o.Name }}</span>
105
+ <span class="u-content" v-html="o.DescHtml"></span>
106
+ <span class="u-remark">
107
+ {{ o.Requirement }}
108
+ </span>
109
+ </li>
110
+
111
+ <jx3-item :item_id="o.id"></jx3-item>
112
+ </el-popover>
109
113
  </ul>
110
114
  <el-alert v-if="!item.length && done" title="没有找到相关条目" type="info" show-icon></el-alert>
111
115
  </el-tab-pane>
@@ -193,12 +197,11 @@
193
197
  </template>
194
198
 
195
199
  <script>
196
- import axios from "axios";
197
200
  import { loadResource, loadStat, getIcons } from "../service/database";
198
201
  import { __ossRoot, __iconPath, __Root, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
199
202
  import detach_types from "../assets/data/detach_type.json";
200
- import User from "@jx3box/jx3box-common/js/user";
201
- import { iconLink } from "@jx3box/jx3box-common/js/utils";
203
+ import { iconLink,getLink } from "@jx3box/jx3box-common/js/utils";
204
+ import Item from './Item.vue';
202
205
  export default {
203
206
  name: "Resource",
204
207
  props: {
@@ -369,7 +372,7 @@ export default {
369
372
  // <img src="${this.iconURL(
370
373
  // o.IconID
371
374
  // )}">
372
- this.html = `<a data-type="buff" class="e-jx3-buff w-jx3-element ${o.CanCancel == 1 ? "isBuff" : "isDebuff"}" href="${this.getLink(
375
+ this.html = `<a data-type="buff" class="e-jx3-buff w-jx3-element ${o.CanCancel == 1 ? "isBuff" : "isDebuff"}" href="${this.getDbLink(
373
376
  "buff",
374
377
  this.client,
375
378
  o.BuffID,
@@ -383,7 +386,7 @@ export default {
383
386
  this.resetItems();
384
387
  o.isSelected = true;
385
388
  if (this.skill_mode == "simple") {
386
- this.html = `<a data-type="skill" class="e-jx3-skill w-jx3-element" href="${this.getLink("skill", this.client, o.SkillID, o.Level)}" data-client="${this.client}" data-id="${
389
+ this.html = `<a data-type="skill" class="e-jx3-skill w-jx3-element" href="${this.getDbLink("skill", this.client, o.SkillID, o.Level)}" data-client="${this.client}" data-id="${
387
390
  o.SkillID
388
391
  }" data-level="${o.Level}">[${o.Name}]</a>`;
389
392
  } else {
@@ -393,7 +396,7 @@ export default {
393
396
  selectItem: function(o, i) {
394
397
  this.resetItems();
395
398
  o.isSelected = true;
396
- this.html = `<a data-type="item" class="e-jx3-item e-jx3-item-q${o.Quality} w-jx3-element" data-mode="" data-id="${o.id}" data-quality="${o.Quality}" data-client="${this.client}" target="_blank" href="${o.Link}">[${o.Name}]</a>`;
399
+ this.html = `<a data-type="item" class="e-jx3-item e-jx3-item-q${o.Quality} w-jx3-element" data-mode="" data-id="${o.id}" data-quality="${o.Quality}" data-client="${this.client}" target="_blank" href="${this.getLink('item', o.id)}">[${o.Name}]</a>`;
397
400
  },
398
401
  selectIcon: function(o) {
399
402
  this.resetItems();
@@ -403,7 +406,7 @@ export default {
403
406
  selectNpc: function (o, i){
404
407
  this.resetItems()
405
408
  o.isSelected = true
406
- this.html = `<a data-type="npc" class="e-jx3-npc w-jx3-element" data-mode="" data-id="${o.ID}" data-client="${this.client}" target="_blank" href="${this.getLink("npc", this.client, o.ID, '')}">[${o.Name}]</a>`
409
+ this.html = `<a data-type="npc" class="e-jx3-npc w-jx3-element" data-mode="" data-id="${o.ID}" data-client="${this.client}" target="_blank" href="${this.getDbLink("npc", this.client, o.ID, '')}">[${o.Name}]</a>`
407
410
  },
408
411
  resetItems: function() {
409
412
  let data = this[this.type];
@@ -418,10 +421,14 @@ export default {
418
421
  iconURL: function(id) {
419
422
  return iconLink(id, this.client);
420
423
  },
421
- getLink: function(type, client, id, level) {
424
+ getDbLink: function(type, client, id, level) {
422
425
  let domain = client == "origin" ? __OriginRoot : __Root;
423
426
  return domain + "app/database/?type=" + type + `&query=${id}&level=${level}`;
424
427
  },
428
+ getLink : function (type,id){
429
+ let domain = this.client == "origin" ? __OriginRoot : __Root;
430
+ return domain + getLink(type,id).slice(1)
431
+ },
425
432
 
426
433
  // 杂项
427
434
  // ==============================
@@ -450,10 +457,18 @@ export default {
450
457
  created: function() {
451
458
  this.checkUA();
452
459
  },
453
- components: {},
460
+ components: {
461
+ 'jx3-item': Item
462
+ },
454
463
  };
455
464
  </script>
456
465
 
457
466
  <style lang="less">
458
467
  @import "../assets/css/resource.less";
468
+
469
+ .m-item-pop {
470
+ padding: 0 !important;
471
+ background: none !important;
472
+ border: none;
473
+ }
459
474
  </style>