增加底部二维码长按跳转的功能
This commit is contained in:
parent
5e85db76f1
commit
da7864bd1f
@ -4426,6 +4426,13 @@
|
||||
"logoutBtn": {
|
||||
"__id__": 23
|
||||
},
|
||||
"qrCodeQQ": {
|
||||
"__id__": 85
|
||||
},
|
||||
"qrCodeWechat": {
|
||||
"__id__": 95
|
||||
},
|
||||
"touchTarget": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
|
@ -61,7 +61,16 @@ cc.Class({
|
||||
logoutBtn: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
}
|
||||
},
|
||||
qrCodeQQ: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
qrCodeWechat: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
touchTarget: null
|
||||
},
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
@ -88,8 +97,37 @@ cc.Class({
|
||||
},
|
||||
|
||||
start() {
|
||||
this.startup = false;
|
||||
this.qrCodeQQ.on(cc.Node.EventType.TOUCH_START, this.onTouchBg, this);
|
||||
this.qrCodeQQ.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
|
||||
this.qrCodeWechat.on(cc.Node.EventType.TOUCH_START, this.onTouchBg, this);
|
||||
this.qrCodeWechat.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
|
||||
},
|
||||
|
||||
// update (dt) {},
|
||||
update(dt) {
|
||||
if (this.startup) {
|
||||
this.time += dt;
|
||||
if (this.time > 2) {
|
||||
this.onTouchEnd();
|
||||
switch (this.touchTarget) {
|
||||
case 'qr_wechat':
|
||||
window.location.href = 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzU0MTk4MzkyNQ==&scene=124#wechat_redirect';
|
||||
break;
|
||||
case 'qr_qq':
|
||||
window.location.href = 'http://qm.qq.com/cgi-bin/qm/qr?k=9OEVDuOyP1BZ_cXOApidE9P2ea8daCVF';
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
onTouchBg(e) {
|
||||
this.touchTarget = e.target.name;
|
||||
this.time = 0;
|
||||
this.startup = true;
|
||||
},
|
||||
onTouchEnd(e) {
|
||||
this.time = 0;
|
||||
this.startup = false;
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user