Authored by 肖亚东

用户注册后获取个人信息等bug修改

// components/resources/pop_up/pop_up.js
Component({
/**
* 组件的属性列表
*/
properties: {
content: {
type: String,
},
isshow: {
type: Boolean,
value: true
},
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
confirmAction: function (e) {
this.setData({
isshow: false
});
},
getUserInfo(e) {
this.triggerEvent('registerToGetUserInfo', e);
}
}
});
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!-- components/resources/pop_up/pop_up.wxml -->
<view class="pop_up {{isshow?'':'hide'}}">
<view class='pop_content'>
<view class="pop_bd">
<view class='pop_title' wx:if='{{content}}'>
<text>{{content}}</text>
</view>
<view class="linView"></view>
<view class='pop_btn'>
<button class='okBtn'
bindtap='cancelPop'
open-type="getUserInfo"
bindgetuserinfo='getUserInfo'
bindtap="confirmAction">确定
</button>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
/* components/resources/pop_up/pop_up.wxss */
.pop_up {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.pop_content {
width: 70%;
position: relative;
}
.pop_bd {
width: 100%;
background-color: #fff;
border-radius: 15rpx;
text-align: center;
box-sizing: border-box;
overflow: hidden;
padding-top: 40rpx;
}
.linView {
margin-top: 20rpx;
background-color: #e0e0e0;
height: 2rpx;
}
.okBtn {
background-color: #fff;
margin: 0;
padding: 0;
}
.okBtn::after {
border-radius: 0;
border: 0;
}
.pop_title {
font-size: 36rpx;
}
.pop_btn {
text-align: center;
}
.hide {
display: none;
}
... ...
... ... @@ -37,6 +37,8 @@ Page(extend({},Toast,{
isLogin: false,
userInfo: {},
hasUnionID: '',
isShowPopup: false,
registerTips: '欢迎加入Yoho!Family!',
ticketData: [],
onActivityList: [],//正在进行的活动
... ... @@ -267,12 +269,22 @@ Page(extend({},Toast,{
} else {
if (result.is_register){
that.showZanToast({ title: '欢迎加入Yoho!Family!',success:function(){
let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0;
app.updateUid(uid)
that.setData({ uid });
that.showUserInfo();
}},1500);
let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0;
that.setData({
uid,
isShowPopup: true,
});
// that.showZanToast({ title: '欢迎加入Yoho!Family!',success:function(){
// let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0;
// app.updateUid(uid)
// that.setData({ uid });
// getUnionID(app.getWechatThirdSession(), function (response) {
// if (response.succeed === true) {
// that.showUserInfo();
// }
// })
// }}, 2000);
} else {
let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0;
app.updateUid(uid)
... ... @@ -288,6 +300,21 @@ Page(extend({},Toast,{
}
},
//注册后上传并获取用户信息
registerToGetUserInfo(e) {
let that = this;
decodeUnionId(app.getWechatThirdSession(),e.detail, function (response){
if (response.isHaveUnionID){
that.setData({
hasUnionID: true,
isLogin:true
});
} else {
// console.log("没有获取到unionid");
}
});
},
loginAndRegisterTapped:function() {
// console.log("loginAndRegisterTapped");
let that = this;
... ...
... ... @@ -6,6 +6,7 @@
"undone-view": "/components/user-center/undone-view/index",
"ticket-slide": "/components/user-center/ticket-slide/index",
"activity-item": "/components/activity-item/index",
"login-button": "/components/login-button/login-button"
"login-button": "/components/login-button/login-button",
"pop_up": "/components/pop_up/pop_up"
}
}
\ No newline at end of file
... ...
... ... @@ -9,10 +9,12 @@
bindgetuserinfo='getUserInfo'
bindupdateuserinfo="updateUserInfo">
</login-button>
<pop_up content="{{registerTips}}" isshow="{{isShowPopup}}" bind:registerToGetUserInfo='registerToGetUserInfo'></pop_up>
</image>
</view>
<!-- 已登录 -->
<block wx:else>
<!-- 头部用户信息 -->
<view class="header-bg">
<image class="user-info" src="{{isLogin ? userInfo.avatarUrl : ''}}" mode="aspectFill">
... ...