merge 拉取远程最新代码
This commit is contained in:
Zy
2026-05-09 08:00:10 +08:00
18 changed files with 113 additions and 517 deletions

View File

@@ -3,21 +3,17 @@ import request,{get,post} from "./request.js"
// =======账号密码登录========
export const getLoginPassword = (data) =>{
return post('/api/resident/auth/loginByPassword',data)
return post('/api/butler/auth/loginByPassword',data)
}
// 注册新用户获取验证码
// 获取验证码
export const getSendCode = (data) =>{
return post('/api/resident/auth/sendSmsCode',data)
return post('/api/butler/auth/sendSmsCode',data)
}
// 注册新用户
export const getRegisterUser = (data) =>{
return post('/api/resident/auth/register',data)
}
// 短信验证码登录
// 手机验证码登录
export const getLoginBySms = (data) =>{
return post('/api/resident/auth/loginBySms',data)
return post('/api/butler/auth/loginBySms',data)
}
// 忘记密码接口
export const getResetPassword = (data) =>{
return post('/api/resident/auth/resetPassword',data)
return post('/api/butler/auth/forgetPassword',data)
}

View File

@@ -1,7 +1,7 @@
let baseUrl = '';
if (process.env.NODE_ENV === 'development') {
baseUrl = 'http://192.168.0.224:8080'; // 开发环境
baseUrl = 'http://192.168.0.239:8080'; // 开发环境
} else {
baseUrl = 'http://192.168.1.224:8080'; // 生产环境
}

View File

