zydx-plus 1.5.24 → 1.7.25
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 +4 -2
- package/src/components/flip/index.js +6 -0
- package/src/components/flip/src/flip.vue +134 -0
- package/src/components/tipBox/index.js +1 -1
- package/src/components/tipBox/src/main.vue +20 -1
- package/src/components/tipBox/src/zydxStyle.css +5 -1
- package/src/components/treeList/index.js +6 -0
- package/src/components/treeList/src/treeList.vue +87 -0
- package/src/index.js +9 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zydx-plus",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.25",
|
|
4
4
|
"description": "Vue.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"vue": "^3.2.13",
|
|
24
|
-
"vue-draggable-next": "^2.1.1"
|
|
24
|
+
"vue-draggable-next": "^2.1.1",
|
|
25
|
+
"pdfjs-dist": "^3.4.120",
|
|
26
|
+
"flipbook-vue": "^1.0.0-beta.4"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
29
|
"@vue/component-compiler-utils": "^2.6.0",
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<template>
|
|
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" :pages="imgArr" @flip-left-end="flipLeft" @flip-right-end="flipRight" v-slot="flipbook" :singlePage="singlePage" :ambient="0" :gloss="1" :dragToFlip="false" :pagesHiRes="0">
|
|
8
|
+
<div class="but">
|
|
9
|
+
<button class="but-brown" @click="flipbook.flipLeft">上一页</button>
|
|
10
|
+
<button class="but-brown" @click="flipbook.flipRight">下一页</button>
|
|
11
|
+
</div>
|
|
12
|
+
</flipbook>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import flipbook from 'flipbook-vue'
|
|
19
|
+
import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js' // 注意导入的写法
|
|
20
|
+
PdfJs.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.entry')
|
|
21
|
+
export default {
|
|
22
|
+
name: "zydx-flip",
|
|
23
|
+
components: {flipbook},
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
pdfPages: 0,
|
|
27
|
+
imgArr: [],
|
|
28
|
+
hei: 0
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
source: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ''
|
|
35
|
+
},
|
|
36
|
+
singlePage: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
mounted() {
|
|
42
|
+
this.$nextTick(() => {
|
|
43
|
+
this.readPdf()
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
flipLeft(e) {
|
|
48
|
+
this.$emit('flip',e)
|
|
49
|
+
},
|
|
50
|
+
flipRight(e) {
|
|
51
|
+
this.$emit('flip',e)
|
|
52
|
+
},
|
|
53
|
+
readPdf() {
|
|
54
|
+
let that = this
|
|
55
|
+
const loadingTask = PdfJs.getDocument(this.source)
|
|
56
|
+
loadingTask.promise.then((pdf) => {
|
|
57
|
+
that.pdfPages = pdf.numPages // 获取pdf文件的总页数
|
|
58
|
+
for(let i=0; i<that.pdfPages; i++) {
|
|
59
|
+
pdf.getPage(i+1).then(function(page) {
|
|
60
|
+
const canvas = document.getElementById('pdf-canvas' + i)
|
|
61
|
+
const ctx = canvas.getContext('2d')
|
|
62
|
+
const dpr = window.devicePixelRatio || 1
|
|
63
|
+
const bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1
|
|
64
|
+
const ratio = dpr / bsr
|
|
65
|
+
const viewport = page.getViewport({ scale: 1 })
|
|
66
|
+
canvas.width = viewport.width * ratio
|
|
67
|
+
canvas.height = viewport.height * ratio
|
|
68
|
+
canvas.style.width = viewport.width + 'px'
|
|
69
|
+
canvas.style.height = viewport.height + 'px'
|
|
70
|
+
ctx.setTransform(ratio, 0, 0, ratio, 0, 0)
|
|
71
|
+
const renderContext = {
|
|
72
|
+
canvasContext: ctx,
|
|
73
|
+
viewport: viewport
|
|
74
|
+
}
|
|
75
|
+
page.render(renderContext)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
for(let i=0; i<that.pdfPages; i++) {
|
|
80
|
+
const canvas = document.getElementById('pdf-canvas' + i)
|
|
81
|
+
const dataURL = canvas.toDataURL("image/jpeg",1); //获取Base64编码
|
|
82
|
+
that.imgArr.push(dataURL)
|
|
83
|
+
}
|
|
84
|
+
},0)
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<style scoped>
|
|
92
|
+
#docView{
|
|
93
|
+
height: 100%;
|
|
94
|
+
}
|
|
95
|
+
.but-brown{
|
|
96
|
+
background-color: #c64c10;
|
|
97
|
+
padding: 0 20px;
|
|
98
|
+
font-size: 12px;
|
|
99
|
+
color: #fff;
|
|
100
|
+
height: 24px;
|
|
101
|
+
line-height: 24px;
|
|
102
|
+
border-radius: 5px;
|
|
103
|
+
border: 0;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
margin-left: 10px;
|
|
106
|
+
}
|
|
107
|
+
.but{
|
|
108
|
+
position: absolute;
|
|
109
|
+
bottom: 0;
|
|
110
|
+
left: 0;
|
|
111
|
+
right: 0;
|
|
112
|
+
z-index: 1;
|
|
113
|
+
text-align: center;
|
|
114
|
+
}
|
|
115
|
+
.book{
|
|
116
|
+
width: 100%;
|
|
117
|
+
height: 100%;
|
|
118
|
+
}
|
|
119
|
+
.flipbook {
|
|
120
|
+
width: 100%;
|
|
121
|
+
height: 100%;
|
|
122
|
+
position: relative;
|
|
123
|
+
padding-bottom: 24px;
|
|
124
|
+
}
|
|
125
|
+
.pdf-container{
|
|
126
|
+
position: relative;
|
|
127
|
+
}
|
|
128
|
+
.pdf-canvas{
|
|
129
|
+
position: absolute;
|
|
130
|
+
top: -100000px;
|
|
131
|
+
left: 0;
|
|
132
|
+
z-index: -100;
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -16,7 +16,7 @@ const Confirm = ({ type, url ,title, promptContent, middle, cancelShow, inputArr
|
|
|
16
16
|
let val = []
|
|
17
17
|
if(type === 'input') {
|
|
18
18
|
for(let i=0; i< inputArr.length; i++) {
|
|
19
|
-
if(inputArr[i].type === 'input') {
|
|
19
|
+
if(inputArr[i].type === 'input' || inputArr[i].type === 'calender') {
|
|
20
20
|
val.push(inputArr[i].value)
|
|
21
21
|
}else {
|
|
22
22
|
val.push(inputArr[i].selectValue)
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
<div style="display: inline-block;">
|
|
19
19
|
<Select v-if="item.type === 'select'" :options="item.option" v-model:value="item.selectValue"></Select>
|
|
20
20
|
</div>
|
|
21
|
+
<div class="cal" v-if="item.type === 'calender'">
|
|
22
|
+
<input type="text" :placeholder="item.placeholder" @focus="focus" v-model="item.value" :disabled="item.disabled" />
|
|
23
|
+
<Calendar v-if="tip" style="top: 35px;" @confirm="confirm($event,item)"></Calendar>
|
|
24
|
+
</div>
|
|
21
25
|
<div v-if="item.type === 'text'" class="text">{{ item.value }}</div>
|
|
22
26
|
</div>
|
|
23
27
|
</div>
|
|
@@ -34,9 +38,15 @@
|
|
|
34
38
|
|
|
35
39
|
<script>
|
|
36
40
|
import Select from '../../select/src/select.vue'
|
|
41
|
+
import Calendar from '../../calendar/src/Calendar'
|
|
37
42
|
export default {
|
|
38
43
|
name: 'zydx-tip-box',
|
|
39
|
-
components: {Select},
|
|
44
|
+
components: {Select,Calendar},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
tip: false
|
|
48
|
+
}
|
|
49
|
+
},
|
|
40
50
|
props: {
|
|
41
51
|
type: { // 弹窗的提示标题
|
|
42
52
|
type: String,
|
|
@@ -75,6 +85,15 @@ export default {
|
|
|
75
85
|
type: Function,
|
|
76
86
|
default: () => {}
|
|
77
87
|
}
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
focus() {
|
|
91
|
+
this.tip = true
|
|
92
|
+
},
|
|
93
|
+
confirm(e,data) {
|
|
94
|
+
data.value = e.start
|
|
95
|
+
this.tip = false
|
|
96
|
+
},
|
|
78
97
|
}
|
|
79
98
|
}
|
|
80
99
|
</script>
|
|
@@ -100,7 +100,7 @@ font-size: 12px;
|
|
|
100
100
|
line-height: 30px;
|
|
101
101
|
padding-right: 10px;
|
|
102
102
|
}
|
|
103
|
-
.tip-input
|
|
103
|
+
.tip-input input{
|
|
104
104
|
width: 211px;
|
|
105
105
|
height: 32px;
|
|
106
106
|
box-sizing: border-box;
|
|
@@ -126,3 +126,7 @@ font-size: 12px;
|
|
|
126
126
|
width: 210px;
|
|
127
127
|
text-align: left;
|
|
128
128
|
}
|
|
129
|
+
.cal{
|
|
130
|
+
display: inline-block;
|
|
131
|
+
position: relative;
|
|
132
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="list">
|
|
3
|
+
<div class="list-cont">
|
|
4
|
+
<div class="list-li" @click="listTap(item,index)" :class="{'list-active': active === index}" v-for="(item,index) in list" :key="index">
|
|
5
|
+
<div class="list-title">
|
|
6
|
+
<span>{{ index + 1 }}. {{ item[column[0].label] }}</span>
|
|
7
|
+
<button v-if="delShow" @click="del(item)">删除</button>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="list-li-cont" v-if="active === index">
|
|
10
|
+
<p v-for="(it,ind) in column.slice(1, column.length)" :key="ind">{{ it.name }}:{{ item[it.label] }}</p>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: "zydx-tree-list",
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
active: 0,
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
list: { // 数据列表
|
|
27
|
+
type: Array,
|
|
28
|
+
default: () => []
|
|
29
|
+
},
|
|
30
|
+
column: { // 数据列表
|
|
31
|
+
type: Array,
|
|
32
|
+
default: () => []
|
|
33
|
+
},
|
|
34
|
+
delShow: { //是否显示取消按钮
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
methods: {
|
|
40
|
+
del() {
|
|
41
|
+
this.$emit('del',data)
|
|
42
|
+
},
|
|
43
|
+
listTap(data,index) {
|
|
44
|
+
this.active = index
|
|
45
|
+
this.$emit('confirm',data)
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<style scoped>
|
|
52
|
+
.list-title{
|
|
53
|
+
display: flex;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
line-height: 30px;
|
|
56
|
+
}
|
|
57
|
+
.list-title>span{
|
|
58
|
+
flex: 1;
|
|
59
|
+
}
|
|
60
|
+
.list-title>button{
|
|
61
|
+
margin-left: 5px;
|
|
62
|
+
margin-top: 4px;
|
|
63
|
+
font-size: 12px;
|
|
64
|
+
background-color: transparent;
|
|
65
|
+
border: 1px solid #000;
|
|
66
|
+
border-radius: 3px;
|
|
67
|
+
padding: 2px 5px;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
height: 22px;
|
|
70
|
+
min-width: 60px;
|
|
71
|
+
}
|
|
72
|
+
.list{
|
|
73
|
+
padding: 0 10px;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
}
|
|
76
|
+
.list-li>span{
|
|
77
|
+
font-size: 16px;
|
|
78
|
+
line-height: 30px;
|
|
79
|
+
}
|
|
80
|
+
.list-li-cont{
|
|
81
|
+
font-size: 14px;
|
|
82
|
+
padding-left: 10px;
|
|
83
|
+
}
|
|
84
|
+
.list-active{
|
|
85
|
+
color: #e20808;
|
|
86
|
+
}
|
|
87
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,8 @@ import Year from './components/year/index';
|
|
|
10
10
|
import Table from './components/data_table/index';
|
|
11
11
|
import buttonGroup from './components/buttonGroup/index';
|
|
12
12
|
import spinner from './components/spinner/index';
|
|
13
|
+
import treeList from './components/treeList/index';
|
|
14
|
+
import flip from './components/flip/index';
|
|
13
15
|
|
|
14
16
|
const components = [
|
|
15
17
|
Calendar,
|
|
@@ -21,7 +23,9 @@ const components = [
|
|
|
21
23
|
Select,
|
|
22
24
|
Year,
|
|
23
25
|
Table,
|
|
24
|
-
buttonGroup
|
|
26
|
+
buttonGroup,
|
|
27
|
+
treeList,
|
|
28
|
+
flip
|
|
25
29
|
];
|
|
26
30
|
|
|
27
31
|
function install(app) {
|
|
@@ -33,7 +37,7 @@ function install(app) {
|
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
export default {
|
|
36
|
-
version: '1.
|
|
40
|
+
version: '1.7.25',
|
|
37
41
|
install,
|
|
38
42
|
Calendar,
|
|
39
43
|
Message,
|
|
@@ -46,6 +50,8 @@ export default {
|
|
|
46
50
|
Select,
|
|
47
51
|
Year,
|
|
48
52
|
Table,
|
|
49
|
-
buttonGroup
|
|
53
|
+
buttonGroup,
|
|
54
|
+
treeList,
|
|
55
|
+
flip
|
|
50
56
|
};
|
|
51
57
|
|