u
This commit is contained in:
parent
0e05f43f7f
commit
06d5d5ca81
9
index.js
9
index.js
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user