@@ -51,7 +51,8 @@
/* 小程序特有相关 */
"mp-weixin": {
"appid": "wx4a49ad94e2b25927",
"usingComponents": true
"usingComponents": true,
"lazyCodeLoading":"requiredComponents"
},
"mp-alipay": {
"usingComponents": true

View File

@@ -89,7 +89,7 @@ const handleConfirm = () => {
}
getResetPassword(params).then(res =>{
if(res.code === 200){
//uni.setStorageSync('token', res.token); // 假设后端返回token字段
//uni.setStorageSync('token', res.token); // 后端返回token字段
uni.showToast({ title: '修改成功', icon: 'success' });
setTimeout(() =>{
uni.navigateTo({ url: '/pageSubPack/loginSub/pwd-login' });
@@ -100,7 +100,7 @@ const handleConfirm = () => {
}
}).catch(err =>{
uni.showToast({
title: '网络异常',
title: err.msg,
icon: 'error'
});
})

View File

@@ -50,7 +50,7 @@
<!-- 底部链接 -->
<view class="bottom-link">
<navigator class="link-item" url="/pageSubPack/loginSub/pwd-login">账号密码登录</navigator>
<navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator>
<!-- <navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator> -->
</view>
</view>
</template>
@@ -120,7 +120,7 @@
if (!canGetVerify.value) return;
let params = {
phone: phoneNumber.value,
scene: 'login'
scene: 'butler_login'
}
uni.showLoading({
title: '发送中...',
@@ -150,7 +150,7 @@
}
}).catch(err => {
uni.showToast({
title: '网络异常',
title: err.msg,
icon: 'error'
});
})
@@ -166,8 +166,8 @@
});
let params = {
phone: phoneNumber.value,
smsCode: '123456',
scene: 'login',
smsCode: verifyCode.value,
scene: 'butler_login',
}
getLoginBySms(params).then(res => {
if (res.code === 200) {
@@ -206,7 +206,7 @@
}).catch(err => {
uni.showToast({
title: '网络异常,请重试',
title: err.msg,
icon: 'error'
});
})
@@ -342,7 +342,7 @@
color: #fff;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 60rpx;
margin-bottom: 40rpx;
}
/* 登录按钮禁用状态 */
@@ -360,7 +360,7 @@
/* 底部链接 */
.bottom-link {
display: flex;
justify-content: space-between;
justify-content: center;
padding: 0 20rpx;
}

View File

@@ -51,7 +51,7 @@
<!-- 底部链接 -->
<view class="bottom-link">
<navigator class="link-item" url="/pageSubPack/loginSub/login">验证码登录</navigator>
<navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator>
<!-- <navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator> -->
</view>
</view>
</template>
@@ -104,67 +104,56 @@
// 登录逻辑
const handleLogin = () => {
// if (!canLogin.value) {
// uni.showToast({ title: '请输入账号和密码', icon: 'none' });
// return
// }
if (!canLogin.value) {
uni.showToast({ title: '请输入账号和密码', icon: 'none' });
return
}
// if (!phoneNumber.value) {
// uni.showToast({ title: '请输入账号', icon: 'none' });
// return;
// }
// if (!password.value) {
// uni.showToast({ title: '请输入密码', icon: 'none' });
// return;
// }
// if(!agreeAgreement.value){
// uni.showToast({ title: '请勾选协议', icon: 'none' });
// return;
// }
// uni.showLoading({ title: '登录中...', mask: true });
// let params = {
// username:phoneNumber.value,
// password:password.value
// }
// getLoginPassword(params).then(res =>{
if (!phoneNumber.value) {
uni.showToast({ title: '请输入账号', icon: 'none' });
return;
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' });
return;
}
if(!agreeAgreement.value){
uni.showToast({ title: '请勾选协议', icon: 'none' });
return;
}
uni.showLoading({ title: '登录中...', mask: true });
let params = {
username:phoneNumber.value,
password:password.value
}
getLoginPassword(params).then(res =>{
// console.log('33333',res)
// if(res.code === 200){
// uni.setStorageSync('token', res.data.token);
// // 存用户ID
// if(res.data) {
// // 存当前绑定的小区ID,0 表示未绑定
if(res.code === 200){
uni.setStorageSync('token', res.data.token);
// 存用户ID
if(res.data) {
// 存当前绑定的小区ID,0 表示未绑定
// const currentVillageId = res.data.currentVillageId || 0;
// uni.setStorageSync('currentVillageId', currentVillageId);
// }
// uni.hideLoading();
// uni.showToast({ title: '登录成功', icon: 'success' });
// setTimeout(() =>{
// uni.switchTab({
// url: '/pages/index/index'
// },1000);
// })
// }else{
// uni.showToast({ title: res.msg, icon: 'error' });
// }
// }).catch(err => {
// uni.showToast({
// title: '网络异常',
// icon: 'error'
// });
// })
// 测试
uni.showLoading({
title: '登录中...',
mask: true
});
}
uni.hideLoading();
uni.showToast({ title: '登录成功', icon: 'success' });
setTimeout(() =>{
uni.switchTab({
url: '/pages/index/index'
},1000);
})
}else{
uni.showToast({ title: res.msg, icon: 'error' });
}
}).catch(err => {
uni.showToast({
title: err.msg,
icon: 'error'
});
}, 1500);
uni.hideLoading()
})
};
</script>
@@ -253,7 +242,7 @@
color: #fff;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 60rpx;
margin-bottom: 40rpx;
}
.login-btn:disabled {
@@ -270,7 +259,7 @@
.bottom-link {
display: flex;
justify-content: space-between;
justify-content: center;
padding: 0 20rpx;
}

View File

@@ -1,393 +0,0 @@
<template>
<view class="register-page">
<view class="status_bar"></view>
<!-- 顶部导航 -->
<view class="nav-bar">
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
<view class="nav-title">注册</view>
</view>
<!-- 注册标题 -->
<view class="register-title">注册用户</view>
<!-- 手机号输入框 -->
<view class="input-item">
<view class="input-icon">
<image src="http://47.104.199.163:9090/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
</view>
<uni-easyinput class="input-content" type="number" v-model="phoneNumber"
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
</uni-easyinput>
</view>
<!-- 验证码输入 + 获取验证码按钮 -->
<view class="input-item verify-item">
<view class="input-icon">
<image src="http://47.104.199.163:9090/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
</view>
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode"
placeholder="请输入验证码" :inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
</uni-easyinput>
<button
class="get-verify-btn"
:disabled="!canGetVerify || countDown > 0"
@click="getVerifyCode"
>
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
</button>
</view>
<!-- 账号输入框 -->
<view class="input-item">
<view class="input-icon">
<image src="http://47.104.199.163:9090/images/login/account.png" mode="" style="height: 100%;width: 100%;"></image>
<!-- <uni-icons type="person" size="24" color="#999"></uni-icons> -->
</view>
<uni-easyinput class="input-content" type="text" v-model="account"
placeholder="请输入账号" :inputBorder="false" :placeholderStyle="placeholderStyle">
</uni-easyinput>
</view>
<!-- 密码输入框 -->
<view class="input-item">
<view class="input-icon">
<image src="http://47.104.199.163:9090/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
</view>
<uni-easyinput class="input-content" type="password" v-model="password"
placeholder="请输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle" >
</uni-easyinput>
</view>
<!-- 协议勾选 -->
<!-- 协议勾选 -->
<view class="agreement-item" >
<view @click="toggleAgreement">
<uni-icons type="checkbox-filled" size="24" color="#4D5DFA" v-if="agreeAgreement"></uni-icons>
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
</view>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意
<text class="agreePrivacy">《用户隐私政策》</text>
</text>
</view>
<!-- 立即注册按钮 -->
<button
class="register-btn"
:disabled="!canRegister"
@click="handleRegister"
>
立即注册
</button>
<!-- 跳转登录链接 -->
<view class="login-link">
<navigator class="link-item" url="/pageSubPack/loginSub/login">已有账号,去登录</navigator>
</view>
</view>
</template>
<script setup>
import { ref, computed, onUnmounted } from 'vue';
import {getRegisterUser,getSendCode} from '../../api/api.js'
// ========== 响应式数据 ==========
// 表单数据
const phoneNumber = ref('');
const verifyCode = ref('');
const account = ref('');
const password = ref('');
const placeholderStyle = ref('font-size:24rpx')
// 协议勾选(默认勾选,和截图一致)
const agreeAgreement = ref(true);
// 验证码倒计时
const countDown = ref(0);
let timer = null;
// ========== 计算属性 ==========
// 是否可获取验证码(手机号格式正确)
const canGetVerify = computed(() => {
const phoneReg = /^1[3-9]\d{9}$/;
return phoneReg.test(phoneNumber.value);
});
// 是否可注册(所有表单项+协议都满足)
const canRegister = computed(() => {
const phoneReg = /^1[3-9]\d{9}$/; // 手机号11位
const verifyReg = /^\d{6}$/; // 验证码6位
const accountReg = /^.{4,20}$/; // 账号4-20位
const pwdReg = /^.{6,16}$/; // 密码6-16位
return phoneReg.test(phoneNumber.value)
&& verifyReg.test(verifyCode.value)
&& accountReg.test(account.value)
&& pwdReg.test(password.value)
&& agreeAgreement.value;
});
// ========== 方法 ==========
// 返回上一页
const goBack = () => {
uni.navigateBack();
};
// 跳转隐私协议
const goToPrivacy = () => {
uni.navigateTo({
url:'/pageSubPack/loginSub/privacy',
})
}
// 切换协议勾选状态
const toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value;
};
// 检查表单状态(实时更新按钮状态)
const checkForm = () => {};
// 获取验证码
const getVerifyCode = () => {
if (!canGetVerify.value) return;
let params = {
phone:phoneNumber.value,
scene:'register'
}
getSendCode(params).then(res =>{
if(res.code === 200){
uni.showToast({
title: '验证码已发送',
icon: 'success'
});
// 开始60秒倒计时
countDown.value = 60;
timer = setInterval(() => {
countDown.value--;
if (countDown.value <= 0) {
clearInterval(timer);
timer = null;
}
}, 1000);
}else{
uni.showToast({
title: '验证码发送失败',
icon: 'error'
});
}
}).catch(err =>{
uni.showToast({
title: '网路异常',
icon: 'error'
});
})
};
// 处理注册逻辑
const handleRegister = () => {
if (!canRegister.value) return;
uni.showLoading({ title: '注册中...', mask: true });
let params = {
phone:phoneNumber.value,
smsCode:verifyCode.value,
username:account.value,
password:password.value
}
getRegisterUser(params).then(res =>{
if(res.code === 200){
uni.hideLoading();
uni.showToast({
title: '注册成功',
icon: 'success'
});
setTimeout(() => {
uni.redirectTo({ url: '/pageSubPack/loginSub/pwd-login' });
}, 1500);
}else{
uni.showToast({
title: '注册失败',
icon: 'error'
});
}
}).catch((err) =>{
uni.showToast({
title: '网络异常',
icon: 'error'
});
})
// 注册成功后跳转到登录页
// uni.redirectTo({
// url: '/pages/login/pwd-login'
// });
// setTimeout(() => {
// }, 1500);
};
// ========== 生命周期 ==========
// 页面卸载时清除定时器
onUnmounted(() => {
if (timer) {
clearInterval(timer);
}
});
</script>
<style scoped>
/* 页面容器 */
.register-page {
padding: 20rpx 40rpx 40rpx;
/* background-color: #f8f9fa; */
min-height: 100vh;
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
}
.status_bar {
height: 46px;
width: 100%;
}
/* 顶部导航栏 */
.nav-bar {
display: flex;
align-items: center;
/* height: 88rpx; */
margin-bottom: 70rpx;
}
.nav-title {
flex: 1;
text-align: center;
font-size: 32rpx;
font-weight: 500;
color: #333;
margin-right: 100rpx;
}
/* 注册标题 */
.register-title {
font-size: 40rpx;
font-weight: 600;
color: #333;
margin-bottom: 60rpx;
}
/* 输入框通用样式 */
.input-item {
display: flex;
align-items: center;
background-color: #fff;
border-radius: 40rpx;
padding: 0 30rpx;
height: 88rpx;
margin-bottom: 30rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
/* 验证码输入项特殊布局 */
.verify-item {
position: relative;
padding-right: 220rpx;
}
/* 输入框图标 */
.input-icon {
margin-right: 20rpx;
color: #999;
width: 50rpx;
height: 50rpx;
}
/* 输入框内容 */
.input-content {
flex: 1;
font-size: 32rpx;
color: #333;
height: 100%;
}
.verify-input {
padding-right: 20rpx;
}
/* 获取验证码按钮 */
.get-verify-btn {
position: absolute;
right: 10rpx;
top: 50%;
transform: translateY(-50%);
width: 200rpx;
height: 70rpx;
line-height: 70rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 198rpx;
font-size: 26rpx;
padding: 0;
margin: 0;
}
.get-verify-btn:disabled {
background-color: #ccc;
color: #fff;
}
.get-verify-btn:after{
border-radius: 50px;
}
/* 协议勾选项 */
.agreement-item {
display: flex;
align-items: center;
margin: 70rpx 0 28rpx 0;
padding-left: 10rpx;
}
.agreement-text {
font-size: 28rpx;
color: #666;
margin-left: 10rpx;
}
.agreePrivacy{
color: #4D5DFA;
}
/* 立即注册按钮 */
.register-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 40rpx;
}
button:after{
border-radius: 8px;
}
.register-btn:disabled {
background-color: #99c8ff;
color: #fff;
}
/* 跳转登录链接 */
.login-link {
text-align: center;
}
.link-item {
font-size: 28rpx;
color: #4D5DFA;
text-decoration: none;
}
</style>

