|
@@ -78,72 +78,16 @@ export default {
|
|
|
success: async res => {
|
|
|
// #ifdef H5
|
|
|
uploadImgs(res.tempFiles[0]).then(res=>{
|
|
|
- console.log(res);
|
|
|
+ this.files.push({
|
|
|
+ url:res.url
|
|
|
+ })
|
|
|
})
|
|
|
- //获取阿里oss上传参数
|
|
|
- // const par = await api.get('/common/oss/config').then(res => {
|
|
|
- // return res.data
|
|
|
- // })
|
|
|
-
|
|
|
- // console.log(res)
|
|
|
-
|
|
|
- // const blob = new Blob(res.tempFilePaths, { type: 'text/plain' })
|
|
|
- // console.log(par, blob)
|
|
|
- // const formData = new FormData()
|
|
|
- // formData.append('file', blob, 'dsff')
|
|
|
-
|
|
|
- // // 配置axios请求参数
|
|
|
- // const config = {
|
|
|
- // method: 'post',
|
|
|
- // url: par.host, // 根据你的存储桶所在地区修改域名
|
|
|
- // headers: {
|
|
|
- // 'Content-Type': 'multipart/form-data'
|
|
|
- // },
|
|
|
- // data: formData
|
|
|
- // }
|
|
|
-
|
|
|
- // upload()
|
|
|
-
|
|
|
- // 发送上传请求
|
|
|
- // try {
|
|
|
- // const response = await api('',config)
|
|
|
- // if (response.status === 200) {
|
|
|
- // console.log('上传成功')
|
|
|
- // } else {
|
|
|
- // console.log('上传失败', response)
|
|
|
- // }
|
|
|
- // } catch (error) {
|
|
|
- // console.log('上传发生错误', error)
|
|
|
- // }
|
|
|
-
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
|
// #endif
|
|
|
-
|
|
|
- const leng = res.tempFiles.length
|
|
|
- console.log(res)
|
|
|
-
|
|
|
- return
|
|
|
-
|
|
|
- for (var file of res.tempFiles) {
|
|
|
- this.files.push({
|
|
|
- url: false,
|
|
|
- key: b64_md5(file.path),
|
|
|
- loUrl: file.path
|
|
|
- })
|
|
|
- }
|
|
|
- for (var i = 0; i < leng; i++) {
|
|
|
- var data = await uploadImg(res.tempFiles[i])
|
|
|
- console.log(data, this.files, b64_md5(res.tempFiles[i].path), 99)
|
|
|
- var obj = this.files.find(item => item.key === b64_md5(res.tempFiles[i].path))
|
|
|
- if (obj) {
|
|
|
- obj.url = data.data.url
|
|
|
- obj.key = b64_md5(data.data.url || '')
|
|
|
- delete obj.loUrl
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
},
|
|
|
fail: err => {
|
|
|
console.log(err)
|