@jx3box/jx3box-editor 2.2.21 → 2.2.23

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.
@@ -109,6 +109,12 @@
109
109
  font-weight: normal;
110
110
  }
111
111
 
112
+ .u-label-icon {
113
+ transform: scale(1.1);
114
+ width: 14px;
115
+ vertical-align: text-bottom;
116
+ }
117
+
112
118
  .u-desc {
113
119
  padding-right: @field-padding-right;
114
120
  }
@@ -118,6 +124,12 @@
118
124
  margin: 0;
119
125
  }
120
126
 
127
+ .u-spec-attribute.u-value::before {
128
+ content: "·";
129
+ .bold;
130
+ .u-orange;
131
+ }
132
+
121
133
  .u-orange {
122
134
  color: #ffa500;
123
135
  }
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -6,11 +6,11 @@
6
6
  export default (BindType) => {
7
7
  switch (BindType) {
8
8
  case 1:
9
- return '不绑定';
9
+ return '可交易';
10
10
  case 2:
11
- return '装备后绑定';
11
+ return '装备前可交易';
12
12
  case 3 :
13
- return '拾取后绑定';
13
+ return '不可交易';
14
14
  default:
15
15
  return '未知'
16
16
  }
package/jsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "paths": {
5
+ "@/*": ["./src/*"]
6
+ }
7
+ },
8
+ "exclude": ["node_modules"]
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-editor",
3
- "version": "2.2.21",
3
+ "version": "2.2.23",
4
4
  "description": "JX3BOX Article & Editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/service/item.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { $node, $cms } from "@jx3box/jx3box-common/js/https";
2
2
 
3
3
  // 获取物品
4
- function get_item(item_id, client) {
4
+ function get_item(item_id, client = 'std') {
5
5
  if (!item_id) return;
6
6
 
7
7
  return $node().get(`/resource/${client}/item_merged.${item_id}`);
package/src/Item.vue CHANGED
@@ -5,99 +5,194 @@
5
5
  :class="{
6
6
  'c-item-equipment': source.AucGenre >= 1 && source.AucGenre <= 4,
7
7
  'c-item-furniture': source.AucGenre == 21,
8
- }"
9
- >
8
+ }">
10
9
  <div class="c-item-wrapper">
11
10
  <!-- 精炼等级 -->
12
11
  <div v-if="source.MaxStrengthLevel" class="u-max-strength-level">
13
- <span v-text="`精炼等级:0 / ${source.MaxStrengthLevel}`"></span>
12
+ <span
13
+ v-text="`精炼等级:0 / ${source.MaxStrengthLevel}`"></span>
14
14
  </div>
15
15
  <!-- 物品名称 -->
16
- <div class="u-title" :style="{ color: color(source.Quality) }" v-text="source.Name"></div>
16
+ <div
17
+ class="u-title"
18
+ :style="{ color: color(source.Quality) }"
19
+ v-text="source.Name"></div>
20
+ <!-- 装备类型 -->
21
+ <div class="u-usage" v-if="show_equip_usage">
22
+ <template v-if="source.EquipUsage == 1">
23
+ <img
24
+ class="u-label-icon"
25
+ src="../assets/img/item/pve.png"
26
+ alt="" />
27
+ <span>秘境挑战</span>
28
+ </template>
29
+ <template v-if="source.EquipUsage == 2">
30
+ <img
31
+ class="u-label-icon"
32
+ src="../assets/img/item/pvp.png"
33
+ alt="" />
34
+ <span>竞技对抗</span>
35
+ </template>
36
+ <template v-if="source.EquipUsage == 3">
37
+ <img
38
+ class="u-label-icon"
39
+ src="../assets/img/item/pvx.png"
40
+ alt="" />
41
+ <span>休闲</span>
42
+ </template>
43
+ </div>
17
44
  <!-- 绑定状态 -->
18
- <div v-if="source.BindType > 1" class="u-bind" v-text="bind(source.BindType)"></div>
45
+ <div
46
+ v-if="source.BindType > 1"
47
+ class="u-bind"
48
+ v-text="bind(source.BindType)"></div>
19
49
  <!-- 唯一 -->
20
- <div v-if="parseInt(source.MaxExistAmount) === 1" class="unique" v-text="'唯一'"></div>
50
+ <div
51
+ v-if="parseInt(source.MaxExistAmount) === 1"
52
+ class="unique"
53
+ v-text="'唯一'"></div>
21
54
  <!-- 存在时间 -->
