parent
cb07f43f85
commit
e5d24e25ef
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
<!-- pages/login/login.wxml -->
|
|
||||||
<view class="container">
|
|
||||||
<view class="title">登录</view>
|
|
||||||
|
|
||||||
<!-- 输入账号ID -->
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="请输入账号ID"
|
|
||||||
bindinput="onIDInput"
|
|
||||||
value="{{ID}}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 输入密码 -->
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
placeholder="请输入密码"
|
|
||||||
bindinput="onPasswordInput"
|
|
||||||
value="{{password}}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 显示错误信息 -->
|
|
||||||
<view class="error">{{errorMessage}}</view>
|
|
||||||
|
|
||||||
<!-- 登录按钮 -->
|
|
||||||
<button bindtap="submitUserInfo">登录</button>
|
|
||||||
|
|
||||||
<!-- 跳转到注册页面 -->
|
|
||||||
<view class="message">
|
|
||||||
还没有账号?<text class="link" bindtap="goToRegister">点击注册</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
@ -1,80 +0,0 @@
|
|||||||
/* pages/login/login.wxss */
|
|
||||||
page {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 100vh;
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
width: 90%;
|
|
||||||
max-width: 400px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
width: 100%;
|
|
||||||
height: 40px;
|
|
||||||
padding: 0 10px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 5px;
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
|
|
||||||
input:focus {
|
|
||||||
border-color: #007aff;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
width: 100%;
|
|
||||||
height: 45px;
|
|
||||||
background-color: #007aff;
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-size: 16px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 45px;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:active {
|
|
||||||
background-color: #005bb5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-section {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
|
||||||
color: red;
|
|
||||||
font-size: 14px;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
margin-top: 10px;
|
|
||||||
text-align: center;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.link {
|
|
||||||
color: #007aff;
|
|
||||||
text-decoration: underline;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
// pages/register/register.js
|
|
||||||
Page({
|
|
||||||
data: {
|
|
||||||
ID: '',
|
|
||||||
password: '',
|
|
||||||
errorMessage: ''
|
|
||||||
},
|
|
||||||
|
|
||||||
// 处理ID输入
|
|
||||||
onIDInput(e) {
|
|
||||||
this.setData({
|
|
||||||
ID: e.detail.value
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 处理密码输入
|
|
||||||
onPasswordInput(e) {
|
|
||||||
this.setData({
|
|
||||||
password: e.detail.value
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 处理注册逻辑
|
|
||||||
submitUserInfo() {
|
|
||||||
const { ID, password } = this.data;
|
|
||||||
|
|
||||||
// 验证 ID 和密码是否为空
|
|
||||||
if (!ID || !password) {
|
|
||||||
this.setData({
|
|
||||||
errorMessage: '账号ID和密码不能为空'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发起注册请求,使用 x-www-form-urlencoded
|
|
||||||
wx.request({
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded' // 设置请求头
|
|
||||||
},
|
|
||||||
url: 'http://192.168.144.1:8080/user/register', // 替换为你的后端API地址
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
'username': ID,
|
|
||||||
'password': password
|
|
||||||
},
|
|
||||||
success(res) {
|
|
||||||
console.log('注册成功', res);
|
|
||||||
wx.showToast({
|
|
||||||
title: '注册成功',
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
// 注册成功后跳转到登录页面
|
|
||||||
wx.redirectTo({
|
|
||||||
url: '/pages/login/login'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 跳转到登录页面
|
|
||||||
goToLogin() {
|
|
||||||
wx.redirectTo({
|
|
||||||
url: '/pages/login/login' // 登录页面的路径
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
<!-- pages/register/register.wxml -->
|
|
||||||
<view class="container">
|
|
||||||
<!-- 注册标题 -->
|
|
||||||
<view class="title">注册</view>
|
|
||||||
|
|
||||||
<!-- 输入账号ID号 -->
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="请输入账号ID"
|
|
||||||
bindinput="onIDInput"
|
|
||||||
value="{{phone}}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 输入密码 -->
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
placeholder="请输入密码"
|
|
||||||
bindinput="onPasswordInput"
|
|
||||||
value="{{password}}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 显示错误信息 -->
|
|
||||||
<view class="error">{{errorMessage}}</view>
|
|
||||||
|
|
||||||
<!-- 注册按钮 -->
|
|
||||||
<button bindtap="submitUserInfo">注册</button>
|
|
||||||
|
|
||||||
<!-- 提示跳转到登录页面 -->
|
|
||||||
<view class="message">
|
|
||||||
已有账号?<text class="link" bindtap="goToLogin">点击登录</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
@ -1,76 +0,0 @@
|
|||||||
/* pages/register/register.wxss */
|
|
||||||
page {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 100vh;
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
width: 90%;
|
|
||||||
max-width: 400px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
width: 100%;
|
|
||||||
height: 40px;
|
|
||||||
padding: 0 10px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 5px;
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
|
|
||||||
input:focus {
|
|
||||||
border-color: #007aff;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
width: 100%;
|
|
||||||
height: 45px;
|
|
||||||
background-color: #007aff;
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-size: 16px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 45px;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:active {
|
|
||||||
background-color: #005bb5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
|
||||||
color: red;
|
|
||||||
font-size: 14px;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
margin-top: 10px;
|
|
||||||
text-align: center;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.link {
|
|
||||||
color: #007aff;
|
|
||||||
text-decoration: underline;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
Loading…
Reference in new issue