修正低版本getLaunchOptionsSync报错的问题
This commit is contained in:
parent
55c5eb84d0
commit
a6ca58881e
22
src/app.wpy
22
src/app.wpy
@ -58,16 +58,6 @@ export default class extends wepy.app {
|
||||
this.use('requestfix');
|
||||
this.use('promisify');
|
||||
// (g.env === 'test') && hookConsoleLog();
|
||||
sdkManage.init();
|
||||
sdkManage.Login(() => {
|
||||
let account = wepy.getStorageSync('account');
|
||||
console.log('finish parse jcfw');
|
||||
console.log(account);
|
||||
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {});
|
||||
if (this.checkClientLogin()) {
|
||||
this.login();
|
||||
}
|
||||
});
|
||||
//全局拦截器
|
||||
this.intercept('request', {
|
||||
config(p) {
|
||||
@ -118,7 +108,17 @@ export default class extends wepy.app {
|
||||
}
|
||||
})
|
||||
}
|
||||
onLaunch() {
|
||||
onLaunch(options) {
|
||||
sdkManage.init(options);
|
||||
sdkManage.Login(() => {
|
||||
let account = wepy.getStorageSync('account');
|
||||
console.log('finish parse jcfw');
|
||||
console.log(account);
|
||||
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {});
|
||||
if (this.checkClientLogin()) {
|
||||
this.login();
|
||||
}
|
||||
});
|
||||
}
|
||||
onShow(options) {
|
||||
console.log('app.onShow');
|
||||
|
@ -22,8 +22,9 @@ var SDKManage = function() {
|
||||
this.hasLogin = false;
|
||||
this.vision = '1.0.0';
|
||||
this.ChannelId = 6001;
|
||||
this.init = function() {
|
||||
jcfw.init(this.ChannelId, this.gameId, this.isoffical);
|
||||
this.init = function(launchObj) {
|
||||
this.launchObj = launchObj;
|
||||
jcfw.init(this.ChannelId, this.gameId, this.isoffical, launchObj);
|
||||
};
|
||||
this.doLogin = function(res) {
|
||||
if (this.loginStep < this.logincbarr.length) {
|
||||
@ -34,9 +35,12 @@ var SDKManage = function() {
|
||||
}
|
||||
};
|
||||
this.checkSharedata = function() {
|
||||
var ldata = wx.getLaunchOptionsSync().query;
|
||||
console.log('checkSharedata');
|
||||
console.log(ldata);
|
||||
var ldata;
|
||||
if (this.launchObj) {
|
||||
ldata = this.launchObj.query;
|
||||
} else {
|
||||
ldata = wx.getLaunchOptionsSync().query;
|
||||
}
|
||||
if (ldata.inviter_id) {
|
||||
jcshare.acceptAchievementInvite(ldata.inviter_id, '100', JSON.stringify([['100', 100]]));
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ var JCFW = {
|
||||
* .onShare(***)
|
||||
* .onShareFail(***)
|
||||
*/
|
||||
init(channelid, gameid, isoffical, response, env) {
|
||||
init(channelid, gameid, isoffical, launchObj, response, env) {
|
||||
if (this._inited) {
|
||||
if (this.rsp != response) {
|
||||
this.rsp = response;
|
||||
@ -95,7 +95,7 @@ var JCFW = {
|
||||
|
||||
|
||||
this._loadLocalID();
|
||||
this._loadLaunchInfo();
|
||||
this._loadLaunchInfo(launchObj);
|
||||
this._loadSystemInfo();
|
||||
//this._loadConfig();
|
||||
|
||||
@ -474,8 +474,15 @@ var JCFW = {
|
||||
storage.remove(_GAME_LOCALUUID);
|
||||
},
|
||||
|
||||
_loadLaunchInfo() {
|
||||
this.lauchInfo = wx.getLaunchOptionsSync();
|
||||
_loadLaunchInfo(res) {
|
||||
let info = null;
|
||||
if(wx && wx.getLaunchOptionsSync){
|
||||
info = wx.getLaunchOptionsSync();
|
||||
}
|
||||
this.lauchInfo = res? res: info;
|
||||
if(!this.lauchInfo){
|
||||
return;
|
||||
}
|
||||
|
||||
this.gamelog.handlelaunch(this.lauchInfo, (sharetype, shareparam, shareid, inviterid,
|
||||
fromid, fromscene, launchobj) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user