@toolspack/ttd-pdfjs 0.1.2 → 0.1.4
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/.eslintignore +5 -5
- package/.eslintrc.js +52 -52
- package/README.md +46 -44
- package/lib/ttd-pdfjs.common.js +113 -113
- package/lib/ttd-pdfjs.umd.js +113 -113
- package/lib/ttd-pdfjs.umd.min.js +4 -4
- package/package.json +39 -40
- package/postcss.config.js +1 -1
- package/src/App.vue +99 -99
- package/src/main.js +17 -16
- package/src/packages/index.js +5 -5
- package/src/packages/pdfjs/PdfView216.vue +417 -418
- package/src/packages/pdfjs/SwitchPage.vue +198 -190
- package/src/packages/utils/index.js +16 -16
- package/src/styles/base.scss +3 -3
- package/src/styles/common.scss +22 -22
- package/src/styles/components/el-pagination.scss +21 -21
- package/src/styles/components/file-group.scss +4 -4
- package/src/styles/components/message.scss +53 -53
- package/src/styles/components/reset.scss +8 -8
- package/src/styles/components/table.scss +35 -35
- package/src/styles/input.less +59 -59
package/package.json
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@toolspack/ttd-pdfjs",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"private": false,
|
|
5
|
-
"main": "lib/ttd-pdfjs.umd.min.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"serve": "vue-cli-service serve",
|
|
8
|
-
"build": "vue-cli-service build",
|
|
9
|
-
"lib": "vue-cli-service build --target lib --dest lib ./src/packages/index.js",
|
|
10
|
-
"lint": "vue-cli-service lint --max-warnings 100"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"babel-cli": "^6.26.0",
|
|
14
|
-
"babel-laoder": "0.0.1-security",
|
|
15
|
-
"babel-polyfill": "^6.26.0",
|
|
16
|
-
"core-js": "^3.34.0",
|
|
17
|
-
"element-ui": "^2.15.14",
|
|
18
|
-
"less": "^3.8.1",
|
|
19
|
-
"less-loader": "^4.1.0",
|
|
20
|
-
"pdfjs-dist": "3.11.174",
|
|
21
|
-
"vue": "^2.6.12"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
25
|
-
"@vue/cli-plugin-babel": "~4.5.11",
|
|
26
|
-
"@vue/cli-plugin-eslint": "~4.5.11",
|
|
27
|
-
"@vue/cli-service": "^4.5.11",
|
|
28
|
-
"@vue/eslint-config-airbnb": "^5.3.0",
|
|
29
|
-
"babel-eslint": "^10.1.0",
|
|
30
|
-
"babel-plugin-component": "^1.1.1",
|
|
31
|
-
"babel-preset-es2015": "^6.24.1",
|
|
32
|
-
"eslint": "^6.7.2",
|
|
33
|
-
"eslint-plugin-import": "^2.22.1",
|
|
34
|
-
"eslint-plugin-node": "^11.1.0",
|
|
35
|
-
"eslint-plugin-promise": "^4.2.1",
|
|
36
|
-
"eslint-plugin-vue": "^6.2.2",
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@toolspack/ttd-pdfjs",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "lib/ttd-pdfjs.umd.min.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"serve": "vue-cli-service serve",
|
|
8
|
+
"build": "vue-cli-service build",
|
|
9
|
+
"lib": "vue-cli-service build --target lib --dest lib ./src/packages/index.js",
|
|
10
|
+
"lint": "vue-cli-service lint --max-warnings 100"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"babel-cli": "^6.26.0",
|
|
14
|
+
"babel-laoder": "0.0.1-security",
|
|
15
|
+
"babel-polyfill": "^6.26.0",
|
|
16
|
+
"core-js": "^3.34.0",
|
|
17
|
+
"element-ui": "^2.15.14",
|
|
18
|
+
"less": "^3.8.1",
|
|
19
|
+
"less-loader": "^4.1.0",
|
|
20
|
+
"pdfjs-dist": "3.11.174",
|
|
21
|
+
"vue": "^2.6.12"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
25
|
+
"@vue/cli-plugin-babel": "~4.5.11",
|
|
26
|
+
"@vue/cli-plugin-eslint": "~4.5.11",
|
|
27
|
+
"@vue/cli-service": "^4.5.11",
|
|
28
|
+
"@vue/eslint-config-airbnb": "^5.3.0",
|
|
29
|
+
"babel-eslint": "^10.1.0",
|
|
30
|
+
"babel-plugin-component": "^1.1.1",
|
|
31
|
+
"babel-preset-es2015": "^6.24.1",
|
|
32
|
+
"eslint": "^6.7.2",
|
|
33
|
+
"eslint-plugin-import": "^2.22.1",
|
|
34
|
+
"eslint-plugin-node": "^11.1.0",
|
|
35
|
+
"eslint-plugin-promise": "^4.2.1",
|
|
36
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
37
|
+
"vue-template-compiler": "^2.6.12"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/postcss.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {}
|
|
1
|
+
module.exports = {}
|
package/src/App.vue
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="app">
|
|
3
|
-
<el-upload
|
|
4
|
-
ref="baseUpload"
|
|
5
|
-
:show-file-list="false"
|
|
6
|
-
name="files"
|
|
7
|
-
:action="actionInner"
|
|
8
|
-
:on-success="handleAvatarSuccess"
|
|
9
|
-
:on-progress="handelProgress"
|
|
10
|
-
:before-upload="beforeAvatarUpload"
|
|
11
|
-
:headers="uploadHeader"
|
|
12
|
-
:data="uploadData"
|
|
13
|
-
:on-exceed="onExceed"
|
|
14
|
-
list-type="text"
|
|
15
|
-
>
|
|
16
|
-
<el-button>上传</el-button>
|
|
17
|
-
</el-upload>
|
|
18
|
-
<PdfView :rotateEnable= true :zoomEnable= true :pdfurl="url" />
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import PdfView from './packages/pdfjs/PdfView216.vue'
|
|
24
|
-
|
|
25
|
-
const mybaseUrl = 'https://petx.totodi.com/'
|
|
26
|
-
|
|
27
|
-
export default {
|
|
28
|
-
components: { PdfView },
|
|
29
|
-
name: 'App',
|
|
30
|
-
data() {
|
|
31
|
-
return {
|
|
32
|
-
maxSize: 10,
|
|
33
|
-
uploadData: { debug: true, bucketName: 'totodi-temp' },
|
|
34
|
-
actionInner: `${mybaseUrl}zuul/file-service/oos/uploadFile`,
|
|
35
|
-
uploadHeader: {},
|
|
36
|
-
url: '',
|
|
37
|
-
uName: 'totodi-contract',
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
mounted() {
|
|
41
|
-
},
|
|
42
|
-
methods: {
|
|
43
|
-
beforeAvatarUpload(file) {
|
|
44
|
-
const isLt2M = file.size / 1024 / 1024 < this.maxSize
|
|
45
|
-
if (!isLt2M) {
|
|
46
|
-
console.log(`上传文件大小不能超过${ this.maxSize }MB!`)
|
|
47
|
-
}
|
|
48
|
-
if (isLt2M) {
|
|
49
|
-
this.progress = file
|
|
50
|
-
}
|
|
51
|
-
return isLt2M
|
|
52
|
-
},
|
|
53
|
-
onExceed(files, fileList) {
|
|
54
|
-
console.log(`当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
|
55
|
-
},
|
|
56
|
-
handelProgress(event, file, fileList) {
|
|
57
|
-
this.progressCurrent = event.percent
|
|
58
|
-
// console.log('progress', event, file, fileList)
|
|
59
|
-
},
|
|
60
|
-
tips(words = []) {
|
|
61
|
-
if (Array.isArray(words) && words.length > 0) {
|
|
62
|
-
const cfile = [...words]
|
|
63
|
-
const lastType = cfile.length > 1 ? cfile.pop() : ''
|
|
64
|
-
return `仅支持 ${cfile.join('、')}${lastType ? ` 或者 ${ lastType}` : ''} 格式`
|
|
65
|
-
}
|
|
66
|
-
return '文件类型不正确'
|
|
67
|
-
},
|
|
68
|
-
handleAvatarSuccess(res, file, fileList) {
|
|
69
|
-
const { code, data, msg } = res
|
|
70
|
-
// this.progress = null
|
|
71
|
-
if (code === 0) {
|
|
72
|
-
const { list } = data
|
|
73
|
-
// let obj = {
|
|
74
|
-
// fileName: file.fileName,
|
|
75
|
-
// bucketName: file.oosBucket,
|
|
76
|
-
// objectKey: file.objectKey,
|
|
77
|
-
// url: file.url,
|
|
78
|
-
// fileMD5: file.fileMD5
|
|
79
|
-
// }
|
|
80
|
-
console.log('upload: ', list[0])
|
|
81
|
-
this.url = list[0].url
|
|
82
|
-
} else {
|
|
83
|
-
console.log(msg || '上传失败!')
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
}
|
|
88
|
-
</script>
|
|
89
|
-
|
|
90
|
-
<style lange="less">
|
|
91
|
-
#app {
|
|
92
|
-
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
93
|
-
-webkit-font-smoothing: antialiased;
|
|
94
|
-
-moz-osx-font-smoothing: grayscale;
|
|
95
|
-
text-align: center;
|
|
96
|
-
color: #2c3e50;
|
|
97
|
-
margin-top: 60px;
|
|
98
|
-
}
|
|
99
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div id="app">
|
|
3
|
+
<el-upload
|
|
4
|
+
ref="baseUpload"
|
|
5
|
+
:show-file-list="false"
|
|
6
|
+
name="files"
|
|
7
|
+
:action="actionInner"
|
|
8
|
+
:on-success="handleAvatarSuccess"
|
|
9
|
+
:on-progress="handelProgress"
|
|
10
|
+
:before-upload="beforeAvatarUpload"
|
|
11
|
+
:headers="uploadHeader"
|
|
12
|
+
:data="uploadData"
|
|
13
|
+
:on-exceed="onExceed"
|
|
14
|
+
list-type="text"
|
|
15
|
+
>
|
|
16
|
+
<el-button>上传</el-button>
|
|
17
|
+
</el-upload>
|
|
18
|
+
<PdfView :rotateEnable= true :scale="1.5" :zoomEnable= true :pdfurl="url" />
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import PdfView from './packages/pdfjs/PdfView216.vue'
|
|
24
|
+
|
|
25
|
+
const mybaseUrl = 'https://petx.totodi.com/'
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
components: { PdfView },
|
|
29
|
+
name: 'App',
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
maxSize: 10,
|
|
33
|
+
uploadData: { debug: true, bucketName: 'totodi-temp' },
|
|
34
|
+
actionInner: `${mybaseUrl}zuul/file-service/oos/uploadFile`,
|
|
35
|
+
uploadHeader: {},
|
|
36
|
+
url: '',
|
|
37
|
+
uName: 'totodi-contract',
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
mounted() {
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
beforeAvatarUpload(file) {
|
|
44
|
+
const isLt2M = file.size / 1024 / 1024 < this.maxSize
|
|
45
|
+
if (!isLt2M) {
|
|
46
|
+
console.log(`上传文件大小不能超过${ this.maxSize }MB!`)
|
|
47
|
+
}
|
|
48
|
+
if (isLt2M) {
|
|
49
|
+
this.progress = file
|
|
50
|
+
}
|
|
51
|
+
return isLt2M
|
|
52
|
+
},
|
|
53
|
+
onExceed(files, fileList) {
|
|
54
|
+
console.log(`当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
|
55
|
+
},
|
|
56
|
+
handelProgress(event, file, fileList) {
|
|
57
|
+
this.progressCurrent = event.percent
|
|
58
|
+
// console.log('progress', event, file, fileList)
|
|
59
|
+
},
|
|
60
|
+
tips(words = []) {
|
|
61
|
+
if (Array.isArray(words) && words.length > 0) {
|
|
62
|
+
const cfile = [...words]
|
|
63
|
+
const lastType = cfile.length > 1 ? cfile.pop() : ''
|
|
64
|
+
return `仅支持 ${cfile.join('、')}${lastType ? ` 或者 ${ lastType}` : ''} 格式`
|
|
65
|
+
}
|
|
66
|
+
return '文件类型不正确'
|
|
67
|
+
},
|
|
68
|
+
handleAvatarSuccess(res, file, fileList) {
|
|
69
|
+
const { code, data, msg } = res
|
|
70
|
+
// this.progress = null
|
|
71
|
+
if (code === 0) {
|
|
72
|
+
const { list } = data
|
|
73
|
+
// let obj = {
|
|
74
|
+
// fileName: file.fileName,
|
|
75
|
+
// bucketName: file.oosBucket,
|
|
76
|
+
// objectKey: file.objectKey,
|
|
77
|
+
// url: file.url,
|
|
78
|
+
// fileMD5: file.fileMD5
|
|
79
|
+
// }
|
|
80
|
+
console.log('upload: ', list[0])
|
|
81
|
+
this.url = list[0].url
|
|
82
|
+
} else {
|
|
83
|
+
console.log(msg || '上传失败!')
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<style lange="less">
|
|
91
|
+
#app {
|
|
92
|
+
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
93
|
+
-webkit-font-smoothing: antialiased;
|
|
94
|
+
-moz-osx-font-smoothing: grayscale;
|
|
95
|
+
text-align: center;
|
|
96
|
+
color: #2c3e50;
|
|
97
|
+
margin-top: 60px;
|
|
98
|
+
}
|
|
99
|
+
</style>
|
package/src/main.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import Vue from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
Button, Input, Upload, Select,
|
|
4
|
-
} from 'element-ui';
|
|
5
|
-
import App from './App.vue';
|
|
6
|
-
|
|
7
|
-
Vue.config.productionTip = false;
|
|
8
|
-
|
|
9
|
-
Vue.component(Button.name, Button);
|
|
10
|
-
Vue.component(Input.name, Input);
|
|
11
|
-
Vue.component(Upload.name, Upload);
|
|
12
|
-
Vue.component(Select.name, Select);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
Button, Input, Upload, Select, Option,
|
|
4
|
+
} from 'element-ui';
|
|
5
|
+
import App from './App.vue';
|
|
6
|
+
|
|
7
|
+
Vue.config.productionTip = false;
|
|
8
|
+
|
|
9
|
+
Vue.component(Button.name, Button);
|
|
10
|
+
Vue.component(Input.name, Input);
|
|
11
|
+
Vue.component(Upload.name, Upload);
|
|
12
|
+
Vue.component(Select.name, Select);
|
|
13
|
+
Vue.component(Option.name, Option);
|
|
14
|
+
|
|
15
|
+
new Vue({
|
|
16
|
+
render: (h) => h(App),
|
|
17
|
+
}).$mount('#app');
|
package/src/packages/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PdfView216 from './pdfjs/PdfView216.vue'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
PdfView216,
|
|
5
|
-
}
|
|
1
|
+
import PdfView216 from './pdfjs/PdfView216.vue'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
PdfView216,
|
|
5
|
+
}
|