优化登录,修改bug
This commit is contained in:
@@ -57,6 +57,12 @@ export const deleteMyHouse = (data) => {
|
||||
export const setMyHouseDefault = (data) => {
|
||||
return post(`/api/resident/my/house/default`, data)
|
||||
}
|
||||
|
||||
// 添加房屋与业主关系-下拉数据
|
||||
export const getHouseDataList = (data) => {
|
||||
return get(`/api/resident/my/house/dataList`, data)
|
||||
}
|
||||
|
||||
// 获取当前用户登录信息
|
||||
export const getUserProfile = (data) => {
|
||||
return get(`/api/resident/user/profile`, data)
|
||||
|
||||
@@ -13,15 +13,20 @@ export default function request(url, data = {}, method = "GET") {
|
||||
// mask: true
|
||||
// });
|
||||
|
||||
const token = uni.getStorageSync("token") || "";
|
||||
const header = {
|
||||
"clientid": "resident",
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
if (token) {
|
||||
header["Authorization"] = "Bearer " + token;
|
||||
}
|
||||
|
||||
uni.request({
|
||||
url: baseUrl + url,
|
||||
data: data,
|
||||
method: method,
|
||||
header: {
|
||||
"Authorization": "Bearer " + (uni.getStorageSync("token") || ''),
|
||||
"clientid": "resident",
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
header,
|
||||
success: (res) => {
|
||||
// uni.hideLoading();
|
||||
|
||||
@@ -33,13 +38,12 @@ export default function request(url, data = {}, method = "GET") {
|
||||
|
||||
const resData = res.data || {};
|
||||
|
||||
// token 过期
|
||||
// token 过期:仅在有 token 且过期时跳转登录页(无 token 用户正常浏览首页,由点击拦截处理)
|
||||
if (resData.code === 401) {
|
||||
uni.showToast({ title: '登录过期,请重新登录', icon: 'none' });
|
||||
uni.clearStorageSync('token');
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' });
|
||||
}, 1500);
|
||||
if (token) {
|
||||
uni.clearStorageSync('token');
|
||||
uni.reLaunch({ url: '/pageSubPack/loginSub/login?mode=pwd' });
|
||||
}
|
||||
reject({ msg: '登录过期', code: 401 });
|
||||
return;
|
||||
}
|
||||
@@ -69,14 +73,19 @@ export const putMethod = (url, data) => request(url, data, 'PUT');
|
||||
// 上传
|
||||
export const upload = (filePath, url) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const t = uni.getStorageSync("token") || "";
|
||||
const uploadHeader = {
|
||||
"clientid": "resident"
|
||||
};
|
||||
if (t) {
|
||||
uploadHeader["Authorization"] = "Bearer " + t;
|
||||
}
|
||||
|
||||
uni.uploadFile({
|
||||
url: baseUrl + url,
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
"Authorization": "Bearer " + (uni.getStorageSync("token") || ''),
|
||||
"clientid": "resident"
|
||||
},
|
||||
header: uploadHeader,
|
||||
success: (res) => {
|
||||
try {
|
||||
const data = JSON.parse(res.data);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// 服务器地址(与 request.js 保持一致)
|
||||
const baseUrl = 'https://wuyeapi.ckdzkj.com';
|
||||
// const baseUrl = 'https://wuyeapi.ckdzkj.com';
|
||||
const baseUrl = "http://192.168.1.222:8080"
|
||||
|
||||
/**
|
||||
* 图片上传 Hook
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<view class="reset-pwd-page">
|
||||
<view class="status_bar"></view>
|
||||
<!-- 顶部导航栏 -->
|
||||
<view class="nav-bar">
|
||||
<!-- <view class="nav-bar">
|
||||
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
|
||||
<view class="nav-title">修改密码</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 密码提示 -->
|
||||
<view class="pwd-tips">密码为 6-16 位,需同时包含字母和数字</view>
|
||||
@@ -13,14 +13,14 @@
|
||||
<!-- 新密码输入框 -->
|
||||
<view class="input-item">
|
||||
<uni-easyinput class="input-content" type="password" v-model="newPassword"
|
||||
placeholder="请输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle">
|
||||
placeholder="请输入密码" :inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 确认密码输入框 -->
|
||||
<view class="input-item">
|
||||
<uni-easyinput class="input-content" type="password" v-model="confirmPassword"
|
||||
placeholder="请再次输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle">
|
||||
placeholder="请再次输入密码" :inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
|
||||
@@ -95,7 +95,7 @@ const handleConfirm = () => {
|
||||
//uni.setStorageSync('token', res.token); // 假设后端返回token字段
|
||||
uni.showToast({ title: '修改成功', icon: 'success' });
|
||||
setTimeout(() =>{
|
||||
uni.navigateTo({ url: '/pageSubPack/loginSub/pwd-login' });
|
||||
uni.navigateTo({ url: '/pageSubPack/loginSub/login?mode=pwd' });
|
||||
},1500)
|
||||
|
||||
}else{
|
||||
@@ -116,7 +116,9 @@ const handleConfirm = () => {
|
||||
/* 页面容器 */
|
||||
.reset-pwd-page {
|
||||
padding: 20rpx 40rpx 40rpx;
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
|
||||
}
|
||||
.status_bar{
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<view class="forget-page">
|
||||
<view class="status_bar"></view>
|
||||
<view class="nav-bar">
|
||||
<!-- <view class="nav-bar">
|
||||
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
|
||||
<view class="nav-title">忘记密码</view>
|
||||
</view>
|
||||
</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" trim="all"
|
||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" @input="phoneNumber = phoneNumber.replace(/\D/g, '')" trim="all"
|
||||
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
@@ -20,7 +20,7 @@
|
||||
<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" trim="all"
|
||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" @input="verifyCode = verifyCode.replace(/\D/g, '')" trim="all"
|
||||
placeholder="请输入验证码" :inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
<button
|
||||
@@ -131,7 +131,9 @@ const goBack = () => {
|
||||
<style scoped>
|
||||
.forget-page{
|
||||
padding: 20rpx 40rpx 40rpx;
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
|
||||
}
|
||||
.status_bar{
|
||||
|
||||
@@ -1,72 +1,82 @@
|
||||
<template>
|
||||
<view class="login-page">
|
||||
<view class="status_bar"></view>
|
||||
<view class="status_bar"></view>
|
||||
|
||||
<!-- 登录标题 -->
|
||||
<view class="login-title">手机验证码登录</view>
|
||||
<view class="login-title">{{ loginMode === 'sms' ? '手机验证码登录' : '账号密码登录' }}</view>
|
||||
|
||||
<!-- 手机号输入框 -->
|
||||
<view class="input-item">
|
||||
<view class="input-icon">
|
||||
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
|
||||
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
<!-- ====== 验证码登录模式 ====== -->
|
||||
<template v-if="loginMode === 'sms'">
|
||||
<!-- 手机号输入框 -->
|
||||
<view class="input-item">
|
||||
<view class="input-icon">
|
||||
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber"
|
||||
@input="phoneNumber = phoneNumber.replace(/\D/g, '')"
|
||||
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
</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="https://wuyeadmin.bugtc.com/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
<!-- 验证码输入框 + 获取验证码按钮 -->
|
||||
<view class="input-item verify-item">
|
||||
<view class="input-icon">
|
||||
<image src="https://wuyeadmin.bugtc.com/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode"
|
||||
@input="verifyCode = verifyCode.replace(/\D/g, '')"
|
||||
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>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<!-- 协议勾选 -->
|
||||
<view class="agreement-item" >
|
||||
<view @click="toggleAgreement">
|
||||
<uni-icons
|
||||
type="checkbox-filled"
|
||||
size="24"
|
||||
color="#007aff"
|
||||
v-if="agreeAgreement"
|
||||
></uni-icons>
|
||||
<uni-icons
|
||||
type="checkbox"
|
||||
size="24"
|
||||
color="#999"
|
||||
v-else
|
||||
></uni-icons>
|
||||
</view>
|
||||
<text class="agreement-text" >我已阅读并同意
|
||||
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
|
||||
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
|
||||
</text>
|
||||
|
||||
<!-- ====== 账号密码登录模式 ====== -->
|
||||
<template v-if="loginMode === 'pwd'">
|
||||
<!-- 账号输入框 -->
|
||||
<view class="input-item">
|
||||
<view class="input-icon">
|
||||
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="text" v-model="account"
|
||||
placeholder="请输入帐号" :inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 密码输入框 -->
|
||||
<view class="input-item">
|
||||
<view class="input-icon">
|
||||
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="password" v-model="password"
|
||||
placeholder="请输入密码" :inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 协议勾选 + 忘记密码 -->
|
||||
<view class="agreement-wrap">
|
||||
<view class="agreement-item">
|
||||
<view @click="toggleAgreement" class="checkbox-icon">
|
||||
<uni-icons type="checkbox-filled" size="24" color="#007aff" v-if="agreeAgreement"></uni-icons>
|
||||
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
|
||||
</view>
|
||||
<text class="agreement-text">我已阅读并同意
|
||||
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
|
||||
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
|
||||
</text>
|
||||
</view>
|
||||
<text class="forget-pwd" v-if="loginMode === 'pwd'" @click="goForgetPwd">忘记密码?</text>
|
||||
</view>
|
||||
|
||||
<!-- 登录按钮 -->
|
||||
<button
|
||||
class="login-btn"
|
||||
@click="handleLogin"
|
||||
>
|
||||
登录
|
||||
</button>
|
||||
<button class="login-btn" @click="handleLogin">登录</button>
|
||||
|
||||
<!-- 底部链接 -->
|
||||
<view class="bottom-link">
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/pwd-login">账号密码登录</navigator>
|
||||
<text class="link-item" @click="switchMode">{{ loginMode === 'sms' ? '账号密码登录' : '验证码登录' }}</text>
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator>
|
||||
</view>
|
||||
|
||||
@@ -77,51 +87,50 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onUnmounted } from 'vue';
|
||||
import {getLoginBySms,getSendCode} from '../api/api.js'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getLoginBySms, getLoginPassword, getSendCode } from '../api/api.js'
|
||||
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
|
||||
|
||||
// ========== 模式切换 ==========
|
||||
// 'sms' = 手机验证码登录, 'pwd' = 账号密码登录
|
||||
const loginMode = ref('pwd')
|
||||
|
||||
// ========== 响应式数据 ==========
|
||||
// 手机号
|
||||
const phoneNumber = ref('');
|
||||
// 验证码
|
||||
const verifyCode = ref('');
|
||||
const phoneNumber = ref('') // 短信登录:手机号
|
||||
const verifyCode = ref('') // 短信登录:验证码
|
||||
const account = ref('') // 密码登录:账号
|
||||
const password = ref('') // 密码登录:密码
|
||||
const agreeAgreement = ref(false)
|
||||
const placeholderStyle = ref('font-size:24rpx')
|
||||
// 是否同意协议
|
||||
const agreeAgreement = ref(false); // 默认不勾选
|
||||
// 倒计时(秒)
|
||||
const countDown = ref(0);
|
||||
// 定时器
|
||||
let timer = null;
|
||||
|
||||
// 验证码倒计时
|
||||
const countDown = ref(0)
|
||||
let timer = null
|
||||
|
||||
// 隐私弹窗
|
||||
const showPrivacyPopup = ref(false)
|
||||
const pendingAction = ref('')
|
||||
|
||||
// ========== onLoad: 读取 mode 参数 ==========
|
||||
onLoad((options) => {
|
||||
if (options && options.mode === 'sms') {
|
||||
loginMode.value = 'sms'
|
||||
} else if (options && options.mode === 'pwd') {
|
||||
loginMode.value = 'pwd'
|
||||
}
|
||||
})
|
||||
|
||||
// ========== 计算属性 ==========
|
||||
// 是否可以获取验证码(手机号格式正确)
|
||||
// 短信模式:是否可获取验证码
|
||||
const canGetVerify = computed(() => {
|
||||
// 手机号正则:11位数字,以1开头
|
||||
const phoneReg = /^1[3-9]\d{9}$/;
|
||||
return phoneReg.test(phoneNumber.value);
|
||||
});
|
||||
if (loginMode.value !== 'sms') return false
|
||||
const phoneReg = /^1[3-9]\d{9}$/
|
||||
return phoneReg.test(phoneNumber.value)
|
||||
})
|
||||
|
||||
// 是否可以登录(手机号+验证码+协议都满足)
|
||||
const canLogin = computed(() => {
|
||||
const phoneReg = /^1[3-9]\d{9}$/;
|
||||
const verifyReg = /^\d{6}$/;
|
||||
return phoneReg.test(phoneNumber.value) && verifyReg.test(verifyCode.value) && agreeAgreement.value;
|
||||
});
|
||||
// ========== 共享方法 ==========
|
||||
const toggleAgreement = () => { agreeAgreement.value = !agreeAgreement.value }
|
||||
|
||||
// ========== 方法 ==========
|
||||
// 检查表单状态
|
||||
const checkForm = () => {
|
||||
// 无需额外逻辑,计算属性已实时监听
|
||||
};
|
||||
|
||||
// 切换协议勾选状态
|
||||
const toggleAgreement = () => {
|
||||
agreeAgreement.value = !agreeAgreement.value;
|
||||
};
|
||||
// 打开用户协议
|
||||
const goToUserAgreement = () => {
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/ownler_xieyi.html')
|
||||
@@ -131,7 +140,6 @@ const goToUserAgreement = () => {
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 打开隐私政策
|
||||
const goToPrivacy = () => {
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/owner.html')
|
||||
@@ -140,13 +148,12 @@ const goToPrivacy = () => {
|
||||
window.open('https://wuye.ckdzkj.com/parivw/owner.html')
|
||||
// #endif
|
||||
}
|
||||
// 打开隐私弹窗
|
||||
|
||||
const openPrivacyPopup = (action) => {
|
||||
pendingAction.value = action || ''
|
||||
showPrivacyPopup.value = true
|
||||
}
|
||||
|
||||
// 同意隐私协议
|
||||
const agreePrivacy = () => {
|
||||
showPrivacyPopup.value = false
|
||||
agreeAgreement.value = true
|
||||
@@ -156,155 +163,140 @@ const agreePrivacy = () => {
|
||||
pendingAction.value = ''
|
||||
}
|
||||
|
||||
// 不同意隐私协议
|
||||
const disagreePrivacy = () => {
|
||||
showPrivacyPopup.value = false
|
||||
pendingAction.value = ''
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
// 切换登录模式
|
||||
const switchMode = () => {
|
||||
if (loginMode.value === 'sms') {
|
||||
loginMode.value = 'pwd'
|
||||
} else {
|
||||
loginMode.value = 'sms'
|
||||
}
|
||||
// 重置相关字段
|
||||
agreeAgreement.value = false
|
||||
if (timer) { clearInterval(timer); timer = null }
|
||||
countDown.value = 0
|
||||
}
|
||||
|
||||
// 忘记密码跳转
|
||||
const goForgetPwd = () => {
|
||||
uni.navigateTo({ url: '/pageSubPack/loginSub/forget-pwd' })
|
||||
}
|
||||
|
||||
// ========== 验证码登录:获取验证码 ==========
|
||||
const getVerifyCode = () => {
|
||||
if (!canGetVerify.value) return;
|
||||
let params = {
|
||||
phone:phoneNumber.value,
|
||||
scene:'login'
|
||||
}
|
||||
uni.showLoading({ title: '发送中...', mask: true });
|
||||
getSendCode(params).then(res =>{
|
||||
if(res.code === 200){
|
||||
uni.hideLoading();
|
||||
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: 'none'
|
||||
});
|
||||
}
|
||||
if (!canGetVerify.value) return
|
||||
uni.showLoading({ title: '发送中...', mask: true })
|
||||
getSendCode({ phone: phoneNumber.value, scene: 'login' }).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.code === 200) {
|
||||
uni.showToast({ title: '验证码已发送', icon: 'success' })
|
||||
countDown.value = 60
|
||||
timer = setInterval(() => {
|
||||
countDown.value--
|
||||
if (countDown.value <= 0) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
uni.showToast({ title: '验证码发送失败', icon: 'none' })
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err.msg||'网络异常',
|
||||
icon: 'none'
|
||||
});
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: err.msg || '网络异常', icon: 'none' })
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// 登录处理
|
||||
// ========== 登录处理(分发) ==========
|
||||
const handleLogin = () => {
|
||||
if (!phoneNumber.value) {
|
||||
uni.showToast({ title: '请输入手机号', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!/^1[3-9]\d{9}$/.test(phoneNumber.value)) {
|
||||
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!verifyCode.value) {
|
||||
uni.showToast({ title: '请输入验证码', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!/^\d{6}$/.test(verifyCode.value)) {
|
||||
uni.showToast({ title: '验证码为 6 位数字', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!agreeAgreement.value) {
|
||||
openPrivacyPopup('login')
|
||||
return;
|
||||
if (loginMode.value === 'sms') {
|
||||
handleSmsLogin()
|
||||
} else {
|
||||
handlePwdLogin()
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 验证码登录 ==========
|
||||
const handleSmsLogin = () => {
|
||||
if (!phoneNumber.value) { uni.showToast({ title: '请输入手机号', icon: 'none' }); return }
|
||||
if (!/^1[3-9]\d{9}$/.test(phoneNumber.value)) { uni.showToast({ title: '请输入正确的手机号', icon: 'none' }); return }
|
||||
if (!verifyCode.value) { uni.showToast({ title: '请输入验证码', icon: 'none' }); return }
|
||||
if (!/^\d{6}$/.test(verifyCode.value)) { uni.showToast({ title: '验证码为 6 位数字', icon: 'none' }); return }
|
||||
if (!agreeAgreement.value) { openPrivacyPopup('login'); return }
|
||||
doLogin()
|
||||
};
|
||||
}
|
||||
|
||||
// ========== 密码登录 ==========
|
||||
const handlePwdLogin = () => {
|
||||
if (!account.value) { uni.showToast({ title: '请输入账号', icon: 'none' }); return }
|
||||
if (account.value.length < 4 || account.value.length > 20) { uni.showToast({ title: '账号长度需为 4-20 位', icon: 'none' }); return }
|
||||
if (!password.value) { uni.showToast({ title: '请输入密码', icon: 'none' }); return }
|
||||
if (password.value.length < 6) { uni.showToast({ title: '密码至少输入 6 位', icon: 'none' }); return }
|
||||
if (password.value.length > 16) { uni.showToast({ title: '密码不能超过 16 位', icon: 'none' }); return }
|
||||
if (!agreeAgreement.value) { openPrivacyPopup('login'); return }
|
||||
doLogin()
|
||||
}
|
||||
|
||||
// ========== 执行登录 ==========
|
||||
const doLogin = () => {
|
||||
uni.showLoading({ title: '登录中...', mask: true });
|
||||
const push_cid = uni.getStorageSync('push_cid')
|
||||
let params = {
|
||||
phone:phoneNumber.value,
|
||||
smsCode:verifyCode.value,
|
||||
scene:'login',
|
||||
cid:push_cid
|
||||
uni.showLoading({ title: '登录中...', mask: true })
|
||||
const push_cid = uni.getStorageSync('push_cid')
|
||||
|
||||
if (loginMode.value === 'sms') {
|
||||
// 验证码登录
|
||||
getLoginBySms({ phone: phoneNumber.value, smsCode: verifyCode.value, scene: 'login', cid: push_cid })
|
||||
.then(onLoginSuccess).catch(onLoginError)
|
||||
} else {
|
||||
// 密码登录
|
||||
getLoginPassword({ username: account.value, password: password.value, cid: push_cid })
|
||||
.then(onLoginSuccess).catch(onLoginError)
|
||||
}
|
||||
getLoginBySms(params).then(res =>{
|
||||
if(res.code === 200){
|
||||
uni.hideLoading();
|
||||
if(res.data){
|
||||
uni.setStorageSync('token', res.data.token);
|
||||
// 存用户ID
|
||||
if(res.data.userId) {
|
||||
uni.setStorageSync('userId', res.data.userId);
|
||||
}
|
||||
// 存当前绑定的小区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' });
|
||||
},1500)
|
||||
}else{
|
||||
uni.showToast({ title: '登录失败', icon: 'none' });
|
||||
}
|
||||
const onLoginSuccess = (res) => {
|
||||
if (res.code === 200 && res.data) {
|
||||
uni.setStorageSync('token', res.data.token)
|
||||
if (res.data.userId) { uni.setStorageSync('userId', res.data.userId) }
|
||||
const currentVillageId = res.data.currentVillageId || 0
|
||||
uni.setStorageSync('currentVillageId', currentVillageId)
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '登录成功', icon: 'success' })
|
||||
setTimeout(() => { uni.switchTab({ url: '/pages/index/index' }) }, 1500)
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: res.msg || '登录失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
uni.showToast({ title:'登录失败', icon: 'none' });
|
||||
}
|
||||
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err.msg || '网络异常,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
})
|
||||
|
||||
// 登录成功后上报推送 CID
|
||||
// #ifdef APP-PLUS
|
||||
const cid = uni.getStorageSync('push_cid')
|
||||
if (cid) {
|
||||
reportPushCID(cid)
|
||||
}
|
||||
// #endif
|
||||
|
||||
// setTimeout(() =>{
|
||||
// uni.switchTab({ url: '/pages/index/index' });
|
||||
// },1500)
|
||||
const onLoginError = (err) => {
|
||||
uni.hideLoading()
|
||||
};
|
||||
uni.showToast({ title: err.msg || '网络异常,请重试', icon: 'none' })
|
||||
}
|
||||
|
||||
// ========== 生命周期 ==========
|
||||
// 页面卸载时清除定时器
|
||||
onUnmounted(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
});
|
||||
if (timer) { clearInterval(timer) }
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器 */
|
||||
.login-page {
|
||||
padding: 80rpx 40rpx 40rpx;
|
||||
/* background-color: #f8f9fa; */
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
background: repeating-linear-gradient(to bottom, #E2F0FF, #F6FAFF );
|
||||
}
|
||||
.status_bar {
|
||||
height: 160px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.status_bar {
|
||||
height: 160px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 登录标题 */
|
||||
.login-title {
|
||||
@@ -335,10 +327,9 @@ onUnmounted(() => {
|
||||
|
||||
/* 输入框图标 */
|
||||
.input-icon {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin-right: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 输入框内容 */
|
||||
@@ -349,7 +340,7 @@ onUnmounted(() => {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* 深度覆盖 uni-easyinput 内部默认样式,解决高度偏移 */
|
||||
/* 深度覆盖 uni-easyinput 内部默认样式 */
|
||||
.input-content :deep(.uni-easyinput__content) {
|
||||
height: 100% !important;
|
||||
min-height: unset !important;
|
||||
@@ -386,36 +377,56 @@ onUnmounted(() => {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* 获取验证码按钮禁用状态 */
|
||||
.get-verify-btn:disabled {
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
.get-verify-btn::after{
|
||||
border-radius: 50px;
|
||||
|
||||
.get-verify-btn::after {
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
/* 协议和忘记密码行 */
|
||||
.agreement-wrap {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin: 70rpx 0 28rpx 0;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
/* 协议勾选项 */
|
||||
.agreement-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 70rpx 0 28rpx 0;
|
||||
padding-left: 10rpx;
|
||||
align-items: flex-start;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.checkbox-icon {
|
||||
flex-shrink: 0;
|
||||
margin-top: 2rpx;
|
||||
}
|
||||
|
||||
/* 协议文本 */
|
||||
.agreement-text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-left: 10rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.agreePrivacy{
|
||||
color: #2F77FD;
|
||||
|
||||
.agreePrivacy {
|
||||
color: #2F77FD;
|
||||
}
|
||||
/* .agreePrivacy.active{
|
||||
color: #2F77FD;
|
||||
} */
|
||||
|
||||
.forget-pwd {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
flex-shrink: 0;
|
||||
margin-left: 16rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 登录按钮 */
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
@@ -428,15 +439,13 @@ onUnmounted(() => {
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
/* 登录按钮禁用状态 */
|
||||
.login-btn:disabled {
|
||||
background-color: #99c8ff;
|
||||
color: #fff;
|
||||
/* border-radius: 50px; */
|
||||
}
|
||||
/* 禁用按钮边框 */
|
||||
button:after{
|
||||
border-radius: 8px;
|
||||
|
||||
button:after {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
/* 底部链接 */
|
||||
@@ -446,7 +455,6 @@ button:after{
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
/* 链接项 */
|
||||
.link-item {
|
||||
font-size: 28rpx;
|
||||
color: #007aff;
|
||||
|
||||
@@ -1,356 +0,0 @@
|
||||
<template>
|
||||
<view class="login-page">
|
||||
<view class="status_bar"></view>
|
||||
<!-- 标题 -->
|
||||
<view class="login-title">账号密码登录</view>
|
||||
|
||||
<!-- 手机号输入框 -->
|
||||
<view class="input-item">
|
||||
<view class="input-icon">
|
||||
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
|
||||
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="text" v-model="phoneNumber"
|
||||
placeholder="请输入帐号" :inputBorder="false" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 密码输入框 -->
|
||||
<view class="input-item">
|
||||
<view class="input-icon">
|
||||
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="password" v-model="password"
|
||||
placeholder="请输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 协议勾选 + 忘记密码 -->
|
||||
<view class="agreement-wrap">
|
||||
<view class="agreement-item">
|
||||
<view @click="toggleAgreement" class="checkbox-icon">
|
||||
<uni-icons
|
||||
type="checkbox-filled"
|
||||
size="24"
|
||||
color="#007aff"
|
||||
v-if="agreeAgreement"
|
||||
></uni-icons>
|
||||
<uni-icons
|
||||
type="checkbox"
|
||||
size="24"
|
||||
color="#999"
|
||||
v-else
|
||||
></uni-icons>
|
||||
</view>
|
||||
|
||||
<text class="agreement-text" >我已阅读并同意
|
||||
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
|
||||
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
|
||||
</text>
|
||||
</view>
|
||||
<navigator class="forget-pwd" url="/pageSubPack/loginSub/forget-pwd">忘记密码?</navigator>
|
||||
</view>
|
||||
|
||||
<!-- 登录按钮 -->
|
||||
<button
|
||||
class="login-btn"
|
||||
@click="handleLogin"
|
||||
>
|
||||
登录
|
||||
</button>
|
||||
|
||||
<!-- 底部链接 -->
|
||||
<view class="bottom-link">
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/login">验证码登录</navigator>
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 隐私协议弹窗 -->
|
||||
<privacy-popup v-model:show="showPrivacyPopup" @agree="agreePrivacy" @disagree="disagreePrivacy" @close="showPrivacyPopup = false" />
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import {onLoad} from "@dcloudio/uni-app"
|
||||
import {getLoginPassword} from '../api/api.js'
|
||||
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
|
||||
|
||||
// 响应式数据
|
||||
const phoneNumber = ref('');
|
||||
const password = ref('');
|
||||
const agreeAgreement = ref(false); // 默认勾选
|
||||
const placeholderStyle = ref('font-size:24rpx')
|
||||
|
||||
|
||||
// 计算属性:是否可登录(帐号+密码+协议都满足)
|
||||
const canLogin = computed(() => {
|
||||
const phoneReg = /^[a-zA-Z0-9_-]{4,16}$/; // 4-16位
|
||||
const pwdReg = /^.{6,16}$/; // 密码6-16位
|
||||
return phoneReg.test(phoneNumber.value) && pwdReg.test(password.value) && agreeAgreement.value;
|
||||
});
|
||||
|
||||
// 切换协议勾选
|
||||
const toggleAgreement = () => {
|
||||
agreeAgreement.value = !agreeAgreement.value;
|
||||
};
|
||||
|
||||
const showPrivacyPopup = ref(false)
|
||||
const pendingAction = ref('') // 记录待执行操作,如 'smsLogin'
|
||||
|
||||
// 打开用户协议
|
||||
const goToUserAgreement = () => {
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/ownler_xieyi.html')
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
window.open('https://wuye.ckdzkj.com/parivw/ownler_xieyi.html')
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 打开隐私政策
|
||||
const goToPrivacy = () => {
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/owner.html')
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
window.open('https://wuye.ckdzkj.com/parivw/owner.html')
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 打开隐私弹窗(可传入待执行操作标识)
|
||||
const openPrivacyPopup = (action) => {
|
||||
pendingAction.value = action || ''
|
||||
showPrivacyPopup.value = true
|
||||
}
|
||||
|
||||
// 同意隐私协议
|
||||
const agreePrivacy = () => {
|
||||
showPrivacyPopup.value = false
|
||||
agreeAgreement.value = true
|
||||
// 执行之前拦截的操作
|
||||
if (pendingAction.value === 'smsLogin') {
|
||||
uni.navigateTo({ url: '/pageSubPack/loginSub/login' })
|
||||
} else if (pendingAction.value === 'login') {
|
||||
doLogin()
|
||||
}
|
||||
pendingAction.value = ''
|
||||
}
|
||||
|
||||
// 不同意隐私协议
|
||||
const disagreePrivacy = () => {
|
||||
showPrivacyPopup.value = false
|
||||
pendingAction.value = ''
|
||||
}
|
||||
|
||||
// 检查表单
|
||||
const checkForm = () => {};
|
||||
|
||||
|
||||
onLoad(() =>{
|
||||
});
|
||||
|
||||
// 登录逻辑
|
||||
const handleLogin = () => {
|
||||
|
||||
if (!phoneNumber.value) {
|
||||
uni.showToast({ title: '请输入账号', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (phoneNumber.value.length < 4 || phoneNumber.value.length > 16) {
|
||||
uni.showToast({ title: '账号长度需为 4-16 位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!password.value) {
|
||||
uni.showToast({ title: '请输入密码', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (password.value.length < 6) {
|
||||
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (password.value.length > 16) {
|
||||
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if(!agreeAgreement.value){
|
||||
openPrivacyPopup('login')
|
||||
return;
|
||||
}
|
||||
doLogin()
|
||||
};
|
||||
|
||||
const doLogin = () => {
|
||||
uni.showLoading({ title: '登录中...', mask: true });
|
||||
const push_cid = uni.getStorageSync('push_cid')
|
||||
let params = {
|
||||
username:phoneNumber.value,
|
||||
password:password.value,
|
||||
cid:push_cid
|
||||
}
|
||||
getLoginPassword(params).then(res =>{
|
||||
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.setStorageSync('userId',res.data.userId)
|
||||
}
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
setTimeout(() =>{
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
},2000);
|
||||
})
|
||||
}else{
|
||||
uni.showToast({ title: res.msg, icon: 'none' });
|
||||
}
|
||||
|
||||
}).catch(err => {
|
||||
// console.log('密码登录异常',err)
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err.msg || '网络异常',
|
||||
icon: 'none'
|
||||
});
|
||||
})
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-page {
|
||||
padding: 80rpx 40rpx 40rpx;
|
||||
/* background-color: #f8f9fa; */
|
||||
min-height: 100vh;
|
||||
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
|
||||
}
|
||||
.status_bar {
|
||||
height: 160px;
|
||||
width: 100%;
|
||||
}
|
||||
.login-title {
|
||||
font-size: 52rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-bottom: 142rpx;
|
||||
}
|
||||
|
||||
.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);
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
margin-right: 20rpx;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
|
||||
.input-content {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* 深度覆盖 uni-easyinput 内部默认样式,解决高度偏移 */
|
||||
.input-content :deep(.uni-easyinput__content) {
|
||||
height: 100% !important;
|
||||
min-height: unset !important;
|
||||
padding: 0 !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.input-content :deep(.uni-easyinput__content-input) {
|
||||
height: 100% !important;
|
||||
min-height: unset !important;
|
||||
padding: 0 !important;
|
||||
line-height: 88rpx;
|
||||
}
|
||||
|
||||
.agreement-wrap {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin: 70rpx 0 28rpx 0;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.agreement-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.checkbox-icon {
|
||||
flex-shrink: 0;
|
||||
margin-top: 2rpx;
|
||||
}
|
||||
|
||||
.agreement-text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-left: 10rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.agreePrivacy{
|
||||
color: #2F77FD;
|
||||
}
|
||||
|
||||
.forget-pwd {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
text-decoration: none;
|
||||
flex-shrink: 0;
|
||||
margin-left: 16rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.login-btn:disabled {
|
||||
background-color: #99c8ff;
|
||||
color: #fff;
|
||||
/* border-radius: 50px; */
|
||||
|
||||
}
|
||||
/* 禁用按钮边框 */
|
||||
button:after{
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.bottom-link {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.link-item {
|
||||
font-size: 28rpx;
|
||||
color: #007aff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -2,10 +2,10 @@
|
||||
<view class="register-page">
|
||||
<view class="status_bar"></view>
|
||||
<!-- 顶部导航 -->
|
||||
<view class="nav-bar">
|
||||
<!-- <view class="nav-bar">
|
||||
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
|
||||
<view class="nav-title">注册</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 注册标题 -->
|
||||
<view class="register-title">注册用户</view>
|
||||
@@ -16,9 +16,9 @@
|
||||
<image src="https://wuyeadmin.bugtc.com/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>
|
||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" @input="phoneNumber = phoneNumber.replace(/\D/g, '')" placeholder="请输入手机号"
|
||||
:inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle" />
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 验证码输入 + 获取验证码按钮 -->
|
||||
@@ -28,9 +28,9 @@
|
||||
</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>
|
||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" @input="verifyCode = verifyCode.replace(/\D/g, '')" placeholder="请输入验证码"
|
||||
:inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle" />
|
||||
|
||||
|
||||
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0" @click="getVerifyCode">
|
||||
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
||||
@@ -45,8 +45,8 @@
|
||||
<!-- <uni-icons type="person" size="24" color="#999"></uni-icons> -->
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="text" v-model="account" placeholder="请输入账号(4-20位)" :inputBorder="false"
|
||||
:placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
maxlength="20" :placeholderStyle="placeholderStyle" />
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="password" v-model="password" placeholder="请输入密码(6-16位)"
|
||||
:inputBorder="false" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
:inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle" />
|
||||
|
||||
|
||||
</view>
|
||||
<!-- 协议勾选 -->
|
||||
@@ -302,7 +302,7 @@
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/loginSub/pwd-login'
|
||||
url: '/pageSubPack/loginSub/login?mode=pwd'
|
||||
});
|
||||
}, 1500);
|
||||
|
||||
@@ -335,7 +335,9 @@
|
||||
.register-page {
|
||||
padding: 20rpx 40rpx 40rpx;
|
||||
/* background-color: #f8f9fa; */
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
<view class="form-item">
|
||||
<view class="item-label">车牌号</view>
|
||||
<input class="item-input" v-model="formData.carNum" placeholder="请输入"
|
||||
placeholder-class="input-placeholder" />
|
||||
placeholder-class="input-placeholder" maxlength="8" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="item-label">车辆品牌</text>
|
||||
<input class="item-input" v-model="formData.carBrand" placeholder="请输入"
|
||||
placeholder-class="input-placeholder" />
|
||||
placeholder-class="input-placeholder" maxlength="32"/>
|
||||
</view>
|
||||
<!-- <view class="form-item" @click="selectItem('车辆品牌')">
|
||||
<text class="item-label">车辆品牌</text>
|
||||
@@ -28,13 +28,13 @@
|
||||
<view class="form-item">
|
||||
<view class="item-label">车辆型号</view>
|
||||
<input class="item-input" v-model="formData.carModel" placeholder="请输入"
|
||||
placeholder-class="input-placeholder" />
|
||||
placeholder-class="input-placeholder" maxlength="32"/>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<view class="item-label">车辆颜色</view>
|
||||
<input class="item-input" v-model="formData.carColor" placeholder="请输入"
|
||||
placeholder-class="input-placeholder" />
|
||||
placeholder-class="input-placeholder" maxlength="5"/>
|
||||
</view>
|
||||
|
||||
<view class="form-item upload-item">
|
||||
@@ -140,7 +140,6 @@
|
||||
title: err.msg || '网络异常',
|
||||
icon: 'none'
|
||||
})
|
||||
console.error('列表接口报错:', err)
|
||||
} finally {
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<scroll-view scroll-y class="form-box">
|
||||
<view class="form-item">
|
||||
<text class="label">住户名称</text>
|
||||
<input class="input" v-model="form.name" placeholder="请输入真实姓名" placeholder-class="ph" />
|
||||
<input class="input" v-model="form.name" placeholder="请输入真实姓名" placeholder-class="ph" maxlength="20"/>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
@@ -117,7 +117,7 @@
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">证件号码</text>
|
||||
<input class="input" v-model="form.cardNo" placeholder="请输入证件号码" placeholder-class="ph" />
|
||||
<input class="input" v-model="form.cardNo" placeholder="请输入证件号码" placeholder-class="ph" maxlength="18"/>
|
||||
</view>
|
||||
|
||||
<view class="form-item arrow-item" @click="openRelation">
|
||||
@@ -129,7 +129,7 @@
|
||||
<view class="form-item phone-item">
|
||||
<text class="label">手机号码</text>
|
||||
<input class="input" v-model="form.phone" placeholder="请输入手机号" placeholder-class="ph"
|
||||
type="tel" />
|
||||
type="tel" maxlength="11"/>
|
||||
<!-- <button class="code-btn" :disabled="cd>0" @click="sendCode">
|
||||
{{ cd > 0 ? cd+'s' : '获取验证码' }}
|
||||
</button> -->
|
||||
@@ -141,7 +141,7 @@
|
||||
<view class="form-item">
|
||||
<text class="label">验证码</text>
|
||||
<input class="input" v-model="form.code" placeholder="请输入6位验证码" placeholder-class="ph"
|
||||
type="number" />
|
||||
type="number" maxlength="6"/>
|
||||
</view>
|
||||
|
||||
<!-- 身份证上传 -->
|
||||
@@ -255,6 +255,7 @@
|
||||
getHouseAuthSendSmsCode,
|
||||
getMyHouseDetail,
|
||||
upDateMyHouse,
|
||||
getHouseDataList,
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
import {
|
||||
useImageUpload
|
||||
@@ -315,35 +316,7 @@
|
||||
|
||||
|
||||
|
||||
const relations = ref([{
|
||||
id: 0,
|
||||
name: '本人'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: '配偶'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '父母'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '子女'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '亲属'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '租户'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '其他'
|
||||
}
|
||||
])
|
||||
const relations = ref([])
|
||||
|
||||
const upDataListNum = ref(0)
|
||||
// const idCardFront = ref('')
|
||||
@@ -495,8 +468,8 @@
|
||||
idCardBackUpload.setPreviewUrl(data.data.cardImageBack?.url || data.data.cardImageBack || '')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: `${res.msg}`,
|
||||
icon: 'error'
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -514,6 +487,7 @@
|
||||
clearInterval(timer)
|
||||
})
|
||||
onLoad((option) => {
|
||||
loadRelations()
|
||||
console.log(uni.getStorageSync('updateHouseId'));
|
||||
if (option.id) {
|
||||
if (uni.getStorageSync('operationType') == 'update') {
|
||||
@@ -560,6 +534,21 @@
|
||||
showRelation.value = false
|
||||
upDataListNum.value++
|
||||
}
|
||||
|
||||
// 获取与业主关系下拉数据
|
||||
const loadRelations = async () => {
|
||||
try {
|
||||
const res = await getHouseDataList({dictType:"com_resident_relationship",dictName:'与业主关系'})
|
||||
if (res.code === 200) {
|
||||
relations.value = (res.rows || []).map(item => ({
|
||||
id: item.dictValue,
|
||||
name: item.dictLabel
|
||||
}))
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('加载与业主关系失败:', err)
|
||||
}
|
||||
}
|
||||
const selectClick = (item) => {
|
||||
formData.status = item;
|
||||
uni.setStorageSync('houseStatus', item)
|
||||
|
||||
@@ -76,7 +76,7 @@ const onDeleteAccount = () => {
|
||||
uni.showToast({ title: '注销成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/loginSub/pwd-login'
|
||||
url: '/pageSubPack/loginSub/login?mode=pwd'
|
||||
})
|
||||
}, 1500)
|
||||
} else {
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
title: err.msg || '网络异常',
|
||||
icon: 'none'
|
||||
})
|
||||
console.error('列表接口报错:', err)
|
||||
// console.error('列表接口报错:', err)
|
||||
} finally {
|
||||
|
||||
}
|
||||
|
||||
@@ -298,6 +298,8 @@
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.2s ease;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* 选中状态 */
|
||||
@@ -315,6 +317,9 @@
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 成功提示弹窗 */
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
}else {
|
||||
uni.showToast({
|
||||
title: `${res.msg}`,
|
||||
icon: 'error'
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -86,7 +86,7 @@
|
||||
}else {
|
||||
uni.showToast({
|
||||
title: `${res.msg}`,
|
||||
icon: 'error'
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -105,10 +105,7 @@
|
||||
content: '确认选择此' + checkType.value + '吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '选择中...',
|
||||
mask: true
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '选择成功',
|
||||
@@ -129,7 +126,6 @@
|
||||
}
|
||||
}, 1000)
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
goFreash()
|
||||
}, 2500)
|
||||
}
|
||||
@@ -190,12 +186,7 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.parkingLot-grid {
|
||||
display: grid;
|
||||
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 30rpx;
|
||||
}
|
||||
|
||||
|
||||
.empty-state {
|
||||
display: flex;
|
||||
@@ -212,6 +203,15 @@
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.parkingLot-grid {
|
||||
/* display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 30rpx; */
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 30rpx
|
||||
|
||||
}
|
||||
|
||||
.parkingLot-item {
|
||||
height: 100rpx;
|
||||
@@ -223,6 +223,9 @@
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.2s ease;
|
||||
/* padding: 0 24rpx; */
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.parkingLot-item.active {
|
||||
@@ -238,5 +241,8 @@
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
@@ -310,7 +310,7 @@
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
uni.reLaunch({
|
||||
url: '/pageSubPack/loginSub/pwd-login'
|
||||
url: '/pageSubPack/loginSub/login?mode=pwd'
|
||||
});
|
||||
}, 1500);
|
||||
} else {
|
||||
@@ -320,7 +320,7 @@
|
||||
uni.removeStorageSync('currentVillageId');
|
||||
uni.hideLoading();
|
||||
uni.reLaunch({
|
||||
url: '/pageSubPack/loginSub/pwd-login'
|
||||
url: '/pageSubPack/loginSub/login?mode=pwd'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
uni.removeStorageSync('currentVillageId');
|
||||
uni.hideLoading();
|
||||
uni.reLaunch({
|
||||
url: '/pageSubPack/loginSub/pwd-login'
|
||||
url: '/pageSubPack/loginSub/login?mode=pwd'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
@@ -42,12 +42,6 @@
|
||||
<text class="label">预约时间</text>
|
||||
<text class="value time-value">{{ showTimeText || '请选择预约时间' }}</text>
|
||||
</view>
|
||||
<!-- <view class="form-item">
|
||||
<text class="label">预约时间</text>
|
||||
<view class="value" @click="">
|
||||
<uni-datetime-picker type="datetime" v-model="form.datetime" @change="changeTime" />
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 问题照片 -->
|
||||
<view class="form-item-wenti">
|
||||
@@ -78,7 +72,7 @@
|
||||
<text class="popup-title">预约时间({{ tempTime.format('YYYY-MM-DD HH:mm') }})</text>
|
||||
<text class="confirm-btn" @click="confirmTime">确认</text>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 时间选择列:日期 | 小时 | 分钟 -->
|
||||
<view class="time-selector">
|
||||
<!-- 日期列 -->
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<template>
|
||||
<view class="contentStyle" style="">
|
||||
<view class="status-bar"></view>
|
||||
<uni-nav-bar title="生活缴费" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||
</uni-nav-bar>
|
||||
<view class="contentStyle">
|
||||
<view class="topbox">
|
||||
<image class="titleImg" src="https://wuyeadmin.bugtc.com/images/propertyImgs/payTitle.png"></image>
|
||||
<image class="payImg" src="https://wuyeadmin.bugtc.com/images/propertyImgs/payImg.png"></image>
|
||||
@@ -91,29 +88,14 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
computed
|
||||
|
||||
} from 'vue'
|
||||
import {
|
||||
onShow,
|
||||
onReady,
|
||||
onReachBottom,
|
||||
onLoad,
|
||||
onUnload,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app'
|
||||
import { ref } from 'vue'
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
import {
|
||||
getTopUpSelectByResident,
|
||||
postInsertOpenId,
|
||||
postSubscribeAuth,
|
||||
getTopUpDetails,
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
// 响应式数据
|
||||
const statusBarHeight = ref(20)
|
||||
const detailslist = ref([])
|
||||
const pageNum = ref(1)
|
||||
const pageSize = ref(3)
|
||||
@@ -179,29 +161,6 @@
|
||||
|
||||
|
||||
|
||||
const postOpenId = async () => {
|
||||
// App 端直接从本地存储获取 openid
|
||||
try {
|
||||
const openid = uni.getStorageSync('openid')
|
||||
if (!openid) {
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
await postInsertOpenId({
|
||||
openid: openid,
|
||||
residentUserId: uni.getStorageSync('userId')
|
||||
})
|
||||
} catch (err) {
|
||||
uni.showToast({
|
||||
title: err.msg || '网络异常',
|
||||
icon: 'none'
|
||||
})
|
||||
// console.error('列表接口报错:', err)
|
||||
}
|
||||
}
|
||||
onShow(() => {
|
||||
|
||||
// Zy --------------
|
||||
@@ -211,13 +170,8 @@
|
||||
// 不再自动请求订阅消息,改为用户点击触发
|
||||
})
|
||||
// 生命周期
|
||||
onReady(() => {})
|
||||
|
||||
onLoad(() => {
|
||||
// postOpenId()
|
||||
uni.hideTabBar({
|
||||
animation: false // 关闭动画,更稳定
|
||||
});
|
||||
uni.hideTabBar({ animation: false });
|
||||
getPayList()
|
||||
})
|
||||
|
||||
@@ -278,21 +232,6 @@
|
||||
uni.setStorageSync('addPaymentType', type.name)
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
console.log('返回',uni.getStorageSync('sourcePage'))
|
||||
if (uni.getStorageSync('sourcePage') == 'serviceIndex') {
|
||||
uni.switchTab({
|
||||
url: '/pages/serviceIndex/serviceIndex'
|
||||
})
|
||||
} else if (uni.getStorageSync('sourcePage') == 'index') {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
uni.removeStorageSync('sourcePage')
|
||||
}
|
||||
|
||||
|
||||
// 获取缴费列表
|
||||
const getBillDetails = (isLoadMore = false) => {
|
||||
if (isLoadMore) {
|
||||
@@ -348,8 +287,9 @@
|
||||
.contentStyle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(180deg, #dfedfd, #F6FAFF);
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.page {
|
||||
@@ -557,11 +497,6 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
width: 100vw;
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
.details-scroll {
|
||||
max-height: 500rpx;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
Reference in New Issue
Block a user