...
|
...
|
@@ -16,7 +16,8 @@ import { |
|
|
} from '../../vendors/zanui/index';
|
|
|
import router from './router/router'
|
|
|
import {wrapperName} from './helper'
|
|
|
import { formatImageUrl } from '../../utils/util'
|
|
|
import { formatImageUrl, getYHStorageSync } from '../../utils/util'
|
|
|
import event from '../../utils/event'
|
|
|
import { jumpByUrl } from '../../libs/urlRoute';
|
|
|
import {getGlobalData, getUid, getStorageUserInfo, isLogin, setUserInfo} from '../../utils/index'
|
|
|
import {login as loginModel} from '../../models'
|
...
|
...
|
@@ -241,6 +242,7 @@ Page(Object.assign({ |
|
|
recommends: r2.code === 200 ? r2.data : [],
|
|
|
avatars: (r3).map(i => {
|
|
|
i.user_name = wrapperName(i.user_name);
|
|
|
i.user_thumb = formatImageUrl(i.user_thumb, 60, 60);
|
|
|
return i;
|
|
|
}),
|
|
|
|
...
|
...
|
@@ -373,7 +375,7 @@ Page(Object.assign({ |
|
|
|
|
|
_getUser() {
|
|
|
const userInfo = getStorageUserInfo();
|
|
|
|
|
|
|
|
|
if (isLogin() && (!userInfo || !userInfo.nickName)) {
|
|
|
|
|
|
|
...
|
...
|
@@ -442,10 +444,22 @@ Page(Object.assign({ |
|
|
router.go('index');
|
|
|
},
|
|
|
|
|
|
goLogin() {
|
|
|
event.emit('user-is-login', {logged: this.logged, loginSuccess: this.loginSuccess});
|
|
|
},
|
|
|
|
|
|
logged() {
|
|
|
|
|
|
},
|
|
|
|
|
|
loginSuccess() {
|
|
|
|
|
|
},
|
|
|
|
|
|
getUserInfo: function(e) {
|
|
|
var that = this;
|
|
|
if (e.detail.errMsg === 'getUserInfo:ok') {
|
|
|
decodeUnionId(app.getWechatThirdSession(), e, function(response) {
|
|
|
decodeUnionId(that.getWechatThirdSession(), e, function(response) {
|
|
|
if (response.isHaveUnionID) {
|
|
|
that.setData({
|
|
|
hasUnionID: true,
|
...
|
...
|
@@ -513,6 +527,10 @@ Page(Object.assign({ |
|
|
})
|
|
|
}
|
|
|
},
|
|
|
getWechatThirdSession() {
|
|
|
return getYHStorageSync('WXThird_session','app') || '';
|
|
|
|
|
|
},
|
|
|
//跳转到登录页面
|
|
|
loginAndRegisterTapped(needBind) {
|
|
|
let that = this;
|
...
|
...
|
@@ -532,7 +550,7 @@ Page(Object.assign({ |
|
|
success: (res) => {
|
|
|
// console.log(res.authSetting["scope.userInfo"])
|
|
|
if (res.authSetting["scope.userInfo"] !== null && res.authSetting["scope.userInfo"] !== undefined && res.authSetting["scope.userInfo"] === true) {
|
|
|
getUnionID(app.getWechatThirdSession(), function(response) {
|
|
|
getUnionID(that.getWechatThirdSession(), function(response) {
|
|
|
// console.log(response)
|
|
|
})
|
|
|
}
|
...
|
...
|
@@ -549,7 +567,7 @@ Page(Object.assign({ |
|
|
wx.navigateTo({
|
|
|
url: '/pages/bindPhoneNumber/bindPhoneNumber'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
} else {
|
...
|
...
|
|