Browse Source

进入首页就登录fix

master
jiazhipeng 2 years ago
parent
commit
0b0ab4bcd9
  1. 3
      pages/index/index.js
  2. 24
      pages/login/index.js
  3. 10
      pages/login/index.wxml
  4. 15
      pages/login/index.wxss
  5. 17
      pages/user/bindtel/index.js
  6. 12
      pages/user/bindtel/index.wxml
  7. 30
      pages/user/bindtel/index.wxss

3
pages/index/index.js

@ -174,7 +174,8 @@ Page({
month: (this.data.months[today.getMonth()]).toUpperCase(), month: (this.data.months[today.getMonth()]).toUpperCase(),
date: today.getDate() date: today.getDate()
}) })
this.getVideoPrize() // 调用接口如果token过期会导致一进入就要登陆
// this.getVideoPrize()
this.getXpthList() this.getXpthList()
}, },
getHeight() { getHeight() {

24
pages/login/index.js

@ -11,7 +11,9 @@ Page({
data: { data: {
err:null, err:null,
canIUseGetUserProfile:false, canIUseGetUserProfile:false,
event: '' event: '',
isApproval: false
}, },
/** /**
@ -45,6 +47,15 @@ Page({
}) })
}, },
getUserProfile:function(e){ getUserProfile:function(e){
if (!this.data.isApproval) {
wx.showToast({
title: '请先阅读并同意相关协议',
icon: "none"
});
return
}
wx.getUserProfile({ wx.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => { success: (res) => {
@ -53,6 +64,14 @@ Page({
}) })
}, },
getUserInfo:function(e,type){ getUserInfo:function(e,type){
if (!this.data.isApproval) {
wx.showToast({
title: '请先阅读并同意相关协议',
icon: "none"
});
return
}
let that = this; let that = this;
if (e.detail && (!e.detail.userInfo)){ if (e.detail && (!e.detail.userInfo)){
wx.reLaunch({ wx.reLaunch({
@ -113,6 +132,9 @@ Page({
let id = e.currentTarget?e.currentTarget.dataset.clickid:e; let id = e.currentTarget?e.currentTarget.dataset.clickid:e;
wx.uma.trackEvent(id) wx.uma.trackEvent(id)
}, },
changeIsApproval:function (e) {
this.setData({isApproval: !this.data.isApproval})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成

10
pages/login/index.wxml

@ -6,6 +6,16 @@
<icon class="iconfont icon-gou1"></icon> <icon class="iconfont icon-gou1"></icon>
<text>获得你的公开信息(昵称、头像、地区及性别)</text> <text>获得你的公开信息(昵称、头像、地区及性别)</text>
</view> </view>
<view class="login-tip-box">
<view class="select-icon" wx:if="{{!isApproval}}" bindtap="changeIsApproval"></view>
<icon class="iconfont icon-gou1" wx:else bindtap="changeIsApproval"></icon>
<view>
<text>选中代表您已阅读同意</text>
<navigator class="navigator-file" url="/pages/user/userPrivacy/index?id=9">《君到苏州用户协议》</navigator>
<navigator class="navigator-file" url="/pages/user/userPrivacy/index?id=12">《君到苏州隐私政策》</navigator>
<navigator class="navigator-file" url="/pages/user/userPrivacy/index?id=14">《君到苏州第三方共享信息清单》</navigator>
</view>
</view>
<!-- <view>{{err}}</view> --> <!-- <view>{{err}}</view> -->
<view class="btn-box"> <view class="btn-box">
<button bindtap="cancel" type="default" >取消</button> <button bindtap="cancel" type="default" >取消</button>

15
pages/login/index.wxss

@ -38,3 +38,18 @@ page {
.btn-box button { .btn-box button {
width: 400rpx; width: 400rpx;
} }
.select-icon{
border-radius: 50%;
color: transparent;
border: 1px solid #666;
width: 24rpx;
height: 24rpx;
flex-shrink: 0;
margin-right: 34rpx;
margin-top: 7rpx;
}
.navigator-file{
display: inline-block;
color: #0b898e;
}

17
pages/user/bindtel/index.js

@ -16,7 +16,9 @@ Page({
sendFlag:true, sendFlag:true,
regToken:null, regToken:null,
codeId:null, codeId:null,
imgCodeInfo:null imgCodeInfo:null,
isApproval: false
}, },
/** /**
@ -152,6 +154,15 @@ Page({
}) })
return false; return false;
} }
if (this.data.regToken && !this.data.isApproval) {
wx.showToast({
title: '请先阅读并同意相关协议',
icon: "none"
});
return
}
let service = "user/changeMobile",data={smsCode:this.data.code,mobile:this.data.tel,smsCodeId:this.data.codeId},api = user.user_post; let service = "user/changeMobile",data={smsCode:this.data.code,mobile:this.data.tel,smsCodeId:this.data.codeId},api = user.user_post;
if(this.data.regToken){ if(this.data.regToken){
service = "user/wxBindPhoneAndLogin" service = "user/wxBindPhoneAndLogin"
@ -185,6 +196,10 @@ Page({
}) })
}, },
changeIsApproval:function (e) {
this.setData({isApproval: !this.data.isApproval})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

12
pages/user/bindtel/index.wxml

@ -18,6 +18,18 @@
<button style="font-size:30rpx;background:#fff;color:#0B898E" type="primary" size="mini" bindtap="getCode">{{buttonText}}</button> <button style="font-size:30rpx;background:#fff;color:#0B898E" type="primary" size="mini" bindtap="getCode">{{buttonText}}</button>
</view> </view>
</view> </view>
<view class="login-tip-box" wx:if="{{regToken}}">
<view class="select-icon" wx:if="{{!isApproval}}" bindtap="changeIsApproval"></view>
<icon class="iconfont icon-gou1" wx:else bindtap="changeIsApproval"></icon>
<view>
<text>选中代表您已阅读同意</text>
<navigator class="navigator-file" url="/pages/user/userPrivacy/index?id=9">《君到苏州用户协议》</navigator>
<navigator class="navigator-file" url="/pages/user/userPrivacy/index?id=12">《君到苏州隐私政策》</navigator>
<navigator class="navigator-file" url="/pages/user/userPrivacy/index?id=14">《君到苏州第三方共享信息清单》</navigator>
</view>
</view>
<view class="btn" bindtap="submit">{{regToken?'绑定':'保存修改'}}</view> <view class="btn" bindtap="submit">{{regToken?'绑定':'保存修改'}}</view>
<button wx:if="{{regToken}}" type="default" bindtap="cancel">取消</button> <button wx:if="{{regToken}}" type="default" bindtap="cancel">取消</button>
<!-- <button class="btn" type="primary" bindtap="submit"></button> --> <!-- <button class="btn" type="primary" bindtap="submit"></button> -->

30
pages/user/bindtel/index.wxss

@ -39,3 +39,33 @@
width: 150rpx; width: 150rpx;
height: 60rpx; height: 60rpx;
} }
.login-tip-box {
display: flex;
align-items: flex-start;
margin: 0 20rpx;
font-size: 28rpx;
margin-top: 40rpx;
line-height: 40rpx;
}
.login-tip-box .icon-gou1 {
line-height: 80rpx;
margin-top: -20rpx;
margin-right: 30rpx;
color: #666;
}
.select-icon{
border-radius: 50%;
color: transparent;
border: 1px solid #666;
width: 24rpx;
height: 24rpx;
flex-shrink: 0;
margin-right: 34rpx;
margin-top: 7rpx;
}
.navigator-file{
display: inline-block;
color: #0b898e;
}
Loading…
Cancel
Save