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.

51 lines
1.2 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.14.5";
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/"},
get attachDir(){return eduUrl + "/api/attachments/"},
cloudDir,
get eduUrl(){return eduUrl},
imgDir: cloudDir + "images/",
get eduImgDir(){return eduUrl + "/images/"},
switchEnv,
pages:[
"exercise/pages/exercise_setting/exercise_setting",
"common-homework/pages/common-homework/common-homework"
]
};
envVersion="release";
switchEnv(envVersion=="develop"?"trial":"release");
module.exports = config;