22
55
  <div
23
56
  v-if="parseInt(source.MaxExistTime) > 0"
24
57
  class="u-max-exist-time"
25
- v-text="'限时时间:' + showDuration(source.MaxExistTime)"
26
- ></div>
58
+ v-text="'限时时间:' + showDuration(source.MaxExistTime)"></div>
27
59
  <!-- 最大拥有数 -->
28
60
  <div
29
61
  v-if="parseInt(source.MaxExistAmount) > 1"
30
62
  class="u-max-exist-amount"
31
- v-text="'最大拥有数:' + source.MaxExistAmount"
32
- ></div>
63
+ v-text="'最大拥有数:' + source.MaxExistAmount"></div>
33
64
  <!-- 武器类别 -->
34
- <div v-if="source.AucGenre == 1" class="u-weapon-type-label">近身武器</div>
35
- <div v-if="source.AucGenre == 2" class="u-weapon-type-label">远程武器</div>
65
+ <div v-if="source.AucGenre == 1" class="u-weapon-type-label"
66
+ >武器</div
67
+ >
68
+ <div v-if="source.AucGenre == 2" class="u-weapon-type-label"
69
+ >暗器</div
70
+ >
36
71
  <!-- 物品类型文案 -->
37
- <div v-if="source.TypeLabel" class="u-type-label" v-text="source.TypeLabel"></div>
72
+ <div
73
+ v-if="source.TypeLabel"
74
+ class="u-type-label"
75
+ v-text="source.TypeLabel"></div>
38
76
  <!-- 装备属性 -->
39
- <div class="u-attributes" v-if="source.attributes && source.attributes.length">
77
+ <div
78
+ class="u-attributes"
79
+ v-if="source.attributes && source.attributes.length">
40
80
  <div
41
- v-for="(attribute, key) in source.attributes"
81
+ v-for="(attribute, key) in common_attributes"
42
82
  :key="key"
43
83
  class="u-field"
44
- :class="[`u-${attribute.color}`]"
45
- >
84
+ :class="[`u-${attribute.color}`]">
46
85
  <span
47
86
  v-if="
48
87
  attribute.type == 'atMeleeWeaponAttackSpeedBase' ||
49
- attribute.type == 'atRangeWeaponAttackSpeedBase'
88
+ attribute.type == 'atRangeWeaponAttackSpeedBase'
50
89
  "
51
90
  class="u-value u-speed"
52
- v-text="attribute.label"
53
- ></span>
91
+ v-text="attribute.label"></span>
54
92
  <span
55
93
  v-else-if="attribute.type == 'atHorseAttribute'"
56
- class="u-value u-horse-attribute"
57
- >
94
+ class="u-value u-horse-attribute">
58
95
  <img
59
96
  v-if="attribute.icon_id > 0"
60
97
  class="u-horse-icon"
61
- :src="iconLink(attribute.icon_id)"
62
- />
63
- <div class="u-horse-desc" v-html="attribute.label"></div>
98
+ :src="iconLink(attribute.icon_id)" />
99
+ <div
100
+ class="u-horse-desc"
101
+ v-html="attribute.label"></div>
64
102
  </span>
65
103
  <span v-else class="u-value">
66
104
  <game-text :text="attribute.label"></game-text>
67
- <!-- <span
68
- class="u-yellow"
69
- v-text="
70
- attribute_percent(
71
- attribute.type,
72
- attribute.value
73
- )
74
- "
75
- ></span>-->
76
105
  </span>
77
106
  </div>
107
+ <template v-if="orange_std_attribute.length > 0">
108
+ <div class="u-spec-attribute-title u-yellow">
109
+ <img
110
+ class="u-label-icon"
111
+ src="../assets/img/item/std.png" />
112
+ <span>特殊属性效果</span>
113
+ </div>
114
+ <div
115
+ class="u-value u-spec-attribute"
116
+ v-for="(attribute, key) in orange_std_attribute"
117
+ :key="key">
118
+ <game-text :text="attribute.label"></game-text>
119
+ </div>
120
+ </template>
121
+ <template v-if="orange_wujie_attribute.length > 0">
122
+ <div class="u-spec-attribute-title u-yellow">
123
+ <img
124
+ class="u-label-icon"
125
+ src="../assets/img/item/wujie.png" />
126
+ <span>特殊属性效果</span>
127
+ </div>
128
+ <div
129
+ class="u-value u-spec-attribute"
130
+ v-for="(attribute, key) in orange_wujie_attribute"
131
+ :key="key">
132
+ <game-text :text="attribute.label"></game-text>
133
+ </div>
134
+ <div class="u-value u-spec-attribute u-orange"
135
+ >属性效果双端一致</div
136
+ >
137
+ </template>
78
138
  </div>