View File

@@ -65,7 +65,7 @@
<view class="confirm-area">
<button class="confirm-btn" :disabled="!selectedItem" :class="{ 'disabled-btn': !selectedItem }"
@tap="handleConfirm">
确认选择
确认
</button>
</view>
</view>
@@ -318,7 +318,7 @@
.search-input-wrapper {
flex: 1;
background-color: #f8f8f8;
background-color: #f3f3f3;
border-radius: 10rpx;
padding: 0 20rpx;
display: flex;
@@ -341,6 +341,7 @@
.placeholder {
color: #999;
font-size: 28rpx;
text-align: center;
}
.clear-icon {
@@ -373,14 +374,14 @@
.community-item {
background-color: #fff;
border-radius: 12rpx;
/* border-radius: 12rpx; */
padding: 30rpx;
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
transition: all 0.2s;
/* box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); */
/* transition: all 0.2s; */
}
.community-item.active {

View File

@@ -172,7 +172,7 @@ const handleConfirm = () => {
uni.showLoading({ title: '修改中...' });
setTimeout(() =>{
uni.navigateTo({
url:'/pageSubPack/setting/setting'
url:`/pageSubPack/setting/setting?newPassword=${confirmPassword.value}`
})
})

View File

@@ -113,11 +113,16 @@ const handleConfirm = () =>{
uni.showToast({ title: '请输入',icon: 'error'});
return
}
setTimeout(()=>{
uni.navigateTo({
url:"/pageSubPack/setting/setting"
})
})
}
// 返回上一页
const goBack = () => {
uni.navigateBack();
};
// const goBack = () => {
// uni.navigateBack();
// };
</script>
<style scoped>

View File

@@ -29,7 +29,7 @@
<!-- 退出登录按钮 -->
<view class="logout-btn-wrap">
<button class="logout-btn" :disabled="!phoneNumber" @tap="handleLogout">退出登录</button>
<button class="logout-btn" :disabled="!phoneNumber || !passwordNumber" @tap="handleLogout">退出登录</button>
</view>
</view>
</template>
@@ -40,14 +40,16 @@ import { onLoad } from '@dcloudio/uni-app'
// 响应式数据
const phoneNumber = ref('15699991212') // 绑定手机号
const passwordNumber = ref('ckk123456')
const passwordNumber = ref('')
// 页面加载时可从接口获取用户信息
onLoad(() => {
// 实际项目中从接口获取用户手机号
// getUserInfo().then(res => {
// phoneNumber.value = res.phone || ''
// })
onLoad((option) => {
// console.log('option',option)
passwordNumber.value = option.newPassword
const userInfo = uni.getStorageSync('tempChangePwdParams')
if(userInfo.phoneNumber){
phoneNumber.value = userInfo.phoneNumber
}
})
// 返回上一页
@@ -94,8 +96,10 @@ const confirmLogout = () => {
setTimeout(() => {
uni.hideLoading()
// 清除本地存储的token等信息
uni.removeStorageSync('token')
uni.removeStorageSync('userInfo')
uni.clearStorageSync()
// uni.removeStorageSync('token')
// uni.removeStorageSync('userInfo')
// uni.removeStorageSync('tempChangePwdParams')
// 提示并跳转到登录页
uni.showToast({
@@ -147,7 +151,7 @@ const confirmLogout = () => {
.nav-title {
flex: 1;
text-align: center;
font-size: 18px;
font-size: 32rpx;
font-weight: 500;
color: #333;
}
@@ -173,14 +177,14 @@ const confirmLogout = () => {
}
.item-label {
font-size: 16px;
font-size: 28rpx;
color: #333;
}
.item-value {
flex: 1;
text-align: right;
font-size: 16px;
font-size: 28rpx;
color: #666;
margin-right: 10px;
overflow: hidden;
@@ -201,7 +205,7 @@ const confirmLogout = () => {
color: #fff;
border: none;
border-radius: 6px;
font-size: 16px;
font-size: 32rpx;
}
.logout-btn::after {

View File

@@ -43,13 +43,6 @@
"navigationBarTitleText": "用户隐私协议"
}
},
{
"path": "register-new-user",
"style": {
"navigationBarTitleText": "注册新用户",
"navigationStyle": "custom"
}
},
{
"path": "forget-pwd",
"style": {

View File

@@ -116,7 +116,7 @@ const handleBtnClick = () => {
box-sizing: border-box;
}
.status_bar {
height: 115px;
height: 140px;
width: 100%;
}
/* 滑动容器 */

View File

@@ -285,7 +285,7 @@ const clickItem = index => {
position: relative;
top: 110px;
left: 0;
padding: 40rpx;
padding: 20rpx 40rpx;
}
.swiper-box {
@@ -305,11 +305,11 @@ const clickItem = index => {
.inspectionClass {
position: relative;
top: 107px;
top: 111px;
left: 0;
margin: 0 40rpx;
background: linear-gradient(to right, #7b87fa, #4d5dfa);
border-radius: 25rpx;
border-radius: 16rpx;
box-sizing: border-box;
padding: 30rpx;
}
@@ -400,7 +400,7 @@ const clickItem = index => {
.function-container {
background-color: #ffffff;
border-radius: 8rpx;
border-radius: 16rpx;
padding: 30rpx 20rpx;
box-sizing: border-box;
position: relative;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB