@yoooloo42/joker 1.0.9 → 1.0.11
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/dist/dist/bundle.css +14 -0
- package/dist/index.cjs.js +1031 -38
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1031 -39
- package/dist/index.esm.js.map +1 -1
- package/package.json +10 -3
package/dist/index.cjs.js
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(r, a) {
|
|
8
|
+
(null == a || a > r.length) && (a = r.length);
|
|
9
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
function _arrayWithoutHoles(r) {
|
|
13
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
14
|
+
}
|
|
15
|
+
function _iterableToArray(r) {
|
|
16
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
17
|
+
}
|
|
18
|
+
function _nonIterableSpread() {
|
|
19
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
20
|
+
}
|
|
21
|
+
function _toConsumableArray(r) {
|
|
22
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
23
|
+
}
|
|
24
|
+
function _unsupportedIterableToArray(r, a) {
|
|
25
|
+
if (r) {
|
|
26
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
27
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
28
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
5
32
|
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
|
6
33
|
/* vim: set ts=2: */
|
|
7
34
|
/*exported XLSX */
|
|
@@ -15864,47 +15891,1013 @@ var FileSaver$1 = /*@__PURE__*/getDefaultExportFromCjs(FileSaver_minExports);
|
|
|
15864
15891
|
* @param {Array<string>} header - 表格的表头(中文名)
|
|
15865
15892
|
* @param {Array<string>} keys - 对应表头的数据字段名(英文键名)
|
|
15866
15893
|
* @param {string} filename - 导出的文件名
|
|
15867
|
-
*/
|
|
15868
|
-
function jsonToExcel({
|
|
15869
|
-
json,
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
// 1. 转换数据格式
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
}
|
|
15902
|
-
|
|
15903
|
-
|
|
15894
|
+
*/
|
|
15895
|
+
function jsonToExcel(_ref) {
|
|
15896
|
+
var json = _ref.json,
|
|
15897
|
+
header = _ref.header,
|
|
15898
|
+
keys = _ref.keys,
|
|
15899
|
+
_ref$filename = _ref.filename,
|
|
15900
|
+
filename = _ref$filename === void 0 ? 'excel-file' : _ref$filename;
|
|
15901
|
+
// 1. 转换数据格式
|
|
15902
|
+
var data = json.map(function (item) {
|
|
15903
|
+
return keys.map(function (key) {
|
|
15904
|
+
return item[key];
|
|
15905
|
+
});
|
|
15906
|
+
});
|
|
15907
|
+
|
|
15908
|
+
// 2. 将表头和数据组合
|
|
15909
|
+
var aoa = [header].concat(_toConsumableArray(data));
|
|
15910
|
+
|
|
15911
|
+
// 3. 创建工作簿和工作表
|
|
15912
|
+
var ws = utils.aoa_to_sheet(aoa);
|
|
15913
|
+
var wb = utils.book_new();
|
|
15914
|
+
utils.book_append_sheet(wb, ws, 'Sheet1');
|
|
15915
|
+
|
|
15916
|
+
// 4. 生成 Excel 文件
|
|
15917
|
+
var wbout = writeSync(wb, {
|
|
15918
|
+
bookType: 'xlsx',
|
|
15919
|
+
bookSST: true,
|
|
15920
|
+
type: 'array'
|
|
15921
|
+
});
|
|
15922
|
+
|
|
15923
|
+
// 5. 保存文件
|
|
15924
|
+
try {
|
|
15925
|
+
FileSaver$1.saveAs(new Blob([wbout], {
|
|
15926
|
+
type: 'application/octet-stream'
|
|
15927
|
+
}), "".concat(filename, ".xlsx"));
|
|
15928
|
+
} catch (e) {
|
|
15929
|
+
if (typeof console !== 'undefined') console.log(e, wbout);
|
|
15930
|
+
}
|
|
15931
|
+
}
|
|
15932
|
+
var FileSaver = {
|
|
15933
|
+
jsonToExcel: jsonToExcel
|
|
15934
|
+
};
|
|
15935
|
+
|
|
15936
|
+
var ly0default = {
|
|
15937
|
+
myProps: {
|
|
15938
|
+
uploadUrl: '',
|
|
15939
|
+
tip: '',
|
|
15940
|
+
// 提示信息
|
|
15941
|
+
limit: 1,
|
|
15942
|
+
// 允许上传的文件个数
|
|
15943
|
+
size: 2048,
|
|
15944
|
+
// 允许上传的文件大小,单位:KB
|
|
15945
|
+
type: '',
|
|
15946
|
+
// 允许上传的文件类型 示例:"image/jpeg", "image/png", "image/webp", "text/plain"
|
|
15947
|
+
avatar: {
|
|
15948
|
+
// 头像
|
|
15949
|
+
width: "120px",
|
|
15950
|
+
height: "160px"
|
|
15951
|
+
}
|
|
15952
|
+
},
|
|
15953
|
+
carplate: {
|
|
15954
|
+
// 车牌识别
|
|
15955
|
+
width: "400px",
|
|
15956
|
+
height: "300px"
|
|
15957
|
+
}
|
|
15958
|
+
};
|
|
15959
|
+
|
|
15960
|
+
var script$5 = {
|
|
15961
|
+
props: ['myProps'], // 注释见default.js中的myProps
|
|
15962
|
+
data(){return {
|
|
15963
|
+
fileList: []
|
|
15964
|
+
}},
|
|
15965
|
+
computed: {
|
|
15966
|
+
myProps0(){
|
|
15967
|
+
return Object.assign(ly0default.myProps, this.myProps)
|
|
15968
|
+
},
|
|
15969
|
+
limit(){
|
|
15970
|
+
return this.myProps0.limit
|
|
15971
|
+
}
|
|
15972
|
+
},
|
|
15973
|
+
methods: {
|
|
15974
|
+
hdlBeforeUpload (file) {
|
|
15975
|
+
let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
|
|
15976
|
+
let isFileSize = file.size / 1024 < this.myProps0.size;
|
|
15977
|
+
|
|
15978
|
+
if (!isFileType) {
|
|
15979
|
+
this.$message.error('上传文件的格式只能是 ' + this.myProps0.type);
|
|
15980
|
+
return false
|
|
15981
|
+
}
|
|
15982
|
+
if (!isFileSize) {
|
|
15983
|
+
this.$message.error('上传文件的大小不能超过 ' + this.myProps0.size + ' KB');
|
|
15984
|
+
return false
|
|
15985
|
+
}
|
|
15986
|
+
|
|
15987
|
+
this.$message('正在上传 ...');
|
|
15988
|
+
return true
|
|
15989
|
+
},
|
|
15990
|
+
// eslint-disable-next-line
|
|
15991
|
+
hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
|
|
15992
|
+
},
|
|
15993
|
+
hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
|
|
15994
|
+
// 重置文件列表
|
|
15995
|
+
this.fileList = fileList;
|
|
15996
|
+
|
|
15997
|
+
// 返回上传结果
|
|
15998
|
+
let fileList0 = [];
|
|
15999
|
+
fileList.forEach(i=>{
|
|
16000
|
+
fileList0.push({
|
|
16001
|
+
src: i.response.data.src
|
|
16002
|
+
});
|
|
16003
|
+
});
|
|
16004
|
+
this.$emit('getUploadResult', {
|
|
16005
|
+
fileList: fileList0
|
|
16006
|
+
});
|
|
16007
|
+
},
|
|
16008
|
+
hdlSuccess (response, file, fileList) { // 上传
|
|
16009
|
+
if (response.code === 0) {
|
|
16010
|
+
// 重置文件列表
|
|
16011
|
+
this.fileList = fileList;
|
|
16012
|
+
|
|
16013
|
+
// 返回上传结果
|
|
16014
|
+
let fileList0 = [];
|
|
16015
|
+
fileList.forEach(i=>{
|
|
16016
|
+
fileList0.push({
|
|
16017
|
+
src: i.response.data.src
|
|
16018
|
+
});
|
|
16019
|
+
});
|
|
16020
|
+
this.$emit('getUploadResult', {
|
|
16021
|
+
fileList: fileList0
|
|
16022
|
+
});
|
|
16023
|
+
this.$message({
|
|
16024
|
+
type: 'info',
|
|
16025
|
+
message: '上传成功'
|
|
16026
|
+
});
|
|
16027
|
+
} else {
|
|
16028
|
+
this.$message({
|
|
16029
|
+
type: 'info',
|
|
16030
|
+
message: '上传失败'
|
|
16031
|
+
});
|
|
16032
|
+
}
|
|
16033
|
+
},
|
|
16034
|
+
hdlDeleteAll () { // 删除全部已上传文件
|
|
16035
|
+
// 重置文件列表
|
|
16036
|
+
this.fileList = [];
|
|
16037
|
+
|
|
16038
|
+
// 返回上传结果
|
|
16039
|
+
this.$emit('getUploadResult', {
|
|
16040
|
+
fileList: []
|
|
16041
|
+
});
|
|
16042
|
+
}
|
|
16043
|
+
}
|
|
16044
|
+
};
|
|
16045
|
+
|
|
16046
|
+
const _hoisted_1$5 = { class: "el-upload__tip" };
|
|
16047
|
+
const _hoisted_2$5 = {
|
|
16048
|
+
key: 0,
|
|
16049
|
+
style: {"font-size":"xx-small"}
|
|
16050
|
+
};
|
|
16051
|
+
|
|
16052
|
+
function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
16053
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
16054
|
+
const _component_el_upload = vue.resolveComponent("el-upload");
|
|
16055
|
+
|
|
16056
|
+
return (vue.openBlock(), vue.createElementBlock("div", null, [
|
|
16057
|
+
vue.createVNode(_component_el_upload, {
|
|
16058
|
+
action: $options.myProps0.uploadUrl,
|
|
16059
|
+
"file-list": $data.fileList,
|
|
16060
|
+
"list-type": "text",
|
|
16061
|
+
"before-upload": $options.hdlBeforeUpload,
|
|
16062
|
+
"on-preview": $options.hdlPreview,
|
|
16063
|
+
"on-remove": $options.hdlRemove,
|
|
16064
|
+
"on-success": $options.hdlSuccess,
|
|
16065
|
+
limit: $options.limit
|
|
16066
|
+
}, {
|
|
16067
|
+
tip: vue.withCtx(() => [
|
|
16068
|
+
vue.createElementVNode("span", _hoisted_1$5, " " + vue.toDisplayString($options.myProps0.tip ? $options.myProps0.tip : "可以上传" + $options.limit + "个文件"), 1 /* TEXT */)
|
|
16069
|
+
]),
|
|
16070
|
+
default: vue.withCtx(() => [
|
|
16071
|
+
vue.createVNode(_component_el_button, {
|
|
16072
|
+
size: "small",
|
|
16073
|
+
type: "primary"
|
|
16074
|
+
}, {
|
|
16075
|
+
default: vue.withCtx(() => [...(_cache[0] || (_cache[0] = [
|
|
16076
|
+
vue.createTextVNode("点击上传", -1 /* CACHED */)
|
|
16077
|
+
]))]),
|
|
16078
|
+
_: 1 /* STABLE */
|
|
16079
|
+
})
|
|
16080
|
+
]),
|
|
16081
|
+
_: 1 /* STABLE */
|
|
16082
|
+
}, 8 /* PROPS */, ["action", "file-list", "before-upload", "on-preview", "on-remove", "on-success", "limit"]),
|
|
16083
|
+
($data.fileList.length>0)
|
|
16084
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$5, vue.toDisplayString("已上传"+$data.fileList.length+"个文件"), 1 /* TEXT */))
|
|
16085
|
+
: vue.createCommentVNode("v-if", true),
|
|
16086
|
+
($data.fileList.length>0)
|
|
16087
|
+
? (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
16088
|
+
key: 1,
|
|
16089
|
+
size: "small",
|
|
16090
|
+
style: {"margin-top":"10px"},
|
|
16091
|
+
onClick: $options.hdlDeleteAll
|
|
16092
|
+
}, {
|
|
16093
|
+
default: vue.withCtx(() => [...(_cache[1] || (_cache[1] = [
|
|
16094
|
+
vue.createTextVNode("删除全部已上传文件", -1 /* CACHED */)
|
|
16095
|
+
]))]),
|
|
16096
|
+
_: 1 /* STABLE */
|
|
16097
|
+
}, 8 /* PROPS */, ["onClick"]))
|
|
16098
|
+
: vue.createCommentVNode("v-if", true)
|
|
16099
|
+
]))
|
|
16100
|
+
}
|
|
16101
|
+
|
|
16102
|
+
script$5.render = render$5;
|
|
16103
|
+
script$5.__file = "src/upload/Upload.vue";
|
|
16104
|
+
|
|
16105
|
+
var script$4 = {
|
|
16106
|
+
props: ['myProps'], // 注释见default.js中的myProps
|
|
16107
|
+
data(){return {
|
|
16108
|
+
fileList: []
|
|
16109
|
+
}},
|
|
16110
|
+
computed: {
|
|
16111
|
+
myProps0(){
|
|
16112
|
+
return Object.assign(ly0default.myProps, this.myProps)
|
|
16113
|
+
}
|
|
16114
|
+
},
|
|
16115
|
+
methods: {
|
|
16116
|
+
hdlStyleAvatarBox(){
|
|
16117
|
+
return "width:" + this.myProps0.avatar.width + "; " +
|
|
16118
|
+
"height:" + this.myProps0.avatar.height + "; " +
|
|
16119
|
+
"position: relative; " +
|
|
16120
|
+
"overflow: hidden; " +
|
|
16121
|
+
"cursor: pointer;"
|
|
16122
|
+
},
|
|
16123
|
+
hdlStyleAvatarImage(){
|
|
16124
|
+
return "display: block;" +
|
|
16125
|
+
"width:" + this.myProps0.avatar.width + "; " +
|
|
16126
|
+
"height:" + this.myProps0.avatar.height + ";"
|
|
16127
|
+
},
|
|
16128
|
+
hdlStyleAvatarIcon(){
|
|
16129
|
+
return "display: block; " +
|
|
16130
|
+
"width:" + this.myProps0.avatar.width + "; " +
|
|
16131
|
+
"height:" + this.myProps0.avatar.height + "; " +
|
|
16132
|
+
"line-height:" + this.myProps0.avatar.height + "; " +
|
|
16133
|
+
"font-size: 28px; " +
|
|
16134
|
+
"color: #8c939d; " +
|
|
16135
|
+
"text-align: center;"
|
|
16136
|
+
},
|
|
16137
|
+
hdlBeforeUpload (file) {
|
|
16138
|
+
let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
|
|
16139
|
+
let isFileSize = file.size / 1024 < this.myProps0.size;
|
|
16140
|
+
|
|
16141
|
+
if (!isFileType) {
|
|
16142
|
+
this.$message.error('上传文件的格式只能是 ' + this.myProps0.type);
|
|
16143
|
+
return false
|
|
16144
|
+
}
|
|
16145
|
+
if (!isFileSize) {
|
|
16146
|
+
this.$message.error('上传文件的大小不能超过 ' + this.myProps0.size + ' KB');
|
|
16147
|
+
return false
|
|
16148
|
+
}
|
|
16149
|
+
|
|
16150
|
+
this.$message('正在上传 ...');
|
|
16151
|
+
return true
|
|
16152
|
+
},
|
|
16153
|
+
// eslint-disable-next-line
|
|
16154
|
+
hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
|
|
16155
|
+
},
|
|
16156
|
+
// eslint-disable-next-line
|
|
16157
|
+
hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
|
|
16158
|
+
// 重置文件列表
|
|
16159
|
+
// 因为只能上传1个图片,移除即清空
|
|
16160
|
+
this.fileList = [];
|
|
16161
|
+
|
|
16162
|
+
// 返回上传结果
|
|
16163
|
+
this.$emit('getUploadResult', {
|
|
16164
|
+
fileList: []
|
|
16165
|
+
});
|
|
16166
|
+
},
|
|
16167
|
+
// eslint-disable-next-line
|
|
16168
|
+
hdlSuccess (response, file, fileList) { // 上传
|
|
16169
|
+
if (response.code === 0) {
|
|
16170
|
+
// 重置文件列表
|
|
16171
|
+
// 因为只能上传1个图片,这里需要清空图片列表
|
|
16172
|
+
this.fileList = [];
|
|
16173
|
+
this.fileList.push(file);
|
|
16174
|
+
|
|
16175
|
+
// 返回上传结果
|
|
16176
|
+
this.$emit('getUploadResult', {
|
|
16177
|
+
fileList: [{
|
|
16178
|
+
src: response.data.src
|
|
16179
|
+
}]
|
|
16180
|
+
});
|
|
16181
|
+
this.$message({
|
|
16182
|
+
type: 'info',
|
|
16183
|
+
message: '上传成功'
|
|
16184
|
+
});
|
|
16185
|
+
} else {
|
|
16186
|
+
this.$message({
|
|
16187
|
+
type: 'info',
|
|
16188
|
+
message: '上传失败'
|
|
16189
|
+
});
|
|
16190
|
+
}
|
|
16191
|
+
},
|
|
16192
|
+
hdlDeleteAll () { // 删除全部已上传文件
|
|
16193
|
+
// 重置文件列表
|
|
16194
|
+
this.fileList = [];
|
|
16195
|
+
|
|
16196
|
+
// 返回上传结果
|
|
16197
|
+
this.$emit('getUploadResult', {
|
|
16198
|
+
fileList: []
|
|
16199
|
+
});
|
|
16200
|
+
}
|
|
16201
|
+
}
|
|
16202
|
+
};
|
|
16203
|
+
|
|
16204
|
+
const _hoisted_1$4 = ["src"];
|
|
16205
|
+
const _hoisted_2$4 = { key: 0 };
|
|
16206
|
+
|
|
16207
|
+
function render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
16208
|
+
const _component_Plus = vue.resolveComponent("Plus");
|
|
16209
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
16210
|
+
const _component_el_upload = vue.resolveComponent("el-upload");
|
|
16211
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
16212
|
+
|
|
16213
|
+
return (vue.openBlock(), vue.createElementBlock("div", null, [
|
|
16214
|
+
vue.createVNode(_component_el_upload, {
|
|
16215
|
+
class: "avatar",
|
|
16216
|
+
style: vue.normalizeStyle($options.hdlStyleAvatarBox()),
|
|
16217
|
+
action: $options.myProps0.uploadUrl,
|
|
16218
|
+
"file-list": $data.fileList,
|
|
16219
|
+
"show-file-list": false,
|
|
16220
|
+
"before-upload": $options.hdlBeforeUpload,
|
|
16221
|
+
"on-preview": $options.hdlPreview,
|
|
16222
|
+
"on-remove": $options.hdlRemove,
|
|
16223
|
+
"on-success": $options.hdlSuccess
|
|
16224
|
+
}, {
|
|
16225
|
+
default: vue.withCtx(() => [
|
|
16226
|
+
($data.fileList.length>0 && $data.fileList[0].response.data.src)
|
|
16227
|
+
? (vue.openBlock(), vue.createElementBlock("img", {
|
|
16228
|
+
key: 0,
|
|
16229
|
+
src: $data.fileList[0].response.data.src,
|
|
16230
|
+
style: vue.normalizeStyle($options.hdlStyleAvatarImage())
|
|
16231
|
+
}, null, 12 /* STYLE, PROPS */, _hoisted_1$4))
|
|
16232
|
+
: (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
16233
|
+
key: 1,
|
|
16234
|
+
class: "avatar-uploader-icon",
|
|
16235
|
+
style: vue.normalizeStyle($options.hdlStyleAvatarIcon())
|
|
16236
|
+
}, {
|
|
16237
|
+
default: vue.withCtx(() => [
|
|
16238
|
+
vue.createVNode(_component_Plus)
|
|
16239
|
+
]),
|
|
16240
|
+
_: 1 /* STABLE */
|
|
16241
|
+
}, 8 /* PROPS */, ["style"]))
|
|
16242
|
+
]),
|
|
16243
|
+
_: 1 /* STABLE */
|
|
16244
|
+
}, 8 /* PROPS */, ["style", "action", "file-list", "before-upload", "on-preview", "on-remove", "on-success"]),
|
|
16245
|
+
($data.fileList.length>0 && $data.fileList[0].response.data.src)
|
|
16246
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$4, [
|
|
16247
|
+
vue.createVNode(_component_el_button, {
|
|
16248
|
+
size: "small",
|
|
16249
|
+
icon: "el-icon-delete",
|
|
16250
|
+
style: {"margin-top":"10px"},
|
|
16251
|
+
onClick: $options.hdlDeleteAll
|
|
16252
|
+
}, {
|
|
16253
|
+
default: vue.withCtx(() => [...(_cache[0] || (_cache[0] = [
|
|
16254
|
+
vue.createTextVNode("删除", -1 /* CACHED */)
|
|
16255
|
+
]))]),
|
|
16256
|
+
_: 1 /* STABLE */
|
|
16257
|
+
}, 8 /* PROPS */, ["onClick"])
|
|
16258
|
+
]))
|
|
16259
|
+
: vue.createCommentVNode("v-if", true)
|
|
16260
|
+
]))
|
|
16261
|
+
}
|
|
16262
|
+
|
|
16263
|
+
script$4.render = render$4;
|
|
16264
|
+
script$4.__scopeId = "data-v-0b647a60";
|
|
16265
|
+
script$4.__file = "src/upload/Upload-avatar.vue";
|
|
16266
|
+
|
|
16267
|
+
var script$3 = {
|
|
16268
|
+
props: ['myProps'],
|
|
16269
|
+
data(){return {
|
|
16270
|
+
fileList: []
|
|
16271
|
+
}},
|
|
16272
|
+
computed: {
|
|
16273
|
+
myProps0(){
|
|
16274
|
+
return Object.assign(ly0default.myProps, this.myProps)
|
|
16275
|
+
}
|
|
16276
|
+
},
|
|
16277
|
+
methods: {
|
|
16278
|
+
hdlStyleAvatarBox(){
|
|
16279
|
+
return "width:" + (this.myProps0.avatar ? this.myProps0.avatar.width : ly0default.carplate.width) + "; " +
|
|
16280
|
+
"height:" + (this.myProps0.avatar ? this.myProps0.avatar.height : ly0default.carplate.height) + "; " +
|
|
16281
|
+
"position: relative; " +
|
|
16282
|
+
"overflow: hidden; " +
|
|
16283
|
+
"cursor: pointer;"
|
|
16284
|
+
},
|
|
16285
|
+
hdlStyleAvatarImage(){
|
|
16286
|
+
return "display: block;" +
|
|
16287
|
+
"width:" + (this.myProps0.avatar ? this.myProps0.avatar.width : ly0default.carplate.width) + "; " +
|
|
16288
|
+
"height:" + (this.myProps0.avatar ? this.myProps0.avatar.height : ly0default.carplate.height) + ";"
|
|
16289
|
+
},
|
|
16290
|
+
hdlStyleAvatarIcon(){
|
|
16291
|
+
return "display: block; " +
|
|
16292
|
+
"width:" + (this.myProps0.avatar ? this.myProps0.avatar.width : ly0default.carplate.width) + "; " +
|
|
16293
|
+
"height:" + (this.myProps0.avatar ? this.myProps0.avatar.height : ly0default.carplate.height) + "; " +
|
|
16294
|
+
"line-height:" + (this.myProps0.avatar ? this.myProps0.avatar.height : ly0default.carplate.height) + "; " +
|
|
16295
|
+
"font-size: 28px; " +
|
|
16296
|
+
"color: #8c939d; " +
|
|
16297
|
+
"text-align: center;"
|
|
16298
|
+
},
|
|
16299
|
+
hdlBeforeUpload (file) {
|
|
16300
|
+
let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
|
|
16301
|
+
let isFileSize = file.size / 1024 < this.myProps0.size;
|
|
16302
|
+
|
|
16303
|
+
if (!isFileType) {
|
|
16304
|
+
this.$message.error('上传文件的格式只能是 ' + this.myProps0.type);
|
|
16305
|
+
return false
|
|
16306
|
+
}
|
|
16307
|
+
if (!isFileSize) {
|
|
16308
|
+
this.$message.error('上传文件的大小不能超过 ' + this.myProps0.size + ' KB');
|
|
16309
|
+
return false
|
|
16310
|
+
}
|
|
16311
|
+
|
|
16312
|
+
this.$message('正在上传 ...');
|
|
16313
|
+
return true
|
|
16314
|
+
},
|
|
16315
|
+
// eslint-disable-next-line
|
|
16316
|
+
hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
|
|
16317
|
+
},
|
|
16318
|
+
// eslint-disable-next-line
|
|
16319
|
+
hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
|
|
16320
|
+
// 重置文件列表
|
|
16321
|
+
// 因为只能上传1个图片,移除即清空
|
|
16322
|
+
this.fileList = [];
|
|
16323
|
+
|
|
16324
|
+
// 返回上传和检测结果
|
|
16325
|
+
this.$emit('getUploadResult', {
|
|
16326
|
+
fileList: []
|
|
16327
|
+
});
|
|
16328
|
+
},
|
|
16329
|
+
// eslint-disable-next-line
|
|
16330
|
+
hdlSuccess (response, file, fileList) { // 上传
|
|
16331
|
+
if (response.code === 0) {
|
|
16332
|
+
// 重置文件列表
|
|
16333
|
+
// 因为只能上传1个图片,这里需要清空图片列表
|
|
16334
|
+
this.fileList = [];
|
|
16335
|
+
this.fileList.push(file);
|
|
16336
|
+
|
|
16337
|
+
// 返回上传结果
|
|
16338
|
+
this.$emit('getUploadResult', {
|
|
16339
|
+
src: response.data.src,
|
|
16340
|
+
result: response.data.result
|
|
16341
|
+
});
|
|
16342
|
+
this.$message({
|
|
16343
|
+
type: 'info',
|
|
16344
|
+
message: '上传成功'
|
|
16345
|
+
});
|
|
16346
|
+
} else {
|
|
16347
|
+
this.$message({
|
|
16348
|
+
type: 'info',
|
|
16349
|
+
message: '上传失败'
|
|
16350
|
+
});
|
|
16351
|
+
}
|
|
16352
|
+
},
|
|
16353
|
+
hdlDeleteAll () { // 删除全部已上传文件
|
|
16354
|
+
// 重置文件列表
|
|
16355
|
+
this.fileList = [];
|
|
16356
|
+
|
|
16357
|
+
// 返回上传结果
|
|
16358
|
+
this.$emit('getUploadResult', {
|
|
16359
|
+
fileList: []
|
|
16360
|
+
});
|
|
16361
|
+
}
|
|
16362
|
+
}
|
|
16363
|
+
};
|
|
16364
|
+
|
|
16365
|
+
const _hoisted_1$3 = ["src"];
|
|
16366
|
+
const _hoisted_2$3 = { key: 0 };
|
|
16367
|
+
|
|
16368
|
+
function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
16369
|
+
const _component_Plus = vue.resolveComponent("Plus");
|
|
16370
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
16371
|
+
const _component_el_upload = vue.resolveComponent("el-upload");
|
|
16372
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
16373
|
+
|
|
16374
|
+
return (vue.openBlock(), vue.createElementBlock("div", null, [
|
|
16375
|
+
vue.createVNode(_component_el_upload, {
|
|
16376
|
+
class: "avatar",
|
|
16377
|
+
style: vue.normalizeStyle($options.hdlStyleAvatarBox()),
|
|
16378
|
+
action: $options.myProps0.uploadUrl,
|
|
16379
|
+
"file-list": $data.fileList,
|
|
16380
|
+
"show-file-list": false,
|
|
16381
|
+
"before-upload": $options.hdlBeforeUpload,
|
|
16382
|
+
"on-preview": $options.hdlPreview,
|
|
16383
|
+
"on-remove": $options.hdlRemove,
|
|
16384
|
+
"on-success": $options.hdlSuccess
|
|
16385
|
+
}, {
|
|
16386
|
+
default: vue.withCtx(() => [
|
|
16387
|
+
($data.fileList.length>0 && $data.fileList[0].response.data.src)
|
|
16388
|
+
? (vue.openBlock(), vue.createElementBlock("img", {
|
|
16389
|
+
key: 0,
|
|
16390
|
+
src: $data.fileList[0].response.data.src,
|
|
16391
|
+
style: vue.normalizeStyle($options.hdlStyleAvatarImage())
|
|
16392
|
+
}, null, 12 /* STYLE, PROPS */, _hoisted_1$3))
|
|
16393
|
+
: (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
16394
|
+
key: 1,
|
|
16395
|
+
class: "avatar-uploader-icon",
|
|
16396
|
+
style: vue.normalizeStyle($options.hdlStyleAvatarIcon())
|
|
16397
|
+
}, {
|
|
16398
|
+
default: vue.withCtx(() => [
|
|
16399
|
+
vue.createVNode(_component_Plus)
|
|
16400
|
+
]),
|
|
16401
|
+
_: 1 /* STABLE */
|
|
16402
|
+
}, 8 /* PROPS */, ["style"]))
|
|
16403
|
+
]),
|
|
16404
|
+
_: 1 /* STABLE */
|
|
16405
|
+
}, 8 /* PROPS */, ["style", "action", "file-list", "before-upload", "on-preview", "on-remove", "on-success"]),
|
|
16406
|
+
($data.fileList.length>0 && $data.fileList[0].src)
|
|
16407
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
|
|
16408
|
+
vue.createVNode(_component_el_button, {
|
|
16409
|
+
size: "small",
|
|
16410
|
+
icon: "el-icon-delete",
|
|
16411
|
+
style: {"margin-top":"10px"},
|
|
16412
|
+
onClick: $options.hdlDeleteAll
|
|
16413
|
+
}, {
|
|
16414
|
+
default: vue.withCtx(() => [...(_cache[0] || (_cache[0] = [
|
|
16415
|
+
vue.createTextVNode("删除", -1 /* CACHED */)
|
|
16416
|
+
]))]),
|
|
16417
|
+
_: 1 /* STABLE */
|
|
16418
|
+
}, 8 /* PROPS */, ["onClick"])
|
|
16419
|
+
]))
|
|
16420
|
+
: vue.createCommentVNode("v-if", true)
|
|
16421
|
+
]))
|
|
16422
|
+
}
|
|
16423
|
+
|
|
16424
|
+
script$3.render = render$3;
|
|
16425
|
+
script$3.__scopeId = "data-v-6fc32e0e";
|
|
16426
|
+
script$3.__file = "src/upload/Upload-carplate.vue";
|
|
16427
|
+
|
|
16428
|
+
var script$2 = {
|
|
16429
|
+
props: ['myProps'],
|
|
16430
|
+
data(){return {
|
|
16431
|
+
fileList: []
|
|
16432
|
+
}},
|
|
16433
|
+
computed: {
|
|
16434
|
+
myProps0(){
|
|
16435
|
+
return Object.assign(ly0default.myProps, this.myProps)
|
|
16436
|
+
}
|
|
16437
|
+
},
|
|
16438
|
+
methods: {
|
|
16439
|
+
hdlBeforeUpload (file) {
|
|
16440
|
+
let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
|
|
16441
|
+
let isFileSize = file.size / 1024 < this.myProps0.size;
|
|
16442
|
+
|
|
16443
|
+
if (!isFileType) {
|
|
16444
|
+
this.$message.error('上传文件的格式只能是 ' + this.myProps0.type);
|
|
16445
|
+
return false
|
|
16446
|
+
}
|
|
16447
|
+
if (!isFileSize) {
|
|
16448
|
+
this.$message.error('上传文件的大小不能超过 ' + this.myProps0.size + ' KB');
|
|
16449
|
+
return false
|
|
16450
|
+
}
|
|
16451
|
+
|
|
16452
|
+
this.$message('正在上传 ...');
|
|
16453
|
+
return true
|
|
16454
|
+
},
|
|
16455
|
+
// eslint-disable-next-line
|
|
16456
|
+
hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
|
|
16457
|
+
},
|
|
16458
|
+
hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
|
|
16459
|
+
// 重置文件列表
|
|
16460
|
+
this.fileList = fileList;
|
|
16461
|
+
|
|
16462
|
+
// 返回上传结果
|
|
16463
|
+
let fileList0 = [];
|
|
16464
|
+
fileList.forEach(i=>{
|
|
16465
|
+
fileList0.push({
|
|
16466
|
+
src: i.response.data.src
|
|
16467
|
+
});
|
|
16468
|
+
});
|
|
16469
|
+
this.$emit('getUploadResult', {
|
|
16470
|
+
fileList: fileList0
|
|
16471
|
+
});
|
|
16472
|
+
},
|
|
16473
|
+
hdlSuccess (response, file, fileList) { // 上传
|
|
16474
|
+
if (response.code === 0) {
|
|
16475
|
+
// 重置文件列表
|
|
16476
|
+
this.fileList = fileList;
|
|
16477
|
+
|
|
16478
|
+
// 返回上传结果
|
|
16479
|
+
let fileList0 = [];
|
|
16480
|
+
fileList.forEach(i=>{
|
|
16481
|
+
fileList0.push({
|
|
16482
|
+
src: i.response.data.src
|
|
16483
|
+
});
|
|
16484
|
+
});
|
|
16485
|
+
this.$emit('getUploadResult', {
|
|
16486
|
+
fileList: fileList0
|
|
16487
|
+
});
|
|
16488
|
+
this.$message({
|
|
16489
|
+
type: 'info',
|
|
16490
|
+
message: '上传成功'
|
|
16491
|
+
});
|
|
16492
|
+
} else {
|
|
16493
|
+
this.$message({
|
|
16494
|
+
type: 'info',
|
|
16495
|
+
message: '上传失败'
|
|
16496
|
+
});
|
|
16497
|
+
}
|
|
16498
|
+
},
|
|
16499
|
+
hdlDeleteAll () { // 删除全部已上传文件
|
|
16500
|
+
// 重置文件列表
|
|
16501
|
+
this.fileList = [];
|
|
16502
|
+
|
|
16503
|
+
// 返回上传结果
|
|
16504
|
+
this.$emit('getUploadResult', {
|
|
16505
|
+
fileList: []
|
|
16506
|
+
});
|
|
16507
|
+
}
|
|
16508
|
+
}
|
|
16509
|
+
};
|
|
16510
|
+
|
|
16511
|
+
const _hoisted_1$2 = { class: "el-upload__tip" };
|
|
16512
|
+
const _hoisted_2$2 = {
|
|
16513
|
+
key: 0,
|
|
16514
|
+
style: {"font-size":"xx-small"}
|
|
16515
|
+
};
|
|
16516
|
+
|
|
16517
|
+
function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
16518
|
+
const _component_upload_filled = vue.resolveComponent("upload-filled");
|
|
16519
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
16520
|
+
const _component_el_upload = vue.resolveComponent("el-upload");
|
|
16521
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
16522
|
+
|
|
16523
|
+
return (vue.openBlock(), vue.createElementBlock("div", null, [
|
|
16524
|
+
vue.createVNode(_component_el_upload, {
|
|
16525
|
+
action: $options.myProps0.uploadUrl,
|
|
16526
|
+
"file-list": $data.fileList,
|
|
16527
|
+
"list-type": "text",
|
|
16528
|
+
"before-upload": $options.hdlBeforeUpload,
|
|
16529
|
+
"on-preview": $options.hdlPreview,
|
|
16530
|
+
"on-remove": $options.hdlRemove,
|
|
16531
|
+
"on-success": $options.hdlSuccess,
|
|
16532
|
+
limit: $options.myProps0.limit,
|
|
16533
|
+
drag: ""
|
|
16534
|
+
}, {
|
|
16535
|
+
tip: vue.withCtx(() => [
|
|
16536
|
+
vue.createElementVNode("div", _hoisted_1$2, " " + vue.toDisplayString($options.myProps0.tip ? $options.myProps0.tip : "可以上传" + $options.myProps0.limit + "个文件"), 1 /* TEXT */)
|
|
16537
|
+
]),
|
|
16538
|
+
default: vue.withCtx(() => [
|
|
16539
|
+
vue.createVNode(_component_el_icon, { class: "el-icon--upload" }, {
|
|
16540
|
+
default: vue.withCtx(() => [
|
|
16541
|
+
vue.createVNode(_component_upload_filled)
|
|
16542
|
+
]),
|
|
16543
|
+
_: 1 /* STABLE */
|
|
16544
|
+
}),
|
|
16545
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("div", { class: "el-upload__text" }, [
|
|
16546
|
+
vue.createTextVNode("将文件拖到此处,或"),
|
|
16547
|
+
vue.createElementVNode("em", null, "点击上传")
|
|
16548
|
+
], -1 /* CACHED */))
|
|
16549
|
+
]),
|
|
16550
|
+
_: 1 /* STABLE */
|
|
16551
|
+
}, 8 /* PROPS */, ["action", "file-list", "before-upload", "on-preview", "on-remove", "on-success", "limit"]),
|
|
16552
|
+
($data.fileList.length>0)
|
|
16553
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, vue.toDisplayString("已上传"+$data.fileList.length+"个文件"), 1 /* TEXT */))
|
|
16554
|
+
: vue.createCommentVNode("v-if", true),
|
|
16555
|
+
($data.fileList.length>0)
|
|
16556
|
+
? (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
16557
|
+
key: 1,
|
|
16558
|
+
size: "small",
|
|
16559
|
+
style: {"margin-top":"10px"},
|
|
16560
|
+
onClick: $options.hdlDeleteAll
|
|
16561
|
+
}, {
|
|
16562
|
+
default: vue.withCtx(() => [...(_cache[1] || (_cache[1] = [
|
|
16563
|
+
vue.createTextVNode("删除全部已上传文件", -1 /* CACHED */)
|
|
16564
|
+
]))]),
|
|
16565
|
+
_: 1 /* STABLE */
|
|
16566
|
+
}, 8 /* PROPS */, ["onClick"]))
|
|
16567
|
+
: vue.createCommentVNode("v-if", true)
|
|
16568
|
+
]))
|
|
16569
|
+
}
|
|
16570
|
+
|
|
16571
|
+
script$2.render = render$2;
|
|
16572
|
+
script$2.__file = "src/upload/Upload-drag.vue";
|
|
16573
|
+
|
|
16574
|
+
var script$1 = {
|
|
16575
|
+
props: ['myProps'],
|
|
16576
|
+
data(){return {
|
|
16577
|
+
fileList: []
|
|
16578
|
+
}},
|
|
16579
|
+
computed: {
|
|
16580
|
+
myProps0(){
|
|
16581
|
+
return Object.assign(ly0default.myProps, this.myProps)
|
|
16582
|
+
}
|
|
16583
|
+
},
|
|
16584
|
+
methods: {
|
|
16585
|
+
hdlBeforeUpload (file) {
|
|
16586
|
+
let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
|
|
16587
|
+
let isFileSize = file.size / 1024 < this.myProps0.size;
|
|
16588
|
+
|
|
16589
|
+
if (!isFileType) {
|
|
16590
|
+
this.$message.error('上传图片的格式只能是 ' + this.myProps0.type);
|
|
16591
|
+
return false
|
|
16592
|
+
}
|
|
16593
|
+
if (!isFileSize) {
|
|
16594
|
+
this.$message.error('上传图片的大小不能超过 ' + this.myProps0.size + ' KB');
|
|
16595
|
+
return false
|
|
16596
|
+
}
|
|
16597
|
+
|
|
16598
|
+
this.$message('正在上传 ...');
|
|
16599
|
+
return true
|
|
16600
|
+
},
|
|
16601
|
+
// eslint-disable-next-line
|
|
16602
|
+
hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
|
|
16603
|
+
},
|
|
16604
|
+
hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
|
|
16605
|
+
// 重置文件列表
|
|
16606
|
+
this.fileList = fileList;
|
|
16607
|
+
|
|
16608
|
+
// 返回上传结果
|
|
16609
|
+
let fileList0 = [];
|
|
16610
|
+
fileList.forEach(i=>{
|
|
16611
|
+
fileList0.push({
|
|
16612
|
+
src: i.response.data.src
|
|
16613
|
+
});
|
|
16614
|
+
});
|
|
16615
|
+
this.$emit('getUploadResult', {
|
|
16616
|
+
fileList: fileList0
|
|
16617
|
+
});
|
|
16618
|
+
},
|
|
16619
|
+
hdlSuccess (response, file, fileList) { // 上传
|
|
16620
|
+
if (response.code === 0) {
|
|
16621
|
+
// 重置文件列表
|
|
16622
|
+
this.fileList = fileList;
|
|
16623
|
+
|
|
16624
|
+
// 返回上传结果
|
|
16625
|
+
let fileList0 = [];
|
|
16626
|
+
fileList.forEach(i=>{
|
|
16627
|
+
fileList0.push({
|
|
16628
|
+
src: i.response.data.src
|
|
16629
|
+
});
|
|
16630
|
+
});
|
|
16631
|
+
this.$emit('getUploadResult', {
|
|
16632
|
+
fileList: fileList0
|
|
16633
|
+
});
|
|
16634
|
+
this.$message({
|
|
16635
|
+
type: 'info',
|
|
16636
|
+
message: '上传成功'
|
|
16637
|
+
});
|
|
16638
|
+
} else {
|
|
16639
|
+
this.$message({
|
|
16640
|
+
type: 'info',
|
|
16641
|
+
message: '上传失败'
|
|
16642
|
+
});
|
|
16643
|
+
}
|
|
16644
|
+
},
|
|
16645
|
+
hdlDeleteAll () { // 删除全部已上传图片
|
|
16646
|
+
// 重置文件列表
|
|
16647
|
+
this.fileList = [];
|
|
16648
|
+
|
|
16649
|
+
// 返回上传结果
|
|
16650
|
+
this.$emit('getUploadResult', {
|
|
16651
|
+
fileList: []
|
|
16652
|
+
});
|
|
16653
|
+
}
|
|
16654
|
+
}
|
|
16655
|
+
};
|
|
16656
|
+
|
|
16657
|
+
const _hoisted_1$1 = { class: "el-upload__tip" };
|
|
16658
|
+
const _hoisted_2$1 = {
|
|
16659
|
+
key: 0,
|
|
16660
|
+
style: {"font-size":"xx-small"}
|
|
16661
|
+
};
|
|
16662
|
+
|
|
16663
|
+
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
16664
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
16665
|
+
const _component_el_upload = vue.resolveComponent("el-upload");
|
|
16666
|
+
|
|
16667
|
+
return (vue.openBlock(), vue.createElementBlock("div", null, [
|
|
16668
|
+
vue.createVNode(_component_el_upload, {
|
|
16669
|
+
action: $options.myProps0.uploadUrl,
|
|
16670
|
+
"file-list": $data.fileList,
|
|
16671
|
+
"list-type": "picture",
|
|
16672
|
+
"before-upload": $options.hdlBeforeUpload,
|
|
16673
|
+
"on-preview": $options.hdlPreview,
|
|
16674
|
+
"on-remove": $options.hdlRemove,
|
|
16675
|
+
"on-success": $options.hdlSuccess,
|
|
16676
|
+
limit: $options.myProps0.limit
|
|
16677
|
+
}, {
|
|
16678
|
+
tip: vue.withCtx(() => [
|
|
16679
|
+
vue.createElementVNode("div", _hoisted_1$1, " " + vue.toDisplayString($options.myProps0.tip ? $options.myProps0.tip : "可以上传" + $options.myProps0.limit + "个图片"), 1 /* TEXT */)
|
|
16680
|
+
]),
|
|
16681
|
+
default: vue.withCtx(() => [
|
|
16682
|
+
vue.createVNode(_component_el_button, {
|
|
16683
|
+
size: "small",
|
|
16684
|
+
type: "primary"
|
|
16685
|
+
}, {
|
|
16686
|
+
default: vue.withCtx(() => [...(_cache[0] || (_cache[0] = [
|
|
16687
|
+
vue.createTextVNode("点击上传", -1 /* CACHED */)
|
|
16688
|
+
]))]),
|
|
16689
|
+
_: 1 /* STABLE */
|
|
16690
|
+
})
|
|
16691
|
+
]),
|
|
16692
|
+
_: 1 /* STABLE */
|
|
16693
|
+
}, 8 /* PROPS */, ["action", "file-list", "before-upload", "on-preview", "on-remove", "on-success", "limit"]),
|
|
16694
|
+
($data.fileList.length>0)
|
|
16695
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, vue.toDisplayString("已上传"+$data.fileList.length+"个图片"), 1 /* TEXT */))
|
|
16696
|
+
: vue.createCommentVNode("v-if", true),
|
|
16697
|
+
($data.fileList.length>0)
|
|
16698
|
+
? (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
16699
|
+
key: 1,
|
|
16700
|
+
size: "small",
|
|
16701
|
+
style: {"margin-top":"10px"},
|
|
16702
|
+
onClick: $options.hdlDeleteAll
|
|
16703
|
+
}, {
|
|
16704
|
+
default: vue.withCtx(() => [...(_cache[1] || (_cache[1] = [
|
|
16705
|
+
vue.createTextVNode("删除全部已上传图片", -1 /* CACHED */)
|
|
16706
|
+
]))]),
|
|
16707
|
+
_: 1 /* STABLE */
|
|
16708
|
+
}, 8 /* PROPS */, ["onClick"]))
|
|
16709
|
+
: vue.createCommentVNode("v-if", true)
|
|
16710
|
+
]))
|
|
16711
|
+
}
|
|
16712
|
+
|
|
16713
|
+
script$1.render = render$1;
|
|
16714
|
+
script$1.__file = "src/upload/Upload-picture.vue";
|
|
16715
|
+
|
|
16716
|
+
var script = {
|
|
16717
|
+
props: ['myProps'],
|
|
16718
|
+
data: function () {
|
|
16719
|
+
return {
|
|
16720
|
+
fileList: [],
|
|
16721
|
+
dialogImageUrl: '',
|
|
16722
|
+
dialogVisible: false
|
|
16723
|
+
}
|
|
16724
|
+
},
|
|
16725
|
+
computed: {
|
|
16726
|
+
myProps0(){
|
|
16727
|
+
return Object.assign(ly0default.myProps, this.myProps)
|
|
16728
|
+
}
|
|
16729
|
+
},
|
|
16730
|
+
methods: {
|
|
16731
|
+
hdlBeforeUpload (file) {
|
|
16732
|
+
let isFileType = !this.myProps0.type || file.type === this.myProps0.type;
|
|
16733
|
+
let isFileSize = file.size / 1024 < this.myProps0.size;
|
|
16734
|
+
|
|
16735
|
+
if (!isFileType) {
|
|
16736
|
+
this.$message.error('上传图片的格式只能是 ' + this.myProps0.type);
|
|
16737
|
+
return false
|
|
16738
|
+
}
|
|
16739
|
+
if (!isFileSize) {
|
|
16740
|
+
this.$message.error('上传图片的大小不能超过 ' + this.myProps0.size + ' KB');
|
|
16741
|
+
return false
|
|
16742
|
+
}
|
|
16743
|
+
|
|
16744
|
+
this.$message('正在上传 ...');
|
|
16745
|
+
return true
|
|
16746
|
+
},
|
|
16747
|
+
hdlPreview (file) { // 点击文件列表中已上传的文件时的钩子
|
|
16748
|
+
this.dialogImageUrl = file.url;
|
|
16749
|
+
this.dialogVisible = true;
|
|
16750
|
+
},
|
|
16751
|
+
hdlRemove (file, fileList) { // 文件列表移除文件时的钩子
|
|
16752
|
+
// 重置文件列表
|
|
16753
|
+
this.fileList = fileList;
|
|
16754
|
+
|
|
16755
|
+
// 返回上传结果
|
|
16756
|
+
let fileList0 = [];
|
|
16757
|
+
fileList.forEach(i=>{
|
|
16758
|
+
fileList0.push({
|
|
16759
|
+
src: i.response.data.src
|
|
16760
|
+
});
|
|
16761
|
+
});
|
|
16762
|
+
this.$emit('getUploadResult', {
|
|
16763
|
+
fileList: fileList0
|
|
16764
|
+
});
|
|
16765
|
+
},
|
|
16766
|
+
hdlSuccess (response, file, fileList) { // 上传
|
|
16767
|
+
if (response.code === 0) {
|
|
16768
|
+
// 重置文件列表
|
|
16769
|
+
this.fileList = fileList;
|
|
16770
|
+
|
|
16771
|
+
// 返回上传结果
|
|
16772
|
+
let fileList0 = [];
|
|
16773
|
+
fileList.forEach(i=>{
|
|
16774
|
+
fileList0.push({
|
|
16775
|
+
src: i.response.data.src
|
|
16776
|
+
});
|
|
16777
|
+
});
|
|
16778
|
+
this.$emit('getUploadResult', {
|
|
16779
|
+
fileList: fileList0
|
|
16780
|
+
});
|
|
16781
|
+
this.$message({
|
|
16782
|
+
type: 'info',
|
|
16783
|
+
message: '上传成功'
|
|
16784
|
+
});
|
|
16785
|
+
} else {
|
|
16786
|
+
this.$message({
|
|
16787
|
+
type: 'info',
|
|
16788
|
+
message: '上传失败'
|
|
16789
|
+
});
|
|
16790
|
+
}
|
|
16791
|
+
},
|
|
16792
|
+
hdlDeleteAll () { // 删除全部已上传图片
|
|
16793
|
+
// 重置文件列表
|
|
16794
|
+
this.fileList = [];
|
|
16795
|
+
|
|
16796
|
+
// 返回上传结果
|
|
16797
|
+
this.$emit('getUploadResult', {
|
|
16798
|
+
fileList: []
|
|
16799
|
+
});
|
|
16800
|
+
}
|
|
16801
|
+
}
|
|
16802
|
+
};
|
|
16803
|
+
|
|
16804
|
+
const _hoisted_1 = { class: "el-upload__tip" };
|
|
16805
|
+
const _hoisted_2 = ["src"];
|
|
16806
|
+
const _hoisted_3 = {
|
|
16807
|
+
key: 0,
|
|
16808
|
+
style: {"font-size":"xx-small"}
|
|
16809
|
+
};
|
|
16810
|
+
|
|
16811
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
16812
|
+
const _component_Plus = vue.resolveComponent("Plus");
|
|
16813
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
16814
|
+
const _component_el_upload = vue.resolveComponent("el-upload");
|
|
16815
|
+
const _component_el_dialog = vue.resolveComponent("el-dialog");
|
|
16816
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
16817
|
+
|
|
16818
|
+
return (vue.openBlock(), vue.createElementBlock("div", null, [
|
|
16819
|
+
vue.createVNode(_component_el_upload, {
|
|
16820
|
+
action: $options.myProps0.uploadUrl,
|
|
16821
|
+
"file-list": _ctx.fileList,
|
|
16822
|
+
"list-type": "picture-card",
|
|
16823
|
+
"before-upload": $options.hdlBeforeUpload,
|
|
16824
|
+
"on-preview": $options.hdlPreview,
|
|
16825
|
+
"on-remove": $options.hdlRemove,
|
|
16826
|
+
"on-success": $options.hdlSuccess,
|
|
16827
|
+
limit: $options.myProps0.limit
|
|
16828
|
+
}, {
|
|
16829
|
+
tip: vue.withCtx(() => [
|
|
16830
|
+
vue.createElementVNode("div", _hoisted_1, " " + vue.toDisplayString($options.myProps0.tip ? $options.myProps0.tip : "可以上传" + $options.myProps0.limit + "个图片"), 1 /* TEXT */)
|
|
16831
|
+
]),
|
|
16832
|
+
default: vue.withCtx(() => [
|
|
16833
|
+
vue.createVNode(_component_el_icon, null, {
|
|
16834
|
+
default: vue.withCtx(() => [
|
|
16835
|
+
vue.createVNode(_component_Plus)
|
|
16836
|
+
]),
|
|
16837
|
+
_: 1 /* STABLE */
|
|
16838
|
+
})
|
|
16839
|
+
]),
|
|
16840
|
+
_: 1 /* STABLE */
|
|
16841
|
+
}, 8 /* PROPS */, ["action", "file-list", "before-upload", "on-preview", "on-remove", "on-success", "limit"]),
|
|
16842
|
+
vue.createVNode(_component_el_dialog, {
|
|
16843
|
+
modelValue: _ctx.dialogVisible,
|
|
16844
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((_ctx.dialogVisible) = $event))
|
|
16845
|
+
}, {
|
|
16846
|
+
default: vue.withCtx(() => [
|
|
16847
|
+
vue.createElementVNode("img", {
|
|
16848
|
+
width: "100%",
|
|
16849
|
+
src: _ctx.dialogImageUrl,
|
|
16850
|
+
alt: ""
|
|
16851
|
+
}, null, 8 /* PROPS */, _hoisted_2)
|
|
16852
|
+
]),
|
|
16853
|
+
_: 1 /* STABLE */
|
|
16854
|
+
}, 8 /* PROPS */, ["modelValue"]),
|
|
16855
|
+
(_ctx.fileList.length>0)
|
|
16856
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, vue.toDisplayString("已上传"+_ctx.fileList.length+"个图片"), 1 /* TEXT */))
|
|
16857
|
+
: vue.createCommentVNode("v-if", true),
|
|
16858
|
+
(_ctx.fileList.length>0)
|
|
16859
|
+
? (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
16860
|
+
key: 1,
|
|
16861
|
+
size: "small",
|
|
16862
|
+
style: {"margin-top":"10px"},
|
|
16863
|
+
onClick: $options.hdlDeleteAll
|
|
16864
|
+
}, {
|
|
16865
|
+
default: vue.withCtx(() => [...(_cache[1] || (_cache[1] = [
|
|
16866
|
+
vue.createTextVNode("删除全部已上传图片", -1 /* CACHED */)
|
|
16867
|
+
]))]),
|
|
16868
|
+
_: 1 /* STABLE */
|
|
16869
|
+
}, 8 /* PROPS */, ["onClick"]))
|
|
16870
|
+
: vue.createCommentVNode("v-if", true)
|
|
16871
|
+
]))
|
|
16872
|
+
}
|
|
16873
|
+
|
|
16874
|
+
script.render = render;
|
|
16875
|
+
script.__file = "src/upload/Upload-picture-card.vue";
|
|
16876
|
+
|
|
16877
|
+
var upload = {
|
|
16878
|
+
Upload: script$5,
|
|
16879
|
+
Upload_avatar: script$4,
|
|
16880
|
+
Upload_carplate: script$3,
|
|
16881
|
+
Upload_drag: script$2,
|
|
16882
|
+
Upload_picture: script$1,
|
|
16883
|
+
Upload_pictureCard: script
|
|
15904
16884
|
};
|
|
15905
16885
|
|
|
15906
|
-
var index = {
|
|
16886
|
+
var index = {
|
|
16887
|
+
install: function install(app, options) {
|
|
16888
|
+
// 全局注册组件
|
|
16889
|
+
app.component('ly0Upload', upload.Upload);
|
|
16890
|
+
app.component('ly0Upload_avatar', upload.Upload_avatar);
|
|
16891
|
+
app.component('ly0Upload_carplate', upload.Upload_carplate);
|
|
16892
|
+
app.component('ly0Upload_drag', upload.Upload_drag);
|
|
16893
|
+
app.component('ly0Upload_picture', upload.Upload_picture);
|
|
16894
|
+
app.component('ly0Upload_pictureCard', upload.Upload_pictureCard);
|
|
16895
|
+
},
|
|
16896
|
+
FileSaver: FileSaver,
|
|
16897
|
+
upload: upload
|
|
16898
|
+
};
|
|
15907
16899
|
|
|
15908
16900
|
exports.FileSaver = FileSaver;
|
|
15909
16901
|
exports.default = index;
|
|
16902
|
+
exports.upload = upload;
|
|
15910
16903
|
//# sourceMappingURL=index.cjs.js.map
|