...
|
...
|
@@ -66,19 +66,31 @@ export default { |
|
|
return {
|
|
|
multiple: false,
|
|
|
action: {
|
|
|
target: '//upload.qiniup.com/',
|
|
|
target: '/mapp/upload',
|
|
|
data(file) {
|
|
|
return {
|
|
|
token: vm.token,
|
|
|
key: 'license/' + Date.now() + '/' + file.name
|
|
|
key: 'license/' + Date.now() + '/' + file.name,
|
|
|
bucket: 'goodsimg',
|
|
|
userId: vm.getUid(),
|
|
|
method: 'yoho.fileupload'
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
file: this.value,
|
|
|
initialIndex: 0
|
|
|
initialIndex: 0,
|
|
|
uid: ''
|
|
|
};
|
|
|
},
|
|
|
async mounted() {
|
|
|
const user = await this.$sdk.getUser();
|
|
|
|
|
|
this.uid = user.uid;
|
|
|
},
|
|
|
methods: {
|
|
|
getUid() {
|
|
|
return this.uid;
|
|
|
},
|
|
|
filesAdded(files) {
|
|
|
let hasIgnore = false;
|
|
|
const maxSize = 10 * 1024 * 1024; // 10M
|
...
|
...
|
@@ -121,10 +133,10 @@ export default { |
|
|
this.initialIndex = this.file.findIndex(i => file.name === i.name);
|
|
|
|
|
|
const imgs = this.file.map(f => {
|
|
|
return '//img01.yohoboys.com/' + f.response.key + '?imageView2/2/w/450/q/60';
|
|
|
return this.getUploadImgAbsoluteUrl(f.response.data, 'goodsimg') + '?imageView2/2/w/450/q/60';
|
|
|
});
|
|
|
|
|
|
if (file && file.response && file.response.key) {
|
|
|
if (file && file.response && file.response.data) {
|
|
|
this.$createImagePreview({
|
|
|
$props: {
|
|
|
imgs,
|
...
|
...
|
@@ -145,6 +157,24 @@ export default { |
|
|
},
|
|
|
fileRemove(file) {
|
|
|
this.$emit('file-change', file);
|
|
|
},
|
|
|
getUploadImgAbsoluteUrl(url, bucket) {
|
|
|
if (!url) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
let urlArr = url.split('/'),
|
|
|
stag = urlArr[urlArr.length - 1].substr(0, 2),
|
|
|
domain = `static.yhbimg.com/${bucket}`;
|
|
|
|
|
|
url = domain + url;
|
|
|
if (stag === '01') {
|
|
|
return `//img11.${url}`;
|
|
|
} else if (stag === '03') {
|
|
|
return `//flv01.${url}`;
|
|
|
} else {
|
|
|
return `//img12.${url}`;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
...
|
...
|
|