zydx-plus 1.32.186 → 1.32.188

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": "zydx-plus",
3
- "version": "1.32.186",
3
+ "version": "1.32.188",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -67,7 +67,7 @@ export default {
67
67
  type: String,
68
68
  default: '每道多选题至少有两个正确项, 所有选项需给出至少一个答案'
69
69
  },
70
- isShow: { // 是否显示答案
70
+ isShow: {
71
71
  type: Boolean,
72
72
  default: true
73
73
  },
@@ -96,6 +96,12 @@ export default {
96
96
  letter: this.letter[index],
97
97
  value: ''
98
98
  })
99
+ this.option()
100
+ },
101
+ option() {
102
+ this.list.map((x, i) => {
103
+ x.letter = this.letter[i]
104
+ })
99
105
  },
100
106
  // 整理数据
101
107
  organize(v) {
@@ -161,7 +167,6 @@ export default {
161
167
  }
162
168
  }else {
163
169
  this.list.forEach(x => {
164
- console.log(x.value)
165
170
  arr.push({
166
171
  index: x.letter,
167
172
  content: [x.value]
@@ -182,15 +187,18 @@ export default {
182
187
  title: (str === 'correct')? '正确选项' : '干扰选项',
183
188
  list: [{value: ''}]
184
189
  })
190
+ this.option()
185
191
  },
186
192
  alternative(index) { // 切换选项
187
193
  this.list[index].list.push({value: ''})
188
194
  },
189
195
  del(index,ins) { // 删除选项
190
196
  this.list[index].list.splice(ins, 1)
197
+ this.option()
191
198
  },
192
199
  delOption(index) { // 删除选项
193
200
  this.list.splice(index, 1)
201
+ this.option()
194
202
  }
195
203
  }
196
204
  }
@@ -240,7 +248,7 @@ export default {
240
248
  color: #FF0000;
241
249
  }
242
250
  .list-title{
243
- padding: 2px 0 2px 10px;
251
+ padding: 2px 0;
244
252
  display: flex;
245
253
  justify-content: center;
246
254
  }
@@ -18,10 +18,10 @@ export function butJson (editor,data) {
18
18
  {name: '(左)黑体5号', key: 'blackLeft5'},
19
19
  ],
20
20
  html: {
21
- blackCenter4: `<p data-signId="title-1" id="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
22
- blackLeft4: `<p data-signId="title-2" id="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
23
- blackCenter5: `<p data-signId="title-3" id="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
24
- blackLeft5: `<p data-signId="title-4" id="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
21
+ blackCenter4: `<p data-signId="title-1" class="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
22
+ blackLeft4: `<p data-signId="title-2" class="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
23
+ blackCenter5: `<p data-signId="title-3" class="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
24
+ blackLeft5: `<p data-signId="title-4" class="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
25
25
  }
26
26
  },
