Commit 590c83b0 by hank

bug

parent e3bb6ab4
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
:on-success="handleSuccess" :on-success="handleSuccess"
:before-upload="beforeUpload" :before-upload="beforeUpload"
class="editor-slide-upload" class="editor-slide-upload"
action="https://httpbin.org/post" :action="uploadUrl"
name="resource"
list-type="picture-card" list-type="picture-card"
> >
<!-- https://httpbin.org/post -->
<el-button size="small" type="primary"> <el-button size="small" type="primary">
点击上传 点击上传
</el-button> </el-button>
...@@ -31,7 +33,7 @@ ...@@ -31,7 +33,7 @@
<script> <script>
// import { getToken } from 'api/qiniu' // import { getToken } from 'api/qiniu'
import { uploadUrl } from '@/api/device'
export default { export default {
name: 'EditorSlideUpload', name: 'EditorSlideUpload',
props: { props: {
...@@ -43,6 +45,7 @@ export default { ...@@ -43,6 +45,7 @@ export default {
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
uploadUrl: uploadUrl(),
listObj: {}, listObj: {},
fileList: [] fileList: []
} }
...@@ -63,11 +66,12 @@ export default { ...@@ -63,11 +66,12 @@ export default {
this.dialogVisible = false this.dialogVisible = false
}, },
handleSuccess(response, file) { handleSuccess(response, file) {
console.log(response)
const uid = file.uid const uid = file.uid
const objKeyArr = Object.keys(this.listObj) const objKeyArr = Object.keys(this.listObj)
for (let i = 0, len = objKeyArr.length; i < len; i++) { for (let i = 0, len = objKeyArr.length; i < len; i++) {
if (this.listObj[objKeyArr[i]].uid === uid) { if (this.listObj[objKeyArr[i]].uid === uid) {
this.listObj[objKeyArr[i]].url = response.files.file this.listObj[objKeyArr[i]].url = response.data
this.listObj[objKeyArr[i]].hasSuccess = true this.listObj[objKeyArr[i]].hasSuccess = true
return return
} }
......
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 sign in to comment