|
|
|
@ -172,7 +172,7 @@ function paste() { |
|
|
|
// 文件上传 |
|
|
|
async function uploadFile() { |
|
|
|
// #ifdef APP-PLUS |
|
|
|
uni.$ui.showToast('APP暂不支持上传文件') |
|
|
|
uni.$ui.showToast('APP暂不支持上传文件'); |
|
|
|
// #endif |
|
|
|
|
|
|
|
// #ifdef H5 |
|
|
|
@ -184,7 +184,6 @@ async function uploadFile() { |
|
|
|
console.error('error: ', error); |
|
|
|
} |
|
|
|
// #endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 拍照上传 |
|
|
|
@ -196,7 +195,7 @@ function uploadPhoto (){ |
|
|
|
count: 1, //默认9 |
|
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 |
|
|
|
sourceType: ['album', 'camera'], //从相册选择 |
|
|
|
success: (res) => { |
|
|
|
success: res => { |
|
|
|
if (!timer) { |
|
|
|
timer = setTimeout(() => { |
|
|
|
uni.$ui.showLoading('正在上传...'); |
|
|
|
@ -209,10 +208,10 @@ function uploadPhoto (){ |
|
|
|
filePath: tempFilePaths[0], |
|
|
|
name: 'files', |
|
|
|
formData: {}, |
|
|
|
success: (res) => { |
|
|
|
success: res => { |
|
|
|
clearTimeout(timer); |
|
|
|
uni.$ui.hideLoading(); |
|
|
|
const data = JSON.parse(res.data) |
|
|
|
const data = JSON.parse(res.data); |
|
|
|
if (data.code === 200) { |
|
|
|
linkValue.value = data.data[0].visitUrl; |
|
|
|
} |
|
|
|
@ -220,10 +219,10 @@ function uploadPhoto (){ |
|
|
|
fail: error => { |
|
|
|
clearTimeout(timer); |
|
|
|
uni.$ui.hideLoading(); |
|
|
|
console.error('error',error) |
|
|
|
console.error('error', error); |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|