u
This commit is contained in:
parent
0e05f43f7f
commit
06d5d5ca81
9
index.js
9
index.js
@ -62,6 +62,7 @@ module.exports = {
|
|||||||
makeServerUrl(route = '') {
|
makeServerUrl(route = '') {
|
||||||
if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。
|
if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。
|
||||||
|
|
||||||
|
route.replace('\\', '/')
|
||||||
if (/^https?:\/\//.test(route)) {
|
if (/^https?:\/\//.test(route)) {
|
||||||
return route
|
return route
|
||||||
}
|
}
|
||||||
@ -219,12 +220,12 @@ module.exports = {
|
|||||||
// url 所在方法进一步处理后,通过 uploadFile 存在 data 里返回结果
|
// url 所在方法进一步处理后,通过 uploadFile 存在 data 里返回结果
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
|
||||||
try{ // 不知为何,uni.uploadFile返回的 data 是字符串而不是对象
|
if (typeof(data)==='string') { // 不知为何,uni.uploadFile返回的 data 是字符串而不是对象
|
||||||
if (typeof(data)==='string') {
|
try{
|
||||||
data = JSON.parse(data)
|
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) {
|
if (data?._state==='SUCCESS' && data?.path) {
|
||||||
|
Loading…
Reference in New Issue
Block a user