增加我的奖品页面,兑换页面

This commit is contained in:
2024-12-05 14:12:41 +08:00
parent fb8c9f8431
commit f15ed3a330
46 changed files with 4711 additions and 778 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,83 +1,41 @@
<template>
<view class="container">
<!-- 小程序状态下登录 -->
<!-- #ifdef MP-WEIXIN || MP-TOUTIAO || MP-KUAISHOU -->
<view class="mp_wxBox">
<view>
<view class="headers">
<image src="../../static/images/logo.png" style="border-radius: 50%;"></image>
<view class="wrapper">
<view class="input-content">
<view class="cu-form-group"
style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<view class="title">手机号</view>
<input type="number" :value="mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
@input="inputChange" />
</view>
<view class="content">
<view>申请获取以下权限</view>
<text>获得你的公开信息(昵称头像地区等)</text>
<view class="cu-form-group" style="border: 2upx solid whitesmoke;border-radius: 30px">
<view class="title">
<text style="margin-left: 30rpx;"></text>
</view>
<input type="password" placeholder="请输入密码" maxlength="20" :value="code" data-key="code"
@input="inputChange" @confirm="toLogin" />
<text class="send-msg" @click="forget">忘记密码</text>
</view>
<button v-show="weixinPhone" style="background: #ff7581;color: #FFFFFF;" class="bottom"
open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
授权手机号
</button>
<button v-show="!weixinPhone" style="background: #ff7581;color: #FFFFFF;" class='bottom'
bindtap="getUserProfile" @tap="wxGetUserInfo">
授权登录
</button>
</view>
<button class="confirm-btn" @click="toLogin">登录</button>
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view style="text-align: center;">
<image style="width: 120upx;height: 120upx;margin-top: 140upx;border-radius:20upx"
src="../../static/images/logo.png"></image>
<button class='confirm-btn' v-if="!isopen" @click="register">手机号登录</button>
<button class='confirm-btn' v-if="isopen" @click="bingwx">微信一键登录</button>
</view>
<!-- #endif -->
<!-- #ifdef APP -->
<view style="text-align: center;">
<image style="width: 120upx;height: 120upx;margin-top: 140upx;border-radius:20upx"
src="../../static/images/logo.png"></image>
<button class='confirm-btn' v-if="!isopen" @click="register">手机号登录</button>
<button class='confirm-btn' v-if="isopen" @click="bingwx">微信一键登录</button>
</view>
<view v-if="phoneLogin || weixinLogin || CheckiosLogin"
style="display: flex;align-items: center;width: 100%;justify-content: center;margin-top: 250upx;">
<view style="width: 100rpx;height: 1rpx;background: #d1d1d1;"></view>
<view style="color: #333333;margin: 0 20rpx;">其他方式登录</view>
<view style="width: 100rpx;height: 1rpx;background: #d1d1d1;"></view>
</view>
<view style="display: flex;margin-top: 80upx;width: 750rpx;justify-content: center;">
<view style="flex: 1;text-align: center;" v-if="phoneLogin">
<image src="/static/images/me/icon_phone.png" @tap="login_phone" style="width: 90upx;height: 90upx;">
</image>
<view style="margin-top: 32px;text-align: center">
<view>
没有账号
<text style="color: #ff7581" @click="register()">立即注册</text>
</view>
</view>
<view style="flex: 1;text-align: center;" v-if="weixinLogin">
<image src="/static/images/index/weixin.png" @tap="appweixinLo" style="width: 90upx;height: 90upx;">
</image>
</view>
<view style="flex: 1;text-align: center;" v-if="CheckiosLogin">
<image src="/static/images/me/appleid_button.png" @tap="ioslogin" style="width: 90upx;height: 90upx;">
</image>
</view>
<!-- <view style="flex: 1;text-align: center;" @tap="ioslogin" v-if="CheckiosLogin">
<image src="../../static/pw/loginphone.png" style="width: 80upx;height: 80upx;"></image>
</view> -->
</view>
<!-- #endif -->
<view class="footer" @click.stop="isCheck">
<view style="display: flex;align-items: center;justify-content: center;">
<u-checkbox-group>
<u-checkbox active-color="#ff7581" v-model="checked" label-size='24upx' shape="circle"
@change="radioChange"></u-checkbox>
</u-checkbox-group>
<view>同意</view>
<!-- 协议地址 -->
<text @click.stop="goTo('/me/setting/mimi')">隐私政策</text><text
@click.stop="goTo('/me/setting/xieyi')">用户协议</text>
</view>
<view class="footer">
<u-checkbox-group>
<u-checkbox v-model="checked" label-size='24upx' shape="circle" @change="radioChange"></u-checkbox>
</u-checkbox-group>
<view>同意</view>
<!-- 协议地址 -->
<navigator url="/me/setting/mimi" open-type="navigate">隐私政策</navigator>
<navigator url="/me/setting/xieyi" open-type="navigate">用户服务协议</navigator>
</view>
<u-toast ref="uToast" />
</view>
@@ -97,465 +55,16 @@
phone: '',
sendTime: '获取验证码',
count: 60,
checked: false,
isopen: false,
qdCodeion: '',
phoneLogin: false,
CheckiosLogin: false,
weixinLogin: false
checked: false
};
},
onLoad() {
// this.$u.get('/app/common/type/108').then(res => { //// 是否开启公众号自动登陆 108
// if (res.code == 0 && res.data) {
// if (res.data.value == '是') {
// // #ifdef H5
// let ua = navigator.userAgent.toLowerCase();
// if (ua.indexOf('micromessenger') !== -1) {
// this.isopen = true;
// } else {
// this.isopen = false;
// }
// // #endif
// } else {
// this.isopen = false;
// }
// }
// })
// // #ifdef H5
// this.selbindwx();
// // #endif
// #ifdef APP-PLUS
let checkWxLogin = this.$queue.getData('checkWxLogin');
if (checkWxLogin != '否') {
this.weixinLogin = true;
} else {
this.weixinLogin = false;
}
let checkPhoneLogin = this.$queue.getData('checkPhoneLogin');
if (checkPhoneLogin != '否') {
this.phoneLogin = true;
} else {
this.phoneLogin = false;
}
switch (uni.getSystemInfoSync().platform) {
case 'android':
break;
case 'ios':
let checkIosLogins = this.$queue.getData('checkIosLogin');
if (checkIosLogins != '否') {
this.CheckiosLogin = true;
} else {
this.CheckiosLogin = false;
}
break;
default:
break;
}
// #endif
//拿一下携带的渠道码
if (uni.getStorageSync('qdCodeion')) {
this.qdCodeion = uni.getStorageSync('qdCodeion')
}
},
methods: {
appweixinLo() {
if (!this.checked) {
uni.showToast({
title: '请同意隐私政策和用户服务协议',
icon: 'none'
})
return;
}
let that = this;
uni.login({
provider: 'weixin',
success: function(loginRes) {
that.$queue.showLoading('正在登录中...');
console.error(loginRes.authResult.openid);
that.$queue.setData('weixinToken', loginRes.authResult.access_token);
that.$queue.setData('unionid', loginRes.authResult.unionid);
that.$queue.setData('weixinOpenid', loginRes.authResult.openid);
that.$Request.postT('/app/Login/wxAppLogin', {
token: loginRes.authResult.access_token,
wxOpenId: loginRes.authResult.openid
})
.then(res => {
console.log(JSON.stringify(res))
if (res.code === 0) {
that.$queue.setData('token', res.token);
that.$queue.setData('userId', res.user.userId);
uni.switchTab({
url: '/pages/index/index'
})
} else {
uni.hideLoading();
uni.showModal({
title: '提示',
content: '需要绑定手机和完善资料,是否继续',
confirmText: '继续注册',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/pages/login/wxmobile'
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
});
}
});
},
login_phone() {
if (!this.checked) {
uni.showToast({
title: '请同意隐私政策和用户服务协议',
icon: 'none'
})
return;
}
let that = this;
uni.getProvider({ //获取可用的服务提供商
service: 'oauth',
success: function(res) {
console.log(res.provider) // ['weixin', qq', 'univerify']
}
});
uni.preLogin({ //预登录
provider: 'univerify', //用手机号登录
success() {
console.log('预登录成功')
uni.login({ //正式登录,弹出授权窗
provider: 'univerify',
univerifyStyle: { // 自定义登录框样式
"fullScreen": false, // 是否全屏显示true表示全屏模式false表示非全屏模式默认值为false。
"backgroundColor": "#FFFFFF", // 授权页面背景颜色,默认值:#ffffff
"icon": {
"path": "static/logo.png" // 自定义显示在授权框中的logo仅支持本地图片 默认显示App logo
},
"phoneNum": {
"color": "#000000", // 手机号文字颜色 默认值:#000000
},
"authButton": {
"normalColor": "#ff7581", // 授权按钮正常状态背景颜色 默认值:#3479f5
"highlightColor": "#ff7581", // 授权按钮按下状态背景颜色 默认值:#2861c5仅ios支持
"disabledColor": "#ff7581", // 授权按钮不可点击时背景颜色 默认值:#73aaf5仅ios支持
"textColor": "#ffffff", // 授权按钮文字颜色 默认值:#ffffff
"title": "本机号码一键登录" // 授权按钮文案 默认值:“本机号码一键登录”
}
},
success(res) { // 正式登录成功
console.log(res
.authResult); // {openid:'登录授权唯一标识',access_token:'接口返回的 token'}
// 在得到access_token后通过callfunction调用云函数
uniCloud.callFunction({
name: 'login', // 云函数名称
data: { //传给云函数的参数
'access_token': res.authResult
.access_token, // 客户端一键登录接口返回的access_token
'openid': res.authResult.openid // 客户端一键登录接口返回的openid
},
success(callRes) {
console.log('调用云函数成功' + JSON.stringify(callRes))
console.log("手机号:" + callRes.result.phoneNumber)
that.savePhoneByUser(callRes.result.phoneNumber);
},
fail(callErr) {
console.log('调用云函数出错' + callErr)
},
complete() {
uni.closeAuthView() //关闭授权登录界面
}
})
},
fail(err) { // 正式登录失败
console.log(err.errCode)
console.log(err.errMsg)
uni.closeAuthView() //关闭授权登录界面
}
})
},
fail(err) { //预登录失败
console.log(err)
console.log('错误码:' + err.errCode)
console.log(err.errMsg)
}
})
},
savePhoneByUser(phone) {
this.$queue.showLoading('登录中...')
let that = this;
that.$Request
.postT('/app/Login/phoneLogin', {
phone: phone
})
.then(ress => {
console.log(JSON.stringify(ress))
if (ress.code === 0) {
that.$queue.setData('token', ress.token);
that.$queue.setData('userId', ress.user.userId);
console.log(ress.user.userId)
console.log(ress.token)
uni.switchTab({
url: '/pages/index/index'
})
} else {
uni.hideLoading();
uni.navigateTo({
url: './phonebind?phone=' + phone
});
}
});
},
//app苹果登录
ioslogin() {
if (!this.checked) {
uni.showToast({
title: '请同意隐私政策和用户服务协议',
icon: 'none'
})
return;
}
console.log("ioslogin")
let that = this;
uni.login({
provider: 'apple',
success: function(loginRes) {
let iosopenid = loginRes.authResult.openid
// 获取用户信息
uni.getUserInfo({
provider: 'apple',
success(ress) {
that.$queue.showLoading('登录中...');
let datas = {
identityToken: JSON.stringify(ress)
}
//在这里获取到苹果手机的ID后可以继续你的操作请求后台进行登录
that.$Request.postT('/app/Login/appleLogin', datas).then(re => {
if (re.code == 0) {
that.$queue.setData('appleId', re.data)
that.$Request.getT(
'/app/Login/insertAppleUser?appleId=' + re.data
).then(res => {
console.log(JSON.stringify(res))
if (res.code == 0) {
that.$queue.setData('token', res
.token);
that.$queue.setData('userId', res.user
.userId);
uni.switchTab({
url: '/pages/index/index'
})
} else {
uni.hideLoading();
if (res.code == 201) {
uni.showModal({
title: '提示',
content: '需要绑定手机和完善资料,是否继续',
confirmText: '继续注册',
success: function(
res) {
if (res
.confirm) {
console
.log(
'用户点击确定'
);
uni.navigateTo({
url: './iosmobile'
});
} else if (res
.cancel) {
console
.log(
'用户点击取消'
);
}
}
});
} else if (res.code == 500) {
that.$queue.showToast(res.msg);
} else {
that.$queue.showToast(res.msg);
}
}
});
} else {
uni.hideLoading();
that.$queue.showToast(re.msg)
}
});
}
});
},
fail: function(err) {
uni.showToast({
icon: 'none',
title: err,
duration: 2000
});
}
});
},
goTo(url) {
uni.navigateTo({
url
});
},
isCheck() {
this.checked = !this.checked
},
selbindwx() {
let ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('micromessenger') !== -1) {
let openid = uni.getStorageSync('openid');
let userId = uni.getStorageSync('userId');
let that = this;
if (!openid) {
if (window.location.href.indexOf('?code=') !== -1 || window.location.href.indexOf('&code=') !==
-1) {
let code;
if (window.location.href.indexOf('?code=') !== -1) {
code = window.location.href.split('?code=')[1].split('&')[0];
} else {
code = window.location.href.split('&code=')[1].split('&')[0];
}
this.$Request.get('/app/Login/getOpenId?code=' + code).then(ret => {
uni.setStorageSync('openid', ret.data)
this.$Request.get('/app/Login/openid/login?openId=' + ret.data).then(res => {
if (res.code == 0) {
this.$queue.setData("phone", res.user.phone);
this.$queue.setData("userId", res.user.userId);
this.$queue.setData("token", res.token);
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('openId', res.user.openId)
this.$queue.setData("userName", res.user.userName);
this.$queue.setData("avatar", res.user.avatar);
this.$queue.setData("invitationCode", res.user.invitationCode);
this.$queue.setData("inviterCode", res.user.inviterCode);
uni.switchTab({
url: '/pages/index/index'
})
} else {
uni.navigateTo({
url: '/pages/login/bind'
});
}
});
});
}
}
}
},
// 微信公众号登录
bingwx() {
if (this.checked) {
let ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('micromessenger') !== -1) {
let openid = uni.getStorageSync('openid');
let userId = uni.getStorageSync('userId');
let that = this;
if (!openid) {
if (window.location.href.indexOf('?code=') !== -1 || window.location.href.indexOf(
'&code=') !==
-1) {
let code;
if (window.location.href.indexOf('?code=') !== -1) {
code = window.location.href.split('?code=')[1].split('&')[0];
} else {
code = window.location.href.split('&code=')[1].split('&')[0];
}
this.$Request.get('/app/Login/getOpenId?code=' + code).then(ret => {
uni.setStorageSync('openid', ret.data)
// uni.setStorageSync('openidheadimgurl', ret.data.headimgurl)
// uni.setStorageSync('openidnickname', ret.data.nickname)
this.$Request.get('/app/Login/openid/login?openId=' + ret.data).then(
res => {
if (res.code == 0) {
this.$queue.setData("phone", res.user.phone);
this.$queue.setData("userId", res.user.userId);
this.$queue.setData("token", res.token);
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('openId', res.user.openId)
this.$queue.setData("userName", res.user.userName);
this.$queue.setData("avatar", res.user.avatar);
this.$queue.setData("invitationCode", res.user
.invitationCode);
this.$queue.setData("inviterCode", res.user
.inviterCode);
uni.switchTab({
url: '/pages/index/index'
})
} else {
uni.navigateTo({
url: '/pages/login/bind'
});
}
});
});
} else {
window.location.href =
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
that.$queue.getWxAppid() +
'&redirect_uri=' +
window.location.href.split('#')[0] +
'&response_type=code&scope=snsapi_userinfo#wechat_redirect';
}
} else {
this.$Request.get('/app/Login/openid/login?openId=' + openid).then(res => {
if (res.code == 0) {
this.$queue.setData("phone", res.user.phone);
this.$queue.setData("userId", res.user.userId);
this.$queue.setData("token", res.token);
this.$queue.setData("userName", res.user.userName);
this.$queue.setData("avatar", res.user.avatar);
this.$queue.setData("invitationCode", res.user.invitationCode);
this.$queue.setData("inviterCode", res.user.inviterCode);
uni.switchTab({
url: '/pages/index/index'
})
} else {
uni.navigateTo({
url: '/pages/login/bind'
});
}
});
}
}
} else {
uni.showToast({
title: '请同意隐私政策和用户服务协议',
icon: 'none'
})
}
},
// 注册
register() {
if (this.checked) {
uni.navigateTo({
url: '/pages/login/loginPhone'
});
} else {
uni.showToast({
title: '请同意隐私政策和用户服务协议',
icon: 'none'
})
}
uni.navigateTo({
url: '/pages/login/register'
});
},
// 忘记密码
forget() {
@@ -574,36 +83,22 @@
wxGetUserInfo(e) {
let that = this;
if (this.checked) {
// wx.getUserProfile({
// desc: '业务需要',
// success: infoRes => {
// console.log("infoRes.encryptedData__________:" + JSON.stringify(infoRes
// .userInfo))
// let nickName = infoRes.userInfo.nickName; //昵称
// let avatarUrl = infoRes.userInfo.avatarUrl; //头像
// let sex = infoRes.userInfo.gender; //性别
// try {
// that.login(nickName, avatarUrl, sex);
// } catch (e) {}
// },
// fail(e) {
// console.log(e, '222222222222222')
// }
// })
let nickName = ''
// #ifdef MP-WEIXIN
nickName = '微信用户'
// #endif
// #ifdef MP-TOUTIAO
nickName = '抖音用户'
// #endif
let avatarUrl = '/static/images/logo.png'
let sex = 1
that.login(nickName, avatarUrl, sex);
wx.getUserProfile({
desc: '业务需要',
success: infoRes => {
console.log("infoRes.encryptedData__________:" + JSON.stringify(infoRes.userInfo))
let nickName = infoRes.userInfo.nickName; //昵称
let avatarUrl = infoRes.userInfo.avatarUrl; //头像
let sex = infoRes.userInfo.gender; //头像
try {
that.login(nickName, avatarUrl, sex);
} catch (e) {}
}
})
} else {
this.$refs.uToast.show({
title: '请阅读并同意隐私政策》和《用户服务协议',
duration: 1500
uni.showToast({
title: '请同意隐私政策用户服务协议',
icon: 'none'
})
}
},
@@ -614,75 +109,6 @@
uni.login({
provider: 'weixin',
success: function(loginRes) {
console.log(loginRes, 'code')
// #ifdef MP-TOUTIAO
let data = {
code: loginRes.code,
anonymous_code: loginRes.anonymousCode
}
that.$Request.post('/app/Login/dyLogin', data).then(res => {
if (res.code == 0) {
let invitationCode = '';
if (uni.getStorageSync('invitation')) {
invitationCode = uni.getStorageSync('invitation')
}
//判断是否需要绑定手机号
if (Number(res.data.flag) === 1) {
that.weixinPhone = true;
} else {
uni.showLoading({
title: '登录中...'
})
that.$Request.postJson('/app/Login/dyRegister', {
userName: nickName, //抖音名称
avatar: avatarUrl, //头像
sex: sex, //性别
// phone: '',
inviterCode: invitationCode,
dyOpenId: res.data.dyOpenId,
qdCode: that.qdCodeion
}).then(ress => {
uni.hideLoading()
if (ress.code == 0) {
uni.setStorageSync('token', ress.token)
uni.setStorageSync('userName', ress.user.userName)
uni.setStorageSync('avatar', ress.user.avatar)
uni.setStorageSync('phone', ress.user.phone)
uni.setStorageSync('invitationCode', ress.user
.invitationCode)
if (ress.user.qdCode) {
uni.setStorageSync('qdCode', ress.user.qdCode)
}
uni.setStorageSync('sex', ress.user.sex)
uni.setStorageSync('userId', ress.user.userId)
uni.setStorageSync('openId', ress.user.dyOpenId)
that.$u.api.userVip({
userId: uni.getStorageSync('userId')
}).then(rest => {
if (rest.code == 0 && rest.data && rest
.data.isVip == 2) {
uni.setStorageSync('isVIP', true)
} else {
uni.setStorageSync('isVIP', false)
}
})
uni.navigateBack();
} else {
uni.showModal({
showCancel: false,
title: '登录失败',
content: res.msg,
});
}
})
}
}
})
// #endif
// #ifdef MP-WEIXIN
let data = {
code: loginRes.code
}
@@ -702,8 +128,7 @@
userName: nickName,
avatar: avatarUrl,
sex: sex, //性别
inviterCode: invitationCode, //别人登录进来携带你的邀请码
qdCode: that.qdCodeion
inviterCode: invitationCode //别人登录进来携带你的邀请码
};
that.sendDataList = sendData;
that.flag = res.data.flag;
@@ -720,132 +145,18 @@
});
}
})
// #endif
// #ifdef MP-KUAISHOU
let data = {
code: loginRes.code,
}
that.$Request.post('/app/Login/ksLogin', data).then(res => {
if (res.code == 0) {
let invitationCode = '';
if (uni.getStorageSync('invitation')) {
invitationCode = uni.getStorageSync('invitation')
}
//判断是否需要绑定手机号
if (Number(res.data.flag) === 1) {
that.weixinPhone = true;
} else {
uni.showLoading({
title: '登录中...'
})
that.$Request.postJson('/app/Login/ksRegister', {
userName: nickName, //名称
avatar: avatarUrl, //头像
sex: sex, //性别
// phone: '',
inviterCode: invitationCode,
ksOpenId: res.data.ksOpenId,
qdCode: that.qdCodeion
}).then(ress => {
uni.hideLoading()
if (ress.code == 0) {
uni.setStorageSync('token', ress.token)
uni.setStorageSync('userName', ress.user.userName)
uni.setStorageSync('avatar', ress.user.avatar)
uni.setStorageSync('phone', ress.user.phone)
uni.setStorageSync('invitationCode', ress.user
.invitationCode)
if (ress.user.qdCode) {
uni.setStorageSync('qdCode', ress.user.qdCode)
}
uni.setStorageSync('sex', ress.user.sex)
uni.setStorageSync('userId', ress.user.userId)
uni.setStorageSync('openId', ress.user.ksOpenId)
that.$u.api.userVip({
userId: uni.getStorageSync('userId')
}).then(rest => {
if (rest.code == 0 && rest.data && rest
.data.isVip == 2) {
uni.setStorageSync('isVIP', true)
} else {
uni.setStorageSync('isVIP', false)
}
})
uni.navigateBack();
} else {
uni.showModal({
showCancel: false,
title: '登录失败',
content: res.msg,
});
}
})
}
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
// #endif
}
});
},
getMyPhone(code) {
let data = {
code: code
}
this.$Request.postT('/app/Login/wxPhone', data).then(res => {
if (res.code == 0) {
this.phone = res.data.phone_info.purePhoneNumber;
this.getWeixinInfo(this.sendDataList);
} else {
uni.showToast({
title: '获取手机号失败',
icon: 'none'
})
}
})
},
//小程序微信登录后获取手机号
getPhoneNumber: function(e) {
console.log(e.detail, '1111111111')
// #ifdef MP-TOUTIAO
if (e.detail.encryptedData && e.detail.iv) {
if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
console.log('用户拒绝提供手机号');
} else {
console.log('用户同意提供手机号');
// console.log('用户拒绝提供手机号');
} else {
uni.showToast({
title: '获取手机号失败',
icon: 'none'
})
// this.setPhoneByInsert(e.detail.encryptedData, e.detail.iv);
this.setPhoneByInsert(e.detail.encryptedData, e.detail.iv);
}
// #endif
// #ifdef MP-WEIXIN
if (e.detail.code) {
this.getMyPhone(e.detail.code)
} else {
uni.showToast({
title: '获取手机号失败',
icon: 'none'
})
}
// if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
// console.log('用户拒绝提供手机号');
// } else {
// console.log('用户同意提供手机号');
// this.setPhoneByInsert(e.detail.encryptedData, e.detail.iv);
// }
// #endif
// #ifdef MP-KUAISHOU
// #endif
},
//小程序微信登录后获取手机号
setPhoneByInsert(decryptData, iv) {
@@ -928,6 +239,13 @@
toLogin() {
// this.$queue.loginClear();
// let openid = this.$queue.getData('openid');
if (!this.checked) {
return this.$refs.uToast.show({
title: '请阅读并同意《隐私政策》和《用户服务协议》',
duration: 1500
})
}
let openid = uni.getStorageSync('openId')
const {
mobile,
@@ -969,19 +287,19 @@
uni.setStorageSync('invitationCode', res.user.invitationCode)
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('openId', res.user.openId)
//设置渠道码
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode)
}
// uni.setStorageSync('openId', res.user.openId)
// this.getWeixinInfo(this.sendDataList);
uni.showToast({
title: '登录成功',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/index/index'
});
}, 1000)
uni.navigateBack({
delta: 2
})
} else {
uni.hideLoading();
uni.showToast({
@@ -1006,8 +324,7 @@
avatar: sendData.avatar, //头像
sex: sendData.sex, //性别
phone: that.phone,
inviterCode: sendData.inviterCode,
qdCode: sendData.qdCode
inviterCode: sendData.inviterCode
};
that.$u.api.insertWxUser(postData).then(res => {
uni.hideLoading();
@@ -1017,9 +334,6 @@
uni.setStorageSync('avatar', res.user.avatar)
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode)
}
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('openId', res.user.openId)
@@ -1043,15 +357,12 @@
}
})
},
}
};
</script>
<style lang="scss">
button:after {
border: none !important;
}
.headers {
text-align: center;
}
@@ -1062,14 +373,12 @@
}
.footer {
// padding-left: 150rpx;
padding-left: 150rpx;
margin-top: 32upx;
font-size: 24upx;
color: #666666;
// text-align: center;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
page {
@@ -1120,10 +429,9 @@
}
.bottom {
width: 686rpx;
margin: 70rpx auto;
line-height: 80upx;
border-radius: 80upx;
margin: 70rpx 50rpx;
height: 80upx;
font-size: 35rpx;
}