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.
58 lines
1.4 KiB
58 lines
1.4 KiB
import config from "./config";
|
|
import {client} from "./js/client";
|
|
|
|
wx.cloud.init({
|
|
traceUser: true,
|
|
env: "educoder"
|
|
});
|
|
|
|
App({
|
|
globalData: {
|
|
versionCode: config.versionCode,
|
|
debug: config.debug
|
|
},
|
|
client,
|
|
api(name, config){return client.api(name,config)},
|
|
callApi(options){return client.callApi(options)},
|
|
user(){ return client.user},
|
|
syncUser(options){return client.syncUser(options)},
|
|
onLaunch: function () {
|
|
|
|
},
|
|
showError(e){
|
|
wx.showToast({
|
|
title: e.message,
|
|
icon:"none"
|
|
})
|
|
},
|
|
showMsg(res){
|
|
wx.showToast({
|
|
title: res.message,
|
|
})
|
|
},
|
|
getPageUrl(url){
|
|
return url.replace(/{(.*)}/, function (match, name) {
|
|
for (var u of __wxConfig.pages) {
|
|
if (u.endsWith("/"+name))
|
|
return "/" + u;
|
|
}
|
|
return match;
|
|
});
|
|
},
|
|
reLaunch({url, success, fail, complete}){
|
|
wx.reLaunch({url: this.getPageUrl(url),success,fail,complete})
|
|
},
|
|
redirectTo({url, success, fail, complete}){
|
|
wx.redirectTo({url: this.getPageUrl(url),success,fail,complete})
|
|
},
|
|
navigateTo({url, success, fail, complete}){
|
|
wx.navigateTo({url: this.getPageUrl(url),success,fail,complete})
|
|
},
|
|
shareApp({imageUrl,path,title}){
|
|
return {
|
|
title: title||"EduCoder教学",
|
|
imageUrl:imageUrl||"",
|
|
path
|
|
}
|
|
}
|
|
}); |