zydx-plus 1.28.133 → 1.28.134

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.28.133",
3
+ "version": "1.28.134",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -0,0 +1,131 @@
1
+ .paper{
2
+ background: #fff;
3
+ padding: 40px;
4
+ border: 1px solid #ccc;
5
+ width: 793px;
6
+ margin: 0 auto;
7
+ }
8
+ .parer-name{
9
+ text-align: right;
10
+ }
11
+ .parer-name-list{
12
+ height: 25px;
13
+ line-height: 25px;
14
+ font-size: 12px;
15
+ }
16
+ .choice:after {
17
+ content: "";
18
+ clear: left;
19
+ display: block;
20
+ }
21
+ .text{
22
+ letter-spacing: 25px;
23
+ margin-right: -25px;
24
+ }
25
+ .parer-name-list span{
26
+ line-height: 25px;
27
+ display: inline-block;
28
+ }
29
+ .parer-name-list em{
30
+ display: inline-block;
31
+ min-width: 100px;
32
+ border-bottom: 1px solid #000;
33
+ height: 25px;
34
+ line-height: 25px;
35
+ text-align: left;
36
+ margin-left: 10px;
37
+ font-style: normal;
38
+ }
39
+ .parer-title{
40
+ padding: 30px 0;
41
+ text-align: center;
42
+ }
43
+ .parer-title span{
44
+ font-size: 14px;
45
+ }
46
+ .parer-title p{
47
+ font-size: 20px;
48
+ margin-top: 5px;
49
+ }
50
+ .parer-cont{
51
+ padding: 10px 0;
52
+ }
53
+ .parer-cont>p{
54
+ font-size: 12px;
55
+ line-height: 18px;
56
+ font-weight: bold;
57
+ }
58
+ .parer-cont>p>span{
59
+ font-weight: normal;
60
+ }
61
+ .parer-table{
62
+ width: 100%;
63
+ margin: 5px 0;
64
+ }
65
+ .parer-table>table{
66
+ width: 100%;
67
+ border-left: 1px solid #ccc;
68
+ border-top: 1px solid #ccc;
69
+ }
70
+ .parer-table>table th,.parer-table>table td{
71
+ line-height: 30px;
72
+ font-weight: normal;
73
+ text-align: center;
74
+ border-bottom: 1px solid #ccc;
75
+ border-right: 1px solid #ccc;
76
+ font-size: 14px;
77
+ }
78
+ .choice-title{
79
+ font-size: 16px;
80
+ font-weight: 700;
81
+ line-height: 23px;
82
+ }
83
+ .subject{
84
+ font-size: 14px;
85
+ line-height: 25px;
86
+ display: flex;
87
+ align-items: center;
88
+ }
89
+ .subject span{
90
+ flex: 1;
91
+ }
92
+ .choice-box{
93
+ text-indent: 2em;
94
+ line-height: 25px;
95
+ font-size: 14px;
96
+ margin: 2px 0;
97
+ position: relative;
98
+ }
99
+ .choice-box input{
100
+ position: absolute;
101
+ top: 7px;
102
+ left: 2em;
103
+ z-index: 1;
104
+ }
105
+ .choice-box span{
106
+ padding-left: 20px;
107
+ }
108
+ .paper-textarea{
109
+ width: calc(100% - 2em);
110
+ height: 85px;
111
+ margin-left: 2em;
112
+ resize: none;
113
+ padding: 10px;
114
+ box-sizing: border-box;
115
+ font-size: 14px;
116
+ }
117
+ .array-ch .choice-box{
118
+ float: left;
119
+ width: 50%;
120
+ }
121
+ .but{
122
+ margin-left: 5px;
123
+ font-size: 12px;
124
+ background-color: transparent;
125
+ border: 1px solid #000;
126
+ border-radius: 3px;
127
+ padding: 2px 5px;
128
+ cursor: pointer;
129
+ min-width: 60px;
130
+ height: 21px;
131
+ }
@@ -1,175 +1,79 @@
1
1
  <template>
2
- <div class="page">
3
- <div class="page-content" v-for="(item,index) in pages" :key="index" v-html="item"></div>
4
- </div>
2
+ <div class="paper">
3
+ <div class="parer-cont">
4
+ <div class="paper-choice" :class="{'array-ch': !styleText(item.testKey)}" v-for="(item,index) in data">
5
+ <div class="subject">
6
+ <span>{{ index + 1 }}.{{ item.title }}</span>
7
+ <div class="subject-but">
8
+ <button class="but" @click="modify(item)">修改</button>
9
+ <button class="but" @click="del(item)">删除</button>
10
+ </div>
11
+ </div>
12
+ <div class="choice">
13
+ <div class="choice-box" v-for="(ts,ind) in JSON.parse(item.testKey)">
14
+ <label>
15
+ <input :disabled="disabled" :type="ques(item.quesType)?'radio':'checkbox'" :name="index" />
16
+ <span>{{ ts.index }}. {{ ts.content[0] }}</span>
17
+ </label>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </div>
5
23
  </template>
