main
parent
b2cd396ff3
commit
c3ac2340d8
@ -1,322 +1,391 @@ |
|||||||
<template> |
<template> |
||||||
<view class="login"> |
<view class="login"> |
||||||
<view class="refund-navbar"> |
<view class="refund-navbar"> |
||||||
<u-navbar |
<u-navbar title="" :border-bottom="false" :background="background"></u-navbar> |
||||||
title="" |
</view> |
||||||
:border-bottom="false" |
<view class="login-hd"> |
||||||
:background="background" |
<view class="a">验证码登录</view> |
||||||
></u-navbar> |
<view class="b">若该手机号未注册,我们将自动为您注册</view> |
||||||
</view> |
</view> |
||||||
<view class="login-hd"> |
<view class="login-bd"> |
||||||
<view class="a">验证码登录</view> |
<view class="a">+86<input v-model="phoneNum" type="tel" placeholder="请输入手机号" /></view> |
||||||
<view class="b">若该手机号未注册,我们将自动为您注册</view> |
<view class="b"> |
||||||
</view> |
<input v-model="semCode" placeholder="请输入验证码" /> |
||||||
<view class="login-bd"> |
<text @click="getCode" v-if="!showCountDown">获取验证码</text> |
||||||
<view class="a" |
<text v-if="showCountDown">{{ countdown }}s</text> |
||||||
>+86<input v-model="phoneNum" type="tel" placeholder="请输入手机号" |
</view> |
||||||
/></view> |
<view class="c" style="display: flex; align-items: center"> |
||||||
<view class="b"> |
<u-checkbox active-color="#FF343C" v-model="isCheckout" style="margin-right: -20rpx"></u-checkbox> |
||||||
<input v-model="semCode" placeholder="请输入验证码" /> |
同意<text @click="toTextPage(1)">《用户服务协议》</text>和<text @click="toTextPage(2)">《隐私政策》</text> |
||||||
<text @click="getCode" v-if="!showCountDown">获取验证码</text> |
</view> |
||||||
<text v-if="showCountDown">{{ countdown }}s</text> |
</view> |
||||||
</view> |
<view class="login-fd login-fd-on" @click="login">登录</view> |
||||||
<view class="c" style="display: flex; align-items: center"> |
<view class="" v-if="isCheckout"> |
||||||
<u-checkbox |
<mpWeiXinMobile :refereeId="refereeId"></mpWeiXinMobile> |
||||||
active-color="#FF343C" |
</view> |
||||||
v-model="isCheckout" |
<view class="" v-else style=" |
||||||
style="margin-right: -20rpx" |
|
||||||
></u-checkbox |
|
||||||
>同意<text @click="toTextPage(1)">《用户服务协议》</text>和<text |
|
||||||
@click="toTextPage(2)" |
|
||||||
>《隐私政策》</text |
|
||||||
> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
<view class="login-fd login-fd-on" @click="login">登录</view> |
|
||||||
<view class="" v-if="isCheckout"> |
|
||||||
<mpWeiXinMobile :refereeId="refereeId"></mpWeiXinMobile> |
|
||||||
</view> |
|
||||||
<view |
|
||||||
class="" |
|
||||||
v-else |
|
||||||
style=" |
|
||||||
font-size: 28rpx; |
font-size: 28rpx; |
||||||
color: #666; |
color: #666; |
||||||
text-align: center; |
text-align: center; |
||||||
margin-top: 50rpx; |
margin-top: 50rpx; |
||||||
" |
" @click="login"> |
||||||
@click="login" |
手机号快捷登录 |
||||||
> |
</view> |
||||||
手机号快捷登录 |
</view> |
||||||
</view> |
<view class="login-box" style="display: none;"> |
||||||
</view> |
<view class="refund-navbar"> |
||||||
|
<u-navbar title="" :border-bottom="false" background="rgba(255, 233, 240, 1)"></u-navbar> |
||||||
|
</view> |
||||||
|
<view class="login-logo"> |
||||||
|
<image src="../../static/login_logo.png" mode=""></image> |
||||||
|
</view> |
||||||
|
<view class="login-name"> |
||||||
|
京苏云商 |
||||||
|
</view> |
||||||
|
<view class="c"> |
||||||
|
<u-checkbox active-color="#FF343C" v-model="isCheckout" style="margin-right: -20rpx"></u-checkbox> |
||||||
|
同意<text @click="toTextPage(1)">《用户服务协议》</text>和<text @click="toTextPage(2)">《隐私政策》</text> |
||||||
|
</view> |
||||||
|
<view class="fd fd-on" @click="login">登录</view> |
||||||
|
</view> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
import * as UserApi from "@/api/user"; |
import * as UserApi from "@/api/user"; |
||||||
import * as CaptchaApi from "@/api/captcha"; |
import * as CaptchaApi from "@/api/captcha"; |
||||||
import mpWeiXinMobile from "./components/mp-weixin-mobile.vue"; |
import mpWeiXinMobile from "./components/mp-weixin-mobile.vue"; |
||||||
import store from "@/store"; |
import store from "@/store"; |
||||||
import { isEmpty } from "@/utils/util"; |
import { |
||||||
import { getSceneData } from '@/core/app' |
isEmpty |
||||||
export default { |
} from "@/utils/util"; |
||||||
components: { |
import { |
||||||
mpWeiXinMobile, |
getSceneData |
||||||
}, |
} from '@/core/app' |
||||||
data() { |
export default { |
||||||
return { |
components: { |
||||||
isCheckout: false, |
mpWeiXinMobile, |
||||||
showCountDown: false, |
}, |
||||||
currentIndex: 0, |
data() { |
||||||
background: { |
return { |
||||||
background: `url(${this.$picUrl}/static/news/login-bg.png) center top no-repeat`, |
isCheckout: false, |
||||||
backgroundSize: "100% auto", |
showCountDown: false, |
||||||
}, |
currentIndex: 0, |
||||||
phoneNum: "", |
background: { |
||||||
semCode: "", |
background: `url(${this.$picUrl}/static/news/login-bg.png) center top no-repeat`, |
||||||
countdown: 60, |
backgroundSize: "100% auto", |
||||||
countDownFun: null, |
}, |
||||||
code: "", |
phoneNum: "", |
||||||
refereeId: "", |
semCode: "", |
||||||
}; |
countdown: 60, |
||||||
}, |
countDownFun: null, |
||||||
onLoad(o) { |
code: "", |
||||||
// 获取二维码场景值 |
refereeId: "", |
||||||
const scene = getSceneData(o) |
}; |
||||||
// 记录推荐人ID |
}, |
||||||
const refereeId = scene.refereeId ? scene.refereeId : (scene.uid?scene.uid:o.refereeId) |
onLoad(o) { |
||||||
this.refereeId = refereeId; |
// 获取二维码场景值 |
||||||
console.log(scene) |
const scene = getSceneData(o) |
||||||
console.log(o) |
// 记录推荐人ID |
||||||
console.log(scene.refereeId) |
const refereeId = scene.refereeId ? scene.refereeId : (scene.uid ? scene.uid : o.refereeId) |
||||||
console.log("refereeId",refereeId) |
this.refereeId = refereeId; |
||||||
console.log(this.refereeId) |
console.log(scene) |
||||||
}, |
console.log(o) |
||||||
methods: { |
console.log(scene.refereeId) |
||||||
toTextPage(n) { |
console.log("refereeId", refereeId) |
||||||
uni.navigateTo({ |
console.log(this.refereeId) |
||||||
url: "/pages/news1/text?pageFlag=" + n, |
}, |
||||||
}); |
methods: { |
||||||
}, |
toTextPage(n) { |
||||||
validatePhoneNumber(phone) { |
uni.navigateTo({ |
||||||
// 定义手机号码的正则表达式 |
url: "/pages/news1/text?pageFlag=" + n, |
||||||
var regExp = /^1[3456789]\d{9}$/; |
}); |
||||||
|
}, |
||||||
|
validatePhoneNumber(phone) { |
||||||
|
// 定义手机号码的正则表达式 |
||||||
|
var regExp = /^1[3456789]\d{9}$/; |
||||||
|
|
||||||
if (regExp.test(phone)) { |
if (regExp.test(phone)) { |
||||||
return true; // 符合手机号码格式要求 |
return true; // 符合手机号码格式要求 |
||||||
} else { |
} else { |
||||||
return false; // 不符合手机号码格式要求 |
return false; // 不符合手机号码格式要求 |
||||||
} |
} |
||||||
}, |
}, |
||||||
getCode() { |
getCode() { |
||||||
// 获取验证码 |
// 获取验证码 |
||||||
const that = this; |
const that = this; |
||||||
if (that.isCheckout == false) { |
if (that.isCheckout == false) { |
||||||
that.$toast("请勾选用户协议"); |
that.$toast("请勾选用户协议"); |
||||||
return; |
return; |
||||||
} |
} |
||||||
if (!that.validatePhoneNumber(that.phoneNum)) { |
if (!that.validatePhoneNumber(that.phoneNum)) { |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
title: "请输入正确的手机号", |
title: "请输入正确的手机号", |
||||||
}); |
}); |
||||||
return; |
return; |
||||||
} |
} |
||||||
that.showCountDown = !that.showCountDown; |
that.showCountDown = !that.showCountDown; |
||||||
|
|
||||||
CaptchaApi.sendSmsCaptcha({ |
CaptchaApi.sendSmsCaptcha({ |
||||||
mobile: that.phoneNum |
mobile: that.phoneNum |
||||||
}).then((res) => { |
}).then((res) => { |
||||||
if (res.status == 200) { |
if (res.status == 200) { |
||||||
that.countDownFun = setInterval(() => { |
that.countDownFun = setInterval(() => { |
||||||
if (that.countdown >= 1) { |
if (that.countdown >= 1) { |
||||||
that.countdown = that.countdown - 1; |
that.countdown = that.countdown - 1; |
||||||
} else { |
} else { |
||||||
that.showCountDown = false; |
that.showCountDown = false; |
||||||
that.countdown = 60; |
that.countdown = 60; |
||||||
clearInterval(that.countDownFun); |
clearInterval(that.countDownFun); |
||||||
} |
} |
||||||
}, 1000); |
}, 1000); |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
icon:"none", |
icon: "none", |
||||||
title: res.message, |
title: res.message, |
||||||
}); |
}); |
||||||
} else { |
} else { |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
icon:"none", |
icon: "none", |
||||||
title: res.message, |
title: res.message, |
||||||
}); |
}); |
||||||
} |
} |
||||||
}); |
}); |
||||||
}, |
}, |
||||||
login() { |
login() { |
||||||
let that = this; |
let that = this; |
||||||
if (that.isCheckout == false) { |
if (that.isCheckout == false) { |
||||||
that.$toast("请勾选用户协议"); |
that.$toast("请勾选用户协议"); |
||||||
return; |
return; |
||||||
} |
} |
||||||
// 登录 |
// 登录 |
||||||
if (!that.validatePhoneNumber(that.phoneNum)) { |
if (!that.validatePhoneNumber(that.phoneNum)) { |
||||||
that.$toast("请输入正确的手机号"); |
that.$toast("请输入正确的手机号"); |
||||||
return; |
return; |
||||||
} |
} |
||||||
if (that.semCode == "") { |
if (that.semCode == "") { |
||||||
that.$toast("请输入验证码"); |
that.$toast("请输入验证码"); |
||||||
return; |
return; |
||||||
} |
} |
||||||
uni.login({ |
uni.login({ |
||||||
provider: "weixin", |
provider: "weixin", |
||||||
success: function (res) { |
success: function(res) { |
||||||
store |
store |
||||||
.dispatch("Login", { |
.dispatch("Login", { |
||||||
smsCode: that.semCode, |
smsCode: that.semCode, |
||||||
mobile: that.phoneNum, |
mobile: that.phoneNum, |
||||||
refereeId: that.refereeId, |
refereeId: that.refereeId, |
||||||
isParty: false, |
isParty: false, |
||||||
partyData: {}, |
partyData: {}, |
||||||
ucode: res.code |
ucode: res.code |
||||||
}) |
}) |
||||||
.then((res) => { |
.then((res) => { |
||||||
uni.setStorageSync("token", res.data.token); |
uni.setStorageSync("token", res.data.token); |
||||||
that.$toast(res.message); |
that.$toast(res.message); |
||||||
that.getUserInfo(); |
that.getUserInfo(); |
||||||
setTimeout(() => that.onNavigateBack(1), 2000); |
setTimeout(() => that.onNavigateBack(1), 2000); |
||||||
}); |
}); |
||||||
}, |
}, |
||||||
fail:function(){ |
fail: function() { |
||||||
store |
store |
||||||
.dispatch("Login", { |
.dispatch("Login", { |
||||||
smsCode: that.semCode, |
smsCode: that.semCode, |
||||||
mobile: that.phoneNum, |
mobile: that.phoneNum, |
||||||
refereeId: that.refereeId, |
refereeId: that.refereeId, |
||||||
isParty: false, |
isParty: false, |
||||||
partyData: {}, |
partyData: {}, |
||||||
// ucode: res.code |
// ucode: res.code |
||||||
}) |
}) |
||||||
.then((res) => { |
.then((res) => { |
||||||
uni.setStorageSync("token", res.data.token); |
uni.setStorageSync("token", res.data.token); |
||||||
that.$toast(res.message); |
that.$toast(res.message); |
||||||
that.getUserInfo(); |
that.getUserInfo(); |
||||||
setTimeout(() => that.onNavigateBack(1), 2000); |
setTimeout(() => that.onNavigateBack(1), 2000); |
||||||
}); |
}); |
||||||
} |
} |
||||||
}); |
}); |
||||||
}, |
}, |
||||||
getUserInfo() { |
getUserInfo() { |
||||||
UserApi.info().then((result) => { |
UserApi.info().then((result) => { |
||||||
uni.setStorageSync("userInfo", result.data.userInfo); |
uni.setStorageSync("userInfo", result.data.userInfo); |
||||||
}); |
}); |
||||||
}, |
}, |
||||||
onNavigateBack(delta = 1) { |
onNavigateBack(delta = 1) { |
||||||
// 登录成功返回原页面 |
// 登录成功返回原页面 |
||||||
const pages = getCurrentPages(); |
const pages = getCurrentPages(); |
||||||
if (pages.length > 1) { |
if (pages.length > 1) { |
||||||
uni.navigateBack({ |
uni.navigateBack({ |
||||||
delta: Number(delta || 1), |
delta: Number(delta || 1), |
||||||
}); |
}); |
||||||
} else { |
} else { |
||||||
this.$navTo("pages/index/index"); |
this.$navTo("pages/index/index"); |
||||||
} |
} |
||||||
}, |
}, |
||||||
}, |
}, |
||||||
}; |
}; |
||||||
</script> |
</script> |
||||||
|
|
||||||
<style lang="scss" scoped> |
<style lang="scss" scoped> |
||||||
.login { |
.login-box { |
||||||
width: 100%; |
width: 100%; |
||||||
background: #fffafb url(https://www.royaum.com.cn/static/news/login-bg.png) |
background: linear-gradient(180deg, rgba(255, 233, 240, 1) 0%, rgba(226, 244, 243, 0) 35%); |
||||||
center top no-repeat; |
min-height: 100vh; |
||||||
background-size: 100% auto; |
|
||||||
min-height: 100vh; |
|
||||||
|
|
||||||
&-hd { |
.login-logo { |
||||||
padding: 90rpx 75rpx 75rpx; |
margin: 365rpx auto 0 auto; |
||||||
overflow: hidden; |
width: 132rpx; |
||||||
|
height: 132rpx; |
||||||
|
border-radius: 24rpx; |
||||||
|
background: rgba(243, 74, 64, 1); |
||||||
|
box-shadow: -4rpx -8rpx 20rpx rgba(243, 74, 64, 0.16); |
||||||
|
|
||||||
.a { |
image { |
||||||
line-height: 80rpx; |
width: 75rpx; |
||||||
font-size: 40rpx; |
height: 85rpx; |
||||||
font-weight: 500; |
margin: 23.5rpx 0 0 28.5rpx; |
||||||
color: #000000; |
} |
||||||
} |
} |
||||||
|
|
||||||
.b { |
.login-name { |
||||||
font-size: 28rpx; |
width: 100%; |
||||||
font-weight: 400; |
text-align: center; |
||||||
color: #5a5a5a; |
|
||||||
line-height: 50rpx; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
&-bd { |
font-weight: bold; |
||||||
padding: 0 75rpx; |
font-size: 36rpx; |
||||||
overflow: hidden; |
color: rgba(243, 74, 64, 1); |
||||||
|
margin-top: 22rpx; |
||||||
|
} |
||||||
|
|
||||||
.a { |
.c { |
||||||
padding: 20rpx 0; |
justify-content: center; |
||||||
border-bottom: 1px solid #f2f2f2; |
padding: 28rpx 0; |
||||||
display: flex; |
font-size: 26rpx; |
||||||
align-items: center; |
font-weight: 400; |
||||||
font-size: 32rpx; |
color: #a0a0a0; |
||||||
font-weight: 400; |
display: flex; |
||||||
color: #212121; |
align-items: center; |
||||||
|
|
||||||
input { |
text { |
||||||
flex: 1; |
color: #ff343c; |
||||||
margin-left: 30rpx; |
} |
||||||
line-height: 50rpx; |
|
||||||
border-left: 1px solid #c4c4c4; |
|
||||||
padding-left: 30rpx; |
|
||||||
font-size: 28rpx; |
|
||||||
color: #212121; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.b { |
::v-deep .u-checkbox__icon-wrap--square { |
||||||
padding: 30rpx 0; |
border-radius: 50% !important; |
||||||
border-bottom: 1px solid #f2f2f2; |
width: 17px !important; |
||||||
display: flex; |
height: 17px !important; |
||||||
align-items: center; |
} |
||||||
font-size: 28rpx; |
} |
||||||
font-weight: 400; |
|
||||||
color: #f3202a; |
|
||||||
|
|
||||||
input { |
.fd { |
||||||
flex: 1; |
width: 680rpx; |
||||||
margin-right: 30rpx; |
line-height: 88rpx; |
||||||
line-height: 50rpx; |
background: rgba(243, 74, 64, 1); |
||||||
font-size: 28rpx; |
border-radius: 88rpx; |
||||||
color: #212121; |
text-align: center; |
||||||
} |
margin: 0 auto; |
||||||
} |
margin-top: 50rpx; |
||||||
|
font-size: 28rpx; |
||||||
|
font-weight: 600; |
||||||
|
color: #ffffff; |
||||||
|
|
||||||
|
.fd-on { |
||||||
|
background-color: rgba(243, 74, 64, 1); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
.c { |
.login { |
||||||
padding: 28rpx 0; |
width: 100%; |
||||||
font-size: 28rpx; |
background: #fffafb url(https://www.royaum.com.cn/static/news/login-bg.png) center top no-repeat; |
||||||
font-weight: 400; |
background-size: 100% auto; |
||||||
color: #a0a0a0; |
min-height: 100vh; |
||||||
|
|
||||||
text { |
&-hd { |
||||||
color: #ff343c; |
padding: 90rpx 75rpx 75rpx; |
||||||
} |
overflow: hidden; |
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
&-fd { |
.a { |
||||||
width: 680rpx; |
line-height: 80rpx; |
||||||
line-height: 88rpx; |
font-size: 40rpx; |
||||||
background: #ffbdba; |
font-weight: 500; |
||||||
border-radius: 88rpx; |
color: #000000; |
||||||
text-align: center; |
} |
||||||
margin: 0 auto; |
|
||||||
margin-top: 120rpx; |
.b { |
||||||
font-size: 28rpx; |
font-size: 28rpx; |
||||||
font-weight: 600; |
font-weight: 400; |
||||||
color: #ffffff; |
color: #5a5a5a; |
||||||
|
line-height: 50rpx; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
&-on { |
&-bd { |
||||||
background-color: #ff343c; |
padding: 0 75rpx; |
||||||
} |
overflow: hidden; |
||||||
} |
|
||||||
} |
.a { |
||||||
</style> |
padding: 20rpx 0; |
||||||
|
border-bottom: 1px solid #f2f2f2; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
font-size: 32rpx; |
||||||
|
font-weight: 400; |
||||||
|
color: #212121; |
||||||
|
|
||||||
|
input { |
||||||
|
flex: 1; |
||||||
|
margin-left: 30rpx; |
||||||
|
line-height: 50rpx; |
||||||
|
border-left: 1px solid #c4c4c4; |
||||||
|
padding-left: 30rpx; |
||||||
|
font-size: 28rpx; |
||||||
|
color: #212121; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.b { |
||||||
|
padding: 30rpx 0; |
||||||
|
border-bottom: 1px solid #f2f2f2; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
font-size: 28rpx; |
||||||
|
font-weight: 400; |
||||||
|
color: #f3202a; |
||||||
|
|
||||||
|
input { |
||||||
|
flex: 1; |
||||||
|
margin-right: 30rpx; |
||||||
|
line-height: 50rpx; |
||||||
|
font-size: 28rpx; |
||||||
|
color: #212121; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.c { |
||||||
|
padding: 28rpx 0; |
||||||
|
font-size: 28rpx; |
||||||
|
font-weight: 400; |
||||||
|
color: #a0a0a0; |
||||||
|
|
||||||
|
text { |
||||||
|
color: #ff343c; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
&-fd { |
||||||
|
width: 680rpx; |
||||||
|
line-height: 88rpx; |
||||||
|
background: #ffbdba; |
||||||
|
border-radius: 88rpx; |
||||||
|
text-align: center; |
||||||
|
margin: 0 auto; |
||||||
|
margin-top: 120rpx; |
||||||
|
font-size: 28rpx; |
||||||
|
font-weight: 600; |
||||||
|
color: #ffffff; |
||||||
|
|
||||||
|
&-on { |
||||||
|
background-color: #ff343c; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
||||||
|
Loading…
Reference in new issue