@lambo-design/upload-file 1.0.0-beta.11 → 1.0.0-beta.13
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/.versionrc +23 -0
- package/CHANGELOG.md +4 -0
- package/package.json +11 -4
- package/src/index.vue +49 -1
package/.versionrc
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tagPrefix": "@lambo-design/upload-file@",
|
|
3
|
+
"releaseCommitMessageFormat": "chore(release): @lambo-design/upload-file@{{currentTag}}",
|
|
4
|
+
"path": ".",
|
|
5
|
+
"header": "# Changelog",
|
|
6
|
+
"types": [
|
|
7
|
+
{"type": "chore", "section":"🎫 Chores | 其他更新", "hidden": false},
|
|
8
|
+
{"type": "revert", "section":"⏪ Reverts | 回退", "hidden": false},
|
|
9
|
+
{"type": "feat", "section": "✨ Features | 新功能", "hidden": false},
|
|
10
|
+
{"type": "fix", "section": "🐛 Bug Fixes | Bug 修复", "hidden": false},
|
|
11
|
+
{"type": "improvement", "section": "Feature Improvements", "hidden": false},
|
|
12
|
+
{"type": "docs", "section":"📝 Documentation | 文档", "hidden": false},
|
|
13
|
+
{"type": "style", "section":"💄 Styles | 风格", "hidden": false},
|
|
14
|
+
{"type": "refactor", "section":"💄 Styles | 风格", "hidden": false},
|
|
15
|
+
{"type": "perf", "section":"⚡ Performance Improvements | 性能优化", "hidden": false},
|
|
16
|
+
{"type": "test", "section":"✅ Tests | 测试", "hidden": false},
|
|
17
|
+
{"type": "build", "section":"👷 Build System | 构建", "hidden": false},
|
|
18
|
+
{"type": "ci", "section":"🔧 Continuous Integration | CI 配置", "hidden":false}
|
|
19
|
+
],
|
|
20
|
+
"commitUrlFormat": "http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/{{hash}}",
|
|
21
|
+
"compareUrlFormat": "http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/{{previousTag}}...{{currentTag}}",
|
|
22
|
+
"issueUrlFormat": "http://git.inspur.com/ecbh/lambo-design/lambo-design/-/issues/{{id}}"
|
|
23
|
+
}
|
package/CHANGELOG.md
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/upload-file",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -12,8 +12,15 @@
|
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"axios": "^0.24.0",
|
|
14
14
|
"axios-cache-plugin": "^0.1.0",
|
|
15
|
-
"@lambo-design/core": "^4.7.1-beta.
|
|
16
|
-
"@lambo-design/shared": "^1.0.0-beta.
|
|
15
|
+
"@lambo-design/core": "^4.7.1-beta.130",
|
|
16
|
+
"@lambo-design/shared": "^1.0.0-beta.154"
|
|
17
17
|
},
|
|
18
|
-
"scripts": {
|
|
18
|
+
"scripts": {
|
|
19
|
+
"release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
|
20
|
+
"release-major": "standard-version --release-as major",
|
|
21
|
+
"release-minor": "standard-version --release-as minor",
|
|
22
|
+
"release-patch": "standard-version --release-as patch",
|
|
23
|
+
"release-beta": "standard-version --prerelease beta",
|
|
24
|
+
"re-publish": "pnpm publish --access public --no-git-checks"
|
|
25
|
+
}
|
|
19
26
|
}
|
package/src/index.vue
CHANGED
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
<List border size="small">
|
|
20
20
|
<ListItem v-for="item in resultList" :key="item.fileCode">
|
|
21
21
|
<div span="21">
|
|
22
|
-
<a :href="item.fileUrl">
|
|
22
|
+
<a :href="item.fileUrl ? item.fileUrl : downloadUrl + item.fileCode">
|
|
23
23
|
{{item.fileName}}
|
|
24
24
|
<span class="size" style="margin-left: 5px" v-if="item.showSize">({{item.showSize}})</span>
|
|
25
25
|
</a>
|
|
26
26
|
</div>
|
|
27
27
|
<div span="3" style="text-align: right">
|
|
28
|
+
<Button v-if="showPreview" @click="previewFile(item)" type="text">预览</Button>
|
|
28
29
|
<Button @click="deleteFile(item.fileCode)" type="text">删除</Button>
|
|
29
30
|
</div>
|
|
30
31
|
</ListItem>
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
|
|
36
37
|
<script>
|
|
37
38
|
import axios from 'axios';
|
|
39
|
+
import config from '../../config'
|
|
38
40
|
import {formatterSizeUnit} from "@lambo-design/shared/utils/date";
|
|
39
41
|
|
|
40
42
|
export default {
|
|
@@ -74,6 +76,12 @@ export default {
|
|
|
74
76
|
required: false,
|
|
75
77
|
default: true
|
|
76
78
|
},
|
|
79
|
+
//是否显示预览文件按钮
|
|
80
|
+
showPreview: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
required: false,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
77
85
|
//其他需要传递的参数
|
|
78
86
|
otherParam: {//其他需要传递的参数
|
|
79
87
|
type: String,
|
|
@@ -102,6 +110,16 @@ export default {
|
|
|
102
110
|
ossFileGetUrl:{
|
|
103
111
|
type:String,
|
|
104
112
|
default:"/oss/file/get/"
|
|
113
|
+
},
|
|
114
|
+
//文件预览所需文件流服务host
|
|
115
|
+
fileOnlinePreviewHost:{
|
|
116
|
+
type: String,
|
|
117
|
+
default: "http://pub-manage-server:8080"
|
|
118
|
+
},
|
|
119
|
+
//预览文件url
|
|
120
|
+
ossFilePreviewUrl:{
|
|
121
|
+
type:String,
|
|
122
|
+
default:"/anon/oss/file/getObjToOutputStream/"
|
|
105
123
|
}
|
|
106
124
|
},
|
|
107
125
|
|
|
@@ -120,6 +138,11 @@ export default {
|
|
|
120
138
|
resultList: []
|
|
121
139
|
}
|
|
122
140
|
},
|
|
141
|
+
computed: {
|
|
142
|
+
downloadUrl: function () {
|
|
143
|
+
return this.ossServerContext + this.ossFileGetUrl;
|
|
144
|
+
}
|
|
145
|
+
},
|
|
123
146
|
methods: {
|
|
124
147
|
UploadFile: function () {
|
|
125
148
|
this.$refs.uploadInput.click();
|
|
@@ -200,6 +223,31 @@ export default {
|
|
|
200
223
|
self.$refs.uploadInput.value = null
|
|
201
224
|
});
|
|
202
225
|
},
|
|
226
|
+
|
|
227
|
+
encode64(value) {
|
|
228
|
+
let typeValue = typeof value;
|
|
229
|
+
if (typeValue == 'string' || typeValue == 'number') {
|
|
230
|
+
return window.btoa(
|
|
231
|
+
window.encodeURIComponent(value)
|
|
232
|
+
.replace(/%([0-9A-F]{2})/g,
|
|
233
|
+
function toSolidBytes(match, p1) {
|
|
234
|
+
return String.fromCharCode('0x' + p1);
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
);
|
|
238
|
+
} else {
|
|
239
|
+
return value;
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
previewFile: function (item) {
|
|
243
|
+
var fileCode = item.fileCode;
|
|
244
|
+
var fileName = item.fileName;
|
|
245
|
+
var fileType = item.fileType;
|
|
246
|
+
if(fileCode) {
|
|
247
|
+
let url = this.fileOnlinePreviewHost + this.ossServerContext + this.ossFilePreviewUrl + fileCode + "?fullfilename=" + fileName + "." + fileType;
|
|
248
|
+
window.open(config.fileOnlinePreviewContext + '/onlinePreview?url='+encodeURIComponent(this.encode64(url)));
|
|
249
|
+
}
|
|
250
|
+
},
|
|
203
251
|
deleteFile: function (fileCode) {
|
|
204
252
|
if (fileCode) {
|
|
205
253
|
var result = [];
|