@jx3box/jx3box-editor 2.2.21 → 2.2.22

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.22",
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,119 @@
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 == source.Name ||
254
+ sibling?.includes(source.Name),
255
+ }">
256
+ {{
257
+ sibling
258
+ .split("/")
259
+ .map(s => s.trim())
260
+ .sort((a, b) => a.localeCompare(b))
261
+ .join(" / ")
262
+ }}</li
263
+ >
162
264
  </ul>
163
265
  <br />
164
266
  <ul class="u-set-attributes u-gray">
165
267
  <li
166
268
  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>
269
+ :key="key">
270
+ <span>{{ `[${key}]` }}</span>
271
+ <game-text
272
+ :client="client"
273
+ :text="attribute"
274
+ :ignore-color="true"></game-text>
171
275
  </li>
172
276
  </ul>
173
277
  <br />
174
278
  </div>
175
279
  <!-- 图片 -->
176
280
  <div class="u-image-url" v-if="source.ImageUrl">
177
- <img :src="source.ImageUrl" @error.once="source.ImageUrl=null" />
281
+ <img
282
+ :src="source.ImageUrl"
283
+ @error.once="source.ImageUrl = null" />
178
284
  </div>
179
285
  <!-- 描述 -->
180
- <p
181
- v-if="source.Desc"
182
- class="u-desc u-yellow">
286
+ <p v-if="source.Desc" class="u-desc u-yellow">
183
287
  <game-text :client="client" :text="source.Desc"></game-text>
184
288
  </p>
185
289
  <!-- 五彩石属性 -->
186
- <p v-if="source.WuCaiHtml" class="u-desc" v-html="source.WuCaiHtml"></p>
290
+ <p
291
+ v-if="source.WuCaiHtml"
292
+ class="u-desc"
293
+ v-html="source.WuCaiHtml"></p>
187
294
  <!-- 品质等级 -->
188
- <div v-if="source.Level" class="u-level u-yellow" v-text="'品质等级' + source.Level"></div>
295
+ <div
296
+ v-if="source.Level"
297
+ class="u-level u-yellow"
298
+ v-text="'品质等级' + source.Level"></div>
189
299
  <!-- 装备分数 -->
190
300
  <div
191
- v-if="source.EquipmentRating"
301
+ v-if="Number(source.EquipmentRating)"
192
302
  class="u-equipment-rating u-orange"
193
- v-text="'装备分数' + source.EquipmentRating"
194
- ></div>
303
+ v-text="'装备分数' + source.EquipmentRating"></div>
195
304
  <!-- 推荐门派心法 -->
196
305
  <div
197
306
  v-if="source.Recommend"
198
307
  class="u-equipment-recommend"
199
- v-text="'推荐门派:' + source.Recommend"
200
- ></div>
308
+ v-text="'推荐门派:' + source.Recommend"></div>
201
309
  <!-- 冷却时间 -->
202
310
  <div
203
311
  v-if="source.CoolDown"
204
312
  class="u-equipment-recommend"
205
- v-text="'使用间隔' + second_format(source.CoolDown)"
206
- ></div>
313
+ v-text="'使用间隔' + second_format(source.CoolDown)"></div>
207
314
  <!-- 外观名称 -->
208
- <div v-if="source.Appearance" class="u-appearance" v-text="'外观名称:' + source.Appearance"></div>
315
+ <div
316
+ v-if="source.Appearance"
317
+ class="u-appearance"
318
+ v-text="'外观名称:' + source.Appearance"></div>
209
319
  <!-- 可收集门派 -->
210
320
  <div
211
321
  v-if="source.CanExterior"
212
322
  class="u-can-exterior"
213
- v-text="'外观:' + source.CanExterior"
214
- ></div>
323
+ v-text="'外观:' + source.CanExterior"></div>
215
324
  <!-- 储物箱共享 -->
216
325
  <div
217
326
  v-if="
218
327
  source.CanShared &&
219
- !(source.AucGenre >= 1 && source.AucGenre <= 4)
328
+ !(source.AucGenre >= 1 && source.AucGenre <= 4)
220
329
  "
221
330
  class="u-can-shared"
222
- >该物品可以放入账号储物箱共享。</div>
331
+ >该物品可以放入账号储物箱共享。</div
332
+ >
223
333
  <div
224
334
  v-if="
225
335
  source.CanShared &&
226
- source.AucGenre >= 1 &&
227
- source.AucGenre <= 4
336
+ source.AucGenre >= 1 &&
337
+ source.AucGenre <= 4
228
338
  "
229
339
  class="u-can-shared"
230
- >该装备未精炼、镶嵌、附魔、穿戴前可以放入账号储物箱共享。</div>
340
+ >该装备未精炼、镶嵌、附魔、穿戴前可以放入账号储物箱共享。</div
341
+ >
231
342
  <!-- 家具可交互可缩放 -->
232
343
  <div v-if="source.furniture_attributes" class="u-furniture-can">
233
344
  <span v-if="source.furniture_attributes.interact">可交互</span>
234
345
  <span
235
346
  v-if="source.furniture_attributes.scale_range"
236
- v-text="`可缩放(${source.furniture_attributes.scale_range.replace(';',' - ')}倍)`"
237
- ></span>
347
+ v-text="
348
+ `可缩放(${source.furniture_attributes.scale_range.replace(
349
+ ';',
350
+ ' - '
351
+ )}倍)`
352
+ "></span>
238
353
  </div>
239
354
  <!-- 物品来源 -->
