vue2-client 1.20.29 → 1.20.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.20.29",
3
+ "version": "1.20.30",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -7,7 +7,12 @@
7
7
  :source="bingliMd"
8
8
  :showUploadButton="false"
9
9
  @extracted="onExtracted"
10
+ @selection-change="onSelectionChange"
10
11
  />
12
+
13
+ <div class="demo-actions">
14
+ <button @click="getSelected">获取选中数据</button>
15
+ </div>
11
16
  </div>
12
17
  </template>
13
18
 
@@ -20,18 +25,50 @@ export default {
20
25
  components: { XMarkdownSectionExtractor },
21
26
  data () {
22
27
  return {
23
- bingliMd
28
+ bingliMd,
29
+ selectedItems: []
24
30
  }
25
31
  },
26
32
  mounted () {
27
- const keywords = ['下一步建议', '诊断依据']
33
+ const keywords = ['还需提问']
28
34
  this.$refs.extractor.extractAs(keywords, 'title-content', true)
35
+ const keywords2 = ['下一步建议']
36
+ this.$refs.extractor.extractAs(keywords2, 'title-content', true)
29
37
  },
30
38
  methods: {
31
39
  onExtracted (sections) {
32
40
  // eslint-disable-next-line no-console
33
41
  console.log('extracted sections:', sections)
42
+ },
43
+ onSelectionChange (selected) {
44
+ this.selectedItems = selected
45
+ },
46
+ getSelected () {
47
+ const selected = this.$refs.extractor.getSelectedItems()
48
+ // eslint-disable-next-line no-console
49
+ console.log('selected items:', selected)
50
+ alert(`已选中 ${selected.length} 条数据,已输出到控制台`)
34
51
  }
35
52
  }
36
53
  }
37
54
  </script>
55
+
56
+ <style lang="less" scoped>
57
+ .demo-actions {
58
+ margin-top: 16px;
59
+
60
+ button {
61
+ padding: 8px 16px;
62
+ background: #1890ff;
63
+ color: #fff;
64
+ border: none;
65
+ border-radius: 4px;
66
+ cursor: pointer;
67
+ font-size: 14px;
68
+
69
+ &:hover {
70
+ background: #40a9ff;
71
+ }
72
+ }
73
+ }
74
+ </style>
@@ -18,7 +18,13 @@
18
18
  <div v-for="(item, iIdx) in sec.items" :key="iIdx" class="item-block">
19
19
  <div class="item-title">{{ item.title }}</div>
20
20
  <div v-if="item.content.length" class="item-list">
21
- <div v-for="(c, cIdx) in item.content" :key="cIdx" class="list-item">
21
+ <div
22
+ v-for="(c, cIdx) in item.content"
23
+ :key="cIdx"
24
+ class="list-item"
25
+ :class="{ 'is-selected': isItemSelected(idx, iIdx, cIdx) }"
26
+ @click="toggleItem(idx, iIdx, cIdx)"
27
+ >
22
28
  <span class="item-number">{{ cIdx + 1 }}.</span> {{ c }}
23
29
  </div>
24
30
  </div>
@@ -86,7 +92,8 @@ export default {
86
92
  itemsByKey: {},
87
93
  formattedData: null,
88
94
  currentSource: null,
89
- renderedSections: []
95
+ renderedSections: [],
96
+ selectedItems: []
90
97
  }
91
98
  },
92
99
  computed: {
@@ -210,9 +217,52 @@ export default {
210
217
  : []
211
218
  }))
212
219
  if (asComponent) {
213
- this.renderedSections = result
220
+ this.renderedSections = [...this.renderedSections, ...result]
214
221
  }
215
222
  return result
223
+ },
224
+ toggleItem (sectionIdx, itemIdx, contentIdx) {
225
+ const key = `${sectionIdx}-${itemIdx}-${contentIdx}`
226
+ const index = this.selectedItems.indexOf(key)
227
+ if (index > -1) {
228
+ this.selectedItems.splice(index, 1)
229
+ } else {
230
+ this.selectedItems.push(key)
231
+ }
232
+ this.$emit('selection-change', this.getSelectedItems())
233
+ },
234
+ isItemSelected (sectionIdx, itemIdx, contentIdx) {
235
+ const key = `${sectionIdx}-${itemIdx}-${contentIdx}`
236
+ return this.selectedItems.includes(key)
237
+ },
238
+ getSelectedItems () {
239
+ const selected = []
240
+ this.renderedSections.forEach((sec, secIdx) => {
241
+ if (Array.isArray(sec.items)) {
242
+ sec.items.forEach((item, itemIdx) => {
243
+ if (Array.isArray(item.content)) {
244
+ item.content.forEach((c, contentIdx) => {
245
+ const key = `${secIdx}-${itemIdx}-${contentIdx}`
246
+ if (this.selectedItems.includes(key)) {
247
+ selected.push({
248
+ sectionTitle: sec.sectionTitle,
249
+ sectionIndex: secIdx,
250
+ itemTitle: item.title,
251
+ itemIndex: itemIdx,
252
+ contentIndex: contentIdx,
253
+ content: c
254
+ })
255
+ }
256
+ })
257
+ }
258
+ })
259
+ }
260
+ })
261
+ return selected
262
+ },
263
+ clearSelection () {
264
+ this.selectedItems = []
265
+ this.$emit('selection-change', [])
216
266
  }
217
267
  }
218
268
  }
@@ -274,9 +324,16 @@ export default {
274
324
  }
275
325
 
276
326
  .list-item {
277
- padding: 4px 0;
327
+ padding: 4px 8px;
278
328
  color: #666;
279
329
  font-size: 13px;
330
+ border-radius: 4px;
331
+ cursor: pointer;
332
+
333
+ &.is-selected {
334
+ background-color: #e6f7ff;
335
+ color: #1890ff;
336
+ }
280
337
  }
281
338
 
282
339
  .item-number {
@@ -19,6 +19,25 @@
19
19
 
20
20
  ---
21
21
 
22
+ ### 还需提问
23
+
24
+ 1. **头痛是否与体位明显相关?**
25
+ - 平躺时加重、站立时减轻,提示可能存在颅内压增高。
26
+ - 咳嗽、用力时加重,提示颅内压增高或静脉窦血栓可能。
27
+ - 无体位变化,更支持偏头痛等原发性头痛。
28
+
29
+ 2. **是否存在近期体重变化、月经紊乱或激素使用?**
30
+ - 近期体重增加、停经,提示内分泌紊乱或特发性颅内高压(IIH)可能。
31
+ - 使用口服避孕药或激素替代治疗,是IIH的危险因素。
32
+ - 无激素使用,需排除其他结构性病变。
33
+
34
+ 3. **是否有视力变化或视野缺损?**
35
+ - 视物模糊、短暂视力丧失,提示视神经受压或IIH相关视神经病变。
36
+ - 视野缺损,需紧急评估视神经功能。
37
+ - 无视力问题,但视乳头水肿仍需重视。
38
+
39
+ ---
40
+
22
41
  ### 最可能的诊断:
23
42
 
24
43
  **特发性颅内压增高(IIH)**,尤其在育龄期肥胖女性中高发,但本例未提及体重情况。