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.

62 lines
1.4 KiB

const cloudDir = "cloud://educoder.6564-educoder-1300855313/";
let _version = "0.19.2";
let { miniProgram:{ envVersion="release", version=_version}={}} = wx.getAccountInfoSync();
version = version||_version;
const developUrl = "https://test-newweb.educoder.net";
const trialUrl = "https://pre-newweb.educoder.net";
const releaseUrl = "https://www.educoder.net";
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;
}
}
const config = global.config = {
version,
envVersion,
saveFlow: wx.getStorageSync('saveFlow'),
env:envVersion,
get apiRoot(){return eduUrl + "/api/"},
get attachDir(){return eduUrl + "/api/attachments/"},
cloudDir,
get eduUrl(){
if(!config.saveFlow)
return eduUrl
else
return ""
},
imgDir: cloudDir + "images/",
get eduImgDir(){
if(!config.saveFlow)
return eduUrl + "/images/"
else
return ""
},
switchEnv,
pages:[
"exercise/pages/exercise_setting/exercise_setting",
"common-homework/pages/common-homework/common-homework"
]
};
switchEnv("release");
//switchEnv(envVersion=="develop"?"trial":"release");
module.exports = config;