You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0 KiB

const cloudDir = "cloud://educoder.6564-educoder-1300855313/";
let { miniProgram:{ envVersion, version}} = wx.getAccountInfoSync();
const developUrl = "https://test-newweb.educoder.net";
const trialUrl = "https://pre-newweb.educoder.net";
const releaseUrl = "https://www.educoder.net";
let _version = "0.13.0";
var eduUrl = releaseUrl;
/**
*
*/
export function switchEnv(env) {
config.env = env;
if (env == "develop") {
eduUrl = developUrl;
config.version = "开发环境 " + _version +"(点击切换)";
}
else if (env == "trial") {
eduUrl = trialUrl;
config.version = "体验版 " + _version;
}
else {
eduUrl = releaseUrl;
config.version = version||_version;
}
}
const config = global.config = {
version:version||_version,
envVersion,
env:envVersion,
get apiRoot(){return eduUrl + "/api/"},
cloudDir,
get eduUrl(){return eduUrl},
imgDir: cloudDir + "images/",
get eduImgDir(){return eduUrl + "/images/"},
switchEnv
};
switchEnv(envVersion=="develop"?"trial":"release");
module.exports = config;