1. 医生端开方2.0测试
This commit is contained in:
@@ -3,9 +3,10 @@ import {config} from "@/common/js/index";
|
||||
export async function requestConfig(ins, options, successHandler = null, failHandler = null, completeHandler = null){
|
||||
//原来是:ins.baseUrl = options.baseUrl || ins.baseUrl
|
||||
let baseUrl = options.baseUrl || ins.baseUrl;
|
||||
// TODO 这里写dev还是生产环境
|
||||
if (options.url.split('/').indexOf('newApi') !== -1) {
|
||||
// baseUrl = "http://127.0.0.1:18001/api/doctor/"
|
||||
baseUrl = "https://api.xiaokang88.com/api/doctor/"
|
||||
baseUrl = "http://127.0.0.1:18001/api/doctor/"
|
||||
// baseUrl = "https://api.xiaokang88.com/api/doctor/"
|
||||
}
|
||||
options.url = options.url.replace('/oldApi/', '');
|
||||
options.url = options.url.replace('/newApi/', '');
|
||||
@@ -41,6 +42,20 @@ export async function requestConfig(ins, options, successHandler = null, failHan
|
||||
config["dataType"] = options.dataType || "json"
|
||||
config["responseType"] = options.responseType || "text"
|
||||
config['sslVerify'] = false
|
||||
|
||||
// 如果是需要提交复杂对象/数组的写操作(POST/PUT/PATCH),强制使用 JSON 提交
|
||||
const method = (config["method"] || "GET").toUpperCase()
|
||||
if (["POST", "PUT", "PATCH"].includes(method)) {
|
||||
const data = config["data"]
|
||||
if (data && typeof data === 'object') {
|
||||
const hasComplexValue = Object.values(data).some((v) => {
|
||||
return v && typeof v === 'object'
|
||||
})
|
||||
if (hasComplexValue) {
|
||||
config.header["Content-Type"] = "application/json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(type === "upload"){
|
||||
config["filePath"] = options.filePath
|
||||
config["name"] = options.name
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import Request from './request.js';
|
||||
import errorCode from './errorCode.js';
|
||||
import {Base64} from "js-base64";
|
||||
let baseUrl = 'https://app.xiaokang88.com/service/v1/'; // 域名
|
||||
// let baseUrl = 'http://127.0.0.1:18000/service/v1/'; // 域名
|
||||
// TODO 这里写dev还是生产环境
|
||||
// let baseUrl = 'https://app.xiaokang88.com/service/v1/'; // 域名
|
||||
let baseUrl = 'http://127.0.0.1:18000/service/v1/'; // 域名
|
||||
// let baseUrl = 'http://www.xk888.com/service/v1/'; // 域名
|
||||
export const config = {
|
||||
baseUrl: baseUrl
|
||||
|
||||
Reference in New Issue
Block a user