79
139
  <!-- 家具属性 -->
80
- <div class="u-furniture-attributes" v-if="source.furniture_attributes">
81
- <div class="u-field u-green" v-if="source.furniture_attributes.view">
82
- <span class="u-value" v-text="`观赏提高${source.furniture_attributes.view}`"></span>
140
+ <div
141
+ class="u-furniture-attributes"
142
+ v-if="source.furniture_attributes">
143
+ <div
144
+ class="u-field u-green"
145
+ v-if="source.furniture_attributes.view">
146
+ <span
147
+ class="u-value"
148
+ v-text="
149
+ `观赏提高${source.furniture_attributes.view}`
150
+ "></span>
83
151
  </div>
84
- <div class="u-field u-green" v-if="source.furniture_attributes.practical">
85
- <span class="u-value" v-text="`实用提高${source.furniture_attributes.practical}`"></span>
152
+ <div
153
+ class="u-field u-green"
154
+ v-if="source.furniture_attributes.practical">
155
+ <span
156
+ class="u-value"
157
+ v-text="
158
+ `实用提高${source.furniture_attributes.practical}`
159
+ "></span>
86
160
  </div>
87
- <div class="u-field u-green" v-if="source.furniture_attributes.hard">
88
- <span class="u-value" v-text="`坚固提高${source.furniture_attributes.hard}`"></span>
161
+ <div
162
+ class="u-field u-green"
163
+ v-if="source.furniture_attributes.hard">
164
+ <span
165
+ class="u-value"
166
+ v-text="
167
+ `坚固提高${source.furniture_attributes.hard}`
168
+ "></span>
89
169
  </div>
90
- <div class="u-field u-green" v-if="source.furniture_attributes.geomantic">
91
- <span class="u-value" v-text="`风水提高${source.furniture_attributes.geomantic}`"></span>
170
+ <div
171
+ class="u-field u-green"
172
+ v-if="source.furniture_attributes.geomantic">
173
+ <span
174
+ class="u-value"
175
+ v-text="
176
+ `风水提高${source.furniture_attributes.geomantic}`
177
+ "></span>
92
178
  </div>
93
- <div class="u-field u-green" v-if="source.furniture_attributes.interesting">
94
- <span class="u-value" v-text="`趣味提高${source.furniture_attributes.interesting}`"></span>
179
+ <div
180
+ class="u-field u-green"
181
+ v-if="source.furniture_attributes.interesting">
182
+ <span
183
+ class="u-value"
184
+ v-text="
185
+ `趣味提高${source.furniture_attributes.interesting}`
186
+ "></span>
95
187
  </div>
96
188
  </div>
97
189
  <!-- 镶嵌 -->
98
190
  <ul v-if="source.Diamonds" class="u-diamonds u-gray">
99
191
  <!-- 五行石 -->
100
- <li class="u-diamond" v-for="(label, key) in source.Diamonds" :key="key">
192
+ <li
193
+ class="u-diamond"
194
+ v-for="(label, key) in source.Diamonds"
195
+ :key="key">
101
196
  <span class="u-square"></span>
102
197
  <span class="u-text" v-text="`镶嵌孔:${label}`"></span>
103
198
  </li>
@@ -111,38 +206,36 @@
111
206
  <div
112
207
  v-if="source.Requires && source.Requires[7]"
113
208
  class="u-require-sex"
114
- v-text="source.Requires[7]"
115
- ></div>
209
+ v-text="source.Requires[7]"></div>
116
210
  <!-- 需要门派 -->
117
211
  <div
118
212
  v-if="source.Requires && source.Requires[6]"
119
213
  class="u-require-school"
120
- v-text="source.Requires[6]"
121
- ></div>
214
+ v-text="source.Requires[6]"></div>
122
215
  <!-- 需要等级 -->
123
216
  <div
124
217
  v-if="source.Requires && source.Requires[5]"
125
218
  class="u-require-level"
126
- v-text="source.Requires[5]"
127
- ></div>
219
+ v-text="source.Requires[5]"></div>
128
220
  <!-- 需要阵营 -->
