zydx-plus 1.17.77 → 1.18.79

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.17.77",
3
+ "version": "1.18.79",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -32,7 +32,9 @@
32
32
  "html2json": "^1.0.2",
33
33
  "@tiptap/extension-image": "^2.0.3",
34
34
  "@tiptap/starter-kit": "^2.0.3",
35
- "@tiptap/vue-3": "^2.0.3"
35
+ "@tiptap/vue-3": "^2.0.3",
36
+ "@vue-office/docx": "^1.1.3",
37
+ "@vue-office/excel": "^1.1.3"
36
38
  },
37
39
  "peerDependencies": {
38
40
  "vue": "^3.2.13"
@@ -643,11 +643,6 @@
643
643
  align-items: center;
644
644
  justify-content: space-between;
645
645
  }
646
-
647
- >>>.el-input__wrapper{
648
- height: 30px;
649
- }
650
-
651
646
  .el-select .el-input {
652
647
  width: 130px;
653
648
  }
@@ -107,6 +107,8 @@ export default {
107
107
  this.isMove = false;
108
108
  },
109
109
  close() {
110
+ this.isMove = false
111
+ this.footIsMove = false
110
112
  this.$emit('close');
111
113
  }
112
114
  }
@@ -140,6 +142,7 @@ export default {
140
142
  z-index: 1;
141
143
  display: inline-block;
142
144
  cursor: ns-resize;
145
+ user-select: none;
143
146
  }
