合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

271 lines
5.3 KiB

<template>
<view class="login-container">
<!-- 顶部欢迎语 -->
<view class="login_image">
<image src="/static/image/组件 3 – 1.png" draggable ="false"></image>
</view>
<view class="welcome">
<text class="welcome-text">欢迎登陆车辆合同生成</text>
</view>
<!-- 账号输入框 -->
<view class="input-container">
<uni-easyinput prefixIcon="person" class="input" placeholder="请输入您的账号" v-model="username" :inputBorder="false" ></uni-easyinput>
<view class="underline"></view>
</view>
<!-- 密码输入框 -->
<view class="input-container">
<uni-easyinput prefixIcon="locked" class="input" type="password" placeholder="请输入您的密码" v-model="password" :inputBorder="false" ></uni-easyinput>
<view class="underline"></view>
</view>
<!-- 协议提示 -->
<view class="agreement">
<radio class = "login-agree" value="r1" :checked="checked" @click="changeCK">登录即代表同意
</radio>
<text class="link" @click="showModal">《用户协议》</text>
<text class="login-agree">与</text>
<text class="link" @click="showModal">《隐私政策》</text>
</view>
<view class = 'button_container'>
<!-- 登录按钮 -->
<button class="login-button" @click="handleLogin">登陆</button>
</view>
<mosowe-confirm-popup
v-model="popupNoCancelShow"
title="服务协议和隐私政策"
confirmText
cancelText
>
没有取消弹框
<template v-slot:footer>
<view class="mini_container">
<button class="mini-btn" type="primary" size="mini" @click="closeModal">取消</button>
<button class="mini-btn" type="primary" size="mini" @click="getConfirm">确认</button>
</view>
</template>
</mosowe-confirm-popup>
</view>
</template>
<script>
export default {
data() {
return {
username: '', // 账号
password: '', // 密码
isModalVisible: false, // 控制弹窗显示
modalTitle: '', // 弹窗标题
modalContent: '' ,// 弹窗内容
popupNoCancelShow: false,
checked:false,
};
},
methods: {
// 处理登录逻辑
handleLogin() {
if (!this.username || !this.password) {
uni.showToast({ title: '请输入账号和密码', icon: 'none' });
return;
}else{
console.log(this.checked);
if(this.checked){
uni.showToast({ title: '登录成功', icon: 'success' });
uni.switchTab({ url: '/pages/home/home' });
}else{
uni.showToast({ title: '请勾选服务协议', icon: 'none' });
}
}
},
// 显示弹窗
showModal() {
this.popupNoCancelShow = true ;
},
// 关闭弹窗
closeModal() {
this.popupNoCancelShow = false ;
},
change(e) {
console.log('当前模式:' + e.type + ',状态:' + e.show);
},
changeCK(){
if(this.checked){
this.checked = false;
}else{
this.checked = true;
}
},
// 处理选中事件
getConfirm(){
console.log("111");
if(this.checked){
this.checked = this.checked;
}else{
this.checked = true;
}
this.popupNoCancelShow = false;
}
}
};
</script>
<style>
/* 页面容器 */
.login-container {
display: flex;
flex-direction: column;
align-items: center;
background-color: #ffffff;
height: 100vh;
width: 100%;
}
.button-text {
color: #fff;
font-size: 12px;
}
/* 登录图片 */
.login_image{
width: 100%;
height: 40%;
}
.login_image image{
width: 100%;
height: 100%;
}
/* 欢迎语 */
.welcome {
height: 15%;
margin-bottom: 40rpx;
display: flex;
justify-content: end;
align-items: center;
}
.welcome-text {
font-size: 20px;
font-weight: bold;
color: #044f7a;
}
/* 输入框容器 */
.input-container {
width: 100%;
left:10%;
}
/* 输入框样式 */
.input {
width: 70%;
height: 40px;
font-size: 16px;
border: none;
outline: none;
background-color: transparent;
}
/* 下划线样式 */
.underline {
width: 100%;
height: 1px;
background-color: #f2f2f2;
margin-top: 5px;
}
/* 协议提示 */
.agreement {
font-size: 14px;
color: #666;
margin-bottom: 20px;
width: 100%;
left:10%;
display: flex;
flex-direction: row;
align-items: center;
}
.login-agree{
font-size: 20rpx;
}
.link {
color: #007aff;
text-decoration: underline;
font-size: 20rpx;
}
.button_container{
width: 100%;
height: 40%;
display: flex;
align-items: center;
}
/* 登录按钮 */
.login-button {
width: 70%;
height: 70rpx;
line-height: 70rpx;
background-color: #044f7a;
color: #fff;
border: none;
border-radius: 4px;
font-size: 16px;
position: absolute;
top:15%;
left:20%;
}
/* 弹窗样式 */
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
}
.modal-content {
width: 80%;
background-color: #fff;
border-radius: 8px;
padding: 20px;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 18px;
font-weight: bold;
margin-bottom: 15px;
}
.close {
font-size: 24px;
cursor: pointer;
}
.modal-body {
font-size: 16px;
line-height: 1.5;
}
.mini_container{
display: flex;
flex-direction: row;
align-items: center;
}
/* 按钮 */
.mini-btn{
width: 30%;
margin-left: 15%;
}
</style>