589 lines
14 KiB
Vue
589 lines
14 KiB
Vue
<template>
|
||
<view class="container">
|
||
<view class="box flex-center">
|
||
<!-- <text>欢迎登录零点八零</text> -->
|
||
|
||
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/Logo" mode=""></image>
|
||
</view>
|
||
<view class="top_box">
|
||
<view class="top_box_one" v-if="showbox">
|
||
<text class="top_box_one_text">手机号码</text>
|
||
<input type="text" v-model="form.loginName" :adjust-position="false" placeholder="请输入手机号码" />
|
||
</view>
|
||
<!-- <view class="top_box_one" v-if="showbox">
|
||
<text class="top_box_one_text">密码</text>
|
||
<input type="mobile" v-model="form.password" :adjust-position="false" placeholder="8-16位密码"
|
||
maxlength="16" :password="!showPassword" />
|
||
<view class="repeat" @click="display">
|
||
<u-icon name="eye" v-if="showPassword"></u-icon>
|
||
<u-icon v-else name="eye-off"></u-icon>
|
||
</view>
|
||
</view> -->
|
||
<view class="top_box_one" v-if="showbox">
|
||
<text class="top_box_one_text">验证码</text>
|
||
<input type="mobile" v-model="form.code" placeholder="请输入短信验证码" maxlength="6" />
|
||
<view class="repeats">
|
||
<view v-if="showText == true" class="yzm"
|
||
style="padding: 8rpx 16rpx 6rpx 16rpx; background: #288efb; border-radius: 15rpx"
|
||
@click="CodeRegister">
|
||
{{ Recapture }}
|
||
</view>
|
||
<view v-else
|
||
style="color: #ccc; background-color: #f9f9f9; padding: 8rpx 16rpx 6rpx 16rpx; border-radius: 15rpx">
|
||
{{ second }}s重新发送
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="top_box_tow flex-between" v-if="showbox">
|
||
<text @click="register">注册账号</text>
|
||
<text @click="passwords">忘记密码?</text>
|
||
</view>
|
||
<!-- #ifdef MP-WEIXIN -->
|
||
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="!showbox">手机号快速登录
|
||
</button>
|
||
<view class="toLogin" v-if="showbox" @click="toLoginconfirm">登录</view>
|
||
<view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view>
|
||
<!-- #endif -->
|
||
<!-- #ifdef APP-PLUS || H5 -->
|
||
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="!showbox">手机号快速登录
|
||
</button>
|
||
<view class="toLogin" v-if="showbox" @click="toLoginconfirm">登录</view>
|
||
<view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view>
|
||
<!-- #endif -->
|
||
<view class="agreement flex-start">
|
||
<u-checkbox-group><u-checkbox shape="circle" @change="radioChange"
|
||
size="24"></u-checkbox></u-checkbox-group>
|
||
<text>阅读并同意零点八零</text>
|
||
<view class="agreement-Item" @click="Privacy(1)">《用户协议》</view>
|
||
及
|
||
<view class="agreement-Item" @click="Privacy(2)">《隐私政策》</view>
|
||
</view>
|
||
</view>
|
||
<!-- #ifdef APP-PLUS || H5 -->
|
||
<view class="box_conf" v-if="debug" @click="showpicker = true">{{ baseUrl || '切换' }}</view>
|
||
<!-- #endif -->
|
||
<u-overlay :show="agreeShow">
|
||
<view class="warp">
|
||
<view class="rect">
|
||
<view class="rect_img"></view>
|
||
<view class="rect_text flex-colum">
|
||
<view class="rect_text_one">用户须知</view>
|
||
<view class="rect_text_tow">
|
||
感谢您使用《银收客》,我们非常重视您的个 人信息和隐私保护,在您使用服务前。请仔 细阅读
|
||
<text @click="Privacy(1)">《用户协议》</text>
|
||
和
|
||
<text @click="Privacy(2)">《隐私协议》</text>
|
||
</view>
|
||
<view class="rect_text_there">如您同意此条款,请点击“同意”并开始使 用我们的产品和服务,我们将尽全力保护您 的个人信息安全</view>
|
||
<view class="rect_text_four flex-between">
|
||
<view class="rect_text_four_o" @click="refuse">拒绝</view>
|
||
<view class="rect_text_four_t" @click="agree">同意</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</u-overlay>
|
||
<u-popup :show="showpopup" mode="center">
|
||
<view style="width: 600rpx; height: 100rpx">
|
||
<u--input style="width: 100%; height: 100%" placeholder="请输入内容" border="surround" @blur="blurinput"
|
||
v-model="valueinput"></u--input>
|
||
</view>
|
||
</u-popup>
|
||
<u-picker :show="showpicker" @cancel="showpicker = false" :columns="columns"
|
||
@confirm="confirmpicker"></u-picker>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
showpicker: false,
|
||
showpopup: false,
|
||
valueinput: '',
|
||
showbox: false,
|
||
|
||
columns: [
|
||
['http://admintestapi.sxczgkj.cn/', 'https://ky.sxczgkj.cn', 'http://192.168.2.22:7004',
|
||
'http://admintestapi.sxczgkj.cn/', '自定义输入'
|
||
]
|
||
],
|
||
radioChangeItem: false, //单选框
|
||
agreeShow: false,
|
||
h: null, //动态高度
|
||
showPassword: false, //是否显示密码
|
||
debug: uni.conf.debug,
|
||
baseUrl: uni.conf.baseUrl,
|
||
// 注册定时器 初始值
|
||
second: 60,
|
||
showText: true,
|
||
Recapture: '发送验证码',
|
||
form: {
|
||
//密码
|
||
loginName: '',
|
||
password: '',
|
||
code: '',
|
||
inviteCode: ''
|
||
}
|
||
};
|
||
},
|
||
mounted() {
|
||
this.computed_h();
|
||
},
|
||
|
||
onLoad() {
|
||
// #ifdef APP-PLUS || H5
|
||
this.showbox = true
|
||
// #endif
|
||
},
|
||
methods: {
|
||
// 同意隐私政策
|
||
agree() {
|
||
uni.setStorageSync('agree', 1);
|
||
this.agreeShow = false;
|
||
},
|
||
blurinput(e) {
|
||
console.log(e);
|
||
uni.conf.baseUrl = e;
|
||
this.baseUrl = e;
|
||
this.showpopup = false;
|
||
},
|
||
confirmpicker(e) {
|
||
this.showpicker = false;
|
||
if (e.value == '自定义输入') {
|
||
this.showpopup = true;
|
||
} else {
|
||
this.baseUrl = e.value[0];
|
||
uni.conf.baseUrl = e.value;
|
||
}
|
||
},
|
||
// 拒绝隐私政策-退出应用
|
||
refuse() {
|
||
// #ifdef APP-PLUS || H5
|
||
//android 退出方法
|
||
plus.runtime.quit();
|
||
// ios 退出方法
|
||
plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
|
||
// #endif
|
||
},
|
||
|
||
radioChange(n) {
|
||
//是否同意
|
||
this.radioChangeItem = n;
|
||
},
|
||
display() {
|
||
// 切换图片显示隐藏
|
||
this.showPassword = !this.showPassword;
|
||
},
|
||
async CodeRegister() {
|
||
//发起验证码
|
||
if (this.form.loginName == null || this.form.loginName == '') {
|
||
uni.showToast({
|
||
title: '请输入电话号码',
|
||
icon: 'none'
|
||
});
|
||
return false;
|
||
}
|
||
const res = await this.api.phoneValidateCode({
|
||
// post 手机验证码
|
||
phone: this.form.loginName
|
||
});
|
||
if (res) {
|
||
uni.showToast({
|
||
title: '验证码获取成功',
|
||
icon: 'none'
|
||
});
|
||
// 定时器
|
||
this.showText = false;
|
||
this.Recapture = '重新获取';
|
||
var interval = setInterval(() => {
|
||
let times = --this.second;
|
||
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
|
||
}, 1000);
|
||
setTimeout(() => {
|
||
clearInterval(interval);
|
||
this.second = 60;
|
||
this.showText = true;
|
||
}, 60000);
|
||
}
|
||
},
|
||
async Privacy(e) {
|
||
if (e == 1) {
|
||
//用户协议
|
||
let res = await this.api.agreementgetAgreementOne({
|
||
discern: 0
|
||
});
|
||
uni.pro.navigateTo('my/about/agreement', {
|
||
discern: 0,
|
||
list: res.data.content
|
||
});
|
||
} else {
|
||
let res3 = await this.api.agreementgetAgreementOne({
|
||
discern: 3
|
||
});
|
||
uni.pro.navigateTo('my/about/agreement', {
|
||
discern: 3,
|
||
list: res3.data.content
|
||
});
|
||
}
|
||
},
|
||
rightClick() {
|
||
console.log(11);
|
||
uni.switchTab({
|
||
url: '/pages/device_shop/index'
|
||
});
|
||
},
|
||
register() {
|
||
uni.navigateTo({
|
||
url: '../login/register'
|
||
});
|
||
},
|
||
passwords() {
|
||
uni.navigateTo({
|
||
url: '../login/password'
|
||
});
|
||
},
|
||
async computed_h() {
|
||
//获取div宽度
|
||
let content_Icon = await uni.utils.info_distance('box');
|
||
let system_info = await uni.getSystemInfo();
|
||
let h = null;
|
||
h = system_info.windowHeight - content_Icon.height + 'px';
|
||
this.h = {
|
||
height: h
|
||
};
|
||
},
|
||
async toLoginconfirm() {
|
||
//登录
|
||
if (this.form.loginName == null || this.form.loginName == '') {
|
||
uni.showToast({
|
||
title: '请输入电话号码',
|
||
icon: 'none'
|
||
});
|
||
return false;
|
||
}
|
||
if (this.radioChangeItem == false) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '请先阅读《用户协议》和《隐私政策》'
|
||
});
|
||
return;
|
||
}
|
||
let res = await this.api.loginapplogin({
|
||
username: this.form.loginName,
|
||
password: this.form.password,
|
||
code: this.form.code
|
||
});
|
||
console.log(res);
|
||
if (res.code == 0) {
|
||
uni.cache.set('token', res.data.token);
|
||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||
.miniAppOpenId)
|
||
uni.cache.set('userInfo', res.data.userInfo);
|
||
// uni.cache.set('shopUser', res.data.shopUser);
|
||
uni.pro.switchTab('index/index')
|
||
}
|
||
|
||
},
|
||
async getPhoneNumber(res) { // 获取手机号
|
||
var resdataa = res
|
||
console.log(res)
|
||
// #ifdef MP-WEIXIN
|
||
uni.login({
|
||
provider: 'weixin',
|
||
success: async (data) => {
|
||
let resdata = await this.api.logingetPhoneNumber({
|
||
code: data.code,
|
||
iv: resdataa.detail.iv,
|
||
encryptedData: resdataa.detail.encryptedData
|
||
})
|
||
console.log(resdata)
|
||
if (resdata.data) {
|
||
this.phone = resdata.data
|
||
this.userlogin()
|
||
}
|
||
}
|
||
});
|
||
// #endif
|
||
},
|
||
async userlogin() {
|
||
// #ifdef MP-WEIXIN
|
||
uni.login({
|
||
provider: 'weixin',
|
||
success: async (data) => {
|
||
try {
|
||
uni.getUserInfo({
|
||
provider: 'weixin',
|
||
success: async (infoRes) => {
|
||
uni.cache.set('weixincode', data.code);
|
||
let res = await this.api.userwxlogin({
|
||
code: uni.cache.get('weixincode'), //临时登录凭证
|
||
encryptedData: infoRes
|
||
.encryptedData, // 用户非敏感信息
|
||
rawData: infoRes.rawData,
|
||
signature: infoRes.signature,
|
||
iv: infoRes.iv,
|
||
phone: this.phone
|
||
})
|
||
if (res.code == 0) {
|
||
uni.cache.set('token', res.data.token);
|
||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||
.miniAppOpenId)
|
||
uni.cache.set('userInfo', res.data.userInfo);
|
||
uni.cache.set('shopUser', res.data.shopUser);
|
||
uni.pro.switchTab('index/index')
|
||
}
|
||
},
|
||
fail: (err) => {
|
||
console.log(err)
|
||
}
|
||
});
|
||
} catch (e) {
|
||
console.log(e)
|
||
}
|
||
}
|
||
});
|
||
// #endif
|
||
},
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
page {
|
||
width: 100%;
|
||
height: 100%;
|
||
background: #FFFFFF;
|
||
}
|
||
|
||
.container {
|
||
position: relative;
|
||
|
||
.top {
|
||
position: absolute;
|
||
left: 64rpx;
|
||
|
||
.u-navbar--fixed {
|
||
top: 88rpx;
|
||
}
|
||
}
|
||
|
||
.box {
|
||
padding-top: 110rpx;
|
||
|
||
image {
|
||
width: 128rpx;
|
||
height: 128rpx;
|
||
}
|
||
}
|
||
|
||
.warp {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
height: 100%;
|
||
|
||
.rect {
|
||
width: 606rpx;
|
||
background-color: #fff;
|
||
border-radius: 12rpx;
|
||
|
||
.rect_img {
|
||
// background: url(@/static/login/uoverlay.png) no-repeat;
|
||
background-size: 100% 100%;
|
||
width: 100%;
|
||
height: 120px;
|
||
}
|
||
|
||
.rect_text {
|
||
padding: 0 40rpx;
|
||
|
||
.rect_text_one {
|
||
margin-top: 32rpx;
|
||
font-size: 32rpx;
|
||
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
|
||
font-weight: 500;
|
||
color: #333333;
|
||
}
|
||
|
||
.rect_text_tow {
|
||
margin-top: 32rpx;
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||
font-weight: 400;
|
||
|
||
text {
|
||
color: #2f87fd;
|
||
}
|
||
|
||
color: #333333;
|
||
}
|
||
|
||
.rect_text_there {
|
||
margin-top: 16rpx;
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
||
font-weight: 400;
|
||
color: #999999;
|
||
}
|
||
|
||
.rect_text_four {
|
||
width: 100%;
|
||
padding: 48rpx 40rpx 30rpx 40rpx;
|
||
|
||
.rect_text_four_o {
|
||
padding: 16rpx 64rpx;
|
||
background: #ffffff;
|
||
border-radius: 36rpx;
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
|
||
font-weight: 500;
|
||
color: #333333;
|
||
border: 2rpx solid #333333;
|
||
}
|
||
|
||
.rect_text_four_t {
|
||
background: #2f87fd;
|
||
padding: 16rpx 64rpx;
|
||
border-radius: 36rpx;
|
||
font-size: 28rpx;
|
||
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
|
||
font-weight: 500;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.box_conf {
|
||
position: fixed;
|
||
top: 0;
|
||
color: #000;
|
||
padding: 20rpx;
|
||
right: 2%;
|
||
}
|
||
|
||
.top_box::after {
|
||
position: absolute;
|
||
// content: url(@/static/icon.png);
|
||
width: 282rpx;
|
||
height: 280rpx;
|
||
top: -240rpx;
|
||
right: 32rpx;
|
||
z-index: 2;
|
||
}
|
||
|
||
.top_box {
|
||
z-index: 9;
|
||
padding: 0 64rpx;
|
||
box-sizing: border-box;
|
||
width: 100%;
|
||
position: fixed;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
background: #ffffff;
|
||
border-radius: 40rpx 40rpx 0px 0px;
|
||
|
||
.top_box_one {
|
||
position: relative;
|
||
width: 100%;
|
||
margin-top: 64rpx;
|
||
border-bottom: 6rpx solid #e5e5e5;
|
||
|
||
.top_box_one_text {
|
||
font-size: 36rpx;
|
||
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
|
||
font-weight: 500;
|
||
color: #333333;
|
||
}
|
||
|
||
input {
|
||
height: auto;
|
||
padding: 18rpx 0 20rpx 0;
|
||
}
|
||
|
||
.repeat {
|
||
position: absolute;
|
||
bottom: 26rpx;
|
||
right: 0;
|
||
width: 25rpx;
|
||
height: 17rpx;
|
||
}
|
||
|
||
.repeats {
|
||
position: absolute;
|
||
bottom: 26rpx;
|
||
right: 0;
|
||
font-size: 24rpx;
|
||
z-index: 9;
|
||
font-family: $uni_family;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
border-radius: 12rpx;
|
||
}
|
||
}
|
||
|
||
.top_box_tow {
|
||
width: 100%;
|
||
|
||
text {
|
||
margin-top: 34rpx;
|
||
font-size: 24rpx;
|
||
font-family: $uni_family;
|
||
font-weight: 400;
|
||
color: #666666;
|
||
}
|
||
}
|
||
|
||
.toLogin {
|
||
margin-top: 212rpx;
|
||
width: 100%;
|
||
background: #F1CB66;
|
||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #333333;
|
||
height: 84rpx;
|
||
line-height: 84rpx;
|
||
text-align: center;
|
||
border: none;
|
||
}
|
||
|
||
.toLogin::after {
|
||
background: none;
|
||
border: none;
|
||
}
|
||
|
||
.toLogins {
|
||
margin-top: 32rpx;
|
||
width: 100%;
|
||
line-height: 84rpx;
|
||
height: 84rpx;
|
||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||
border: 2rpx solid #333333;
|
||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||
font-weight: 400;
|
||
font-size: 32rpx;
|
||
color: #333333;
|
||
text-align: center;
|
||
}
|
||
|
||
.agreement {
|
||
width: 100%;
|
||
margin-top: 40rpx;
|
||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||
font-weight: 500;
|
||
font-size: 20rpx;
|
||
color: #999999;
|
||
text-align: left;
|
||
|
||
.agreement-Item {
|
||
color: #333333;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style> |