Commit 3f445935 authored by liujiangnan's avatar liujiangnan

feat: 不同环境的地址

parent 77ab51dc
......@@ -33,7 +33,10 @@ export default class NewClass extends middleLayerBase {
console.log("===jsonStr===", jsonStr);
const { bundleInfo } = JSON.parse(jsonStr);
this.DOMAIN = bundleInfo.base_url;
this.API_BASE = bundleInfo.base_url;
if (this.API_BASE.indexOf("staging-")<0) {
this.DOMAIN = this.DOMAIN.replace("staging-", "");
}
this.token = bundleInfo.token;
this.course_id = bundleInfo.course_id;
this.courseware_id = bundleInfo.courseware_id;
......
......@@ -70,7 +70,7 @@ export abstract class middleLayerBase extends cc.Component {
callNetworkApiPost(uri, data, callBack) {
const xhr = new XMLHttpRequest();
const url = `${this.DOMAIN}${uri}`;
const url = `${this.API_BASE}${uri}`;
xhr.open("POST", url, true);
xhr.setRequestHeader('content-type', 'application/json');
xhr.onreadystatechange = () => {
......@@ -96,7 +96,7 @@ export abstract class middleLayerBase extends cc.Component {
callBack(xhr.responseText);
}
};
const url = `${this.DOMAIN}${uri}${queryStr}`;
const url = `${this.API_BASE}${uri}${queryStr}`;
console.log('url = ' + url);
xhr.open('GET', url, true);
xhr.send();
......@@ -114,7 +114,8 @@ export abstract class middleLayerBase extends cc.Component {
xhr.send();
}
DOMAIN = "http://staging-openapi.iteachabc.com";
DOMAIN = "http://staging-teach.cdn.ireadabc.com/";
API_BASE = "http://staging-openapi.iteachabc.com/";
asyncCallNetworkApiGet(apiName, data): Promise<any> {
return new Promise((resolve, reject) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment