修改登录流程,使用公众号来获取相关资料
This commit is contained in:
parent
0f8ccea56b
commit
cceb187611
78
src/app.wpy
78
src/app.wpy
@ -30,9 +30,9 @@ export default class extends wepy.app {
|
|||||||
config = {
|
config = {
|
||||||
pages: [
|
pages: [
|
||||||
'pages/index',
|
'pages/index',
|
||||||
|
'pages/login',
|
||||||
'pages/game',
|
'pages/game',
|
||||||
'pages/gameInfo',
|
'pages/gameInfo',
|
||||||
'pages/login',
|
|
||||||
'pages/search',
|
'pages/search',
|
||||||
'pages/jumppage',
|
'pages/jumppage',
|
||||||
'pages/video',
|
'pages/video',
|
||||||
@ -52,7 +52,6 @@ export default class extends wepy.app {
|
|||||||
userInfo: null,
|
userInfo: null,
|
||||||
gameToken: null,
|
gameToken: null,
|
||||||
vip: false,
|
vip: false,
|
||||||
jcfwLogined: false,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
@ -63,7 +62,7 @@ export default class extends wepy.app {
|
|||||||
//全局拦截器
|
//全局拦截器
|
||||||
this.intercept('request', {
|
this.intercept('request', {
|
||||||
config(p) {
|
config(p) {
|
||||||
let token = wepy.getStorageSync('game_token');
|
let token = wepy.getStorageSync('mp_token');
|
||||||
if (token) {
|
if (token) {
|
||||||
p.header['Authorization'] = `JWT ${token}`;
|
p.header['Authorization'] = `JWT ${token}`;
|
||||||
}
|
}
|
||||||
@ -86,48 +85,12 @@ export default class extends wepy.app {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//登录流程
|
|
||||||
login() {
|
|
||||||
let self = this;
|
|
||||||
return new Promise(async function(resolve, reject) {
|
|
||||||
wepy.setStorageSync('game_token', null);
|
|
||||||
//获取code
|
|
||||||
try {
|
|
||||||
let account = wepy.getStorageSync('account');
|
|
||||||
let data = {
|
|
||||||
account_id: account.account_id,
|
|
||||||
session_id: account.session_id,
|
|
||||||
open_id: account.openid,
|
|
||||||
unionid: account.unionid
|
|
||||||
};
|
|
||||||
let res = await http.post('/api/emulated/user_login', data);
|
|
||||||
wepy.setStorageSync('game_token', res.token);
|
|
||||||
self.globalData.gameToken = res.token;
|
|
||||||
jcEvent.emit(jcEvent.events.LOGIN_FINISHED, {});
|
|
||||||
resolve();
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
onLaunch(options) {
|
onLaunch(options) {
|
||||||
console.log('app.onLaunch');
|
console.log('app.onLaunch', options);
|
||||||
console.log(options);
|
|
||||||
sdkManage.init(options);
|
sdkManage.init(options);
|
||||||
sdkManage.Login(() => {
|
|
||||||
let account = wepy.getStorageSync('account');
|
|
||||||
console.log('finish parse jcfw');
|
|
||||||
console.log(account);
|
|
||||||
this.globalData.jcfwLogined = true;
|
|
||||||
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {});
|
|
||||||
if (this.checkClientLogin()) {
|
|
||||||
this.login();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
onShow(options) {
|
onShow(options) {
|
||||||
console.log('app.onShow');
|
console.log('app.onShow', options);
|
||||||
console.log(options);
|
|
||||||
if (options.scene === 1038) { //从小程序返回
|
if (options.scene === 1038) { //从小程序返回
|
||||||
jcEvent.emit(jcEvent.events.NEED_UPDATE_SCORE, {});
|
jcEvent.emit(jcEvent.events.NEED_UPDATE_SCORE, {});
|
||||||
let referrerInfo = options.referrerInfo;
|
let referrerInfo = options.referrerInfo;
|
||||||
@ -162,23 +125,7 @@ export default class extends wepy.app {
|
|||||||
}
|
}
|
||||||
return needAuthorize;
|
return needAuthorize;
|
||||||
}
|
}
|
||||||
checkJcfwLogin() {
|
|
||||||
return this.globalData.jcfwLogined;
|
|
||||||
}
|
|
||||||
checkClientLogin() {
|
|
||||||
let self = this;
|
|
||||||
let needLogin = true;
|
|
||||||
if (!self.globalData.gameToken) {
|
|
||||||
if (wepy.getStorageSync('game_token')) {
|
|
||||||
self.globalData.gameToken = wepy.getStorageSync('game_token');
|
|
||||||
needLogin = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
needLogin = false;
|
|
||||||
}
|
|
||||||
return needLogin;
|
|
||||||
// return true;
|
|
||||||
}
|
|
||||||
updateGlobalData(name, obj) {
|
updateGlobalData(name, obj) {
|
||||||
// 校验: globalData
|
// 校验: globalData
|
||||||
if (!this.globalData) return;
|
if (!this.globalData) return;
|
||||||
@ -201,24 +148,15 @@ export default class extends wepy.app {
|
|||||||
getGlobalDate(name) {
|
getGlobalDate(name) {
|
||||||
return this.globalData[name];
|
return this.globalData[name];
|
||||||
}
|
}
|
||||||
showAll() {
|
// 判断当前用户是否是vip
|
||||||
return this.globalData.showAll;
|
|
||||||
}
|
|
||||||
isVip() {
|
isVip() {
|
||||||
return this.globalData.vip;
|
return this.globalData.vip;
|
||||||
}
|
}
|
||||||
|
// 更新当前用户的vip状态
|
||||||
updateVip(vip) {
|
updateVip(vip) {
|
||||||
this.globalData.vip = vip;
|
this.globalData.vip = vip;
|
||||||
}
|
}
|
||||||
getShareCount() {
|
// 日志上报
|
||||||
return sdkManage.getAchievInviteeNum();
|
|
||||||
}
|
|
||||||
getShareDetail() {
|
|
||||||
return sdkManage.queryAchievementShareDetail();
|
|
||||||
}
|
|
||||||
updateUserInfo(allInfo) {
|
|
||||||
return sdkManage.updateUser(allInfo);
|
|
||||||
}
|
|
||||||
log(eventName, param) {
|
log(eventName, param) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
sdkManage.uploadLog(eventName, param);
|
sdkManage.uploadLog(eventName, param);
|
||||||
|
@ -3,6 +3,7 @@ export default {
|
|||||||
env: env,
|
env: env,
|
||||||
// apiBase: env === 'test'? 'http://192.168.100.232' : 'https://ghost.kingsome.cn',
|
// apiBase: env === 'test'? 'http://192.168.100.232' : 'https://ghost.kingsome.cn',
|
||||||
apiBase: env === 'test'? 'https://ghost-test.kingsome.cn' : 'https://ghost.kingsome.cn',
|
apiBase: env === 'test'? 'https://ghost-test.kingsome.cn' : 'https://ghost.kingsome.cn',
|
||||||
|
loginPage: env === 'test'? 'https://wechat-test.kingsome.cn/weapp/index.html?scope=snsapi_base' : 'https://wechat.kingsome.cn/weapp/index.html?scope=snsapi_base',
|
||||||
cdnBase: 'https://h5games-al.kingsome.cn/emulator-static/',
|
cdnBase: 'https://h5games-al.kingsome.cn/emulator-static/',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
gameTypes: ['射击','格斗', '角色扮演','动作角色扮演',
|
gameTypes: ['射击','格斗', '角色扮演','动作角色扮演',
|
||||||
|
@ -26,12 +26,13 @@ export default {
|
|||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
BUY_GAME_SUCCESS: 'buy-game-success',
|
BUY_GAME_SUCCESS: 'buy-game-success',
|
||||||
LOGIN_FINISHED : 'login-finished',
|
|
||||||
UPDATE_RECENT_GAMES: 'update-recent-games',
|
UPDATE_RECENT_GAMES: 'update-recent-games',
|
||||||
UPDATE_GAME_STATUS: 'update-game-status',
|
UPDATE_GAME_STATUS: 'update-game-status',
|
||||||
NEED_UPDATE_SCORE: 'need-update-score',
|
NEED_UPDATE_SCORE: 'need-update-score',
|
||||||
NEED_UPDATE_CFG: 'need-update-cfg',
|
NEED_UPDATE_CFG: 'need-update-cfg',
|
||||||
|
NEED_UPDATE_UINFO: 'need-update-uinfo',
|
||||||
BUY_ITEM_RESULT: 'buy-item-result',
|
BUY_ITEM_RESULT: 'buy-item-result',
|
||||||
BUY_VIP_RESULT: 'buy-vip-result'
|
BUY_VIP_RESULT: 'buy-vip-result',
|
||||||
|
NEED_SHOW_LOGIN_PAGE: 'need_show_login_page',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
55
src/components/z-auth-view.wpy
Normal file
55
src/components/z-auth-view.wpy
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!--授权界面-->
|
||||||
|
<style lang="less">
|
||||||
|
.z-auth-back {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #FFF;
|
||||||
|
z-index: 101;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="z-auth-back {{ show ? '' : 'hidden'}}">
|
||||||
|
<view class='zan-font-14 zan-c-gray-dark' style='text-align:center;margin-top:50rpx;margin-bottom:50rpx;'>
|
||||||
|
允许微信授权后,才可以使用</view>
|
||||||
|
<view class="zan-btns">
|
||||||
|
<button open-type='getUserInfo' bindgetuserinfo="bindGetUserInfo" class="zan-btn zan-btn--primary">授权登录</button>
|
||||||
|
<!--<button bindtap='navigateBack' class="zan-btn">返回首页</button>-->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import wepy from 'wepy'
|
||||||
|
import jcEvent from '../common/jc-event';
|
||||||
|
|
||||||
|
export default class zAuthView extends wepy.component {
|
||||||
|
props = {
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
data = {
|
||||||
|
}
|
||||||
|
methods = {
|
||||||
|
showView() {
|
||||||
|
this.show = true;
|
||||||
|
this.$apply();
|
||||||
|
},
|
||||||
|
bindGetUserInfo: async function(e) {
|
||||||
|
if (e.detail.userInfo) {
|
||||||
|
wepy.setStorageSync('userInfo', JSON.stringify(e.detail.userInfo));
|
||||||
|
jcEvent.emit(jcEvent.events.NEED_UPDATE_UINFO, e.detail);
|
||||||
|
this.show = false;
|
||||||
|
this.$apply();
|
||||||
|
} else {
|
||||||
|
this.$invoke('zanToast', 'showZanToast', { title: '很遗憾,您拒绝了微信授权, 无法使用该小程序', timeout: 2000 })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
hideView() {
|
||||||
|
this.show = false;
|
||||||
|
this.$apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -1,57 +1,36 @@
|
|||||||
var jcfw = require('./jcfw');
|
let jcfw = require('./jcfw');
|
||||||
var jcgamelog = jcfw.gamelog;
|
let jcshare = jcfw.share;
|
||||||
var jcshare = jcfw.share;
|
let g = require('../common/global').default;
|
||||||
var g = require('../common/global').default;
|
|
||||||
var ShareConfig = {
|
let SDKManage = function() {
|
||||||
'money':
|
|
||||||
{
|
|
||||||
urls: ['gift.jpg'],
|
|
||||||
titles: ['领元宝'],
|
|
||||||
logid: 1
|
|
||||||
},
|
|
||||||
'normal':
|
|
||||||
{
|
|
||||||
urls: ['gift.jpg'],
|
|
||||||
titles: ['领元宝'],
|
|
||||||
logid: 2
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var SDKManage = function() {
|
|
||||||
this.isoffical = g.env === 'product';
|
this.isoffical = g.env === 'product';
|
||||||
this.gameId = 8004;
|
this.gameId = 8004;
|
||||||
this.hasLogin = false;
|
this.hasLogin = false;
|
||||||
this.vision = '1.0.0';
|
this.vision = '1.0.0';
|
||||||
this.ChannelId = 6001;
|
this.ChannelId = 7101;
|
||||||
|
this.mpCode = '';
|
||||||
this.init = function(launchObj) {
|
this.init = function(launchObj) {
|
||||||
this.launchObj = launchObj;
|
this.launchObj = launchObj;
|
||||||
jcfw.init(this.ChannelId, this.gameId, this.isoffical, launchObj);
|
jcfw.init(this.ChannelId, this.gameId, this.isoffical, launchObj);
|
||||||
};
|
};
|
||||||
this.doLogin = function(res) {
|
this.updateMpCode = function(mpCode) {
|
||||||
if (this.loginStep < this.logincbarr.length) {
|
this.mpCode = mpCode;
|
||||||
this.logincbarr[this.loginStep](res);
|
|
||||||
this.loginStep++;
|
|
||||||
} else {
|
|
||||||
this.loginOver();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
this.checkSharedata = function() {
|
this.login = async function(cb) {
|
||||||
var ldata;
|
await this.gameLogin();
|
||||||
if (this.launchObj) {
|
await this.checkShareData();
|
||||||
ldata = this.launchObj.query;
|
// redis 配置
|
||||||
} else {
|
await this.getGameConfig();
|
||||||
ldata = wx.getLaunchOptionsSync().query;
|
// 获取分享配置
|
||||||
}
|
await this.getShareConfig();
|
||||||
if (ldata.inviter_id) {
|
|
||||||
jcshare.acceptAchievementInvite(ldata.inviter_id, '100', JSON.stringify([['100', 100]]));
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
|
||||||
this.doLogin();
|
|
||||||
}, 10);
|
|
||||||
};
|
};
|
||||||
this.gamelogin = function() {
|
this.gameLogin = () => {
|
||||||
var token = wx.getStorageSync('token');
|
let self = this;
|
||||||
var self = this;
|
let loginCount = 0;
|
||||||
if (!token || token == '') {
|
return new Promise((resolve, reject) => {
|
||||||
|
let login = () => {
|
||||||
|
let token = wx.getStorageSync('token');
|
||||||
|
if (!token) {
|
||||||
token = jcfw.makeUUID();
|
token = jcfw.makeUUID();
|
||||||
try {
|
try {
|
||||||
wx.setStorageSync('token', token);
|
wx.setStorageSync('token', token);
|
||||||
@ -60,34 +39,62 @@ var SDKManage = function() {
|
|||||||
}
|
}
|
||||||
jcfw.loginUser((res) => {
|
jcfw.loginUser((res) => {
|
||||||
self.hasLogin = true;
|
self.hasLogin = true;
|
||||||
console.log('login success');
|
console.log('login success', res);
|
||||||
console.log(res);
|
|
||||||
wx.setStorageSync('account', res);
|
wx.setStorageSync('account', res);
|
||||||
self.account_id = res.account_id;
|
self.account_id = res.account_id;
|
||||||
self.doLogin();
|
resolve();
|
||||||
},
|
},
|
||||||
(neterr, logicerr, errmsg) => {
|
(neterr, logicerr, errmsg) => {
|
||||||
self.gamelogin();
|
if (loginCount++ < 10) {
|
||||||
|
login();
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
self.mpCode
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
this.getGameConfig = function() {
|
login();
|
||||||
var self = this;
|
});
|
||||||
var cb = function(res) {
|
};
|
||||||
|
this.checkShareData = function() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let 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]]));
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
|
||||||
console.log('getGameConfig');
|
|
||||||
console.log(res);
|
};
|
||||||
|
|
||||||
|
this.getGameConfig = function() {
|
||||||
|
let tryCount = 0;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let cb = function(res) {
|
||||||
|
console.log('getGameConfig', res);
|
||||||
wx.setStorageSync('cfg', res);
|
wx.setStorageSync('cfg', res);
|
||||||
setTimeout(() => {
|
resolve();
|
||||||
self.doLogin();
|
|
||||||
}, 10);
|
|
||||||
};
|
};
|
||||||
var cbf = function(res) {
|
let cbf = function(res) {
|
||||||
console.log('getGameConfig fail');
|
console.log('getGameConfig fail');
|
||||||
self.getGameConfig();
|
if (tryCount++ < 10) {
|
||||||
|
request();
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
let request = () => {
|
||||||
jcfw.cloud.initConfig(cb, cbf);
|
jcfw.cloud.initConfig(cb, cbf);
|
||||||
// jcfw.getConfig('',cb,cbf);
|
};
|
||||||
|
request();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -103,10 +110,9 @@ var SDKManage = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.getShareConfig = function() {
|
this.getShareConfig = function() {
|
||||||
var self = this;
|
let tryCount = 0;
|
||||||
var cbs = function(res) {
|
return new Promise((resolve, reject) => {
|
||||||
self.doLogin();
|
let cbs = function(res) {
|
||||||
console.log(res);
|
|
||||||
if (res.length > 0) {
|
if (res.length > 0) {
|
||||||
let shareArr = [];
|
let shareArr = [];
|
||||||
for (let obj of res) {
|
for (let obj of res) {
|
||||||
@ -117,42 +123,22 @@ var SDKManage = function() {
|
|||||||
}
|
}
|
||||||
wx.setStorageSync('share_cfg', shareArr);
|
wx.setStorageSync('share_cfg', shareArr);
|
||||||
}
|
}
|
||||||
// for (var i = 0; i < res.length; i++) {
|
console.log('getShareConfig success', res);
|
||||||
// var sdt = res[i];
|
resolve();
|
||||||
// if (ShareConfig[sdt.type]) {
|
|
||||||
// ShareConfig[sdt.type].urls = sdt.images;
|
|
||||||
// ShareConfig[sdt.type].titles = sdt.strs;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if(cc.sys.platform == cc.sys.WECHAT_GAME){
|
|
||||||
// wx.showShareMenu({
|
|
||||||
// withShareTicket: false
|
|
||||||
// });
|
|
||||||
// wx.onShareAppMessage(function () {
|
|
||||||
// return {
|
|
||||||
// title: Main.config.shareConfig["normal"].title,
|
|
||||||
// imageUrl: Main.config.shareConfig["normal"].url2[0]
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
console.log('getShareConfig ssssssssssssss');
|
|
||||||
console.log(res);
|
|
||||||
};
|
};
|
||||||
var cbf = function() {
|
let cbf = function() {
|
||||||
console.log('getShareConfig fffffffffff');
|
console.log('getShareConfig fail');
|
||||||
self.getShareConfig();
|
if (tryCount++ < 10) {
|
||||||
|
request();
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
let request = () => {
|
||||||
jcfw.cloud.getShareData(this.sex, this.province, this.city, cbs, cbf);
|
jcfw.cloud.getShareData(this.sex, this.province, this.city, cbs, cbf);
|
||||||
};
|
};
|
||||||
|
request();
|
||||||
this.loadData = function() {
|
});
|
||||||
var self = this;
|
|
||||||
var cb = function(v) {
|
|
||||||
// self.playerData.load(v);
|
|
||||||
|
|
||||||
self.doLogin();
|
|
||||||
};
|
|
||||||
this.getStorage(['aaa', 'bbb'], cb);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getAchievInviteeNum = function() {
|
this.getAchievInviteeNum = function() {
|
||||||
@ -162,7 +148,7 @@ var SDKManage = function() {
|
|||||||
console.log(res);
|
console.log(res);
|
||||||
let invitee_nums = 0;
|
let invitee_nums = 0;
|
||||||
for (let i = 0; i < res.length; i++) {
|
for (let i = 0; i < res.length; i++) {
|
||||||
if (res[i].achievement_id == 100) {
|
if (res[i].achievement_id === 100) {
|
||||||
invitee_nums = res[i].invitee_num;//邀请玩家数
|
invitee_nums = res[i].invitee_num;//邀请玩家数
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -172,29 +158,10 @@ var SDKManage = function() {
|
|||||||
jcshare.getAchievInviteeNum(callback, (err) => {
|
jcshare.getAchievInviteeNum(callback, (err) => {
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.Login = function(cb) {
|
|
||||||
this.loginStep = 0;
|
|
||||||
if (cb) {
|
|
||||||
this.loginOver = cb;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.logincbarr = [
|
|
||||||
this.gamelogin.bind(this),
|
|
||||||
// this.wxGetUseInfo.bind(this),
|
|
||||||
this.checkSharedata.bind(this),
|
|
||||||
// redis 配置
|
|
||||||
this.getGameConfig.bind(this),
|
|
||||||
// 获取分享配置
|
|
||||||
this.getShareConfig.bind(this),
|
|
||||||
// 获取云存档
|
|
||||||
// this.loadData.bind(this),
|
|
||||||
];
|
|
||||||
this.doLogin();
|
|
||||||
};
|
|
||||||
this.queryAchievementShareDetail = function() {
|
this.queryAchievementShareDetail = function() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const callback = function(res) {
|
const callback = function(res) {
|
||||||
@ -212,14 +179,14 @@ var SDKManage = function() {
|
|||||||
resolve(obj);
|
resolve(obj);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
reject(err);
|
reject(err);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
this.uploadLog = function(eventName, param) {
|
this.uploadLog = function(eventName, param) {
|
||||||
jcfw.gamelog.logButtonClick(eventName, param);
|
jcfw.gamelog.logButtonClick(eventName, param);
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var instance = new SDKManage();
|
let instance = new SDKManage();
|
||||||
module.exports = instance;
|
module.exports = instance;
|
||||||
|
@ -355,7 +355,9 @@ module.exports = {
|
|||||||
this.userinfo = {};
|
this.userinfo = {};
|
||||||
}
|
}
|
||||||
switch(this.channelid){
|
switch(this.channelid){
|
||||||
case 6001:{
|
case 6001:
|
||||||
|
case 7101:
|
||||||
|
{
|
||||||
this.userinfo.nickname = info.nickName;
|
this.userinfo.nickname = info.nickName;
|
||||||
this.userinfo.country= info.country;
|
this.userinfo.country= info.country;
|
||||||
this.userinfo.province= info.province;
|
this.userinfo.province= info.province;
|
||||||
@ -497,7 +499,7 @@ module.exports = {
|
|||||||
self.sessionid = obj.session_id;
|
self.sessionid = obj.session_id;
|
||||||
self.accountid = obj.account_id;
|
self.accountid = obj.account_id;
|
||||||
self.openid = obj.openid;
|
self.openid = obj.openid;
|
||||||
self.actived = obj.activated == true;
|
self.actived = !!obj.activated;
|
||||||
self.logined = true;
|
self.logined = true;
|
||||||
self.login_costtime = nowtime - self._loginstarttime;
|
self.login_costtime = nowtime - self._loginstarttime;
|
||||||
self._loadServerInfo(obj);
|
self._loadServerInfo(obj);
|
||||||
@ -592,13 +594,12 @@ module.exports = {
|
|||||||
this.updateuserinfo(userinfo);
|
this.updateuserinfo(userinfo);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case 7001:{
|
case 7001:
|
||||||
|
case 7002:
|
||||||
|
case 7101:{
|
||||||
this.login(exparam, successcb, failcb);
|
this.login(exparam, successcb, failcb);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case 7002:{
|
|
||||||
this.login(exparam, successcb, failcb);
|
|
||||||
}break;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -192,4 +192,19 @@ export default class baseMixin extends wepy.mixin {
|
|||||||
}).exec();
|
}).exec();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取本地存储
|
||||||
|
* @param {string} key
|
||||||
|
* */
|
||||||
|
$getStorage(key) {
|
||||||
|
return wepy.getStorageSync(key);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 保存数据至本地存储
|
||||||
|
* @param {string} key
|
||||||
|
* @param {object} value
|
||||||
|
* */
|
||||||
|
$setStorage(key, value) {
|
||||||
|
wepy.setStorageSync(key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,5 @@ export default class cfgMixin extends wepy.mixin {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ export default class navMixin extends wepy.mixin {
|
|||||||
url: '/pages/gameInfo?id=' + gid
|
url: '/pages/gameInfo?id=' + gid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 登陆页面
|
// 跳转到登录公众号页面
|
||||||
$toLogin() {
|
$toMpLogin() {
|
||||||
wepy.navigateTo({
|
wepy.redirectTo({
|
||||||
url: '/pages/login'
|
url: '/pages/login'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -45,4 +45,5 @@ export default class navMixin extends wepy.mixin {
|
|||||||
url: '/pages/webview?link=' + encodeURIComponent(url) + '&title='
|
url: '/pages/webview?link=' + encodeURIComponent(url) + '&title='
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
22
src/mixins/webApi.js
Normal file
22
src/mixins/webApi.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import wepy from 'wepy'
|
||||||
|
import http from '../utils/http';
|
||||||
|
|
||||||
|
export default class apiMixin extends wepy.mixin {
|
||||||
|
async $clienLogin() {
|
||||||
|
let wxData = await wepy.login();
|
||||||
|
console.log('wx.login: ', wxData);
|
||||||
|
let account = wepy.getStorageSync('account');
|
||||||
|
let data = {
|
||||||
|
account_id: account.account_id,
|
||||||
|
session_id: account.session_id,
|
||||||
|
open_id: account.openid,
|
||||||
|
unionid: account.unionid,
|
||||||
|
code: wxData.code,
|
||||||
|
};
|
||||||
|
let res = await http.post('/api/emulated/user_login', data);
|
||||||
|
wepy.setStorageSync('mp_token', res.token);
|
||||||
|
}
|
||||||
|
$isClientLogin() {
|
||||||
|
return !!wepy.getStorageSync('mp_token');
|
||||||
|
}
|
||||||
|
}
|
@ -173,7 +173,7 @@
|
|||||||
this.zActionSheetCfg.payVer = g.env === 'product' ? 'release' : 'develop';
|
this.zActionSheetCfg.payVer = g.env === 'product' ? 'release' : 'develop';
|
||||||
this.vip = this.$parent.isVip();
|
this.vip = this.$parent.isVip();
|
||||||
this.id = decodeURIComponent(params.id);
|
this.id = decodeURIComponent(params.id);
|
||||||
this.showAll = this.$parent.showAll();
|
this.showAll = this.$showAll();
|
||||||
console.log(this.id);
|
console.log(this.id);
|
||||||
let self = this;
|
let self = this;
|
||||||
jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => {
|
jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => {
|
||||||
|
@ -50,14 +50,15 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="record-list">
|
<view class="record-list">
|
||||||
<repeat for="{{records}}" item="item" >
|
<repeat for="{{records}}" item="item" >
|
||||||
<recordCell :item="item" @gameCellTap.user="gameTap" :showAll.sync = 'showAll'/>
|
<recordCell :item="item" @gameCellTap.user="gameTap" :showAll.sync = 'showAll'></recordCell>
|
||||||
</repeat>
|
</repeat>
|
||||||
<zanLoadmore :loading.sync="loading" :nodata.sync="noData" :nomore.sync="noMore" nodata_str="暂无数据"></zanLoadmore>
|
<zanLoadmore :loading.sync="loading" :nodata.sync="noData" :nomore.sync="noMore" nodata_str="暂无数据"></zanLoadmore>
|
||||||
</view>
|
</view>
|
||||||
<toast/>
|
<toast></toast>
|
||||||
<inviteView :config.sync="inviteViewCfg" :btnList.sync="inviteBtns" @inviteBtnClick.user="inviteBtnClick" @needHideMe.user="hideInviteView"></inviteView>
|
<inviteView :config.sync="inviteViewCfg" :btnList.sync="inviteBtns" @inviteBtnClick.user="inviteBtnClick" @needHideMe.user="hideInviteView"></inviteView>
|
||||||
<zanToptips/>
|
<zanToptips></zanToptips>
|
||||||
<zScrollText/>
|
<zScrollText></zScrollText>
|
||||||
|
<zAuthView></zAuthView>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -70,6 +71,8 @@
|
|||||||
import zanLoadmore from '../components/zan-loadmore';
|
import zanLoadmore from '../components/zan-loadmore';
|
||||||
import inviteView from '../components/invite-view';
|
import inviteView from '../components/invite-view';
|
||||||
import zanToptips from '../components/zan-toptips'
|
import zanToptips from '../components/zan-toptips'
|
||||||
|
import zAuthView from '../components/z-auth-view';
|
||||||
|
import zScrollText from '../components/z-scroll-text';
|
||||||
import jcEvent from '../common/jc-event';
|
import jcEvent from '../common/jc-event';
|
||||||
import image from '../common/images';
|
import image from '../common/images';
|
||||||
import global from '../common/global';
|
import global from '../common/global';
|
||||||
@ -77,10 +80,13 @@
|
|||||||
import tips from '../mixins/tips';
|
import tips from '../mixins/tips';
|
||||||
import cfg from '../mixins/cfg';
|
import cfg from '../mixins/cfg';
|
||||||
import nav from '../mixins/nav';
|
import nav from '../mixins/nav';
|
||||||
import zScrollText from '../components/z-scroll-text';
|
import webApi from '../mixins/webApi';
|
||||||
|
|
||||||
|
|
||||||
|
let sdkManage = require('../jcfw/SDKManage');
|
||||||
|
|
||||||
export default class Index extends wepy.page {
|
export default class Index extends wepy.page {
|
||||||
mixins = [base, tips, cfg, nav];
|
mixins = [base, tips, cfg, nav, webApi];
|
||||||
config = {
|
config = {
|
||||||
navigationBarTitleText: '游戏大厅',
|
navigationBarTitleText: '游戏大厅',
|
||||||
enablePullDownRefresh: true,
|
enablePullDownRefresh: true,
|
||||||
@ -94,7 +100,8 @@
|
|||||||
zanLoadmore: zanLoadmore,
|
zanLoadmore: zanLoadmore,
|
||||||
inviteView: inviteView,
|
inviteView: inviteView,
|
||||||
zanToptips: zanToptips,
|
zanToptips: zanToptips,
|
||||||
zScrollText: zScrollText
|
zScrollText: zScrollText,
|
||||||
|
zAuthView: zAuthView
|
||||||
};
|
};
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
@ -137,12 +144,12 @@
|
|||||||
this.$toGameInfo(gid);
|
this.$toGameInfo(gid);
|
||||||
},
|
},
|
||||||
async toSearch() {
|
async toSearch() {
|
||||||
this.showScollText('1. 你已成功领取100元代金券,点击查看详情,想看就看; 2. 你已成功领取100元代金券,点击查看详情,想看就看; 3. 你已成功领取100元代金券,点击查看详情,想看就看;');
|
// this.showScollText('1. 你已成功领取100元代金券,点击查看详情,想看就看; 2. 你已成功领取100元代金券,点击查看详情,想看就看; 3. 你已成功领取100元代金券,点击查看详情,想看就看;');
|
||||||
// wepy.navigateTo({
|
wepy.navigateTo({
|
||||||
// url: '/pages/search'
|
url: '/pages/search'
|
||||||
// })
|
})
|
||||||
// let movie = 'http://iqiyi.kuyun-bofang.com/20190208/eebojrT3/index.m3u8'
|
// let movie = 'http://iqiyi.kuyun-bofang.com/20190208/eebojrT3/index.m3u8'
|
||||||
// this.$toMovie(movie, '流浪地球');
|
// this.$toWebView('https://wechat-test.kingsome.cn/weapp/index.html?scope=snsapi_base');
|
||||||
},
|
},
|
||||||
async showInviteView() {
|
async showInviteView() {
|
||||||
await this.updateInviteViewData();
|
await this.updateInviteViewData();
|
||||||
@ -198,8 +205,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onLoad(options) {
|
async onLoad(options) {
|
||||||
console.log('index.onload, is logined: ' + this.$parent.checkJcfwLogin());
|
console.log('index.onload', options);
|
||||||
console.log(options);
|
// begin of 登录流程
|
||||||
|
if (options.loadtype && options.loadtype === 'login') {
|
||||||
|
console.log('get mp code success:' + options.code);
|
||||||
|
this.$setStorage('mp_code', options.code);
|
||||||
|
}
|
||||||
|
const mpCode = this.$getStorage('mp_code');
|
||||||
|
if (!mpCode) {
|
||||||
|
return this.$toMpLogin();
|
||||||
|
}
|
||||||
|
sdkManage.updateMpCode(mpCode);
|
||||||
|
try {
|
||||||
|
await sdkManage.login();
|
||||||
|
console.log('finish parse jcfw');
|
||||||
|
} catch (err) {
|
||||||
|
console.log('sdkManage login error');
|
||||||
|
}
|
||||||
|
let account = this.$getStorage('account');
|
||||||
|
console.log('account:', account);
|
||||||
|
let mpToken = this.$getStorage('mp_token');
|
||||||
|
if (!mpToken) {
|
||||||
|
await this.$clienLogin();
|
||||||
|
}
|
||||||
|
// end of 登录流程
|
||||||
|
|
||||||
this.myGameTitles = [];
|
this.myGameTitles = [];
|
||||||
this.recommendTitles = ['推荐'];
|
this.recommendTitles = ['推荐'];
|
||||||
this.$apply();
|
this.$apply();
|
||||||
@ -209,18 +239,10 @@
|
|||||||
withShareTicket: true
|
withShareTicket: true
|
||||||
});
|
});
|
||||||
this.payVer = global.env === 'product' ? 'release' : 'develop';
|
this.payVer = global.env === 'product' ? 'release' : 'develop';
|
||||||
if (this.$parent.checkJcfwLogin()) {
|
|
||||||
this.joinRoomPlay(options);
|
this.joinRoomPlay(options);
|
||||||
}
|
|
||||||
if (!this.$parent.checkClientLogin()) {
|
|
||||||
this.getAllData();
|
this.getAllData();
|
||||||
this.vip_params = `token=${this.$parent.getGlobalDate('gameToken')}`;
|
this.vip_params = `token=${this.$parent.getGlobalDate('gameToken')}`;
|
||||||
} else {
|
|
||||||
jcEvent.on(jcEvent.events.LOGIN_FINISHED, this, data => {
|
|
||||||
this.getAllData()
|
|
||||||
this.vip_params = `token=${this.$parent.getGlobalDate('gameToken')}`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
jcEvent.on(jcEvent.events.UPDATE_RECENT_GAMES, this, data => {
|
jcEvent.on(jcEvent.events.UPDATE_RECENT_GAMES, this, data => {
|
||||||
this.getRecentGames()
|
this.getRecentGames()
|
||||||
});
|
});
|
||||||
@ -240,8 +262,28 @@
|
|||||||
jcEvent.on(jcEvent.events.NEED_UPDATE_CFG, this, data => {
|
jcEvent.on(jcEvent.events.NEED_UPDATE_CFG, this, data => {
|
||||||
this.showAll = this.$showAll();
|
this.showAll = this.$showAll();
|
||||||
this.showBuy = !!this.vip_btn_title && this.$showBuy();
|
this.showBuy = !!this.vip_btn_title && this.$showBuy();
|
||||||
|
let cfg = wepy.getStorageSync('cfg');
|
||||||
|
if (!cfg._getrewardtype) {
|
||||||
|
wepy.hideShareMenu();
|
||||||
|
} else {
|
||||||
|
wepy.showShareMenu({
|
||||||
|
withShareTicket: true
|
||||||
|
});
|
||||||
|
}
|
||||||
this.$apply();
|
this.$apply();
|
||||||
this.joinRoomPlay(options);
|
})
|
||||||
|
jcEvent.on(jcEvent.events.NEED_UPDATE_UINFO, this, async (data) => {
|
||||||
|
let userInfo = data.userInfo;
|
||||||
|
if (userInfo) {
|
||||||
|
this.nickname = userInfo.nickName;
|
||||||
|
this.avatar = userInfo.avatarUrl;
|
||||||
|
this.$apply();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await sdkManage.updateUser(data);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
jcEvent.on(jcEvent.events.BUY_VIP_RESULT, this, data => {
|
jcEvent.on(jcEvent.events.BUY_VIP_RESULT, this, data => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
@ -256,7 +298,8 @@
|
|||||||
this.$parent.log('buy_vip_fail', data);
|
this.$parent.log('buy_vip_fail', data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG);
|
||||||
|
console.log('page on load finished');
|
||||||
}
|
}
|
||||||
getAllData() {
|
getAllData() {
|
||||||
this.getRecords();
|
this.getRecords();
|
||||||
@ -266,33 +309,25 @@
|
|||||||
this.getRecommendGames();
|
this.getRecommendGames();
|
||||||
}
|
}
|
||||||
onUnload() {
|
onUnload() {
|
||||||
jcEvent.remove(jcEvent.events.LOGIN_FINISHED, this);
|
|
||||||
jcEvent.remove(jcEvent.events.UPDATE_RECENT_GAMES, this);
|
jcEvent.remove(jcEvent.events.UPDATE_RECENT_GAMES, this);
|
||||||
jcEvent.remove(jcEvent.events.UPDATE_GAME_STATUS, this);
|
jcEvent.remove(jcEvent.events.UPDATE_GAME_STATUS, this);
|
||||||
jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this);
|
jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this);
|
||||||
jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this);
|
jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this);
|
||||||
jcEvent.remove(jcEvent.events.BUY_VIP_RESULT, this);
|
jcEvent.remove(jcEvent.events.BUY_VIP_RESULT, this);
|
||||||
|
jcEvent.remove(jcEvent.events.NEED_UPDATE_UINFO, this);
|
||||||
}
|
}
|
||||||
onShow(options) {
|
onShow(options) {
|
||||||
console.log('onshow');
|
console.log('onshow', options);
|
||||||
console.log(options);
|
|
||||||
this.$parent.log('index_onshow', {});
|
this.$parent.log('index_onshow', {});
|
||||||
let cfg = wepy.getStorageSync('cfg');
|
if (this.$parent.checkAuthorize()) {
|
||||||
if (!cfg._getrewardtype) {
|
this.$invoke('zAuthView', 'showView', {})
|
||||||
wepy.hideShareMenu();
|
|
||||||
} else {
|
|
||||||
wepy.showShareMenu({
|
|
||||||
withShareTicket: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
this.showAll = this.$showAll();
|
|
||||||
let userInfo = this.$parent.getUserInfo();
|
let userInfo = this.$parent.getUserInfo();
|
||||||
if (userInfo) {
|
if (userInfo) {
|
||||||
this.nickname = userInfo.nickName;
|
this.nickname = userInfo.nickName;
|
||||||
this.avatar = userInfo.avatarUrl;
|
this.avatar = userInfo.avatarUrl;
|
||||||
this.$apply();
|
this.$apply();
|
||||||
}
|
}
|
||||||
(this.$parent.checkAuthorize()) && this.$toLogin();
|
|
||||||
}
|
}
|
||||||
initPageParam() {
|
initPageParam() {
|
||||||
this.all_count = 999;
|
this.all_count = 999;
|
||||||
@ -476,7 +511,7 @@
|
|||||||
let gameList = [];
|
let gameList = [];
|
||||||
this.inviteBtns = [];
|
this.inviteBtns = [];
|
||||||
try {
|
try {
|
||||||
userList = await this.$parent.getShareDetail();
|
userList = await sdkManage.queryAchievementShareDetail();
|
||||||
gameList = await this.myAchieveGames();
|
gameList = await this.myAchieveGames();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('error get invite user list');
|
console.log('error get invite user list');
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
import cfg from '../mixins/cfg';
|
import cfg from '../mixins/cfg';
|
||||||
import g from '../common/global';
|
import g from '../common/global';
|
||||||
|
|
||||||
|
let sdkManage = require('../jcfw/SDKManage');
|
||||||
export default class JumpPage extends wepy.page {
|
export default class JumpPage extends wepy.page {
|
||||||
components = {};
|
components = {};
|
||||||
mixins = [base, tips, cfg];
|
mixins = [base, tips, cfg];
|
||||||
@ -120,7 +121,7 @@
|
|||||||
console.log(`aid : ${this.aid}`);
|
console.log(`aid : ${this.aid}`);
|
||||||
let self = this;
|
let self = this;
|
||||||
try {
|
try {
|
||||||
this.shareCount = await this.$parent.getShareCount();
|
this.shareCount = await sdkManage.getAchievInviteeNum();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
@ -1,65 +1,44 @@
|
|||||||
<style lang="less">
|
<style lang="less">
|
||||||
.zan-btns {
|
.container{
|
||||||
width: 95%;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class='zan-font-14 zan-c-gray-dark' style='text-align:center;margin-top:50rpx;margin-bottom:50rpx;'>
|
<web-view src="{{link}}"></web-view>
|
||||||
允许微信授权后,才可以使用</view>
|
|
||||||
<view class="zan-btns">
|
|
||||||
<button open-type='getUserInfo' bindgetuserinfo="bindGetUserInfo" class="zan-btn zan-btn--primary">授权登录</button>
|
|
||||||
<!--<button bindtap='navigateBack' class="zan-btn">返回首页</button>-->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
<zanToast />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import wepy from 'wepy'
|
import wepy from 'wepy'
|
||||||
import zanToast from '../components/zan-toast'
|
|
||||||
import base from '../mixins/base';
|
import base from '../mixins/base';
|
||||||
import tips from '../mixins/tips';
|
import tips from '../mixins/tips';
|
||||||
import cfg from '../mixins/cfg';
|
import cfg from '../mixins/cfg';
|
||||||
|
import global from '../common/global';
|
||||||
|
|
||||||
export default class Login extends wepy.page {
|
export default class LoginPage extends wepy.page {
|
||||||
config = {
|
components = {};
|
||||||
navigationBarTitleText: '授权'
|
|
||||||
}
|
|
||||||
mixins = [base, tips, cfg];
|
mixins = [base, tips, cfg];
|
||||||
components = {
|
config = {
|
||||||
zanToast: zanToast
|
navigationBarBackgroundColor: '#FFF',
|
||||||
}
|
navigationBarTextStyle: 'white',
|
||||||
|
backgroundColor: '#FFF',
|
||||||
|
backgroundColorTop: '#FFF',
|
||||||
|
disableSwipeBack: true,
|
||||||
|
};
|
||||||
data = {
|
data = {
|
||||||
backType: 'index'
|
link: '',
|
||||||
}
|
};
|
||||||
|
|
||||||
computed = {
|
|
||||||
now () {
|
|
||||||
return +new Date()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
methods = {
|
methods = {
|
||||||
bindGetUserInfo: async function(e) {
|
};
|
||||||
let self = this
|
|
||||||
if (e.detail.userInfo) {
|
|
||||||
wepy.setStorageSync('userInfo', JSON.stringify(e.detail.userInfo));
|
|
||||||
self.$parent.updateGlobalData('userInfo', e.detail.userInfo);
|
|
||||||
await self.$parent.updateUserInfo(e.detail);
|
|
||||||
wepy.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$invoke('zanToast', 'showZanToast', { title: '很遗憾,您拒绝了微信授权, 无法使用该小程序', timeout: 2000 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoad() {
|
onLoad(params) {
|
||||||
console.log('login onLoad');
|
//TODO: 根据登录状态直接跳转首页或者加载登录页
|
||||||
this.$parent.log('login_page_onload', {});
|
// this.$parent.log('main_page_onload', params);
|
||||||
|
this.link = global.loginPage;
|
||||||
|
this.$apply();
|
||||||
|
console.log('load page: ' + this.link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user