129
221
  <div
130
222
  v-if="source.Requires && source.Requires[100]"
131
223
  class="u-require-camp"
132
- v-text="source.Requires[100]"
133
- ></div>
224
+ v-text="source.Requires[100]"></div>
134
225
  <!-- 需求宅邸等级 -->
135
226
  <div
136
227
  v-if="source.Requires && source.Requires[101]"
137
228
  class="u-require-homeland-level"
138
- v-text="source.Requires[101]"
139
- ></div>
229
+ v-text="source.Requires[101]"></div>
140
230
  <!-- 最大耐久度 -->
141
231
  <div
142
- v-if="source.AucGenre >= 1 && source.AucGenre <= 3 && source.MaxDurability"
232
+ v-if="
233
+ source.AucGenre >= 1 &&
234
+ source.AucGenre <= 3 &&
235
+ source.MaxDurability
236
+ "
143
237
  class="u-max-durability"
144
- v-text="'最大耐久度' + source.MaxDurability"
145
- ></div>
238
+ v-text="'最大耐久度' + source.MaxDurability"></div>
146
239
  <!-- 套装信息 -->
147
240
  <div v-if="source.Set" class="u-set">
148
241
  <br />
@@ -150,94 +243,120 @@
150
243
  class="u-yellow"
151
244
  v-text="
152
245
  `${source.Set.name}(1/${source.Set.siblings.length})`
153
- "
154
- ></div>
246
+ "></div>
155
247
  <ul class="u-set-siblings u-gray">
156
248
  <li
157
249
  v-for="(sibling, key) in source.Set.siblings"
158
250
  :key="key"
159
- v-text="sibling"
160
- :class="{ 'u-yellow': sibling == source.Name }"
161
- ></li>
251
+ :class="{
252
+ 'u-yellow':
253
+ sibling &&
254
+ (sibling == source.Name ||
255
+ sibling.includes(source.Name)),
256
+ }">
257
+ {{
258
+ sibling
259
+ .split("/")
260
+ .map(s => s.trim())
261
+ .sort((a, b) => a.localeCompare(b))
262
+ .join(" / ")
263
+ }}</li
264
+ >
162
265
  </ul>
163
266
  <br />
164
267
  <ul class="u-set-attributes u-gray">
165
268
  <li
166
269
  v-for="(attribute, key) in source.Set.attributes"
167
- :key="key"
168
- >
169
- <span>{{`[${key}]`}}</span>
170
- <game-text :client="client" :text="attribute" :ignore-color="true"></game-text>
270
+ :key="key">
271
+ <span>{{ `[${key}]` }}</span>
272
+ <game-text
273
+ :client="client"
274
+ :text="attribute"
275
+ :ignore-color="true"></game-text>
171
276
  </li>
172
277
  </ul>
173
278
  <br />
174
279
  </div>
175
280
  <!-- 图片 -->
176
281
  <div class="u-image-url" v-if="source.ImageUrl">
177
- <img :src="source.ImageUrl" @error.once="source.ImageUrl=null" />
282
+ <img
283
+ :src="source.ImageUrl"
284
+ @error.once="source.ImageUrl = null" />
178
285
  </div>
179
286
  <!-- 描述 -->
180
- <p
181
- v-if="source.Desc"
182
- class="u-desc u-yellow">
287
+ <p v-if="source.Desc" class="u-desc u-yellow">
183
288
  <game-text :client="client" :text="source.Desc"></game-text>
184
289
  </p>
185
290
  <!-- 五彩石属性 -->
186
- <p v-if="source.WuCaiHtml" class="u-desc" v-html="source.WuCaiHtml"></p>
291
+ <p
292
+ v-if="source.WuCaiHtml"
293
+ class="u-desc"
294
+ v-html="source.WuCaiHtml"></p>
187
295
  <!-- 品质等级 -->
188
- <div v-if="source.Level" class="u-level u-yellow" v-text="'品质等级' + source.Level"></div>
296
+ <div
297
+ v-if="source.Level"
298
+ class="u-level u-yellow"
299
+ v-text="'品质等级' + source.Level"></div>
189
300
  <!-- 装备分数 -->
190
301
  <div
191
- v-if="source.EquipmentRating"
302
+ v-if="Number(source.EquipmentRating)"
192
303
  class="u-equipment-rating u-orange"
