zydx-plus 1.28.132 → 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.132",
3
+ "version": "1.28.134",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -1,12 +1,10 @@
1
1
  <template>
2
2
  <div class="drag-pop" :style="position">
3
- <div class="drag-head"
4
- :style="{'background-color':titleColor}"
5
- @mousedown="mousedown"
6
- @mousemove="mousemove"
7
- @mouseup="mouseup"
8
- @mouseleave="mousemove">
9
- <span>按住可拖动弹窗</span>
3
+ <div class="drag-head" :style="{'background-color':titleColor}">
4
+ <span @mousedown="mousedown"
5
+ @mousemove="mousemove"
6
+ @mouseup="mouseup"
7
+ @mouseleave="mousemove">按住可拖动弹窗</span>
10
8
  <i @click.stop="close"></i>
11
9
  </div>
12
10
  <div class="drag-cont" @mousemove="footMove" @mouseleave="footMove">
@@ -185,8 +183,17 @@ export default {
185
183
  }
186
184
  .drag-head span{
187
185
  text-align: center;
188
- width: 100%;
186
+ width: calc(100% - 30px);
189
187
  display: inline-block;
188
+ margin-right: 40px;
189
+ }
190
+ @keyframes linkDown {
191
+ 0% {
192
+ opacity: 0;
193
+ }
194
+ 100% {
195
+ opacity: 1;
196
+ }
190
197
  }
191
198
  .drag-pop {
192
199
  position: fixed;
@@ -194,6 +201,8 @@ export default {
194
201
  background-color: #fff;
195
202
  border-radius: 3px;
196
203
  z-index: 999;
204
+ animation: linkDown .3s linear forwards;
205
+ opacity: 0;
197
206
  }
198
207
  .drag-head{
199
208
  height: 30px;
@@ -2,7 +2,11 @@
2
2
  <div class="read">
3
3
  <vue-office-docx v-if="fileType === 'docx'" :src="url" style="height: 100%;" @rendered="renderedHandler" />
4
4
  <vue-office-excel v-if="fileType === 'xlsx'" :src="url" style="height: 100%;" @rendered="renderedHandler" />
5
- <div class="view-pdf" v-if="fileType === 'pdf'" id="canvas-wrap"></div>
5
+ <div class="view-pdf" v-if="fileType === 'pdf'">
6
+ <div class="pageContainer" v-for="(item,index) in idArr">
7
+ <canvas :id="item"></canvas>
8
+ </div>
9
+ </div>
6
10
  <div class="mp4" v-if="fileType === 'mp4'">
7
11
  <video :src="url" controls></video>
8
12
  </div>
@@ -11,7 +15,7 @@
11
15
  </div>
12
16
  <div v-if="loading" class="loading-back">
13
17
  <div class="loading-cont">
14
- <div class="loading">Loading</div>
18
+ <div class="loadings">Loading</div>
15
19
  </div>
16
20
  </div>
17
21
  </div>
@@ -40,6 +44,7 @@ export default {
40
44
  pdfPages: 0,
41
45
  loading: true,
42
46
  repeat: false,
47
+ idArr: []
43
48
  }
44
49
  },
45
50
  props: {
@@ -61,14 +66,14 @@ export default {
61
66
  },
62
67
  methods: {
63
68
  repeatInit() {
64
- if(this.repeat) return // 防止重复加载
69
+ if (this.repeat) return // 防止重复加载
65
70
  this.repeat = true
66
71
  this.loading = true
67
72
  this.fileType = this.url.split('.').pop()
68
- if(this.fileType === 'pdf') this.init()
73
+ if (this.fileType === 'pdf') this.init()
69
74
  setTimeout(() => {
70
75
  this.repeat = false
71
- },1000)
76
+ }, 1000)
72
77
  },
73
78
  renderedHandler() {
74
79
  this.loading = false
@@ -78,59 +83,44 @@ export default {
78
83
  const loadingTask = PdfJs.getDocument(this.url)
79
84
  loadingTask.promise.then((pdf) => {
80
85
  that.pdfPages = pdf.numPages // 获取pdf文件的总页数
81
- for (let i = 0; i < that.pdfPages; i++) {
82
- let inx = i+1
83
- pdf.getPage(inx).then(function (page) {
84
- let viewport = page.getViewport({scale: 1.3})
85
- return page.getOperatorList().then(function(opList) {
86
- let svgGfx = new PdfJs.SVGGraphics(page.commonObjs, page.objs)
87
- return svgGfx.getSVG(opList, viewport).then(function(svg) {
88
- that.svgArr.push({
89
- index: inx,
90
- width: viewport.width,
91
- height: viewport.height,
92
- data: svg
93
- })
94
- })
95
- })
96
- })
97
- }
86
+ let page = pdf.numPages
87
+ // if(that.pdfPages > 5) page = 5
88
+ that.getPDF(pdf,page)
98
89
  })
99
- setTimeout(() => {
100
- that.sortArr()
101
- },100)
102
90
  },
103
- // 数组根据索引排序
104
- sortArr() {
105
- for(let j = 0; j < this.svgArr.length;j++){
106
- let temp = this.svgArr[j],
107
- val = temp['index'],
108
- i = j-1;
109
- while(i >=0 && this.svgArr[i]['index']>val){
110
- this.svgArr[i+1] = this.svgArr[i];
111
- i = i-1;
112
- }
113
- this.svgArr[i+1] = temp;
91
+ getPDF(pdf,page) {
92
+ let that = this
93
+ for (let i = 0; i < page; i++) {
94
+ const id = 'canvas' + Math.random().toString(36).substr(2)
95
+ that.idArr.push(id)
96
+ pdf.getPage(that.idArr.length).then(function (page) {
97
+ let canvas = document.getElementById(id)
98
+ let ctx = canvas.getContext('2d');
99
+ let viewport = page.getViewport({scale: 1.35})
100
+ canvas.width = viewport.width * 2
101
+ canvas.height = viewport.height * 2
102
+ canvas.style.width = viewport.width + 'px'
103
+ canvas.style.height = viewport.height + 'px'
104
+ let renderContext = {
105
+ canvasContext: ctx,
106
+ viewport: viewport,
107
+ transform: [2, 0, 0, 2, 0, 0]
108
+ }
109
+ page.render(renderContext)
110
+ })
114
111
  }
115
- this.svgArr.forEach(x => {
116
- let container = document.createElement('div')
117
- container.id = 'canvas_' + x.index
118
- container.className = 'pageContainer'
119
- container.style.width = x.width + 'px'
120
- container.style.height = x.height + 'px'
121
- container.style.display = 'inline-block'
122
- container.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)'
123
- container.style.marginBottom = '5px'
124
- document.getElementById('canvas-wrap').appendChild(container)
125
- container.appendChild(x.data)
126
- })
127
- this.renderedHandler()
128
- },
112
+ that.renderedHandler()
113
+ }
129
114
  }
130
115
  }