6
24
 
7
25
  <script>
8
- import katex from "katex";
9
- import "katex/dist/katex.css";
26
+
10
27
  export default {
11
- name: "zydx-word",
28
+ name: "zydx-paper",
12
29
  data() {
13
30
  return {
14
- perPage: 40,
15
- pages: [],
16
- imgList: [], // 图片列表
17
- strNum: 76, // 每行字符数
18
- pagesText: '', // 每页内容
19
- start: 0
31
+ value: this.data
20
32
  }
21
33
  },
22
34
  props: {
23
- content: {
24
- type: String,
25
- default: ''
35
+ data: {
36
+ type: Array,
37
+ default: []
38
+ },
39
+ disabled: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ butShow: {
44
+ type: Boolean,
45
+ default: true
26
46
  }
27
47
  },
28
- mounted() {
29
- this.splitHtml(this.content, this.perPage)
48
+ watch: {
49
+ data: {
50
+ handler: function (val, oldVal) {
51
+ this.value = val
52
+ },
53
+ deep: true
54
+ }
30
55
  },
31
56
  methods: {
32
- ToString(data) {
33
- return katex.renderToString(data, {
34
- throwOnError: false,
35
- });
36
- },
37
- getImgHeight(imgs) {
38
- // 获取img标签里的图片地址
39
- imgs = imgs.join('')
40
- imgs = imgs.match(/<img.*?>/g)
41
- if (imgs === null) return
42
- for (let i = 0; i < imgs.length; i++) {
43
- // 获取图片地址
44
- imgs[i] = imgs[i].match(/src=".*?"/g)[0].replace(/src="|"/g, '')
45
- const img = new Image()
46
- img.src = imgs[i]
47
- img.onload = () => {
48
- let height = img.height
49
- let width = img.width
50
- // 计算图片比例
51
- const scale = height / width
52
- // 计算图片高度整数
53
- height = Math.floor(693 * scale)
54
- this.imgList.push({
55
- src: imgs[i],
56
- height: height,
57
- width: width,
58
- index: i
59
- })
60
- }
61
- }
57
+ modify(v) {
58
+ this.$emit('modify',v)
62
59
  },
63
- resetData() {
64
- this.start = 0
65
- this.pages.push(this.pagesText)
66
- this.pagesText = ''
60
+ del(v) {
61
+ this.$emit('del',v)
67
62
  },
68
- splitHtml(html, perPage) {
69
- const arr = html.split('</p>')
70
- this.getImgHeight(arr)
71
- setTimeout(() => {
72
- // 重新排序
73
- this.imgList.sort((a, b) => {
74
- return a.index - b.index
75
- })
76
- let imgIndex = 0
77
- // 筛选出标签里的内容
78
- for (let i = 0; i < arr.length; i++) {
79
- // 判断是否是最后一个
80
- if (arr.length - 1 === i) {
81
- this.pagesText += `${arr[i]}`
82
- this.resetData()
83
- break
84
- }
85
- if (this.start >= perPage) this.resetData()
86
- // 判断是否是img标签
87
- if (arr[i].indexOf('<img') > -1) {
88
- const h = this.imgList[imgIndex].height
89
- const w = this.imgList[imgIndex].width
90
- const src = this.imgList[imgIndex].src
91
- const hNum = Math.ceil(h / 27)
92
- if ((perPage - this.start) < hNum) this.resetData()
93
- this.start += hNum
94
- this.pagesText += `<p style="text-align: center;"><img style="width: ${(w < 693) ? w : 693}px;height: ${(h > 1020) ? 1020 : h}px;vertical-align: middle;padding: 14px 0" src="${src}" alt="" /></p>`
95
- imgIndex += 1
96
- } else {
97
- // 判断是否data-w-e-type="video"
98
- if (arr[i].indexOf('data-w-e-type="formula"') > -1) {
99
- // 获取公式内容
100
- const dataValue = arr[i].match(/data-value=".*?"/g)[0].replace(/data-value="|"/g, '')
101
- // 删除span标签
102
- arr[i] = arr[i].replace(/<span.*?>/g, '$')
103
- arr[i] = arr[i].replace(/<\/span>/g, '$')
104
- const sp = arr[i].split('$$')
105
- arr[i] = `${sp[0]}${this.ToString(dataValue)}${sp[1]}`
106
- }
107
- // 判断标签是否是h1-h6
108
- if (arr[i].indexOf('<h') > -1) {
109
- arr[i] = arr[i].replace(/<h[1-6]>/g, '<p style="font-size: 18px;font-weight: bold;">')
110
- arr[i] = arr[i].replace(/<\/h[1-6]>/g, '</p>')
111
- }
112
- const text = arr[i].replace(/<[^>]+>/g, '')
113
- const lenNum = Math.ceil(this.thatLenText(text,0).len / this.strNum)
114
- if ((perPage - this.start) < lenNum) {
115
- const { st, end, surplus } = this.thatLenText(text,(perPage - this.start),lenNum)
116
- this.pagesText += `<p>${st}</p>`
117
- this.resetData()
118
- this.start = surplus
119
- this.pagesText = `<p>${end}</p>`
120
- }else {
121
- this.start += (lenNum <= 0) ? 1 : lenNum
122
- this.pagesText += `${arr[i]}`
123
- }
124
- }
125
- }
126
- }, 200)
63
+ ques(v){
64
+ return v.indexOf('101') > -1
127
65
  },
128
- // 计算每行字符数
129
- thatLenText(data,num,lenNum) {
130
- let len = 0
131
- let st = ''
132
- let end = ''
133
- for(let i= 0; i < data.length; i++) {
134
- if(data[i].replace(/[^\u4e00-\u9fa5]/g, '')) {
135
- len += 2
136
- }else if(data[i].match(/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u2014|\u2026|\u2013]/g)) {
137
- len += 2
138
- }else if(data[i].match(/[a-zA-Z]/g)) {
139
- len += 1
140
- }else {
141
- len += 1
142
- }
143
- if(len <= num*this.strNum) {
144
- st += data[i]
145
- }else {
146
- end += data[i]
66
+ styleText(v) {
67
+ const data = JSON.parse(v)
68
+ for(let i=0; i< data.length; i++) {
69
+ if(data[i].content[0].length > 20) {
70
+ return true
147
71
  }
148
72
  }
149
- return {st, end, len, row: num-1, surplus: lenNum - num}
150
- }
73
+ return false
74
+ },
151
75
  }
152
76
  }
153
77
  </script>
154
78
 
155
- <style scoped>
156
- .page {
157
- text-align: center;
158
- width: 100%;
159
- }
160
-
161
- .page-content {
162
- width: 793px;
163
- height: 1122px;
164
- background-color: #fff;
165
- padding: 50px;
166
- display: inline-block;
167
- white-space: pre-wrap;
168
- text-align: left;
169
- box-shadow: 0 0 5px rgba(0, 0, 0, .5);
170
- margin-bottom: 30px;
171
- font-size: 18px;
172
- position: relative;
173
- box-sizing: border-box;
174
- }
175
- </style>
79
+ <style scoped src="./word.css"></style>
package/src/index.js CHANGED
@@ -14,7 +14,6 @@ import treeList from './components/treeList/index';
14
14
  import flip from './components/flip/index';
15
15
  import editor from './components/editor/index';
16
16
  import tab from './components/tab/index';
17
- import word from './components/word/index';
18
17
  import mind from './components/mind/index';
19
18
  import bizHeader from './components/biz_header/index';
20
19
  import editor2 from './components/editor2/index';
@@ -27,6 +26,7 @@ import input from './components/input/index';
27
26
  import time from './components/time/index';
28
27
  import preface from './components/preface/index';
29
28
  import choice from './components/choice/index';
29
+ import word from './components/word/index';
30
30
 
31
31
  const components = [
32
32
  Calendar,
@@ -43,7 +43,6 @@ const components = [
43
43
  flip,
44
44
  editor,
45
45
  tab,
46
- word,
47
46
  mind,
48
47
  bizHeader,
49
48
  editor2,
@@ -55,7 +54,8 @@ const components = [
55
54
  input,
56
55
  time,
57
56
  preface,
58
- choice
57
+ choice,
58
+ word
59
59
  ];
60
60
 
61
61
  function install(app) {
@@ -67,7 +67,7 @@ function install(app) {
67
67
  }
68
68
 
69
69
  export default {
70
- version: '1.28.133',
70
+ version: '1.28.134',
71
71
  install,
72
72
  Calendar,
73
73
  Message,
@@ -85,7 +85,6 @@ export default {
85
85
  flip,
86
86
  editor,
87
87
  tab,
88
- word,
89
88
  mind,
90
89
  bizHeader,
91
90
  editor2,
@@ -97,6 +96,7 @@ export default {
97
96
  input,
98
97
  time,
99
98
  preface,
100
- choice
99
+ choice,
100
+ word
101
101
  };
102
102