240
- <div v-if="source.GetType" class="u-get-type" v-text="`物品来源:${source.GetType}`"></div>
355
+ <div
356
+ v-if="source.GetType"
357
+ class="u-get-type"
358
+ v-text="`物品来源:${source.GetType}`"></div>
241
359
  </div>
242
360
  </div>
243
361
  </template>
@@ -253,24 +371,24 @@ import color from "../assets/js/item/color.js";
253
371
  import { iconLink } from "@jx3box/jx3box-common/js/utils";
254
372
 
255
373
  import second_format from "../assets/js/item/second_format.js";
256
- import dayjs from 'dayjs';
257
- import duration from 'dayjs/plugin/duration'
374
+ import dayjs from "dayjs";
375
+ import duration from "dayjs/plugin/duration";
258
376
  dayjs.extend(duration);
259
377
 
260
378
  export default {
261
379
  name: "Item",
262
380
  props: {
263
381
  item: {
264
- type: Object
382
+ type: Object,
265
383
  },
266
384
  item_id: {
267
- type: String
385
+ type: String,
268
386
  },
269
387
  client: {
270
- type: String
388
+ type: String,
271
389
  },
272
390
  jx3ClientType: {
273
- type: Number
391
+ type: Number,
274
392
  },
275
393
  },
276
394
  data() {
@@ -279,35 +397,59 @@ export default {
279
397
  };
280
398
  },
281
399
  components: {
282
- GameText
400
+ GameText,
283
401
  },
284
- computed : {
402
+ computed: {
285
403
  // 兼容旧版传值
286
- env_client_id : function (){
287
- return location.href.includes('origin') ? 2 : 1
404
+ env_client_id: function () {
405
+ return location.href.includes("origin") ? 2 : 1;
288
406
  },
289
- client_id : function (){
290
- return this.jx3ClientType || this.env_client_id
407
+ client_id: function () {
408
+ return this.jx3ClientType || this.env_client_id;
291
409
  },
292
- client_by_id : function (){
293
- return this.client_id == 1 ? 'std' : 'origin'
410
+ client_by_id: function () {
411
+ return this.client_id == 1 ? "std" : "origin";
294
412
  },
295
413
  // 新版传值
296
- final_client : function (){
297
- return this.client || this.client_by_id
414
+ final_client: function () {
415
+ return this.client || this.client_by_id;
416
+ },
417
+ cache_key: function () {
418
+ return `item-${this.final_client}-${this.item_id}`;
419
+ },
420
+ // 是否展示装备类型
421
+ show_equip_usage() {
422
+ if (Number(this.source?.AucGenre) === 1 && this.source.Quality > 4)
423
+ return false;
424
+ if ([1, 2, 3].includes(Number(this.source?.AucGenre))) return true;
425
+ if (this.source?.AucGenre == 4 && this.source?.AucSubType < 4)
426
+ return true;
427
+ return false;
428
+ },
429
+ common_attributes() {
430
+ return this.source?.attributes?.filter(
431
+ item => item.color != "orange"
432
+ );
433
+ },
434
+ orange_std_attribute() {
435
+ return this.source?.attributes?.filter(
436
+ item => item.color == "orange" && !item.is_mobile
437
+ );
298
438
  },
299
- cache_key : function (){
300
- return `item-${this.final_client}-${this.item_id}`
439
+ orange_wujie_attribute() {
440
+ return this.source?.attributes?.filter(
441
+ item => item.color == "orange" && item.is_mobile
442
+ );
301
443
  },
302
444
  },
303
445
  methods: {
304
- iconLink : function (id){
305
- return iconLink(id,this.final_client)
446
+ iconLink: function (id) {
447
+ return iconLink(id, this.final_client);
306
448
  },
307
449
  second_format,
308
- showDuration : function (val){
309
- val = Number(val)
310
- return val && dayjs.duration(val).asDays().toFixed(0) + '';
450
+ showDuration: function (val) {
451
+ val = Number(val);
452
+ return val && dayjs.duration(val).asDays().toFixed(0) + "";
311
453
  },
312
454
  attribute_percent,
313
455
  bind,
@@ -331,23 +473,26 @@ export default {
331
473
  let _cache = sessionStorage.getItem(this.cache_key);
332
474
 
333
475
  // 本地读取缓存
334
- if(_cache){
335
- try{
336
- this.source = JSON.parse(_cache)
337
- }catch(e){
338
- console.log(e,'[Item]无法解析本地缓存')
476
+ if (_cache) {
477
+ try {
478
+ this.source = JSON.parse(_cache);
479
+ } catch (e) {
480
+ console.log(e, "[Item]无法解析本地缓存");
339
481
  }
340
482
 
341
- // 服务端拉取
342
- }else{
343
- get_item(this.item_id, this.final_client).then((res) => {
483
+ // 服务端拉取
484
+ } else {
485
+ get_item(this.item_id, this.final_client).then(res => {
344
486
  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
487
+ let isValidItem = JSON.stringify(item) !== "{}";
488
+ if (isValidItem) {
489
+ this.source = item;
490
+ sessionStorage.setItem(
491
+ this.cache_key,
492
+ JSON.stringify(this.source)
493
+ );
494
+ } else {
495
+ this.source = null;
351
496
  }
352
497
  });
353
498
  }
@@ -360,4 +505,4 @@ export default {
360
505
 
361
506
  <style lang="less">
362
507
  @import "../assets/css/module/item.less";
363
- </style>
508
+ </style>