合并远程master分支
This commit is contained in:
Zy
2026-05-06 08:43:14 +08:00
12 changed files with 161 additions and 138 deletions

View File

@@ -1,23 +0,0 @@
import request,{get,post} from "./request.js"
// =======账号密码登录========
export const getLoginPassword = (data) =>{
return post('/api/resident/auth/loginByPassword',data)
}
// 注册新用户获取验证码
export const getSendCode = (data) =>{
return post('/api/resident/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)
}
// 忘记密码接口
export const getResetPassword = (data) =>{
return post('/api/resident/auth/resetPassword',data)
}

View File

@@ -1,81 +0,0 @@
let baseUrl = '';
if (process.env.NODE_ENV === 'development') {
baseUrl = 'http://192.168.0.224:8080'; // 开发环境
} else {
baseUrl = 'http://192.168.1.224:8080'; // 生产环境
}
export default function request(url, data = {}, method = "GET") {
return new Promise((resolve, reject) => {
// 加载中提示(提升用户体验)
uni.showLoading({ title: '请求中...', mask: true });
uni.request({
url: baseUrl + url,
data: data,
method: method,
header: {
"Authorization": "Bearer " + (uni.getStorageSync("token") || ''),
"clientid": "resident",
'content-type': 'application/json'
},
// header: {
// "token": uni.getStorageSync("token") || '',
// 'content-type': 'application/json'
// },
success: (res) => {
uni.hideLoading(); // 关闭加载提示
// 处理HTTP状态码(网络层面)
if (res.statusCode !== 200) {
const errMsg = `请求失败(${res.statusCode})`;
uni.showToast({ title: errMsg, icon: "none", duration: 2000 });
reject(errMsg);
return;
}
// 处理业务状态码(后端返回的data里)
const resData = res.data || {}; // 兼容后端返回空的情况
// 优先处理token过期(401)
if (resData.code === 401) {
uni.showToast({ title: '登录过期,请重新登录', icon: 'none', duration: 2000 });
uni.clearStorageSync('token');
setTimeout(() => {
uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' });
}, 1500);
reject('token 过期');
return;
}
// 业务成功(code=200)
if (resData.code === 200) {
resolve(resData); // 只返回核心数据,简化页面调用
}
// 业务失败(code=500)
else if (resData.code === 500) {
const errMsg = resData.msg || '请求失败';
uni.showToast({ title: errMsg, icon: "none", duration: 2000 });
// resolve(null)
reject(errMsg);
}
else {
const errMsg = resData.msg || '业务异常';
uni.showToast({ title: errMsg, icon: "none", duration: 2000 });
reject(errMsg);
}
},
fail: (err) => {
uni.hideLoading(); // 关闭加载提示
const errMsg = err.msg || '网络请求失败';
uni.showToast({ title: errMsg, icon: "none", duration: 2000 });
reject(err);
}
});
});
}
export const get = (url, data) => request(url, data, 'GET');
export const post = (url, data) => request(url, data, 'POST');

View File

@@ -89,11 +89,12 @@ const selectProject = (item) => {
padding: 10px;
height: 100vh;
box-sizing: border-box;
background-color: #f9f9f9;
}
.search-bar {
display: flex;
align-items: center;
padding: 8px 10px;
padding: 13px 16px;
background: #f5f5f5;
border-radius: 6px;
margin-bottom: 10px;
@@ -109,8 +110,9 @@ const selectProject = (item) => {
.category-left {
width: 120px;
height: 100%;
background: #f8f8f8;
background: #fff;
border-radius: 6px 0 0 6px;
margin-right: 20rpx;
}
.category-item {
padding: 15px 10px;
@@ -119,8 +121,8 @@ const selectProject = (item) => {
border-bottom: 1px solid #eee;
}
.category-item.active {
background: #fff;
color: #007aff;
background: #f9f9f9;
color: #222;
font-weight: bold;
}
.category-right {

View File

@@ -22,8 +22,8 @@
</view>
<!-- 确定按钮 -->
<button
class="confirm-btn"
<button
class="confirm-btn"
:disabled="!canConfirm"
@click="handleConfirm"
>
@@ -35,7 +35,7 @@
<script setup>
import { ref, computed } from 'vue';
import {onLoad,onShow} from '@dcloudio/uni-app'
import{getResetPassword} from '../api/api.js'
import{getResetPassword} from '../../api/api.js'
// ========== 响应式数据 ==========
@@ -54,8 +54,8 @@ const canConfirm = computed(() => {
// 密码格式规则:6-16位任意字符(可根据需求调整)
const pwdReg = /^(?=.*[a-zA-Z])(?=.*\d).{6,16}$/;
// 校验条件:新密码符合格式 + 确认密码和新密码一致 + 均不为空
return pwdReg.test(newPassword.value)
&& newPassword.value === confirmPassword.value
return pwdReg.test(newPassword.value)
&& newPassword.value === confirmPassword.value
&& newPassword.value && confirmPassword.value;
});
@@ -66,10 +66,10 @@ const goBack = () => {
};
onShow(() => {
// 从缓存读取参数
const params = uni.getStorageSync('tempChangePwdParams') || {};
const params = uni.getStorageSync('tempChangePwdParams') || {};
// 赋值
phone.value = params.phoneNumber
smsCode.value = params.verifyCode
smsCode.value = params.verifyCode
// 用完删除缓存(避免下次跳转读取旧值)
uni.removeStorageSync('tempChangePwdParams');
});
@@ -94,14 +94,14 @@ const handleConfirm = () => {
setTimeout(() =>{
uni.navigateTo({ url: '/pageSubPack/loginSub/pwd-login' });
},1500)
}else{
uni.showToast({ title: "修改失败", icon: 'error' });
}
}
}).catch(err =>{
uni.showToast({
title: '网络异常',
icon: 'error'
title: '网络异常',
icon: 'error'
});
})
@@ -134,7 +134,7 @@ const handleConfirm = () => {
}
.status_bar{
width: 100%;
height: 46px;
height: 36px;
}
/* 顶部导航栏 */
@@ -148,9 +148,10 @@ const handleConfirm = () => {
.nav-title {
flex: 1;
text-align: center;
font-size: 36rpx;
font-size: 32rpx;
font-weight: 500;
color: #333;
color: #000;
margin-right: 100rpx;
}
/* 输入框通用样式 */
@@ -180,9 +181,9 @@ const handleConfirm = () => {
line-height: 88rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
margin-top: 20rpx;
border-radius: 8rpx;
font-size: 28rpx;
margin-top: 66rpx;
}
/* 确定按钮禁用状态 */
@@ -192,6 +193,6 @@ const handleConfirm = () => {
}
/* 禁用按钮边框 */
button:after{
border-radius: 50px;
border-radius: 8px;
}
</style>
</style>

View File

@@ -23,8 +23,8 @@
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" trim="all"
placeholder="请输入验证码" :inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
</uni-easyinput>
<button
class="get-verify-btn"
<button
class="get-verify-btn"
:disabled="!canGetVerify || countDown > 0"
@click="getVerifyCode"
>
@@ -32,19 +32,19 @@
</button>
</view>
<!-- 下一步 -->
<button
class="forget-btn"
<button
class="forget-btn"
:disabled="!canRegister"
@click="handleNext"
>
下一步
</button>
</view>
</template>
<script setup>
import { ref, computed, onUnmounted } from 'vue';
import {getSendCode} from '../api/api.js'
import { ref, computed, onUnmounted } from 'vue';
import {getSendCode} from '../../api/api.js'
// ====响应式数据======
const phoneNumber = ref('')
@@ -73,7 +73,7 @@ const getVerifyCode = () => {
uni.showToast({
title: '验证码已发送',
icon: 'success'
});
});
// 开始60秒倒计时
countDown.value = 60;
timer = setInterval(() => {
@@ -82,25 +82,25 @@ const getVerifyCode = () => {
clearInterval(timer);
timer = null;
}
}, 1000);
}, 1000);
}else{
uni.showToast({
title: '验证码发送失败',
icon: 'error'
});
});
}
})
};
// 是否下一步
const canRegister = computed(() => {
const phoneReg = /^1[3-9]\d{9}$/; // 手机号11位
const verifyReg = /^\d{6}$/; // 验证码6位
return phoneReg.test(phoneNumber.value)
&& verifyReg.test(verifyCode.value)
return phoneReg.test(phoneNumber.value)
&& verifyReg.test(verifyCode.value)
});
// 下一步
const handleNext = () =>{
@@ -121,14 +121,14 @@ const handleNext = () =>{
const goBack = () => {
uni.navigateBack();
};
</script>
<style scoped>
.forget-page{
padding: 20rpx 40rpx 40rpx;
min-height: 100vh;
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
}
}
.status_bar{
width: 100%;
height: 46px;
@@ -144,9 +144,10 @@ const goBack = () => {
.nav-title {
flex: 1;
text-align: center;
font-size: 36rpx;
font-size: 32rpx;
font-weight: 500;
color: #333;
color: #000;
margin-right: 100rpx;
}
/* 输入框通用样式 */
.input-item {
@@ -196,7 +197,7 @@ const goBack = () => {
background-color: #4D5DFA;
color: #fff;
border-radius: 35rpx;
font-size: 28rpx;
font-size: 26rpx;
padding: 0;
margin: 0;
}
@@ -205,6 +206,9 @@ const goBack = () => {
background-color: #ccc;
color: #fff;
}
.get-verify-btn:after{
border-radius: 50px;
}
/* 下一步按钮 */
.forget-btn{
width: 100%;
@@ -212,9 +216,10 @@ const goBack = () => {
line-height: 88rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 40rpx;
margin-top: 66rpx;
}
.forget-btn:disabled{
background-color: #99c8ff;
@@ -222,8 +227,8 @@ const goBack = () => {
}
/* 禁用按钮边框 */
button:after{
border-radius: 50px;
border-radius: 8px;
}
</style>

View File

@@ -64,7 +64,7 @@
import {
getLoginBySms,
getSendCode
} from '../api/api.js'
} from '../../api/api.js'
// ========== 响应式数据 ==========
// 手机号
@@ -243,11 +243,11 @@
/* 登录标题 */
.login-title {
font-size: 48rpx;
font-size: 52rpx;
font-weight: 600;
color: #333;
text-align: center;
margin-bottom: 80rpx;
margin-bottom: 142rpx;
}
/* 输入框项 */
@@ -301,7 +301,7 @@
background-color: #4D5DFA;
color: #fff;
border-radius: 35rpx;
font-size: 28rpx;
font-size: 26rpx;
padding: 0;
margin: 0;
}
@@ -312,18 +312,21 @@
color: #fff;
border-radius: 50px;
}
.get-verify-btn:after{
border-radius: 50px;
}
/* 协议勾选项 */
.agreement-item {
display: flex;
align-items: center;
margin: 40rpx 0;
margin: 70rpx 0 28rpx 0;
padding-left: 10rpx;
}
/* 协议文本 */
.agreement-text {
font-size: 28rpx;
font-size: 24rpx;
color: #666;
margin-left: 10rpx;
}
@@ -337,8 +340,8 @@
line-height: 88rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 60rpx;
}
@@ -351,7 +354,7 @@
/* 禁用按钮边框 */
button:after {
border-radius: 50px;
border-radius: 8px;
}
/* 底部链接 */

View File

@@ -23,7 +23,7 @@
<image src="http://47.104.199.163:9090/images/login/password.png" mode=""
style="height: 100%;width: 100%;"></image>
</view>
<uni-easyinput class="input-content" type="password" v-model="password" placeholder="请输入密码"
<uni-easyinput class="input-content" type="password" v-model="password" placeholder="请输入6-16位密码"
:inputBorder="false" :placeholderStyle="placeholderStyle">
</uni-easyinput>
@@ -66,7 +66,7 @@
} from "@dcloudio/uni-app"
import {
getLoginPassword
} from '../api/api.js'
} from '../../api/api.js'
// 响应式数据
const phoneNumber = ref('');
@@ -183,11 +183,11 @@
}
.login-title {
font-size: 48rpx;
font-size: 52rpx;
font-weight: 600;
color: #333;
text-align: center;
margin-bottom: 80rpx;
margin-bottom: 142rpx;
}
.input-item {
@@ -218,7 +218,7 @@
display: flex;
justify-content: space-between;
align-items: center;
margin: 40rpx 0;
margin: 70rpx 0 28rpx 0;
padding: 0 10rpx;
}
@@ -228,7 +228,7 @@
}
.agreement-text {
font-size: 28rpx;
font-size: 24rpx;
color: #666;
margin-left: 10rpx;
}
@@ -240,8 +240,8 @@
} */
.forget-pwd {
font-size: 28rpx;
color: #4D5DFA;
font-size: 24rpx;
color: #666;
text-decoration: none;
}
@@ -251,8 +251,8 @@
line-height: 88rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 60rpx;
}
@@ -265,7 +265,7 @@
/* 禁用按钮边框 */
button:after {
border-radius: 50px;
border-radius: 8px;
}
.bottom-link {

View File

@@ -29,9 +29,9 @@
<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"
<button
class="get-verify-btn"
:disabled="!canGetVerify || countDown > 0"
@click="getVerifyCode"
>
@@ -48,7 +48,7 @@
<uni-easyinput class="input-content" type="text" v-model="account"
placeholder="请输入账号" :inputBorder="false" :placeholderStyle="placeholderStyle">
</uni-easyinput>
</view>
<!-- 密码输入框 -->
@@ -60,29 +60,25 @@
<uni-easyinput class="input-content" type="password" v-model="password"
placeholder="请输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle" >
</uni-easyinput>
</view>
<!-- 协议勾选 -->
<view class="agreement-item" @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>
<text class="agreement-text">我已阅读并同意《用户隐私政策》</text>
</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"
<button
class="register-btn"
:disabled="!canRegister"
@click="handleRegister"
>
@@ -98,7 +94,7 @@
<script setup>
import { ref, computed, onUnmounted } from 'vue';
import {getRegisterUser,getSendCode} from '../api/api.js'
import {getRegisterUser,getSendCode} from '../../api/api.js'
// ========== 响应式数据 ==========
// 表单数据
@@ -127,10 +123,10 @@ const canRegister = computed(() => {
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)
return phoneReg.test(phoneNumber.value)
&& verifyReg.test(verifyCode.value)
&& accountReg.test(account.value)
&& pwdReg.test(password.value)
&& agreeAgreement.value;
});
@@ -139,6 +135,12 @@ const canRegister = computed(() => {
const goBack = () => {
uni.navigateBack();
};
// 跳转隐私协议
const goToPrivacy = () => {
uni.navigateTo({
url:'/pageSubPack/loginSub/privacy',
})
}
// 切换协议勾选状态
const toggleAgreement = () => {
@@ -161,7 +163,7 @@ const getVerifyCode = () => {
uni.showToast({
title: '验证码已发送',
icon: 'success'
});
});
// 开始60秒倒计时
countDown.value = 60;
timer = setInterval(() => {
@@ -171,21 +173,21 @@ const getVerifyCode = () => {
timer = null;
}
}, 1000);
}else{
uni.showToast({
title: '验证码发送失败',
icon: 'error'
});
});
}
}).catch(err =>{
uni.showToast({
title: '网路异常',
icon: 'error'
});
});
})
};
// 处理注册逻辑
@@ -207,27 +209,27 @@ const handleRegister = () => {
});
setTimeout(() => {
uni.redirectTo({ url: '/pageSubPack/loginSub/pwd-login' });
}, 1500);
}, 1500);
}else{
uni.showToast({
title: '注册失败',
icon: 'error'
});
});
}
}).catch((err) =>{
uni.showToast({
title: '网络异常',
icon: 'error'
title: '网络异常',
icon: 'error'
});
})
// 注册成功后跳转到登录页
// uni.redirectTo({
// url: '/pages/login/pwd-login'
// });
// setTimeout(() => {
// setTimeout(() => {
// }, 1500);
};
@@ -264,14 +266,15 @@ onUnmounted(() => {
.nav-title {
flex: 1;
text-align: center;
font-size: 36rpx;
font-size: 32rpx;
font-weight: 500;
color: #333;
margin-right: 100rpx;
}
/* 注册标题 */
.register-title {
font-size: 48rpx;
font-size: 40rpx;
font-weight: 600;
color: #333;
margin-bottom: 60rpx;
@@ -326,8 +329,8 @@ onUnmounted(() => {
line-height: 70rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 35rpx;
font-size: 28rpx;
border-radius: 198rpx;
font-size: 26rpx;
padding: 0;
margin: 0;
}
@@ -335,13 +338,17 @@ onUnmounted(() => {
.get-verify-btn:disabled {
background-color: #ccc;
color: #fff;
}
.get-verify-btn:after{
border-radius: 50px;
}
/* 协议勾选项 */
.agreement-item {
display: flex;
align-items: center;
margin: 40rpx 0;
margin: 70rpx 0 28rpx 0;
padding-left: 10rpx;
}
@@ -350,6 +357,9 @@ onUnmounted(() => {
color: #666;
margin-left: 10rpx;
}
.agreePrivacy{
color: #4D5DFA;
}
/* 立即注册按钮 */
.register-btn {
@@ -358,12 +368,12 @@ onUnmounted(() => {
line-height: 88rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 40rpx;
}
button:after{
border-radius: 50px;
border-radius: 8px;
}
.register-btn:disabled {
background-color: #99c8ff;
@@ -380,4 +390,4 @@ button:after{
color: #4D5DFA;
text-decoration: none;
}
</style>
</style>

View File

@@ -7,7 +7,7 @@
<uni-nav-bar left-icon="left" title="远程开门" backgroundColor ="none" :border="false" @clickLeft="narBack" />
</view>
<view class="top-img">
<image src="/static/imgs/xuancheng-bg.png" mode="" style="width: 100%;height: 100%;"></image>
<image src="/static/imgs/xuancheng-bg.png" mode="" style="width: 100%;height: 100%;"></image>
</view>
<!-- 提示文案 -->
@@ -25,8 +25,8 @@
<!-- 网格布局:2行2列 -->
<view class="grid-container">
<!-- 每个门选项 -->
<view
v-for="(item, index) in doorList"
<view
v-for="(item, index) in doorList"
:key="index"
:class="['door-item', { active: selectedDoor === index }]"
@click="selectDoor(index)"
@@ -67,7 +67,7 @@ const selectDoor = (index) => {
showSuccess.value = false // 选择新门时隐藏成功提示
}
// 返回
const narBack = () =>{
const narBack = () =>{
uni.switchTab({
url:"/pages/index/index"
})
@@ -159,7 +159,7 @@ const openDoor = () => {
.auth-container {
background: #ffffff;
border-radius: 20rpx;
padding: 30rpx 20rpx;
padding: 40rpx 42rpx;
margin-bottom: 60rpx;
position: relative;
top: -86px;
@@ -168,9 +168,10 @@ const openDoor = () => {
.auth-title {
text-align: center;
font-size: 32rpx;
font-weight: 500;
color: #333333;
padding-bottom: 20rpx;
border-bottom: 1px solid #e5e5e5;
/* border-bottom: 1px solid #e5e5e5; */
margin-bottom: 30rpx;
}
@@ -204,14 +205,14 @@ const openDoor = () => {
/* 门图标 */
.door-icon {
width: 80rpx;
height: 80rpx;
width: 126rpx;
height: 114rpx;
/* background-color: #f5f5f5; */
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 15rpx;
margin-bottom: 44rpx;
}
.icon-text {
/* font-size: 40rpx; */
@@ -221,8 +222,9 @@ const openDoor = () => {
/* 门名称 */
.door-name {
font-size: 26rpx;
color: #333333;
font-size: 32rpx;
color: #222;
font-weight: 500;
}
/* 确认按钮 */
@@ -239,4 +241,4 @@ const openDoor = () => {
.confirm-btn::after {
border: none; /* 去除uni-app默认按钮边框 */
}
</style>
</style>

View File

@@ -265,7 +265,7 @@ const handleConfirm = () => {
line-height: 88rpx;
background-color: #4D5DFA;
color: #fff;
border-radius: 44rpx;
border-radius: 8rpx;
font-size: 28rpx;
margin-top: 20rpx;
border: none;
@@ -280,6 +280,6 @@ const handleConfirm = () => {
/* 禁用按钮边框重置 */
button:after {
border: none;
border-radius: 44rpx;
border-radius: 8rpx;
}
</style>

View File

@@ -44,7 +44,7 @@
</template>
<script setup>
import { ref, computed, onUnmounted } from 'vue';
import {getSendCode} from '../api/api.js'
import {getSendCode} from '../../api/api.js'
// ====响应式数据======
const phoneNumber = ref('')