修改验证短信

This commit is contained in:
zhouyanli
2026-09-04 18:01:17 +08:00
parent c3004c76a8
commit 1efccef465
6 changed files with 53 additions and 41 deletions

View File

@@ -2,8 +2,8 @@
"name" : "花开物业",
"appid" : "__UNI__29C3D60",
"description" : "智慧社区居民端面向小区业主使用,支持注册、验证码、账号密码多种登录方式,提供密码找回功能,账号使用安全便捷。支持多小区切换,首页设有轮播 banner、社区公告,集成远程开门、生活缴费、在线报修、访客邀请、社区活动常用服务。全服务板块统一涵盖门禁开门、线上缴费、报修申报、访客预约、投诉反馈、问卷调研、活动报名、社区公示、一键联系物业功能。个人中心可管理房屋、住户、车位、车辆信息,支持更换手机号、修改密码、消息通知设置、版本更新及账号退出,一站式满足业主居家生活、社区服务、房产车辆管理需求,实现社区生活数字化、便捷化。",
"versionName" : "1.2.2",
"versionCode" : 136,
"versionName" : "1.2.3",
"versionCode" : 137,
"transformPx" : false,
"uniCloud" : {
"provider" : "aliyun",

View File

@@ -21,6 +21,10 @@ export const getLoginBySms = (data) =>{
export const getResetPassword = (data) =>{
return post('/api/resident/auth/resetPassword',data)
}
// 忘记密码 校验短信验证码
export const verifySmsCode = (data) =>{
return post('/api/resident/auth/verifySmsCode',data)
}
// =========首页=======
// 获取bannar图
export const getBannarList = (data) =>{

View File

@@ -2,8 +2,8 @@ import { navigateToLogin } from '@/common/checkLogin.js'
let baseUrl = '';
if (process.env.NODE_ENV === 'development') {
// baseUrl = 'http://192.168.1.6:8080'; // 开发环境
baseUrl = 'http://192.168.1.222:8080';
baseUrl = 'http://192.168.1.6:8080'; // 开发环境
// baseUrl = 'http://192.168.1.222:8080';
} else {
baseUrl = 'https://wuyeapi.ckdzkj.com'; // 生产环境
}
@@ -34,7 +34,7 @@ export default function request(url, data = {}, method = "GET") {
// HTTP 失败
if (res.statusCode !== 200) {
reject({ msg: `请求异常 ${res.statusCode}`, code: res.statusCode });
reject({ msg: `请求异常 ${ res.statusCode}`, code: res.statusCode });
return;
}

View File

@@ -1,21 +1,15 @@
<template>
<view class="reset-pwd-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="pwd-tips">密码为 6-16 位,需同时包含字母和数字</view>
<!-- 新密码输入框 -->
<view class="input-item">
<uni-easyinput class="input-content" type="password" v-model="newPassword"
placeholder="请输入密码" :inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle">
</uni-easyinput>
</view>
<!-- 密码提示 -->
<view class="pwd-tips">密码为 6-16 位,需同时包含字母和数字</view>
<!-- 确认密码输入框 -->
<view class="input-item">
@@ -148,7 +142,7 @@ const handleConfirm = () => {
border-radius: 40rpx;
padding: 0 30rpx;
height: 88rpx;
margin-bottom: 30rpx;
margin-bottom: 10rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
display: flex;
align-items: center;
@@ -179,10 +173,10 @@ const handleConfirm = () => {
/* 密码提示 */
.pwd-tips {
font-size: 24rpx;
font-size: 16rpx;
color: #999;
margin-bottom: 20rpx;
padding-left: 10rpx;
padding-left: 20rpx;
}
/* 确定按钮 */

View File

@@ -16,30 +16,27 @@
</view>
<input class="input-content verify-input native-input" :type="inputType" v-model="verifyCode"
placeholder="请输入验证码" maxlength="6" placeholder-style="font-size:24rpx"/>
<button
class="get-verify-btn"
:disabled="!canGetVerify || countDown > 0"
@click="getVerifyCode"
>
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0"
@click="getVerifyCode">
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
</button>
</view>
<!-- 下一步 -->
<button
class="forget-btn"
:disabled="!canRegister"
<button
class="forget-btn"
:disabled="!canRegister || submitting"
@click="handleNext"
>
下一步
{{ submitting ? '校验中...' : '下一步' }}
</button>
</view>
</template>
<script setup>
import { ref, computed, onUnmounted } from 'vue';
import {getSendCode} from '../api/api.js'
import {getSendCode,verifySmsCode} from '../api/api.js'
// 输入框类型:统一用 text,避免 number 在真机上把 -/. 过滤掉导致手机号被误判合法;非法手机号由 canGetVerify 禁用获取验证码按钮
// 输入框类型:统一用 text
const inputType = 'text'
// ====响应式数据======
@@ -47,6 +44,7 @@ const phoneNumber = ref('')
const verifyCode = ref('')
const countDown = ref(0)
const submitting = ref(false)
let timer = null;
const placeholderStyle = ref('font-size:24rpx')
@@ -105,18 +103,34 @@ const canRegister = computed(() => {
});
// 下一步
const handleNext = () =>{
// 把参数存到本地缓存
uni.setStorageSync('tempChangePwdParams', {
phoneNumber:phoneNumber.value,
verifyCode: verifyCode.value
});
if(!canRegister.value){
uni.showToast({ title: '请输入',icon: 'error'});
return
}
uni.navigateTo({
url: '/pageSubPack/loginSub/change-pwd'
});
if(!canRegister.value){
uni.showToast({ title: '请输入正确的手机号和验证码', icon: 'none'});
return
}
if(submitting.value) return
submitting.value = true
// 后端验证短信
verifySmsCode({
phone: phoneNumber.value,
smsCode: verifyCode.value,
scene: 'reset'
}).then(res =>{
// 把参数存到本地缓存
uni.setStorageSync('tempChangePwdParams', {
phoneNumber:phoneNumber.value,
verifyCode: verifyCode.value
});
uni.navigateTo({
url: '/pageSubPack/loginSub/change-pwd'
});
}).catch(err =>{
uni.showToast({
title: err.msg || '验证码错误',
icon: 'none'
});
}).finally(() =>{
submitting.value = false
})
}
// 返回上一页
const goBack = () => {

View File

@@ -143,7 +143,7 @@ const fetchDetail = async (id) => {
uni.showToast({ title: res.msg || '获取详情失败', icon: 'none' })
}
} catch (e) {
uni.showToast({ title: '网络异常', icon: 'none' })
uni.showToast({ title: e.msg || '网络异常', icon: 'none' })
}
}