193
- v-text="'装备分数' + source.EquipmentRating"
194
- ></div>
304
+ v-text="'装备分数' + source.EquipmentRating"></div>
195
305
  <!-- 推荐门派心法 -->
196
306
  <div
197
307
  v-if="source.Recommend"
198
308
  class="u-equipment-recommend"
199
- v-text="'推荐门派:' + source.Recommend"
200
- ></div>
309
+ v-text="'推荐门派:' + source.Recommend"></div>
201
310
  <!-- 冷却时间 -->
202
311
  <div
203
312
  v-if="source.CoolDown"
204
313
  class="u-equipment-recommend"
205
- v-text="'使用间隔' + second_format(source.CoolDown)"
206
- ></div>
314
+ v-text="'使用间隔' + second_format(source.CoolDown)"></div>
207
315
  <!-- 外观名称 -->
208
- <div v-if="source.Appearance" class="u-appearance" v-text="'外观名称:' + source.Appearance"></div>
316
+ <div
317
+ v-if="source.Appearance"
318
+ class="u-appearance"
319
+ v-text="'外观名称:' + source.Appearance"></div>
209
320
  <!-- 可收集门派 -->
210
321
  <div
211
322
  v-if="source.CanExterior"
212
323
  class="u-can-exterior"
213
- v-text="'外观:' + source.CanExterior"
214
- ></div>
324
+ v-text="'外观:' + source.CanExterior"></div>
215
325
  <!-- 储物箱共享 -->
216
326
  <div
217
327
  v-if="
218
328
  source.CanShared &&
219
- !(source.AucGenre >= 1 && source.AucGenre <= 4)
329
+ !(source.AucGenre >= 1 && source.AucGenre <= 4)
220
330
  "
221
331
  class="u-can-shared"
222
- >该物品可以放入账号储物箱共享。</div>
332
+ >该物品可以放入账号储物箱共享。</div
333
+ >
223
334
  <div
224
335
  v-if="
225
336
  source.CanShared &&
226
- source.AucGenre >= 1 &&
227
- source.AucGenre <= 4
337
+ source.AucGenre >= 1 &&
338
+ source.AucGenre <= 4
228
339
  "
229
340
  class="u-can-shared"
230
- >该装备未精炼、镶嵌、附魔、穿戴前可以放入账号储物箱共享。</div>
341
+ >该装备未精炼、镶嵌、附魔、穿戴前可以放入账号储物箱共享。</div
342
+ >
231
343
  <!-- 家具可交互可缩放 -->
232
344
  <div v-if="source.furniture_attributes" class="u-furniture-can">
233
345
  <span v-if="source.furniture_attributes.interact">可交互</span>
234
346
  <span
235
347
  v-if="source.furniture_attributes.scale_range"
236
- v-text="`可缩放(${source.furniture_attributes.scale_range.replace(';',' - ')}倍)`"
237
- ></span>
348
+ v-text="
349
+ `可缩放(${source.furniture_attributes.scale_range.replace(
350
+ ';',
351
+ ' - '
352
+ )}倍)`
353
+ "></span>
238
354
  </div>
239
355
  <!-- 物品来源 -->
240
- <div v-if="source.GetType" class="u-get-type" v-text="`物品来源:${source.GetType}`"></div>
356
+ <div
357
+ v-if="source.GetType"
358
+ class="u-get-type"
359
+ v-text="`物品来源:${source.GetType}`"></div>
241
360
  </div>
242
361
  </div>
243
362
  </template>
@@ -253,24 +372,24 @@ import color from "../assets/js/item/color.js";
253
372
  import { iconLink } from "@jx3box/jx3box-common/js/utils";
254
373
 
255
374
  import second_format from "../assets/js/item/second_format.js";
256
- import dayjs from 'dayjs';
257
- import duration from 'dayjs/plugin/duration'
375
+ import dayjs from "dayjs";
376
+ import duration from "dayjs/plugin/duration";
258
377
  dayjs.extend(duration);
259
378
 
