Commit 7455d88e authored by renjintao's avatar renjintao

upload 增加进度条

parent 47f073b6
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
:on-format-error="onFormatError" :on-format-error="onFormatError"
multiple multiple
:style="style" :style="style"
:on-progress="onProgress"
> >
<div style="padding: 20px 0;text-align:center" v-if="cloudIco"> <div style="padding: 20px 0;text-align:center" v-if="cloudIco">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon> <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
</div> </div>
<Button icon="ios-cloud-upload-outline" v-if="!cloudIco">上传文件</Button> <Button icon="ios-cloud-upload-outline" v-if="!cloudIco">上传文件</Button>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro"/>
<Tag <Tag
v-for="(item,index) in nameList" v-for="(item,index) in nameList"
:key="index" :key="index"
...@@ -47,7 +49,9 @@ export default { ...@@ -47,7 +49,9 @@ export default {
hbaseFileListNew: [], hbaseFileListNew: [],
formatList: ['png', 'jpg', 'gif'], formatList: ['png', 'jpg', 'gif'],
postUrl: '', postUrl: '',
style: '' style: '',
per: 0,
vshowPro: false
} }
}, },
created() {}, created() {},
...@@ -75,11 +79,17 @@ export default { ...@@ -75,11 +79,17 @@ export default {
} }
}, },
methods: { methods: {
onProgress(event, file, fileList) {
this.per = 0
this.vshowPro = true
},
// change(event) { // change(event) {
// this.$emit('on-change', event) // this.$emit('on-change', event)
// }, // },
//上传成功文件 //上传成功文件
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
this.per = 60
this.vshowPro = true
const hbaseFileList = [] const hbaseFileList = []
const filesList = [] const filesList = []
if (file.response.status == 0) { if (file.response.status == 0) {
...@@ -89,6 +99,11 @@ export default { ...@@ -89,6 +99,11 @@ export default {
objImag.id = file.response.data.id objImag.id = file.response.data.id
filesList.push(objImag) filesList.push(objImag)
this.nameList = this.nameList.concat(filesList) this.nameList = this.nameList.concat(filesList)
this.per = 100
setTimeout(() => {
this.per = 0
this.vshowPro = false
}, 2000)
} else { } else {
this.$Message.error('上传失败,请重新上传!') this.$Message.error('上传失败,请重新上传!')
} }
......
...@@ -22,9 +22,11 @@ ...@@ -22,9 +22,11 @@
:on-format-error="onFormatError" :on-format-error="onFormatError"
:show-upload-list="false" :show-upload-list="false"
:files="files" :files="files"
:on-progress="onProgress"
> >
<Button type="primary" icon="ios-cloud-upload-outline">本地上传</Button> <Button type="primary" icon="ios-cloud-upload-outline">本地上传</Button>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro"/>
</Col> </Col>
</Row> </Row>
</template> </template>
...@@ -86,7 +88,9 @@ export default { ...@@ -86,7 +88,9 @@ export default {
'&' + '&' +
this.parms, this.parms,
formatList: ['png', 'jpg', 'gif'], formatList: ['png', 'jpg', 'gif'],
newName: '' newName: '',
per: 0,
vshowPro: false
} }
}, },
created() { created() {
...@@ -256,11 +260,17 @@ export default { ...@@ -256,11 +260,17 @@ export default {
this.isCancas = true this.isCancas = true
this.isphoto = false this.isphoto = false
}, },
onProgress(event, file, fileList) {
this.per = 0
this.vshowPro = true
},
// change(event) { // change(event) {
// this.$emit('on-change', event.target.value) // this.$emit('on-change', event.target.value)
// }, // },
//上传成功文件 //上传成功文件
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
this.per = 60
this.vshowPro = true
const hbaseFileList = [] const hbaseFileList = []
const filesList = [] const filesList = []
if (file.response.status == 0) { if (file.response.status == 0) {
...@@ -271,6 +281,11 @@ export default { ...@@ -271,6 +281,11 @@ export default {
this.fileUrlPath = this.downUrl + objImag.filePath this.fileUrlPath = this.downUrl + objImag.filePath
this.newName = file.response.data.fileName this.newName = file.response.data.fileName
this.$emit('on-change', JSON.stringify(filesList)) this.$emit('on-change', JSON.stringify(filesList))
this.per = 100
setTimeout(() => {
this.per = 0
this.vshowPro = false
}, 2000)
} else { } else {
this.$Message.error('上传失败,请重新上传!') this.$Message.error('上传失败,请重新上传!')
} }
......
...@@ -14,9 +14,11 @@ ...@@ -14,9 +14,11 @@
:on-format-error="onFormatError" :on-format-error="onFormatError"
:show-upload-list="false" :show-upload-list="false"
:files="files" :files="files"
:on-progress="onProgress"
> >
<Button icon="ios-cloud-upload-outline">上传文件</Button> <Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro"/>
</div> </div>
</template> </template>
<script> <script>
...@@ -40,7 +42,9 @@ export default { ...@@ -40,7 +42,9 @@ export default {
'&' + '&' +
this.parms, this.parms,
formatList: ['png', 'jpg', 'gif'], formatList: ['png', 'jpg', 'gif'],
newName: '' newName: '',
per: 0,
vshowPro: false
} }
}, },
created() {}, created() {},
...@@ -60,11 +64,17 @@ export default { ...@@ -60,11 +64,17 @@ export default {
} }
}, },
methods: { methods: {
onProgress(event, file, fileList) {
this.per = 0
this.vshowPro = true
},
// change(event) { // change(event) {
// this.$emit('on-change', event.target.value) // this.$emit('on-change', event.target.value)
// }, // },
//上传成功文件 //上传成功文件
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
this.per = 60
this.vshowPro = true
const hbaseFileList = [] const hbaseFileList = []
const filesList = [] const filesList = []
if (file.response.status == 0) { if (file.response.status == 0) {
...@@ -74,6 +84,11 @@ export default { ...@@ -74,6 +84,11 @@ export default {
filesList.push(objImag) filesList.push(objImag)
this.newName = file.response.data.fileName this.newName = file.response.data.fileName
this.$emit('on-change', JSON.stringify(filesList)) this.$emit('on-change', JSON.stringify(filesList))
this.per = 100
setTimeout(() => {
this.per = 0
this.vshowPro = false
}, 2000)
} else { } else {
this.$Message.error('上传失败,请重新上传!') this.$Message.error('上传失败,请重新上传!')
} }
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
:on-exceeded-size="onExceededSize" :on-exceeded-size="onExceededSize"
:on-format-error="onFormatError" :on-format-error="onFormatError"
:action="postUrl" :action="postUrl"
:on-progress="onProgress"
> >
<div style="padding: 20px 0;text-align:center"> <div style="padding: 20px 0;text-align:center">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon> <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>将文件拖到此处,或点击上传</p> <p>将文件拖到此处,或点击上传</p>
</div> </div>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro"/>
<Tag <Tag
v-for="(item,index) in nameList" v-for="(item,index) in nameList"
:key="index" :key="index"
...@@ -62,7 +64,9 @@ export default { ...@@ -62,7 +64,9 @@ export default {
'jpg', 'jpg',
'gif' 'gif'
], ],
postUrl: '' postUrl: '',
per: 0,
vshowPro: false
} }
}, },
created() {}, created() {},
...@@ -72,7 +76,13 @@ export default { ...@@ -72,7 +76,13 @@ export default {
this.intFiles() this.intFiles()
}, },
onProgress(event, file, fileList) {
this.per = 0
this.vshowPro = true
},
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
this.per = 60
this.vshowPro = true
const hbaseFileList = [] const hbaseFileList = []
const filesList = [] const filesList = []
if (file.response.status == 0) { if (file.response.status == 0) {
...@@ -82,6 +92,11 @@ export default { ...@@ -82,6 +92,11 @@ export default {
objImag.id = file.response.data.id objImag.id = file.response.data.id
filesList.push(objImag) filesList.push(objImag)
this.nameList = this.nameList.concat(filesList) this.nameList = this.nameList.concat(filesList)
this.per = 100
setTimeout(() => {
this.per = 0
this.vshowPro = false
}, 2000)
var url = `${designUrl}/routingfile/createorupdate` var url = `${designUrl}/routingfile/createorupdate`
var dataValidate = { var dataValidate = {
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
:on-exceeded-size="onExceededSize" :on-exceeded-size="onExceededSize"
:on-format-error="onFormatError" :on-format-error="onFormatError"
:action="postUrl" :action="postUrl"
:on-progress="onProgress"
> >
<div style="padding: 20px 0;text-align:center"> <div style="padding: 20px 0;text-align:center">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon> <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>将文件拖到此处,或点击上传</p> <p>将文件拖到此处,或点击上传</p>
</div> </div>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro"/>
<Tag <Tag
v-for="(item,index) in nameList" v-for="(item,index) in nameList"
:key="index" :key="index"
...@@ -53,7 +55,9 @@ export default { ...@@ -53,7 +55,9 @@ export default {
'jpg', 'jpg',
'gif' 'gif'
], ],
postUrl: '' postUrl: '',
per: 0,
vshowPro: false
} }
}, },
created() {}, created() {},
...@@ -66,8 +70,13 @@ export default { ...@@ -66,8 +70,13 @@ export default {
}, },
methods: { methods: {
onProgress(event, file, fileList) {
this.per = 0
this.vshowPro = true
},
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
this.per = 60
this.vshowPro = true
const hbaseFileList = [] const hbaseFileList = []
const filesList = [] const filesList = []
if (file.response.status == 0) { if (file.response.status == 0) {
...@@ -77,6 +86,11 @@ export default { ...@@ -77,6 +86,11 @@ export default {
objImag.id = file.response.data.id objImag.id = file.response.data.id
filesList.push(objImag) filesList.push(objImag)
this.nameList = this.nameList.concat(filesList) this.nameList = this.nameList.concat(filesList)
this.per = 100
setTimeout(() => {
this.per = 0
this.vshowPro = false
}, 2000)
} else { } else {
this.$Message.error('上传失败,请重新上传!') this.$Message.error('上传失败,请重新上传!')
} }
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
:on-exceeded-size="onExceededSize" :on-exceeded-size="onExceededSize"
:on-format-error="onFormatError" :on-format-error="onFormatError"
:action="postUrl" :action="postUrl"
:on-progress="onProgress"
> >
<div style="padding: 20px 0;text-align:center"> <div style="padding: 20px 0;text-align:center">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon> <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>将文件拖到此处,或点击上传</p> <p>将文件拖到此处,或点击上传</p>
</div> </div>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro"/>
<Tag <Tag
v-for="(item,index) in nameList" v-for="(item,index) in nameList"
:key="index" :key="index"
...@@ -62,7 +64,9 @@ export default { ...@@ -62,7 +64,9 @@ export default {
'jpg', 'jpg',
'gif' 'gif'
], ],
postUrl: '' postUrl: '',
per: 0,
vshowPro: false
} }
}, },
created() {}, created() {},
...@@ -72,7 +76,13 @@ export default { ...@@ -72,7 +76,13 @@ export default {
this.intFiles() this.intFiles()
}, },
onProgress(event, file, fileList) {
this.per = 0
this.vshowPro = true
},
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
this.per = 60
this.vshowPro = true
const hbaseFileList = [] const hbaseFileList = []
const filesList = [] const filesList = []
if (file.response.status == 0) { if (file.response.status == 0) {
...@@ -82,6 +92,11 @@ export default { ...@@ -82,6 +92,11 @@ export default {
objImag.id = file.response.data.id objImag.id = file.response.data.id
filesList.push(objImag) filesList.push(objImag)
this.nameList = this.nameList.concat(filesList) this.nameList = this.nameList.concat(filesList)
this.per = 100
setTimeout(() => {
this.per = 0
this.vshowPro = false
}, 2000)
var url = `${designUrl}/routingfile/createorupdate` var url = `${designUrl}/routingfile/createorupdate`
var dataValidate = { var dataValidate = {
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
:on-exceeded-size="onExceededSize" :on-exceeded-size="onExceededSize"
:on-format-error="onFormatError" :on-format-error="onFormatError"
:action="postUrl" :action="postUrl"
:on-progress="onProgress"
> >
<div style="padding: 20px 0;text-align:center"> <div style="padding: 20px 0;text-align:center">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon> <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>将文件拖到此处,或点击上传</p> <p>将文件拖到此处,或点击上传</p>
</div> </div>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro"/>
<Tag <Tag
v-for="(item,index) in nameList" v-for="(item,index) in nameList"
:key="index" :key="index"
...@@ -53,7 +55,9 @@ export default { ...@@ -53,7 +55,9 @@ export default {
'jpg', 'jpg',
'gif' 'gif'
], ],
postUrl: '' postUrl: '',
per: 0,
vshowPro: false
} }
}, },
created() {}, created() {},
...@@ -66,8 +70,13 @@ export default { ...@@ -66,8 +70,13 @@ export default {
}, },
methods: { methods: {
onProgress(event, file, fileList) {
this.per = 0
this.vshowPro = true
},
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
this.per = 60
this.vshowPro = true
const hbaseFileList = [] const hbaseFileList = []
const filesList = [] const filesList = []
if (file.response.status == 0) { if (file.response.status == 0) {
...@@ -77,6 +86,11 @@ export default { ...@@ -77,6 +86,11 @@ export default {
objImag.id = file.response.data.id objImag.id = file.response.data.id
filesList.push(objImag) filesList.push(objImag)
this.nameList = this.nameList.concat(filesList) this.nameList = this.nameList.concat(filesList)
this.per = 100
setTimeout(() => {
this.per = 0
this.vshowPro = false
}, 2000)
} else { } else {
this.$Message.error('上传失败,请重新上传!') this.$Message.error('上传失败,请重新上传!')
} }
......
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