460 lines
11 KiB
Vue
460 lines
11 KiB
Vue
<template>
|
||
<view class="container">
|
||
<view class="box flex-colum-start">
|
||
<text>您好,</text>
|
||
<text>欢迎使用银收客</text>
|
||
</view>
|
||
<view class="top_box" :style="h">
|
||
<view class="top_box_one">
|
||
<text class="top_box_one_text">手机号码</text>
|
||
<input type="text" v-model="form.loginName" :adjust-position="false" placeholder="请输入手机号码"
|
||
maxlength="-1" data-key="mobile" />
|
||
</view>
|
||
<view class="top_box_one">
|
||
<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_tow flex-between">
|
||
<text @click="register">注册账号</text>
|
||
<text @click="passwords">忘记密码?</text>
|
||
</view>
|
||
<view class="toLogin" @click="toLogin">登录</view>
|
||
<view class="agreement flex-start">
|
||
<u-checkbox-group><u-checkbox shape="circle" @change="radioChange"
|
||
size="12"></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>
|
||
<view class="box_conf" v-if="debug" @click="showpicker = true">{{ baseUrl || '切换' }}</view>
|
||
<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: '',
|
||
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,
|
||
form: {
|
||
//密码
|
||
loginName: '',
|
||
password: ''
|
||
}
|
||
};
|
||
},
|
||
mounted() {
|
||
this.computed_h();
|
||
},
|
||
|
||
onLoad() {},
|
||
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
|
||
//android 退出方法
|
||
plus.runtime.quit();
|
||
// ios 退出方法
|
||
plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
|
||
// #endif
|
||
},
|
||
|
||
radioChange(n) {
|
||
//是否同意
|
||
this.radioChangeItem = n;
|
||
},
|
||
display() {
|
||
// 切换图片显示隐藏
|
||
this.showPassword = !this.showPassword;
|
||
},
|
||
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 toLogin() {
|
||
//登录
|
||
if (this.form.loginName == null || this.form.loginName == '') {
|
||
uni.showToast({
|
||
title: '请输入电话号码',
|
||
icon: 'none'
|
||
});
|
||
return false;
|
||
}
|
||
if (this.form.password == null || this.form.password == '' || uni.$u.trim(this.form.password, 'all') ==
|
||
'') {
|
||
uni.showToast({
|
||
title: '请输入密码或密码不能输入空格',
|
||
icon: 'none'
|
||
});
|
||
return false;
|
||
}
|
||
if (this.radioChangeItem == false) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '请先阅读《用户协议》和《隐私政策》'
|
||
});
|
||
return;
|
||
}
|
||
let res = await this.api.Login({
|
||
loginName: this.form.loginName,
|
||
password: this.form.password
|
||
});
|
||
console.log(res);
|
||
if (res.code == 200) {
|
||
uni.cache.set('loginName', this.form.loginName + '');
|
||
uni.cache.set('password', this.form.password + '');
|
||
uni.cache.set('token', res.data.userApp.token);
|
||
uni.cache.set('myLoginName', res.data.userInfo.loginName);
|
||
uni.cache.set('userId', res.data.userInfo.id);
|
||
uni.cache.set('userInfo', res.data.userInfo);
|
||
uni.cache.set('userApp', res.data.userApp);
|
||
|
||
// 积分商城用到的token
|
||
// uni.cache.set('rechargeToken', res.data.rechargeToken);
|
||
this.$store.commit('set_login', true);
|
||
this.$store.commit('userInfo', res.data.userInfo);
|
||
this.$store.commit('userApp', res.data.userApp);
|
||
this.$store.dispatch('USerVoiceactions'); //获取语音播报初始数据
|
||
// #ifdef APP-PLUS
|
||
try {
|
||
let pinf = plus.push.getClientInfo();
|
||
let cid = (pinf && pinf.clientid) || ''; //客户端标识
|
||
uni.cache.set('cid', cid);
|
||
let res = await this.api.pushbindalias({
|
||
cid: cid
|
||
});
|
||
console.log('cid res===', res);
|
||
console.log('cid===', cid);
|
||
} catch (e) {
|
||
console.log('ciderr===', e);
|
||
//TODO handle the exception
|
||
}
|
||
// #endif
|
||
uni.pro.switchTab('/pages/index/index');
|
||
} else {
|
||
this.$api.msg(res.message);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
page {
|
||
width: 100%;
|
||
height: 100%;
|
||
background: linear-gradient(104deg, #4679ff 0%, #2868e8 47%, #2a94fc 100%);
|
||
}
|
||
|
||
.container {
|
||
position: relative;
|
||
|
||
.top {
|
||
position: absolute;
|
||
left: 64rpx;
|
||
|
||
.u-navbar--fixed {
|
||
top: 88rpx;
|
||
}
|
||
}
|
||
|
||
.box {
|
||
padding-top: 228rpx;
|
||
padding-left: 64rpx;
|
||
padding-bottom: 144rpx;
|
||
box-sizing: border-box;
|
||
|
||
text {
|
||
font-size: 40rpx;
|
||
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
|
||
font-weight: 500;
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
|
||
.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: 10%;
|
||
color: #fff;
|
||
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;
|
||
bottom: 0;
|
||
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;
|
||
}
|
||
}
|
||
|
||
.top_box_tow {
|
||
width: 100%;
|
||
|
||
text {
|
||
margin-top: 34rpx;
|
||
font-size: 24rpx;
|
||
font-family: $uni_family;
|
||
font-weight: 400;
|
||
color: #666666;
|
||
}
|
||
}
|
||
|
||
.toLogin {
|
||
width: 570rpx;
|
||
margin-top: 112rpx;
|
||
padding: 10rpx 0;
|
||
text-align: center;
|
||
background: #288efb;
|
||
border-radius: 40rpx 40rpx 40rpx 40rpx;
|
||
font-size: 36rpx;
|
||
font-family: $uni_family;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.agreement {
|
||
margin-top: 14rpx;
|
||
font-size: 20rpx;
|
||
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
|
||
font-weight: 500;
|
||
color: #7c8e97;
|
||
|
||
.agreement-Item {
|
||
color: #4ca1fc;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style> |