Commit 02c7ed03 authored by renjintao's avatar renjintao

input

parent 0c62226b
<!--一次只能上传一个文件 -->
<template>
<div>
<div>
<Input
v-model="newName"
style="height:30px;width:240px;float:left;"
placeholder="请选择上传文件"
disabled
/>
<Upload
v-model="name"
:action="postUrl"
:on-success="uploadSuccess"
:on-error="uploadError"
:on-remove="removeFile"
:format="formatList"
:max-size="maxSize"
:on-exceeded-size="onExceededSize"
:on-format-error="onFormatError"
:show-upload-list="false"
:files="files"
:on-progress="onProgress"
style="width:120px;float:left"
>
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
<a v-show="newName.length>2&&showButton" :href="fileUrlPath" @click="downFile(newPath)" target="_blank" style="float:left">查看</a>
</div>
<Input v-model="newName" style="height:28px;width:400px;float:left;margin-top:2px;">
<Button slot="prepend" icon="ios-eye" title="查看" @click="downFile(newName)"></Button>
</Input>
<Upload
v-model="name"
:action="postUrl"
:on-success="uploadSuccess"
:on-error="uploadError"
:on-remove="removeFile"
:format="formatList"
:max-size="maxSize"
:on-exceeded-size="onExceededSize"
:on-format-error="onFormatError"
:show-upload-list="false"
:files="files"
:on-progress="onProgress"
>
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro" />
</div>
</template>
......@@ -52,7 +44,7 @@ export default {
this.parms,
formatList: ["png", "jpg", "gif"],
newName: "",
newPath:'',
newPath: "",
per: 0,
vshowPro: false
};
......@@ -72,9 +64,9 @@ export default {
type: String,
default: ""
},
showButton:{
type:Boolean,
default:true,
showButton: {
type: Boolean,
default: true
}
},
methods: {
......@@ -96,8 +88,8 @@ export default {
objImag.fileName = file.response.data.fileName;
objImag.filePath = file.response.data.downloadPath;
filesList.push(objImag);
this.newName = file.response.data.fileName;
this.newPath=file.response.data.downloadPath
this.newName = file.response.data.downloadPath;
this.newPath = file.response.data.downloadPath;
this.$emit("on-change", JSON.stringify(filesList));
this.per = 100;
setTimeout(() => {
......@@ -146,9 +138,20 @@ export default {
}
return this.formatList;
},
downFile(path) {
this.fileUrlPath = this.downUrl + path;
},
downFile(path) {
let truePath = path.trim();
if (truePath.length > 2) {
if (
truePath.substring(0, 7).toLowerCase() == "http://" ||
truePath.substring(0, 8).toLowerCase() == "https://"
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
}
}
}
},
mounted() {
this.formatL();
......@@ -166,5 +169,4 @@ export default {
};
</script>
<style lang="less">
</style>
\ No newline at end of file
......@@ -126,7 +126,7 @@ export default {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$refs.inputfile.newName = this.entity.qualityTemplateName;
this.$refs.inputfile.newName = this.entity.qualityTemplate;
this.$refs.inputfile.newPath = this.entity.qualityTemplate;
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment