This commit is contained in:
陆柯 2021-10-20 10:19:03 +08:00
parent 0e05f43f7f
commit 06d5d5ca81

View File

@ -62,6 +62,7 @@ module.exports = {
makeServerUrl(route = '') {
if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。
route.replace('\\', '/')
if (/^https?:\/\//.test(route)) {
return route
}
@ -219,12 +220,12 @@ module.exports = {
// url 所在方法进一步处理后,通过 uploadFile 存在 data 里返回结果
uni.hideLoading()
try{ // 不知为何uni.uploadFile返回的 data 是字符串而不是对象
if (typeof(data)==='string') {
if (typeof(data)==='string') { // 不知为何uni.uploadFile返回的 data 是字符串而不是对象
try{
data = JSON.parse(data)
}catch(exp){
return { _state: 'CLIENT_FAIL_RESPONSE_JSON_MALFORMED'}
}
}catch(exp){
return { _state: 'CLIENT_FAIL_RESPONSE_JSON_MALFORMED'}
}
if (data?._state==='SUCCESS' && data?.path) {