27
27
  textMenu: {
@@ -142,9 +142,10 @@ function menusData(data,key) {
142
142
  return arr
143
143
  }
144
144
 
145
- // 随机id
145
+ // 随机
146
146
  function randomId() {
147
- return Math.random().toString(36).substr(2)
147
+ const id = Math.random().toString(36).substr(2)
148
+ return id.replace(/[0-9]/g, '')
148
149
  }
149
150
 
150
151
  // 时间
@@ -224,7 +224,7 @@ export default {
224
224
  readOnlyPage() {
225
225
  this.htmlArr = []
226
226
  const data = document.querySelectorAll('.editing-cont')[0].childNodes[0].childNodes
227
- let max = 1123
227
+ let max = 1110
228
228
  let pHeight = 0
229
229
  let html = ''
230
230
  for (let i = 0; i < data.length; i++) {
@@ -235,10 +235,13 @@ export default {
235
235
  html = ''
236
236
  }
237
237
  if((pHeight + text) > max) {
238
- // console.log(this.rows(data[i],(pHeight + text) - max))
238
+ console.log(this.rows(data[i],(pHeight + text) - max))
239
+ const {start,end} = this.rows(data[i],pHeight - max)
240
+ html += `<p>${start}</p>`
239
241
  this.htmlArr.push(html)
240
242
  pHeight = 0
241
243
  html = ''
244
+ html += `<p>${end}</p>`
242
245
  }
243
246
  pHeight += text + 5
244
247
  html += data[i].outerHTML
@@ -603,7 +606,7 @@ export default {
603
606
  height: 100%;
604
607
  }
605
608
  :deep(.read-only-p p) {
606
- margin: 5px 0;
609
+ line-height: 25px;
607
610
  }
608
611
  .read-only-a{
609
612
  position: absolute;
@@ -692,7 +695,7 @@ label{
692
695
  margin: 10px 0;
693
696
  }
694
697
  .editing-cont :deep(p) {
695
- margin: 10px 0;
698
+ line-height: 25px;
696
699
  }
697
700
  li{
698
701
  list-style: none;
@@ -85,6 +85,7 @@ import Color from '@tiptap/extension-color'
85
85
  import textStyle from '@tiptap/extension-text-style'
86
86
  import { sid } from "./sign-id";
87
87
  import { FontSize } from "./font-size";
88
+ import { titleId } from "./title-id";
88
89
  export default {
89
90
  name: 'zydx-xiao-editor',
90
91
  components: {
@@ -184,7 +185,7 @@ export default {
184
185
  },
185
186
  placeholder: {
186
187
  type: String,
187
- default: ''
188
+ default: '请输入内容'
188
189
  }
189
190
  },
190
191
  emits: ['see','del','complete','update:data','enclosureSuccess','download','updateData'],
@@ -220,6 +221,7 @@ export default {
220
221
  StarterKit,
221
222
  textStyle,
222
223
  FontSize,
224
+ titleId,
223
225
  Color.configure({
224
226
  types: ['textStyle'],
225
227
  }),
@@ -405,7 +407,7 @@ export default {
405
407
  if(v === 'center' || v === 'left' || v === 'right') this.editor.chain().focus().setTextAlign(v).run()
406
408
  if(v === 'add') {
407
409
  let html = this.editor.getHTML()
408
- html += '<p style="text-align: right;"><span style="color: #999;">请填来源</span></p>'
410
+ html += '<p class="source" style="text-align: right;"><span></span></p>'
409
411
  this.editor.commands.setContent(html)
410
412
  }
411
413
  if(v === 'centerH2') this.editor.chain().focus().setFontSize('16px').setBold().setTextAlign('center').run()
@@ -441,6 +443,13 @@ export default {
441
443
  pointer-events: none;
442
444
  height: 0;
443
445
  }
446
+ :deep(.source).is-empty::before {
447
+ color: #adb5bd;
448
+ content: '添加来源';
449
+ float: right;
450
+ height: 0;
451
+ pointer-events: none;
452
+ }
444
453
  :deep(.editor-img){
445
454
  max-width: 100%;
446
455
  }
@@ -0,0 +1,33 @@
1
+ import { Extension } from '@tiptap/core'
2
+
3
+ export const titleId = Extension.create({
4
+ name: 'titleId',
5
+
6
+ addOptions() {
7
+ return {
8
+ types: ['heading', 'paragraph'],
9
+ }
10
+ },
11
+
12
+ addGlobalAttributes() {
13
+ return [
14
+ {
15
+ types: this.options.types,
16
+ attributes: {
17
+ titleId: {
18
+ default: null,
19
+ parseHTML: element => element.getAttribute('class'),
20
+ renderHTML: attributes => {
21
+ if (!attributes.titleId) {
22
+ return {}
23
+ }
24
+ return {
25
+ 'class': attributes.titleId,
26
+ }
27
+ },
28
+ },
29
+ },
30
+ },
31
+ ]
32
+ }
33
+ })
@@ -158,7 +158,7 @@ export default {
158
158
  let arr = []
159
159
  v.forEach(item => {
160
160
  arr.push({
161
- ...v,
161
+ ...item,
162
162
  quesType: item.quesType,
163
163
  quesName: item.quesName,
164
164
  easyScore: item.easyScore? item.easyScore: '',
@@ -166,4 +166,12 @@ input[name='check'] {
166
166
  }
167
167
  .subject-html :deep(p){
168
168
  margin: 2px 0;
169
+ }
170
+ .subject-html-title{
171
+ text-indent: 2em;
172
+ font-weight: bold;
173
+ font-size: 14px;
174
+ }
175
+ .subject-html-cont{
176
+ text-align: justify;
169
177
  }
@@ -6,7 +6,7 @@
6
6
  <div class="subject-title">
7
7
  <label>
8
8
  <input v-if="multipleShow" type="checkbox" :checked="item.checked" @change="checkboxChange($event,index)" name="check" />
9
- <span>{{ item.order }}.<em v-html="item.title"></em>
9
+ <span>{{ item.order }}.<em v-html="item.title"></em><em v-if="scoreShow">({{ item.score }}分)</em>
10
10
  <i class="subject-but" ref="subject">
11
11
  <b :style="{right: -item.right + 'px', top: item.top + 'px'}" v-if="butShow" ref="b">
12
12
  <button class="but" @click="modify(item)">修改</button>
@@ -29,7 +29,10 @@
29
29
  </div>
30
30
  </div>
31
31
  <div v-if="item.alist" class="subject-html">
32
- <div v-for="(item,index) in item.alist" v-html="item.amexontet"></div>
32
+ <div v-for="(item,index) in item.alist">
33
+ <div class="subject-html-title">{{ titleText }}{{ index + 1 }}</div>
34
+ <div class="subject-html-cont" v-html="item.annexContent"></div>
35
+ </div>
33
36
  </div>
34
37
  <div class="choice" v-if="item.testKey">
35
38
  <div class="choice-box" v-for="(ts,ind) in JSON.parse(item.testKey)">
@@ -83,6 +86,14 @@ export default {
83
86
  choice: {
84
87
  type: Boolean,
85
88
  default: false
89
+ },
90
+ titleText: {
91
+ type: String,
92
+ default: '材料'
93
+ },
94
+ scoreShow: {
95
+ type: Boolean,
96
+ default: false
86
97
  }
87
98
  },
88
99
  watch: {
@@ -95,7 +106,7 @@ export default {
95
106
  item.top = 0
96
107
  if(item.alist) {
97
108
  item.alist.map(x => {
98
- x.amexontet = json2html({node: "root",child: JSON.parse(x.amexontet)})
109
+ x.annexContent = json2html({node: "root",child: JSON.parse(x.annexContent)})
99
110
  return x
100
111
  })
101
112
  }
@@ -105,10 +116,11 @@ export default {
105
116
  const w = this.$refs.parer.offsetWidth
106
117
  for(let i = 0; i< this.$refs.subject.length; i++) {
107
118
  this.value[i].right = w - this.$refs.subject[i].offsetLeft
108
- if(this.value[i].right < this.$refs.b[i].offsetWidth) this.value[i].top = 25
119
+ if(this.$refs.b && this.$refs.b.length > 0) {
120
+ if(this.value[i].right < this.$refs.b[i].offsetWidth) this.value[i].top = 25
121
+ }
109
122
  }
110
123
  })
111
- console.log(this.value)
112
124
  },
113
125
  immediate: true,
114
126
  },
@@ -139,7 +151,7 @@ export default {
139
151
  return v.indexOf('101') > -1
140
152
  },
141
153
  styleText(v) {
142
- if(!v) return
154
+ if(!v || v === 'null') return
143
155
  const data = JSON.parse(v)
144
156
  for(let i=0; i< data.length; i++) {
145
157
  if(data[i].content[0].length > 20) {
@@ -4,7 +4,7 @@
4
4
  <slot></slot>
5
5
  </div>
6
6
  <div class="word-page" v-if="page">
7
- <div class="page-cont" v-for="(item,index) in htmlArr">
7
+ <div class="page-cont" v-for="(item,index) in htmlArr" :key="index">
8
8
  <div class="page-cont-html" v-html="item"></div>
9
9
  <div class="page-cont-num">{{ index + 1 }}/{{ htmlArr.length }}</div>
10
10
  </div>
@@ -15,11 +15,15 @@
15
15
  <script>
16
16
  import exportWord from 'js-export-word'
17
17
 
18
+
18
19
  export default {
19
20
  name: "zydx-paper",
20
21
  data() {
21
22
  return {
22
- htmlArr: []
23
+ htmlArr: [],
24
+ max: 823,
25
+ pHeight: 0,
26
+ html: ''
23
27
  }
24
28
  },
25
29
  props: {
@@ -43,35 +47,52 @@ export default {
43
47
  }
44
48
  }
45
49
  },
46
- mounted() {
47
- this.$nextTick(() => {
48
- this.init()
49
- })
50
- },
51
50
  methods: {
52
51
  init() {
53
- const slot = this.$slots.default()[0]
54
- let max = 1123
55
- let pHeight = 0
56
- let html = ''
57
- for (let i = 0; i < slot.children.length; i++) {
58
- const data = document.getElementsByClassName(slot.children[i].props.class)
59
- let text = data[0].offsetHeight
60
- if((pHeight + text) > max) {
61
- this.htmlArr.push(html)
62
- pHeight = 0
63
- html = ''
52
+ this.htmlArr = []
53
+ this.pHeight = 0
54
+ this.html = ''
55
+ setTimeout(() => {
56
+ const data = document.getElementById('test').children[0].childNodes
57
+ this.children(data)
58
+ },0)
59
+ },
60
+ children(data) {
61
+ for (let i = 0; i < data.length; i++) {
62
+ let text = data[i].offsetHeight
63
+ if((this.pHeight + text) > this.max) {
64
+ this.propsClass(data[i].children)
65
+ }else {
66
+ this.pHeight += text
67
+ this.html += data[i].outerHTML
64
68
  }
65
- pHeight += text
66
- html += data[0].outerHTML
67
- if(i === slot.children.length - 1) {
68
- this.htmlArr.push(html)
69
- pHeight = 0
70
- html = ''
69
+ if(i === data.length - 1) {
70
+ this.htmlArr.push(this.html)
71
+ this.pHeight = 0
72
+ this.html = ''
71
73
  break
72
74
  }
73
75
  }
74
76
  },
77
+ propsClass(data) {
78
+ for (let i = 0; i < data.length; i++) {
79
+ let text = data[i].offsetHeight
80
+ if((this.pHeight + text) > this.max) {
81
+ if(data[i].children.length === 0) {
82
+ this.htmlArr.push(this.html)
83
+ this.pHeight = 0
84
+ this.html = ''
85
+ this.pHeight += text
86
+ this.html += data[i].outerHTML
87
+ }else {
88
+ this.propsClass(data[i].children)
89
+ }
90
+ }else {
91
+ this.pHeight += text
92
+ this.html += data[i].outerHTML
93
+ }
94
+ }
95
+ },
75
96
  exportToWord() {
76
97
  const wrap = document.getElementById('test')
77
98
  const config = {
package/src/index.js CHANGED
@@ -77,7 +77,7 @@ function install(app) {
77
77
  }
78
78
 
79
79
  export default {
80
- version: '1.32.186',
80
+ version: '1.32.188',
81
81
  install,
82
82
  Calendar,
83
83
  Message,