131
116
  </script>
132
117
 
133
118
  <style scoped>
119
+ .pageContainer{
120
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
121
+ margin-bottom: 10px;
122
+ display: inline-block;
123
+ }
134
124
  .mp4,.mp3{
135
125
  width: 100%;
136
126
  }
@@ -171,7 +161,7 @@ export default {
171
161
  display: inline-block;
172
162
  margin: 0 auto;
173
163
  }
174
- .loading {
164
+ .loadings {
175
165
  display: inline-block;
176
166
  font-size: 28px;
177
167
  font-family: Arial, Helvetica, sans-serif;
@@ -182,7 +172,7 @@ export default {
182
172
  position: relative;
183
173
  }
184
174
 
185
- .loading::after {
175
+ .loadings::after {
186
176
  content: "Loading";
187
177
  position: absolute;
188
178
  left: 0;
@@ -136,7 +136,7 @@ export default {
136
136
  this.inputArr[index].value = file
137
137
  },
138
138
  isNumberKey(evt,index) {
139
- const charCode = (evt.which) ? evt.which : event.keyCode;
139
+ const charCode = (evt.which) ? evt.which : evt.keyCode;
140
140
  if(this.inputArr[index].value === undefined) return true
141
141
  let val = this.inputArr[index].value.toString()
142
142
  if (charCode === 46) {
@@ -1,3 +1,11 @@
1
+ @keyframes linkDown {
2
+ 0% {
3
+ opacity: 0;
4
+ }
5
+ 100% {
6
+ opacity: 1;
7
+ }
8
+ }
1
9
  .tip-popupWindowSearch{
2
10
  position: fixed;
3
11
  top: 0;
@@ -17,6 +25,8 @@
17
25
  border: 5px rgba(0, 0, 0, .1) solid;
18
26
  margin: 0 auto;
19
27
  box-sizing: border-box;
28
+ animation: linkDown .3s linear forwards;
29
+ opacity: 0;
20
30
  }
21
31
  .tip-boxContent{
22
32
  max-height: 600px;
@@ -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.132',
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