260
379
  export default {
261
380
  name: "Item",
262
381
  props: {
263
382
  item: {
264
- type: Object
383
+ type: Object,
265
384
  },
266
385
  item_id: {
267
- type: String
386
+ type: String,
268
387
  },
269
388
  client: {
270
- type: String
389
+ type: String,
271
390
  },
272
391
  jx3ClientType: {
273
- type: Number
392
+ type: Number,
274
393
  },
275
394
  },
276
395
  data() {
@@ -279,35 +398,59 @@ export default {
279
398
  };
280
399
  },
281
400
  components: {
282
- GameText
401
+ GameText,
283
402
  },
284
- computed : {
403
+ computed: {
285
404
  // 兼容旧版传值
286
- env_client_id : function (){
287
- return location.href.includes('origin') ? 2 : 1
405
+ env_client_id: function () {
406
+ return location.href.includes("origin") ? 2 : 1;
288
407
  },
289
- client_id : function (){
290
- return this.jx3ClientType || this.env_client_id
408
+ client_id: function () {
409
+ return this.jx3ClientType || this.env_client_id;
291
410
  },
292
- client_by_id : function (){
293
- return this.client_id == 1 ? 'std' : 'origin'
411
+ client_by_id: function () {
412
+ return this.client_id == 1 ? "std" : "origin";
294
413
  },
295
414
  // 新版传值
296
- final_client : function (){
297
- return this.client || this.client_by_id
415
+ final_client: function () {
416
+ return this.client || this.client_by_id;
417
+ },
418
+ cache_key: function () {
419
+ return `item-${this.final_client}-${this.item_id}`;
420
+ },
421
+ // 是否展示装备类型
422
+ show_equip_usage() {
423
+ if (Number(this.source?.AucGenre) === 1 && this.source.Quality > 4)
424
+ return false;
425
+ if ([1, 2, 3].includes(Number(this.source?.AucGenre))) return true;
426
+ if (this.source?.AucGenre == 4 && this.source?.AucSubType < 4)
427
+ return true;
428
+ return false;
429
+ },
430
+ common_attributes() {
431
+ return this.source?.attributes?.filter(
432
+ item => item.color != "orange"
433
+ );
434
+ },
435
+ orange_std_attribute() {
436
+ return this.source?.attributes?.filter(
437
+ item => item.color == "orange" && !item.is_mobile
438
+ );
298
439
  },
299
- cache_key : function (){
300
- return `item-${this.final_client}-${this.item_id}`
440
+ orange_wujie_attribute() {
441
+ return this.source?.attributes?.filter(
442
+ item => item.color == "orange" && item.is_mobile
443
+ );
301
444
  },
302
445
  },
303
446
  methods: {
304
- iconLink : function (id){
305
- return iconLink(id,this.final_client)
447
+ iconLink: function (id) {
448
+ return iconLink(id, this.final_client);
306
449
  },
307
450
  second_format,
308
- showDuration : function (val){
309
- val = Number(val)
310
- return val && dayjs.duration(val).asDays().toFixed(0) + '';
451
+ showDuration: function (val) {
452
+ val = Number(val);
453
+ return val && dayjs.duration(val).asDays().toFixed(0) + "";
311
454
  },
312
455
  attribute_percent,
313
456
  bind,
@@ -331,23 +474,26 @@ export default {
331
474
  let _cache = sessionStorage.getItem(this.cache_key);
332
475
 
333
476
  // 本地读取缓存
334
- if(_cache){
335
- try{
336
- this.source = JSON.parse(_cache)
337
- }catch(e){
338
- console.log(e,'[Item]无法解析本地缓存')
477
+ if (_cache) {
478
+ try {
479
+ this.source = JSON.parse(_cache);
480
+ } catch (e) {
481
+ console.log(e, "[Item]无法解析本地缓存");
339
482
  }
340
483
 
341
- // 服务端拉取
342
- }else{
343
- get_item(this.item_id, this.final_client).then((res) => {
484
+ // 服务端拉取
485
+ } else {
486
+ get_item(this.item_id, this.final_client).then(res => {
344
487
  let item = res.data;
345
- let isValidItem = JSON.stringify(item) !== "{}"
346
- if(isValidItem){
347
- this.source = item
348
- sessionStorage.setItem(this.cache_key,JSON.stringify(this.source));
349
- }else{
350
- this.source = null
488
+ let isValidItem = JSON.stringify(item) !== "{}";
489
+ if (isValidItem) {
490
+ this.source = item;
491
+ sessionStorage.setItem(
492
+ this.cache_key,
493
+ JSON.stringify(this.source)
494
+ );
495
+ } else {
496
+ this.source = null;
351
497
  }
352
498
  });
353
499
  }
@@ -360,4 +506,4 @@ export default {
360
506
 
361
507
  <style lang="less">
362
508
  @import "../assets/css/module/item.less";
363
- </style>
509
+ </style>