更新微信小游戏登录

This commit is contained in:
我是leo
2018-07-31 10:22:00 +08:00
parent c5adcda031
commit 2bcc2c06c4
8 changed files with 69 additions and 109 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -72,10 +72,10 @@
"_active": true,
"_components": [
{
"__id__": 15
"__id__": 16
},
{
"__id__": 16
"__id__": 17
}
],
"_prefab": null,
@@ -376,7 +376,7 @@
},
{
"__type__": "cc.Node",
"_name": "close",
"_name": "btn_close",
"_objFlags": 0,
"_parent": {
"__id__": 2
@@ -558,7 +558,11 @@
},
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"clickEvents": [
{
"__id__": 15
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$normalColor": {
@@ -597,6 +601,15 @@
"__id__": 10
}
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 2
},
"component": "HelloWorld",
"handler": "",
"customEventData": ""
},
{
"__type__": "cc.Canvas",
"_name": "",

View File

@@ -1,5 +1,18 @@
{
"appKey": "",
"appSecret": "",
"encryptJs": true,
"excludeScenes": [],
"fb-instant-games": {},
"includeAnySDK": false,
"includeSDKBox": false,
"inlineSpriteFrames": true,
"inlineSpriteFrames_native": true,
"jailbreakPlatform": false,
"md5Cache": false,
"mergeStartScene": false,
"oauthLoginServer": "",
"optimizeHotUpdate": false,
"orientation": {
"landscapeLeft": true,
"landscapeRight": true,
@@ -7,7 +20,22 @@
"upsideDown": false
},
"packageName": "org.cocos2d.helloworld",
"privateKey": "",
"qqplay": {
"REMOTE_SERVER_ROOT": "",
"orientation": "portrait"
},
"renderMode": "0",
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"title": "hello_world",
"webOrientation": "auto"
"title": "hello_Ios",
"webOrientation": "auto",
"wechatgame": {
"REMOTE_SERVER_ROOT": "",
"appid": "wx6ac3f5090a6b99c5",
"isSubdomain": false,
"orientation": "portrait",
"subContext": ""
},
"xxteaKey": "8d905e07-1e49-42",
"zipCompressJs": true
}

View File

@@ -336,7 +336,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 146.81,
"width": 147,
"height": 60
},
"_rotationX": 0,
@@ -390,7 +390,7 @@
}
],
"_tag": -1,
"_active": false,
"_active": true,
"_components": [
{
"__id__": 13
@@ -426,7 +426,7 @@
"_scaleY": 1.2,
"_position": {
"__type__": "cc.Vec2",
"x": -200,
"x": 0,
"y": -449
},
"_skewX": 0,
@@ -626,7 +626,7 @@
}
],
"_tag": -1,
"_active": true,
"_active": false,
"_components": [
{
"__id__": 19
@@ -662,7 +662,7 @@
"_scaleY": 1.2,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"x": 100,
"y": -449
},
"_skewX": 0,
@@ -866,17 +866,18 @@
"_fitHeight": false
},
{
"__type__": "280c3rsZJJKnZ9RqbALVwtK",
"__type__": "4896an2Du9KerKmdF65r/u1",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_a": 1,
"label": {
"__id__": 9
"headSprite": {
"__id__": 7
},
"text": "Hello, World!"
"tipLabel": {
"__id__": 9
}
}
]

View File

@@ -1,80 +0,0 @@
// obj.fn();
function func(){
// console.log( this ); // 20 this -> window
// var c=1;
// var b=function(){
// var b=1;
// console.log(this);
// return 1;
// }
// var c=new b();
// console.log(c);
// var d=b();
// console.log(d);
// var f=b;
// console.log(f);
var obj = {
a: 20,
fn: function() {
console.log( this ); // 20 this -> window
}
}
obj.fn();
}
func();
cc.Class({
extends: cc.Component,
properties: {
_a:1,
// _c:this._b+2,
label: {
default: null,
type: cc.Label
},
// defaults, set visually when attaching this script to the Canvas
text: 'Hello, World!',
},
// use this for initialization
onLoad: function () {
this.label.string = this.text;
var c=2;
var obj = {
a: 20,
c:this,
b: this._a + 10,
fn: function() {
console.log( this );
console.log(c,this.c);
}
}
func();
setTimeout(()=> {
var a = 30;
console.log( this );
})
setTimeout(function() {
var a = 30;
console.log( this );
})
obj.fn();
},
// called every frame
update: function (dt) {
},
});

View File

@@ -1,9 +0,0 @@
{
"ver": "1.0.5",
"uuid": "280c3aec-6492-4a9d-9f51-a9b00b570b4a",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -14,15 +14,16 @@ cc.Class({
},
start() {
this.wechatLogin();
// this.wechatLogin();
},
wechatLogin() {
console.log('login');
wx.login({
success: function () {
success: (event)=> {
console.log('login event=', event);
wx.getUserInfo({
success: function (res) {
success: (res)=> {
myGlobal.userInfo = res.userInfo;
var userInfo = res.userInfo;
var nickName = userInfo.nickName;
@@ -32,6 +33,7 @@ cc.Class({
var city = userInfo.city;
var country = userInfo.country;
console.log(nickName, avatarUrl, gender, province, city, country);
this.onBtn_1(null);
}
});
},

View File

@@ -29,5 +29,10 @@
"orientation": "portrait"
},
"xxteaKey": "e9e8f007-239d-40",
"zipCompressJs": true
"zipCompressJs": true,
"qqplay": {
"orientation": "portrait",
"REMOTE_SERVER_ROOT": ""
},
"fb-instant-games": {}
}