|
| xqd
@@ -53,13 +53,77 @@ App({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- login: function (that) {
|
|
|
+ // dologin: function (raw) {
|
|
|
+ // var pages = getCurrentPages();
|
|
|
+ // var page = pages[(pages.length - 1)];
|
|
|
+ // wx.login({
|
|
|
+ // success: function (res) {
|
|
|
+ // if (res.code) {
|
|
|
+ // var code = res.code;
|
|
|
+ // getApp().request({
|
|
|
+ // url: api.passport.login,
|
|
|
+ // method: "post",
|
|
|
+ // data: {
|
|
|
+ // code: code,
|
|
|
+ // user_info: JSON.stringify(raw.userInfo),
|
|
|
+ // encrypted_data: raw.encryptedData,
|
|
|
+ // iv: raw.iv,
|
|
|
+ // signature: raw.signature
|
|
|
+ // },
|
|
|
+ // success: function (res) {
|
|
|
+ // wx.hideLoading();
|
|
|
+ // if (res.code == 0) {
|
|
|
+ // wx.setStorageSync("access_token", res.data.access_token);
|
|
|
+ // wx.setStorageSync("user_info", res.data);
|
|
|
+
|
|
|
+ // var p = getCurrentPages();
|
|
|
+ // var parent_id = 0;
|
|
|
+ // if (p[0].options.user_id != undefined) {
|
|
|
+ // var parent_id = p[0].options.user_id;
|
|
|
+ // }
|
|
|
+ // else if (p[0].options.scene != undefined) {
|
|
|
+ // var parent_id = p[0].options.scene;
|
|
|
+ // }
|
|
|
+ // getApp().bindParent({
|
|
|
+ // parent_id: parent_id || 0
|
|
|
+ // });
|
|
|
+
|
|
|
+ // if (page == undefined) {
|
|
|
+ // return;
|
|
|
+
|
|
|
+ // }
|
|
|
+ // var loginNoRefreshPage = getApp().loginNoRefreshPage;
|
|
|
+ // for (var i in loginNoRefreshPage) {
|
|
|
+ // if (loginNoRefreshPage[i] === page.route)
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // wx.redirectTo({
|
|
|
+ // url: "/" + page.route + "?" + util.objectToUrlParams(page.options),
|
|
|
+ // fail: function () {
|
|
|
+ // wx.switchTab({
|
|
|
+ // url: "/" + page.route,
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+
|
|
|
+ // } else {
|
|
|
+ // wx.showToast({
|
|
|
+ // title: res.msg
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ login: function (e) {
|
|
|
var pages = getCurrentPages();
|
|
|
var page = pages[(pages.length - 1)];
|
|
|
- // wx.showLoading({
|
|
|
- // title: "正在登录",
|
|
|
- // mask: true,
|
|
|
- // });
|
|
|
+ wx.showLoading({
|
|
|
+ title: "正在登录",
|
|
|
+ mask: true,
|
|
|
+ });
|
|
|
wx.login({
|
|
|
success: function (res) {
|
|
|
if (res.code) {
|
|
| xqd
@@ -67,7 +131,7 @@ App({
|
|
|
wx.getSetting({
|
|
|
success: res => {
|
|
|
if (res.authSetting['scope.userInfo']) {
|
|
|
- console.log('已经授权')
|
|
|
+ console.log('已经授权' + code)
|
|
|
// 已经授权,可以直接调用 getUserInfo
|
|
|
// 获取用户信息
|
|
|
wx.getSetting({
|
|
| xqd
@@ -355,6 +419,10 @@ App({
|
|
|
'acid': '-1',
|
|
|
'version': '1.0.0',
|
|
|
'siteroot': 'https://u5.9026.com/app/index.php',
|
|
|
+ 'siteroot': 'https://u5.9026.com/app/index.php',
|
|
|
+ },
|
|
|
+ globalData:{
|
|
|
+ 'userInfo': null,
|
|
|
},
|
|
|
currentPage: null,
|
|
|
pageOnLoad: function (page) {
|