<template>
|
|
<view class="container">
|
|
<view class="form">
|
|
<input class="input" type="text" placeholder="请输入您的账号" v-model="username" />
|
|
<input class="input" type="password" placeholder="请输入您的密码" v-model="password" />
|
|
<view class="agreement">
|
|
<checkbox-group @change="handleAgreementChange">
|
|
<label>
|
|
<checkbox value="agree" /> 阅读并同意《用户协议》和《隐私政策》
|
|
</label>
|
|
</checkbox-group>
|
|
</view>
|
|
<button class="button" @click="handleLogin">登录</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
username: '',
|
|
password: '',
|
|
agreed: false
|
|
};
|
|
},
|
|
methods: {
|
|
handleAgreementChange(e) {
|
|
this.agreed = e.detail.value.includes('agree');
|
|
},
|
|
handleLogin() {
|
|
if (!this.agreed) {
|
|
uni.showToast({
|
|
title: '请先同意用户协议和隐私政策',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
// 这里可以添加登录逻辑
|
|
uni.showToast({
|
|
title: '登录成功',
|
|
icon: 'success'
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
.container {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
.form {
|
|
width: 80%;
|
|
background-color: #fff;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.input {
|
|
width: 100%;
|
|
height: 40px;
|
|
margin-bottom: 15px;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.agreement {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.button {
|
|
width: 100%;
|
|
height: 40px;
|
|
background-color: #007aff;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 4px;
|
|
font-size: 16px;
|
|
}
|
|
</style>
|