|
|
@@ -40,6 +40,7 @@ Page({
|
|
|
// invite = options.invite
|
|
|
// }
|
|
|
// var that = this
|
|
|
+ this.checkLogin();
|
|
|
},
|
|
|
onShow: function () {
|
|
|
var that = this;
|
|
|
@@ -61,64 +62,65 @@ Page({
|
|
|
|
|
|
|
|
|
//原登陆检测
|
|
|
-
|
|
|
- //2020登陆检测
|
|
|
- wx.login({
|
|
|
- success: res => {
|
|
|
- getApp().globalData.try_login = true;
|
|
|
-
|
|
|
- var url = 'xcx/login'
|
|
|
- var params = {
|
|
|
- code: res.code
|
|
|
- }
|
|
|
- var success = function (res) {
|
|
|
- console.log('pageLogin',res);
|
|
|
- if(res.data.wx_user){
|
|
|
- var userInfo = res.data.wx_user
|
|
|
- that.setData({
|
|
|
- userInfo: userInfo
|
|
|
- })
|
|
|
- //checkwxhead---start
|
|
|
- if(res.data.wx_user.full_head == ''){
|
|
|
- wx.getSetting({
|
|
|
- success: res => {
|
|
|
- var auth = res.authSetting
|
|
|
- if (auth['scope.userInfo']) {
|
|
|
- console.log('wxhead none')
|
|
|
- wx.getUserInfo({
|
|
|
- success: function(res3) {
|
|
|
- console.log('userinfo',res3)
|
|
|
- var url = 'xcx/save_wx_user/info'
|
|
|
- var params = {
|
|
|
- userinfo: JSON.stringify(res3)
|
|
|
- }
|
|
|
- var success = function (res4) {
|
|
|
- console.log('authorize',res4)
|
|
|
- that.onShow()
|
|
|
- }
|
|
|
- _request.$post(url, params, success)
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- that.setData({
|
|
|
- userInfo: 'nologin'
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- //checkwxhead---end
|
|
|
- }else{
|
|
|
- that.setData({
|
|
|
- userInfo: 'nologin'
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- _request.$get(url, params, success)
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
+ },
|
|
|
+ checkLogin:function(){
|
|
|
+ var that = this;
|
|
|
+ //2020登陆检测
|
|
|
+ wx.login({
|
|
|
+ success: res => {
|
|
|
+ getApp().globalData.try_login = true;
|
|
|
+
|
|
|
+ var url = 'xcx/login'
|
|
|
+ var params = {
|
|
|
+ code: res.code
|
|
|
+ }
|
|
|
+ var success = function (res) {
|
|
|
+ console.log('pageLogin',res);
|
|
|
+ if(res.data.wx_user){
|
|
|
+ var userInfo = res.data.wx_user
|
|
|
+ that.setData({
|
|
|
+ userInfo: userInfo
|
|
|
+ })
|
|
|
+ //checkwxhead---start
|
|
|
+ if(res.data.wx_user.full_head == ''){
|
|
|
+ wx.getSetting({
|
|
|
+ success: res => {
|
|
|
+ var auth = res.authSetting
|
|
|
+ if (auth['scope.userInfo']) {
|
|
|
+ console.log('wxhead none')
|
|
|
+ wx.getUserInfo({
|
|
|
+ success: function(res3) {
|
|
|
+ console.log('userinfo',res3)
|
|
|
+ var url = 'xcx/save_wx_user/info'
|
|
|
+ var params = {
|
|
|
+ userinfo: JSON.stringify(res3)
|
|
|
+ }
|
|
|
+ var success = function (res4) {
|
|
|
+ console.log('authorize',res4)
|
|
|
+ that.onShow()
|
|
|
+ }
|
|
|
+ _request.$post(url, params, success)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ that.setData({
|
|
|
+ userInfo: 'nologin'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //checkwxhead---end
|
|
|
+ }else{
|
|
|
+ that.setData({
|
|
|
+ userInfo: 'nologin'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _request.$get(url, params, success)
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
getPoster: function (val) {
|
|
|
poster = val.split('$')
|