zydx-plus 1.19.94 → 1.19.96

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.19.94",
3
+ "version": "1.19.96",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -80,12 +80,10 @@ export default defineComponent({
80
80
  }
81
81
  },
82
82
  mounted() {
83
- setTimeout(() => {
84
83
  this.formData.html = this.html
85
84
  setTimeout(() => {
86
- if(this.readOnly) this.opts.editable.config.readOnly = this.readOnly
85
+ if(this.readOnly) this.opts.editable.config.readOnly = this.readOnly
87
86
  },0)
88
- },0)
89
87
  },
90
88
  setup(props) {
91
89
  const { opts, handle, instance, clearContent, syncContent, reloadEditor } = useWangEditor({
@@ -42,16 +42,14 @@ class signButtonMenu {
42
42
  let nodes = JSON.parse(JSON.stringify(node)) //拷贝一份
43
43
  if(typeCode(node,'attachment')) return
44
44
  const resume = {
45
- type: 'paragraph',
46
- children: [{
47
- type: 'attachment',
48
- fileName: signData.text,
49
- link: signData.ico,
50
- children: [{text:''}]
51
- }]
45
+ type: 'attachment',
46
+ fileName: signData.text,
47
+ link: signData.ico,
48
+ children: [{text:''}]
52
49
  }
53
50
  nodes.unshift(resume)
54
51
  editor.clear()
52
+ console.log(nodes)
55
53
  for(let i = 0; i < nodes.length; i++){
56
54
  editor.insertNode(nodes[i])
57
55
  }
@@ -166,6 +164,64 @@ class titleButtonMenu {
166
164
  }
167
165
  }
168
166
 
167
+ class literatureButtonMenu {
168
+ constructor(v) {
169
+ titleData = v
170
+ this.title = '参考文献' // 自定义菜单标题
171
+ this.tag = 'button'
172
+ }
173
+ // 获取菜单执行时的 value ,用不到则返回空 字符串或 false
174
+ getValue(editor) {
175
+ return false
176
+ }
177
+ // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false
178
+ isActive(editor) {
179
+ return false
180
+ }
181
+ // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false
182
+ isDisabled(editor) {
183
+ return false
184
+ }
185
+ // 点击菜单时触发的函数
186
+ exec(editor, value) {
187
+ if (this.isDisabled(editor)) return
188
+ const resume = {
189
+ type: 'attachment',
190
+ text: '[1]作者.期刊论文名称IJ1.期刊名称,发表年份(第几期):页码',
191
+ color: '#000000',
192
+ fontSize: '14px',
193
+ }
194
+ const resume2 = {
195
+ type: 'paragraph',
196
+ children: [{
197
+ text: '[2]作者.学位论文名称[D1.毕业院校所在城市:毕业院校,论文提交年份:页码',
198
+ color: '#000000',
199
+ fontSize: '14px',
200
+ }]
201
+ }
202
+ const resume3 = {
203
+ type: 'paragraph',
204
+ children: [{
205
+ text: '[3]作者.著作名称[M.出版社所在城市:出版社名称,出版年份:页码.',
206
+ color: '#000000',
207
+ fontSize: '14px',
208
+ }]
209
+ }
210
+ const resume4 = {
211
+ type: 'paragraph',
212
+ children: [{
213
+ text: '[4]作者.文章名称[N].报纸名称,发行日期(版面)',
214
+ color: '#000000',
215
+ fontSize: '14px',
216
+ }]
217
+ }
218
+ editor.insertNode(resume)
219
+ editor.insertNode(resume2)
220
+ editor.insertNode(resume3)
221
+ editor.insertNode(resume4)
222
+ }
223
+ }
224
+
169
225
  const signMenuConf = {
170
226
  key: 'signMenu',
171
227
  factory(v) {
@@ -186,7 +242,13 @@ const titleMenuConf = {
186
242
  return new titleButtonMenu(v)
187
243
  },
188
244
  }
245
+ const literatureMenuConf = {
246
+ key: 'literatureMenu',
247
+ factory(v) {
248
+ return new literatureButtonMenu(v)
249
+ },
250
+ }
189
251
 
190
252
  export const menuModule = {
191
- menus: [signMenuConf,redMenuConf,titleMenuConf]
253
+ menus: [signMenuConf,redMenuConf,titleMenuConf,literatureMenuConf]
192
254
  }
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  </div>
16
16
  <div class="ed-cont" :style="heightStyleCont">
17
- <div :style="{'border': (readOnly)? '1px solid #ccc': '0'}" v-if="editorShow">
17
+ <div :style="{'border': (borderShow)? '1px solid #ccc': '0'}" v-if="editorShow">
18
18
  <editor-content class="editor" :editor="editor" :style="heightStyleCont" />
19
19
  </div>
20
20
  <div class="editor-but" v-if="butText !== ''&& readOnly">
@@ -154,6 +154,10 @@ export default {
154
154
  editorShow: {
155
155
  type: Boolean,
156
156
  default: true
157
+ },
158
+ borderShow: {
159
+ type: Boolean,
160
+ default: true
157
161
  }
158
162
  },
159
163
  emits: ['see','del','complete','update:data'],
@@ -297,7 +301,7 @@ export default {
297
301
  const url = this.uploadImage.url + this.uploadAttData[index].filePath
298
302
  let a = document.createElement('a');
299
303
  a.style.display = 'none';
300
- a.download = this.uploadAttData[index].filename;
304
+ a.download = this.uploadAttData[index].filename? this.uploadAttData[index].filename : this.uploadAttData[index].annexName;
301
305
  a.href = url;
302
306
  document.body.appendChild(a);
303
307
  a.click();
@@ -1,135 +1,136 @@
1
1
  <template>
2
- <div id="docView">
3
- <div style="height: 100%;">
4
- <div class="book">
5
- <div class="pages">
6
- <div class="wrap" id="canvas-wrap">
7
- <div class="wrap-can">
8
- <canvas id="the-canvas"></canvas>
9
- </div>
10
- </div>
11
- <div class="page-but-left" :style="{cursor: pageIndex === 1?'default':'pointer'}" @click="flipLeft(pageIndex-=1,false)"></div>
12
- <div class="page-but-right" :style="{cursor: pageIndex === pdfPages?'default':'pointer'}" @click="flipRight(pageIndex+=1,false)"></div>
13
- <!-- <div class="paper z-in" :class="{'data-right': pages}">-->
14
- <!-- <div class="page page-2" id="canvas-wrap1"></div>-->
15
- <!-- <div class="page page-2-back" id="canvas-wrap2"></div>-->
16
- <!-- </div>-->
17
- <!-- <div class="paper z-in-ac">-->
18
- <!-- <div class="page page-2" id="canvas-wrap3"></div>-->
19
- <!-- <div class="page page-2-back" id="canvas-wrap4"></div>-->
20
- <!-- </div>-->
21
- </div>
22
- </div>
23
- <div class="but-wrap" v-if="butShow">
24
- <button class="but-brown" :disabled="pageIndex === 1" :class="{'but-act': pageIndex === 1}" @click="flipLeft(pageIndex-=1,false)">上一页</button>
25
- <button class="but-brown" :disabled="pageIndex === pdfPages" :class="{'but-act': pageIndex === pdfPages}" @click="flipRight(pageIndex+=1,false)">下一页</button>
26
- </div>
27
- </div>
28
- </div>
2
+ <div class="docView">
3
+ <div style="height: 100%;">
4
+ <div class="book">
5
+ <div class="pages">
6
+ <div class="wrap">
7
+ <div class="wrap-can">
8
+ <canvas :id="id"></canvas>
9
+ </div>
10
+ </div>
11
+ <div class="page-but-left" :style="{cursor: pageIndex === 1?'default':'pointer'}" @click="flipLeft(pageIndex-=1,false)"></div>
12
+ <div class="page-but-right" :style="{cursor: pageIndex === pdfPages?'default':'pointer'}" @click="flipRight(pageIndex+=1,false)"></div>
13
+ <!-- <div class="paper z-in" :class="{'data-right': pages}">-->
14
+ <!-- <div class="page page-2" id="canvas-wrap1"></div>-->
15
+ <!-- <div class="page page-2-back" id="canvas-wrap2"></div>-->
16
+ <!-- </div>-->
17
+ <!-- <div class="paper z-in-ac">-->
18
+ <!-- <div class="page page-2" id="canvas-wrap3"></div>-->
19
+ <!-- <div class="page page-2-back" id="canvas-wrap4"></div>-->
20
+ <!-- </div>-->
21
+ </div>
22
+ </div>
23
+ <div class="but-wrap" v-if="butShow">
24
+ <button class="but-brown" :disabled="pageIndex === 1" :class="{'but-act': pageIndex === 1}" @click="flipLeft(pageIndex-=1,false)">上一页</button>
25
+ <button class="but-brown" :disabled="pageIndex === pdfPages" :class="{'but-act': pageIndex === pdfPages}" @click="flipRight(pageIndex+=1,false)">下一页</button>
26
+ </div>
27
+ </div>
28
+ </div>
29
29
  </template>
30
30
 
31
31
  <script>
32
- import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js' // 注意导入的写法
33
- import { TextLayerBuilder } from 'pdfjs-dist/web/pdf_viewer'
32
+ import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js' // 注意导入的写法d
34
33
  PdfJs.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.entry')
35
34
  export default {
36
- name: "zydx-flip",
37
- data() {
38
- return {
39
- pdfPages: 0,
40
- imgArr: {},
41
- hei: 0,
42
- pageIndex: this.page,
43
- show: false,
44
- load: 0,
45
- loadWidth: 0,
46
- pages: false,
47
- pagesData: [],
48
- opacity: 1
49
- }
50
- },
51
- props: {
52
- source: {
53
- type: String,
54
- default: ''
35
+ name: "zydx-flip",
36
+ data() {
37
+ return {
38
+ pdfPages: 0,
39
+ imgArr: {},
40
+ hei: 0,
41
+ pageIndex: this.page,
42
+ show: false,
43
+ load: 0,
44
+ loadWidth: 0,
45
+ pages: false,
46
+ pagesData: [],
47
+ opacity: 1,
48
+ id: null
49
+ }
50
+ },
51
+ props: {
52
+ source: {
53
+ type: String,
54
+ default: ''
55
+ },
56
+ singlePage: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ butShow: {
61
+ type: Boolean,
62
+ default: true
63
+ },
64
+ page: {
65
+ type: Number,
66
+ default: 1
67
+ }
55
68
  },
56
- singlePage: {
57
- type: Boolean,
58
- default: false
69
+ watch: {
70
+ page: {
71
+ handler: function (val, oldVal) {
72
+ this.pageIndex = val
73
+ },
74
+ immediate: true
75
+ }
59
76
  },
60
- butShow: {
61
- type: Boolean,
62
- default: true
77
+ emits: ['flip'],
78
+ mounted() {
79
+ this.readPdf()
80
+ this.id = 'canvas-wrap' + Math.random().toString(36).substr(2)
63
81
  },
64
- page: {
65
- type: Number,
66
- default: 1
82
+ methods: {
83
+ flipLeft(e,v) {
84
+ if(e <= 1) {
85
+ this.pageIndex = 1
86
+ }else {
87
+ this.pageIndex = e
88
+ }
89
+ this.readPdf()
90
+ if(!v) {
91
+ this.$emit('flip', {
92
+ page: this.pageIndex,
93
+ total: this.pdfPages
94
+ })
95
+ }
96
+ },
97
+ flipRight(e,v) {
98
+ if(e >= this.pdfPages) {
99
+ this.pageIndex = this.pdfPages
100
+ }else {
101
+ this.pageIndex = e
102
+ }
103
+ this.readPdf()
104
+ if(!v) {
105
+ this.$emit('flip', {
106
+ page: this.pageIndex,
107
+ total: this.pdfPages
108
+ })
109
+ }
110
+ },
111
+ readPdf() {
112
+ let that = this
113
+ const loadingTask = PdfJs.getDocument(this.source)
114
+ loadingTask.promise.then((pdf) => {
115
+ that.pdfPages = pdf.numPages // 获取pdf文件的总页数
116
+ pdf.getPage(that.pageIndex).then(function (page) {
117
+ let canvas = document.getElementById(that.id)
118
+ let ctx = canvas.getContext('2d');
119
+ let viewport = page.getViewport({scale: 1})
120
+ canvas.width = viewport.width * 2
121
+ canvas.height = viewport.height * 2
122
+ canvas.style.width = viewport.width + 'px'
123
+ canvas.style.height = viewport.height + 'px'
124
+ let renderContext = {
125
+ canvasContext: ctx,
126
+ viewport: viewport,
127
+ transform: [2, 0, 0, 2, 0, 0]//这里会进行放大,解决模糊问题
128
+ }
129
+ page.render(renderContext)
130
+ })
131
+ })
132
+ }
67
133
  }
68
- },
69
- watch: {
70
- page: {
71
- handler: function (val, oldVal) {
72
- this.pageIndex = val
73
- },
74
- immediate: true
75
- }
76
- },
77
- emits: ['flip'],
78
- mounted() {
79
- this.readPdf()
80
- },
81
- methods: {
82
- flipLeft(e,v) {
83
- if(e <= 1) {
84
- this.pageIndex = 1
85
- }else {
86
- this.pageIndex = e
87
- }
88
- this.readPdf()
89
- if(!v) {
90
- this.$emit('flip', {
91
- page: this.pageIndex,
92
- total: this.pdfPages
93
- })
94
- }
95
- },
96
- flipRight(e,v) {
97
- if(e >= this.pdfPages) {
98
- this.pageIndex = this.pdfPages
99
- }else {
100
- this.pageIndex = e
101
- }
102
- this.readPdf()
103
- if(!v) {
104
- this.$emit('flip', {
105
- page: this.pageIndex,
106
- total: this.pdfPages
107
- })
108
- }
109
- },
110
- readPdf() {
111
- let that = this
112
- const loadingTask = PdfJs.getDocument(this.source)
113
- loadingTask.promise.then((pdf) => {
114
- that.pdfPages = pdf.numPages // 获取pdf文件的总页数
115
- pdf.getPage(that.pageIndex).then(function (page) {
116
- let canvas = document.getElementById('the-canvas')
117
- let ctx = canvas.getContext('2d');
118
- let viewport = page.getViewport({scale: 1})
119
- canvas.width = viewport.width * 2
120
- canvas.height = viewport.height * 2
121
- canvas.style.width = viewport.width + 'px'
122
- canvas.style.height = viewport.height + 'px'
123
- let renderContext = {
124
- canvasContext: ctx,
125
- viewport: viewport,
126
- transform: [2, 0, 0, 2, 0, 0]//这里会进行放大,解决模糊问题
127
- }
128
- page.render(renderContext)
129
- })
130
- })
131
- }
132
- }
133
134
  }
134
135
  </script>
135
136
 
@@ -176,27 +177,27 @@ export default {
176
177
  padding-bottom: 10px;
177
178
  font-size: 14px;
178
179
  }
179
- #docView{
180
- height: 100%;
180
+ .docView{
181
+ height: 100%;
181
182
  }
182
183
  .but-brown{
183
- background-color: #c64c10;
184
- padding: 0 20px;
185
- font-size: 12px;
186
- color: #fff;
187
- height: 24px;
188
- line-height: 24px;
189
- border-radius: 5px;
190
- border: 0;
191
- cursor: pointer;
192
- margin-left: 10px;
184
+ background-color: #c64c10;
185
+ padding: 0 20px;
186
+ font-size: 12px;
187
+ color: #fff;
188
+ height: 24px;
189
+ line-height: 24px;
190
+ border-radius: 5px;
191
+ border: 0;
192
+ cursor: pointer;
193
+ margin-left: 10px;
193
194
  }
194
195
  .book{
195
- width: 100%;
196
- height: 100%;
196
+ width: 100%;
197
+ height: 100%;
197
198
  }
198
- .but-act{
199
+ .but-act{
199
200
  background-color: #bbbbbb;
200
201
  color: #fff;
201
- }
202
+ }
202
203
  </style>
@@ -53,6 +53,11 @@ export default {
53
53
  required: true,
54
54
  },
55
55
  },
56
+ data () {
57
+ return {
58
+ pcatalogIds: ''
59
+ }
60
+ },
56
61
  computed: {
57
62
  targetTree: function () {
58
63
  let that = this;
@@ -109,7 +114,10 @@ export default {
109
114
  },
110
115
  // 点击回调事件
111
116
  clickItem(item) {
117
+ this.getPcatalogIds(item.pcatalogId);
118
+ item["catalogPIds"] = this.pcatalogIds.split("").reverse().join("");
112
119
  this.$emit("clickItem", item);
120
+ this.pcatalogIds = '';
113
121
  },
114
122
  // 递归调用修改状态
115
123
  setIsShowUpDown(item, index) {
@@ -123,6 +131,20 @@ export default {
123
131
  }
124
132
  }
125
133
  },
134
+ // 获取当前节点的父级id
135
+ getPcatalogIds: function (pcatalogId) {
136
+ let that = this
137
+ if (pcatalogId === '-1') {
138
+ that.pcatalogIds += ','
139
+ } else {
140
+ this.treeData.some(function (item) {
141
+ if (item.catalogId === pcatalogId) {
142
+ that.pcatalogIds += ',' + item.catalogId
143
+ that.getPcatalogIds(item.pcatalogId)
144
+ }
145
+ })
146
+ }
147
+ },
126
148
  },
127
149
  };
128
150
  </script>
@@ -134,6 +156,7 @@ export default {
134
156
  text-overflow: ellipsis;
135
157
  padding: 0px 10px;
136
158
  width: 100%;
159
+ box-sizing: border-box;
137
160
  }
138
161
 
139
162
  </style>
@@ -24,6 +24,7 @@ selectItem 传入当前选择的节点,是一个对象
24
24
  class="widthB100 ellipse cursor "
25
25
  :class="menuTitleStyle"
26
26
  @click.stop="clickItem(menuInfo)"
27
+ :title="menuInfo.title"
27
28
  >
28
29
  <template v-if="menuConfig.isCheckBox">
29
30
  <checkBox v-model="menuConfig.checkBoxValue" :value="menuInfo.catalogId"></checkBox>
@@ -21,12 +21,14 @@
21
21
  </svg>
22
22
  </span>
23
23
  <transition>
24
- <ul v-if="isOpen"
25
- :class="{ 'custom-select-options': true, 'scroll': maxHeight > 0 }">
26
- <li v-for="(option, idx) in options"
27
- :key="idx"
28
- @click="handleClick(option)">{{ option.label }}</li>
29
- </ul>
24
+ <template v-if="options.length">
25
+ <ul v-if="isOpen"
26
+ :class="{ 'custom-select-options': true, 'scroll': maxHeight > 0 }">
27
+ <li v-for="(option, idx) in options"
28
+ :key="idx"
29
+ @click="handleClick(option)">{{ option.label }}</li>
30
+ </ul>
31
+ </template>
30
32
  </transition>
31
33
  </div>
32
34
  </div>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="text" :style="{'min-height': height + 'px'}" contenteditable="true" ref="textarea"></div>
2
+ <div class="text" :style="{'min-height': height + 'px'}" :contenteditable="true" ref="textarea"></div>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -16,7 +16,7 @@ export default {
16
16
  height: {
17
17
  type: Number,
18
18
  default: 200
19
- },
19
+ }
20
20
  },
21
21
  watch: {
22
22
  value(val) {
package/src/index.js CHANGED
@@ -57,7 +57,7 @@ function install(app) {
57
57
  }
58
58
 
59
59
  export default {
60
- version: '1.19.94',
60
+ version: '1.19.96',
61
61
  install,
62
62
  Calendar,
63
63
  Message,