144
147
  .in{
145
148
  position: absolute;
@@ -150,6 +153,7 @@ export default {
150
153
  z-index: 1;
151
154
  display: inline-block;
152
155
  cursor: nwse-resize;
156
+ user-select: none;
153
157
  }
154
158
  .right{
155
159
  position: absolute;
@@ -160,6 +164,7 @@ export default {
160
164
  z-index: 1;
161
165
  display: inline-block;
162
166
  cursor: ew-resize;
167
+ user-select: none;
163
168
  }
164
169
  .drag-head i {
165
170
  position: absolute;
@@ -191,6 +196,7 @@ export default {
191
196
  color: #fff;
192
197
  border-top-left-radius: 3px;
193
198
  border-top-right-radius: 3px;
199
+ user-select: none;
194
200
  }
195
201
  .drag-cont{
196
202
  height: calc(100% - 60px);
@@ -37,7 +37,7 @@ export default defineComponent({
37
37
  },
38
38
  readOnly: {
39
39
  type: Boolean,
40
- default: true
40
+ default: false
41
41
  },
42
42
  butShow: {
43
43
  type: Boolean,
@@ -61,6 +61,11 @@ export default defineComponent({
61
61
  }
62
62
  },
63
63
  emits: ['confirm'],
64
+ watch: {
65
+ html() {
66
+ this.formData.html = this.html
67
+ }
68
+ },
64
69
  methods: {
65
70
  confirm() {
66
71
  this.syncContent() //强制同步数据
@@ -4,7 +4,7 @@
4
4
  <div class="ed-title" v-if="titleShow">{{ title }}</div>
5
5
  <div class="ed-but" v-if="readOnly">
6
6
  <div class="ed-head-but" v-for="(item,index) in toolbar">
7
- <button v-if="item.key === 'but'" class="but" @click="item.onClick(item)" :style="{color: (item.active)? '#00ff00' :'#000'}">{{ item.title }}</button>
7
+ <button v-if="item.key === 'but'" class="but" @click="item.onClick(item,info)" :style="{color: (item.active)? '#00ff00' :'#000'}">{{ item.title }}</button>
8
8
  <label v-else-if="item.key === 'upImg' || item.key === 'uploadAtt'">
9
9
  <input type="file" @change="upload($event,item.key)" :accept="(item.key === 'upImg')?'image/*':'application/*'" style="display: none;">
10
10
  <span class="but">{{ item.title }}</span>
@@ -105,9 +105,19 @@ export default {
105
105
  uploadType: {
106
106
  type: Boolean,
107
107
  default: false
108
+ },
109
+ info: {
110
+ type: String,
111
+ default: ''
112
+ }
113
+ },
114
+ emits: ['see','complete','update:data'],
115
+ watch:{
116
+ data(e) {
117
+ this.editor.commands.setContent(json2html({node: "root",child: (e.html === undefined)? [] : e.html}))
118
+ this.uploadAttData = (e.enclosure === undefined)? [] : e.enclosure
108
119
  }
109
120
  },
110
- emits: ['see','complete'],
111
121
  mounted() {
112
122
  this.uploadAttData = (this.data.enclosure === undefined)? [] : this.data.enclosure
113
123
  this.heightStyle = (this.height === '100%')? {height: '100%'} : {'min-height': this.height}
@@ -162,7 +172,6 @@ export default {
162
172
  const file = e.target.files[0]
163
173
  if(this.uploadType) {
164
174
  if(v === 'uploadAtt') {
165
- console.log(file)
166
175
  this.uploadAttData.push(file)
167
176
  }else {
168
177
  this.uploadFile(file).then(r => {
@@ -219,7 +228,7 @@ export default {
219
228
  download(index) {
220
229
  const url = this.uploadImage.url + this.uploadAttData[index].filePath
221
230
  let a = document.createElement('a');
222
- a.style = 'display: none';
231
+ a.style.display = 'none';
223
232
  a.download = this.uploadAttData[index].filename;
224
233
  a.href = url;
225
234
  document.body.appendChild(a);
@@ -308,7 +317,7 @@ export default {
308
317
  }
309
318
  .editor{
310
319
  border-radius: 3px;
311
- padding: 20px;
320
+ padding: 10px;
312
321
  outline: none;
313
322
  }
314
323
  .editor img{
@@ -1,16 +1,26 @@
1
1
  <template>
2
2
  <div id="docView">
3
- <div class="pdf-container">
4
- <canvas :id="'pdf-canvas'+ index" v-for="(item,index) in pdfPages" class="pdf-canvas"></canvas>
5
- </div>
6
- <div class="book">
7
- <flipbook class="flipbook" :startPage="pageIndex" :pages="imgArr" @flip-left-end="flipLeft($event,false)" @flip-right-end="flipRight($event,false)" v-slot="flipbook" :singlePage="singlePage" :ambient="0" :gloss="1" :dragToFlip="false" :pagesHiRes="0">
8
- <div class="but" v-if="butShow">
9
- <button class="but-brown" :class="{'but-act': pageIndex === 1}" @click="flipbook.flipLeft">上一页</button>
10
- <button class="but-brown" :class="{'but-act': pageIndex === pdfPages}" @click="flipbook.flipRight">下一页</button>
11
- </div>
12
- </flipbook>
13
- </div>
3
+ <div v-show="show" class="load-pop">
4
+ <div class="load">
5
+ <span>文件较大耐心等待</span>
6
+ <div class="loading">
7
+ <div class="loading-cont" :style="{'width': loadWidth +'%'}"></div>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ <div v-show="!show" style="height: 100%;">
12
+ <div class="pdf-container">
13
+ <canvas :id="'pdf-canvas'+ index" v-for="(item,index) in pdfPages" class="pdf-canvas"></canvas>
14
+ </div>
15
+ <div class="book">
16
+ <flipbook class="flipbook" :startPage="pageIndex" :pages="imgArr" @flip-left-end="flipLeft($event,false)" @flip-right-end="flipRight($event,false)" v-slot="flipbook" :singlePage="singlePage" :ambient="0" :gloss="1" :dragToFlip="false" :pagesHiRes="0">
17
+ <div class="but" v-if="butShow">
18
+ <button class="but-brown" :class="{'but-act': pageIndex === 1}" @click="flipbook.flipLeft">上一页</button>
19
+ <button class="but-brown" :class="{'but-act': pageIndex === pdfPages}" @click="flipbook.flipRight">下一页</button>
20
+ </div>
21
+ </flipbook>
22
+ </div>
23
+ </div>
14
24
  </div>
15
25
  </template>
16
26
 
@@ -26,7 +36,10 @@ export default {
26
36
  pdfPages: 0,
27
37
  imgArr: [],
28
38
  hei: 0,
29
- pageIndex: this.page
39
+ pageIndex: this.page,
40
+ show: false,
41
+ load: 0,
42
+ loadWidth: 0
30
43
  }
31
44
  },
32
45
  props: {
@@ -74,6 +87,7 @@ export default {
74
87
  },
75
88
  readPdf() {
76
89
  let that = this
90
+ if(that.pdfPages > 30) that.show = true
77
91
  const loadingTask = PdfJs.getDocument(this.source)
78
92
  loadingTask.promise.then((pdf) => {
79
93
  that.pdfPages = pdf.numPages // 获取pdf文件的总页数
@@ -95,13 +109,28 @@ export default {
95
109
  viewport: viewport
96
110
  }
97
111
  page.render(renderContext)
112
+ if(that.pdfPages > 30) {
113
+ that.load = i + 1
114
+ that.loadWidth = Math.floor(that.load / that.pdfPages * 100)
115
+ }
98
116
  });
99
117
  }
100
- setTimeout(() => {
118
+ setTimeout(function () {
101
119
  for (let i = 0; i < that.pdfPages; i++) {
102
120
  const canvas = document.getElementById('pdf-canvas' + i)
103
121
  const dataURL = canvas.toDataURL("image/jpeg", 1); //获取Base64编码
104
122
  that.imgArr.push(dataURL)
123
+ that.load = i + 1
124
+ if(that.pdfPages > 30) {
125
+ if(that.load >= that.pdfPages) {
126
+ setTimeout(() => {
127
+ that.show = false
128
+ that.load = 0
129
+ },100)
130
+ }else {
131
+ that.loadWidth = Math.floor(that.load / that.pdfPages * 100)
132
+ }
133
+ }
105
134
  }
106
135
  }, 500)
107
136
  })
@@ -111,6 +140,40 @@ export default {
111
140
  </script>
112
141
 
113
142
  <style scoped>
143
+ .load-pop{
144
+ width: 100%;
145
+ height: 100%;
146
+ display: flex;
147
+ align-items: center;
148
+ }
149
+ .load{
150
+ display: inline-block;
151
+ margin: 0 auto;
152
+ }
153
+ .load>span{
154
+ display: inline-block;
155
+ width: 100%;
156
+ text-align: center;
157
+ padding-bottom: 10px;
158
+ font-size: 14px;
159
+ }
160
+ .loading{
161
+ width: 200px;
162
+ height: 10px;
163
+ border-radius: 20px;
164
+ position: relative;
165
+ overflow: hidden;
166
+ background-color: #ccc;
167
+ }
168
+ .loading-cont{
169
+ position: absolute;
170
+ top: 0;
171
+ left: 0;
172
+ z-index: 1;
173
+ background-color: #5daf34;
174
+ height: 100%;
175
+ border-radius: 20px;
176
+ }
114
177
  #docView{
115
178
  height: 100%;
116
179
  }
@@ -0,0 +1,6 @@
1
+ import main from './src/read.vue';
2
+
3
+ main.install = function(Vue) {
4
+ Vue.component(main.name, main);
5
+ };
6
+ export default main;
@@ -0,0 +1,131 @@
1
+ <template>
2
+ <div class="read">
3
+ <vue-office-docx v-if="fileType === 'docx'" :src="url" style="height: 100%;" />
4
+ <vue-office-excel v-if="fileType === 'xlsx' || fileType === 'xls'" :src="url" style="height: 100%;" />
5
+ <div class="view-pdf" v-if="fileType === 'pdf'" id="canvas-wrap"></div>
6
+ <div class="mp4" v-if="fileType === 'mp4'">
7
+ <video :src="url" controls></video>
8
+ </div>
9
+ <div class="mp3" v-if="fileType === 'mp3'">
10
+ <audio :src="url" controls></audio>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js' // 注意导入的写法
17
+ PdfJs.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.entry')
18
+ //引入VueOfficeDocx组件
19
+ import VueOfficeDocx from '@vue-office/docx'
20
+ //引入VueOfficeExcel组件
21
+ import VueOfficeExcel from '@vue-office/excel'
22
+ //引入相关样式
23
+ import '@vue-office/docx/lib/index.css'
24
+ //引入相关样式
25
+ import '@vue-office/excel/lib/index.css'
26
+ export default {
27
+ name: "zydx-read",
28
+ components: {VueOfficeDocx,VueOfficeExcel},
29
+ data() {
30
+ return {
31
+ fileType: null,
32
+ PdfJs: null,
33
+ svgArr: [],
34
+ container: null
35
+ }
36
+ },
37
+ props: {
38
+ url: {
39
+ type: String,
40
+ default: '',
41
+ pdfPages: 0
42
+ }
43
+ },
44
+ mounted() {
45
+ this.fileType = this.url.split('.').pop()
46
+ if(this.fileType === 'pdf') this.init()
47
+ },
48
+ methods: {
49
+ init() {
50
+ let that = this
51
+ const loadingTask = PdfJs.getDocument(this.url)
52
+ loadingTask.promise.then((pdf) => {
53
+ that.pdfPages = pdf.numPages // 获取pdf文件的总页数
54
+ for (let i = 0; i < that.pdfPages; i++) {
55
+ let inx = i+1
56
+ pdf.getPage(inx).then(function (page) {
57
+ let viewport = page.getViewport({scale: 1})
58
+ return page.getOperatorList().then(function(opList) {
59
+ let svgGfx = new PdfJs.SVGGraphics(page.commonObjs, page.objs)
60
+ return svgGfx.getSVG(opList, viewport).then(function(svg) {
61
+ that.svgArr.push({
62
+ index: inx,
63
+ width: viewport.width,
64
+ height: viewport.height,
65
+ data: svg
66
+ })
67
+ })
68
+ })
69
+ })
70
+ }
71
+ })
72
+ setTimeout(() => {
73
+ that.sortArr()
74
+ },100)
75
+ },
76
+ // 数组根据索引排序
77
+ sortArr() {
78
+ for(let j = 0; j < this.svgArr.length;j++){
79
+ let temp = this.svgArr[j],
80
+ val = temp['index'],
81
+ i = j-1;
82
+ while(i >=0 && this.svgArr[i]['index']>val){
83
+ this.svgArr[i+1] = this.svgArr[i];
84
+ i = i-1;
85
+ }
86
+ this.svgArr[i+1] = temp;
87
+ }
88
+ this.svgArr.forEach(x => {
89
+ let container = document.createElement('div')
90
+ container.id = 'canvas_' + x.index
91
+ container.className = 'pageContainer'
92
+ container.style.width = x.width + 'px'
93
+ container.style.height = x.height + 'px'
94
+ container.style.display = 'inline-block'
95
+ container.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)'
96
+ container.style.marginBottom = '5px'
97
+ document.getElementById('canvas-wrap').appendChild(container)
98
+ container.appendChild(x.data)
99
+ })
100
+ },
101
+ }
102
+ }
103
+ </script>
104
+
105
+ <style scoped>
106
+ .mp4,.mp3{
107
+ width: 100%;
108
+ }
109
+ .mp4 video,.mp3 audio{
110
+ width: 100%;
111
+ }
112
+ .view-pdf{
113
+ text-align: center;
114
+ height: 100%;
115
+ overflow: auto;
116
+ padding: 10px;
117
+ }
118
+ .view-pdf::-webkit-scrollbar {
119
+ width: 0
120
+ }
121
+ .read{
122
+ width: 100%;
123
+ height: 100%;
124
+ }
125
+ :deep(.vue-office-docx)::-webkit-scrollbar {
126
+ width: 0
127
+ }
128
+ :deep(.docx-wrapper) {
129
+ background-color: #fff;
130
+ }
131
+ </style>
@@ -5,7 +5,7 @@
5
5
  right: 0;
6
6
  bottom: 0;
7
7
  background-color: rgba(0, 0, 0, 0.2);
8
- z-index: 200;
8
+ z-index: 2000;
9
9
  display: flex;
10
10
  align-items: center;
11
11
  }
package/src/index.js CHANGED
@@ -20,6 +20,7 @@ import bizHeader from './components/biz_header/index';
20
20
  import editor2 from './components/editor2/index';
21
21
  import dragPopup from './components/dragPopup/index';
22
22
  import bizTaskInfo from './components/biz_taskInfo/index';
23
+ import read from './components/read/index';
23
24
 
24
25
  const components = [
25
26
  Calendar,
@@ -41,7 +42,8 @@ const components = [
41
42
  bizHeader,
42
43
  editor2,
43
44
  dragPopup,
44
- bizTaskInfo
45
+ bizTaskInfo,
46
+ read
45
47
  ];
46
48
 
47
49
  function install(app) {
@@ -53,7 +55,7 @@ function install(app) {
53
55
  }
54
56
 
55
57
  export default {
56
- version: '1.17.77',
58
+ version: '1.18.79',
57
59
  install,
58
60
  Calendar,
59
61
  Message,
@@ -76,6 +78,7 @@ export default {
76
78
  bizHeader,
77
79
  editor2,
78
80
  dragPopup,
79
- bizTaskInfo
81
+ bizTaskInfo,
82
+ read
80
83
  };
81
84