Compare commits

...

16 Commits

Author SHA1 Message Date
zhouyanli
445e44b3d9 Merge branch 'main' of http://gitea.bugtc.com/zhouyanli/property-resident-side 2026-04-18 17:35:15 +08:00
zhouyanli
71f422d254 首页 2026-04-18 17:35:00 +08:00
zhouyanli
6ab4904deb 注册用户 2026-04-18 17:34:49 +08:00
zhouyanli
a40a96b90b 密码登录 2026-04-18 17:34:36 +08:00
zhouyanli
88ecf15f9e 密码登录 2026-04-18 17:34:16 +08:00
zhouyanli
be154fcc1b 引导页 2026-04-18 17:34:01 +08:00
zhouyanli
08794aa023 选择小区 2026-04-18 17:33:50 +08:00
zhouyanli
97f1566132 远程开门 2026-04-18 17:33:38 +08:00
zhouyanli
2512da2324 公告详情 2026-04-18 17:33:26 +08:00
zhouyanli
be358d070b 公告 2026-04-18 17:33:15 +08:00
zhouyanli
d8a23063d9 在线报修 2026-04-18 17:32:42 +08:00
zhouyanli
dc9e722b3f 修改访客列表 2026-04-18 17:32:17 +08:00
zhouyanli
d97fdbe6a6 修改访客邀请 2026-04-18 17:31:46 +08:00
zhouyanli
821aeb227f 组件按需引入 2026-04-18 17:31:03 +08:00
zhouyanli
d18e5a3351 登录分包 2026-04-18 17:30:38 +08:00
zhouyanli
00e9de94f6 导航箭头 2026-04-18 16:15:04 +08:00
15 changed files with 576 additions and 472 deletions

View File

@@ -54,7 +54,8 @@
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
"usingComponents" : true,
"lazyCodeLoading": "requiredComponents"
},
"mp-alipay" : {
"usingComponents" : true

View File

@@ -1,32 +1,14 @@
{
"pages": [
// {
// "path": "pages/navigation/navigation",
// "style": {
// "navigationBarTitleText": "引导页",
// "navigationBarTextStyle": "white",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// },
// {
// "path": "pages/login/pwd-login",
// "style": {
// "navigationBarTitleText": "密码登录",
// "navigationBarTextStyle": "white",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// },
// {
// "path": "pages/login/login",
// "style": {
// "navigationBarTitleText": "验证码登录",
// "navigationBarTextStyle": "white",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// },
{
"path": "pages/navigation/navigation",
"style": {
"navigationBarTitleText": "引导页",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index",
@@ -61,6 +43,20 @@
"navigationStyle": "custom"
}
},
{
"path": "pwd-login",
"style": {
"navigationBarTitleText": "账号密码登录",
"navigationStyle": "custom"
}
},
{
"path": "login",
"style": {
"navigationBarTitleText": "验证码登录",
"navigationStyle": "custom"
}
},
{
"path": "forget-pwd",
"style": {
@@ -82,7 +78,8 @@
"pages": [{
"path": "onlineRepair",
"style": {
"navigationBarTitleText": "在线报修"
"navigationBarTitleText": "在线报修",
"navigationStyle": "custom"
}
},
{
@@ -128,7 +125,8 @@
"pages": [{
"path": "visitor-list",
"style": {
"navigationBarTitleText": "访客邀请"
"navigationBarTitleText": "访客邀请",
"navigationStyle": "custom"
}
},
{

View File

@@ -37,7 +37,7 @@
<up-swiper :list="bannerList" indicator indicatorMode="dot" ></up-swiper>
</view>
<view class="noticeClass">
<image src="/static/首页/公告.png" style="width: 81rpx;height: 81rpx;position: absolute;top: 10px;left: 16px;"></image>
<image src="/static/首页/公告.png" style="width: 38px;height: 38px;position: absolute;top: 21px;left: 27px;"></image>
<uni-notice-bar show-icon :text="noticeText" type="line"
:showIcon="true" show-get-more scrollable color="#000" background-color="#fff" moreColor="#000" @getmore="getNoticeMore"/>
<!-- <up-notice-bar class="notice-bar" :text="noticeText" mode="link" speed="100" bgColor="#FFF" color="#000" url="pages/notice-list/noticeList"></up-notice-bar> -->
@@ -326,13 +326,13 @@ const moreClick = () =>{
position: relative;
top: 110px;
left: 0;
padding: 20rpx;
padding: 40rpx;
}
.noticeClass{
position: relative;
top: 205rpx;
top: 167rpx;
left: 0;
padding: 20rpx;
padding: 40rpx;
}
.noticeClass.uni-noticebar{
padding: 10px 15px 10px 45px;
@@ -343,12 +343,12 @@ const moreClick = () =>{
}
.bg-card-open{
position: relative;
top: 180rpx;
top: 102rpx;
left: 0;
padding: 20rpx;
background-color: #fff;
border-radius: 8rpx;
margin: 9px;
margin: 20px;
}
.openClass{
display: flex;
@@ -371,12 +371,12 @@ const moreClick = () =>{
.adCardClass{
// width: 100%;
height: 200rpx;
margin: 17rpx;
margin: 40rpx;
background-color: #3E8EFF;
// margin-top: 30rpx;
border-radius: 20rpx;
border-radius: 28rpx;
position: relative;
top:99px;
top:50px;
left: 0;
.titleLeft{
text-align: left;
@@ -394,10 +394,13 @@ const moreClick = () =>{
}
.activity-card{
position: relative;
top: 102px;
top: 45px;
left: 0;
bottom: 20;
}
.uni-card{
margin: 18px !important;
}
.eventListClass{
margin: 20rpx;
display: flex;

View File

@@ -77,7 +77,7 @@
<!-- 底部链接 -->
<view class="bottom-link">
<navigator class="link-item" url="/pages/login/pwd-login">账号密码登录</navigator>
<navigator class="link-item" url="/pages/loginSub/pwd-login">账号密码登录</navigator>
<navigator class="link-item" url="/pages/loginSub/register-new-user">注册新用户</navigator>
</view>
</view>
@@ -166,16 +166,16 @@ const handleLogin = () => {
smsCode:'123456',
scene:'login',
}
getLoginBySms(params).then(res =>{
if(res.code === 200){
//uni.setStorageSync('token', res.token); // 假设后端返回token字段
uni.showToast({ title: '登录成功', icon: 'success' });
// getLoginBySms(params).then(res =>{
// if(res.code === 200){
// //uni.setStorageSync('token', res.token); // 假设后端返回token字段
// uni.showToast({ title: '登录成功', icon: 'success' });
}else{
uni.showToast({ title:'登录失败', icon: 'error' });
}
// }else{
// uni.showToast({ title:'登录失败', icon: 'error' });
// }
})
// })
uni.switchTab({ url: '/pages/index/index' });
// 模拟登录请求
// uni.showLoading({
@@ -198,7 +198,7 @@ onUnmounted(() => {
padding: 80rpx 40rpx 40rpx;
/* background-color: #f8f9fa; */
min-height: 100vh;
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
background: repeating-linear-gradient(to bottom, #E2F0FF, #F6FAFF );
}
.status_bar {
height: 160px;

View File

@@ -58,7 +58,7 @@
<!-- 底部链接 -->
<view class="bottom-link">
<navigator class="link-item" url="/pages/login/login">验证码登录</navigator>
<navigator class="link-item" url="/pages/loginSub/login">验证码登录</navigator>
<navigator class="link-item" url="/pages/loginSub/register-new-user">注册新用户</navigator>
</view>
</view>

View File

@@ -91,7 +91,7 @@
<!-- 跳转登录链接 -->
<view class="login-link">
<navigator class="link-item" url="/pages/login/pwd-login">已有账号去登录</navigator>
<navigator class="link-item" url="/pages/loginSub/login">已有账号去登录</navigator>
</view>
</view>
</template>

View File

@@ -14,6 +14,7 @@
<swiper-item>
<view class="guide-item">
<image class="guide-img" src="/static/引导1.png" ></image>
<view style="height: 200rpx;width: 100%;"></view>
<view class="guide-title">便捷服务</view>
<view class="guide-subtitle">报修缴费预约</view>
</view>
@@ -83,7 +84,7 @@ const handleBtnClick = () => {
uni.setStorageSync('hasShowGuide', true);
// 2. 跳转首页
uni.navigateTo({
url:"/pages/login/pwd-login"
url:"/pages/loginSub/pwd-login"
})
// uni.switchTab({
// url: '/pages/index/index'
@@ -97,7 +98,8 @@ const handleBtnClick = () => {
.guide-page {
width: 100%;
height: 100vh;
background-color: #f8f9ff;
/* background-color: #f8f9ff; */
background: linear-gradient(to bottom, #E2F0FF, #F6FAFF);
display: flex;
flex-direction: column;
align-items: center;
@@ -125,7 +127,7 @@ const handleBtnClick = () => {
justify-content: center;
}
/* 引导插画 */
.guide-img {
width: 100%;
height: 100%;

View File

@@ -121,7 +121,7 @@
<style lang="scss">
/* 通知列表容器 */
.notice-list {
padding: 12px 12px 20px;
padding: 20px;
box-sizing: border-box;
background-color: #f9f9f9;
}

View File

@@ -139,6 +139,7 @@
.container {
min-height: 100vh;
background-color: #ffffff;
padding: 20px;
// font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
@@ -155,7 +156,7 @@
// border-bottom: 1px solid #f0f0f0;
.article-title {
font-size: 18px;
font-size: 32rpx;
font-weight: bold;
color: #333333;
line-height: 1.4;

View File

@@ -98,9 +98,9 @@ const openDoor = () => {
<style scoped>
/* 页面全局样式 */
.door-open-page {
background: linear-gradient(180deg, #4a90e2, #F6FAFF);
background: linear-gradient(180deg, #E2F0FF, #F6FAFF);
min-height: 100vh;
padding: 30rpx 26rpx;
padding: 30rpx 40rpx;
box-sizing: border-box;
}
.status_bar {
@@ -191,7 +191,8 @@ const openDoor = () => {
align-items: center;
padding: 30rpx 20rpx;
border-radius: 10rpx;
border: 2px solid #e5e5e5;
border: 2px solid #2F77FD;
background-color: #F6F9FE;
transition: all 0.3s;
}
/* 选中状态 */
@@ -229,8 +230,8 @@ const openDoor = () => {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background-color: #ffffff;
color: #2c6bc7;
background-color: #2F77FD;
color: #fff;
font-size: 32rpx;
border-radius: 20rpx;
border: none;

View File

@@ -292,7 +292,7 @@ onMounted(() => {
background-color: #f5f5f5;
display: flex;
flex-direction: column;
/* padding: 20rpx; */
padding: 40rpx;
}
/* 搜索区域 */
@@ -356,7 +356,7 @@ onMounted(() => {
/* 小区列表 */
.community-list {
flex: 1;
padding: 0 30rpx;
/* padding: 0 30rpx; */
margin-top: 20rpx;
margin-bottom: 180rpx;

View File

@@ -1,9 +1,14 @@
<template>
<view class="repair-page">
<view class="status_bar"></view>
<!-- 顶部导航栏 -->
<!-- <view class="nav-bar">
<text class="nav-title">在线报修</text>
</view> -->
<view class="nav-bar">
<view class="nav-left" @tap="goBack">
<image src="/static/首页/arr-left.png" style="width: 48rpx; height: 48rpx;"></image>
</view>
<view class="nav-title">在线报修</view>
<view class="nav-right"></view>
</view>
<!-- 报修类型Tab -->
<view class="repair-type-tabs">
@@ -27,7 +32,7 @@
</view>
</view>
<view style="margin: 10px 13px;">
<view style="margin: 14px 0px;">
<text class="repair-title">报修记录</text>
</view>
@@ -145,7 +150,10 @@ function personalClick(){
url:"/pages/online-repair/personalRepair"
})
}
// 返回上一页
const goBack = () => {
uni.navigateBack()
}
// 跳转报修详情
const goDetail = (item) => {
// const itemStr = encodeURIComponent(JSON.stringify(item))
@@ -158,15 +166,55 @@ const goDetail = (item) => {
<style scoped>
/* 页面整体样式 */
.repair-page {
background-color: #f5f5f5;
background: linear-gradient(to bottom left, #E2F0FF 0%, #f9f9f9 50%);
min-height: 100vh;
padding: 0 40rpx;
}
.status_bar {
height: 32px;
width: 100%;
}
/* 顶部导航栏 */
.nav-bar {
height: 90rpx;
display: flex;
align-items: center;
/* padding: 0 30rpx; */
color: #fff;
position: sticky;
top: 44px;
z-index: 100;
margin-bottom: 20px;
/* box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.2); */
}
.nav-left {
width: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.nav-title {
flex: 1;
text-align: center;
font-size: 32rpx;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 20rpx;
color: #000;
}
.nav-right {
width: 60rpx;
}
/* 报修类型Tab */
.repair-type-tabs {
display: flex;
background-color: #fff;
padding: 10px;
/* background-color: #fff; */
/* padding: 10px; */
}
.type-tab {
flex: 1;
@@ -199,8 +247,8 @@ const goDetail = (item) => {
.record-status-tabs {
display: flex;
/* background-color: #fff; */
margin-top: 10px;
padding: 0 15px;
/* margin-top: 10px; */
/* padding: 0 15px; */
}
.status-tab {
flex: 1;
@@ -229,7 +277,7 @@ const goDetail = (item) => {
/* 报修列表 */
.repair-list {
padding: 10px;
padding: 28rpx 0rpx;
}
.repair-item {
background-color: #fff;
@@ -326,7 +374,7 @@ const goDetail = (item) => {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
font-size: 28rpx;
}
.item-time {
color: #999;

View File

@@ -1,7 +1,13 @@
<template>
<view class="visitor-add-page">
<!-- Tab 切换车辆来访/人员来访 -->
<view class="tab-bar">
<view class="visitor-invite">
<!-- 顶部导航 -->
<!-- <view class="nav-bar">
<uni-icons type="left" size="20" color="#000" @click="navigateBack"></uni-icons>
<view class="nav-title">访客邀请</view>
</view> -->
<!-- 标签切换车辆来访/人员来访 -->
<view class="tab-wrap">
<view
class="tab-item"
:class="{ active: activeTab === 'car' }"
@@ -12,485 +18,477 @@
<view
class="tab-item"
:class="{ active: activeTab === 'person' }"
@click="switchTab('person')"
@click="switchTab('person')"
>
人员来访
</view>
</view>
<!-- 表单区域 -->
<scroll-view class="form-scroll" scroll-y>
<view class="form-wrap">
<!-- 房屋信息 -->
<view class="form-section">
<uni-forms ref="formRef" :modelValue="formData" :rules="formRules" label-width="105px" label-align="left">
<!-- 来访地址 -->
<uni-forms-item label="来访地址:" name="address" required>
<uni-data-select v-model="formData.address" :localdata="addressList" @change="changeAddress" :clear="false"></uni-data-select>
</uni-forms-item>
<!-- 访客姓名 -->
<uni-forms-item label="访客姓名" name="name" required>
<uni-easyinput type="text" v-model="formData.name" placeholder="请输入姓名" />
</uni-forms-item>
<!-- 访客性别 -->
<uni-forms-item label="访客性别" name="gender" required>
<uni-data-select v-model="formData.gender" :localdata="sexList" @change="changeSex" :clear="false"></uni-data-select>
</uni-forms-item>
<!-- 访客联系方式 -->
<uni-forms-item label="访客联系方式" name="phone" required>
<uni-easyinput
v-model="formData.phone"
placeholder="请输入联系方式"
type="number" />
</uni-forms-item>
<!-- 车牌号仅车辆来访显示 -->
<uni-forms-item
label="车牌号:"
name="carNumber"
required
v-if="activeTab === 'car'"
>
<view class="plate-input-wrap">
<!-- 省份简称选择框 -->
<view
class="plate-item province-item"
@click="showProvinceClick"
>
<text>{{ plateChars[0] || '选' }}</text>
</view>
<!-- 6个字符输入框省份+6=完整车牌 -->
<input
v-for="(char, index) in plateChars.slice(1)"
:key="index"
ref="el => plateInputRefs[index + 1] = el"
class="plate-item char-item"
v-model="plateChars[index + 1]"
maxlength="1"
type="text"
@input="handlePlateInput(index + 1, $event)"
placeholder=""
@keydown="handlePlateKeydown(index + 1, $event)"/>
</view>
</uni-forms-item>
<!-- 随行人数 -->
<uni-forms-item label="随行人数:" name="escortNum">
<uni-easyinput v-model="formData.escortNum" placeholder="请输入随行人数" type="number"/>
</uni-forms-item>
<!-- 来访时间 -->
<uni-forms-item label="来访时间:" name="visitTime" required>
<uni-datetime-picker type="datetime" v-model="formData.visitTime" @change="handleTimeChange" />
</uni-forms-item>
<!-- 离开时间 -->
<uni-forms-item label="离开时间:" name="leaveTime" required>
<uni-datetime-picker type="datetime" v-model="formData.leaveTime" @change="handleTimeChange" />
</uni-forms-item>
</uni-forms>
<view class="section-title">房屋信息</view>
<view class="form-item">
<view class="label">
<text class="required">*</text>来访地址
</view>
<view class="value" @click="openAddressModal">
{{ form.address }}
<uni-icons type="right" size="16" color="#999"></uni-icons>
</view>
</view>
</view>
<!-- 提示文字 -->
<view class="tips-text">
预计来访时间和预计离开时间间隔不能超过24小时
<view>车辆停留请勿超出有效期需及时驶出小区</view>
<!-- 访客信息 -->
<view class="form-section">
<view class="section-title">访客信息</view>
<view class="form-item">
<view class="label">访客姓名</view>
<input
class="input"
placeholder="请输入访客姓名"
v-model="form.name"
/>
</view>
<view class="form-item">
<view class="label">
<text class="required">*</text>访客性别
</view>
<view class="value" @click="openGenderModal">
{{ form.gender }}
<uni-icons type="right" size="16" color="#999"></uni-icons>
</view>
</view>
<view class="form-item">
<view class="label">
<text class="required">*</text>访客联系方式
</view>
<input
class="input"
placeholder="请输入联系方式"
v-model="form.phone"
type="number"
/>
</view>
<!-- 车牌号仅车辆来访显示 -->
<view class="form-item" v-if="activeTab === 'car'">
<view class="label">
<text class="required">*</text>车牌号
</view>
<view class="car-number-wrap">
<input
class="car-input"
v-for="(item, index) in 8"
:key="index"
v-model="form.carNumber[index]"
maxlength="1"
type="text"
/>
</view>
</view>
<view class="form-item">
<view class="label">
<text class="required">*</text>随行人数
</view>
<input
class="input"
placeholder="请输入随行人数"
v-model="form.peopleNum"
type="number"
/>
</view>
</view>
</scroll-view>
<!-- 有效期 -->
<view class="form-section">
<view class="section-title">有效期</view>
<view class="form-item">
<view class="label">
<text class="required">*</text>来访时间
</view>
<view class="value">
<uni-datetime-picker type="datetime" v-model="visitTime" @change="changeLog" :border="false"/>
</view>
</view>
<view class="form-item">
<view class="label">
<text class="required">*</text>离开时间
</view>
<view class="value">
<uni-datetime-picker type="datetime" v-model="leaveTime" @change="changeLog" :border="false"/>
</view>
</view>
<view class="tips">预计来访时间和预计离开时间间隔不能超过24小时</view>
<view class="tips">车辆停留请勿超出有效期需及时驶出小区</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="btn-footer">
<view class="btn-wrap">
<button
class="main-btn"
@click="activeTab === 'car' ? submitInvite() : goToQrcode()"
class="submit-btn"
@click="submitForm"
>
{{ activeTab === 'car' ? '确认邀请' : '生成通行二维码' }}
</button>
</view>
<!-- 省份选择弹窗 -->
<uni-popup v-model="showProvinceSelect" type="center" ref="popup">
<view class="popup-select-wrap">
<text class="popup-title">选择省份简称</text>
<uni-data-select
v-model="plateChars[0]"
:localdata="provinceList"
@confirm="onProvinceConfirm"
@cancel="popup.close()"
placeholder="请选择省份简称"
></uni-data-select>
<!-- 地址选择弹窗 -->
<uni-popup ref="addressModalRef" type="bottom" :mask-click="false">
<view class="modal-wrap">
<view class="modal-title">选择来访地址</view>
<view class="address-list">
<view
class="address-item"
:class="{ active: item === form.address }"
v-for="item in addressList"
:key="item"
@click="selectAddress(item)"
>
{{ item }}
</view>
</view>
<uni-icons
type="closeempty"
size="20"
class="modal-close"
@click="closeAddressModal"
></uni-icons>
</view>
</uni-popup>
<!-- 性别选择弹窗 -->
<uni-popup ref="genderModalRef" type="bottom" :mask-click="false">
<view class="modal-wrap">
<view class="gender-list">
<view
class="gender-item"
:class="{ active: item === form.gender }"
v-for="item in genderList"
:key="item"
@click="selectGender(item)"
>
{{ item }}
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script setup>
import { ref, reactive, watch, nextTick } from 'vue';
import { ref, reactive} from 'vue';
import{onLoad } from "@dcloudio/uni-app"
// 激活的Tabcar-车辆来访person-人员来访
// 标签激活状态
const activeTab = ref('car');
const popup = ref(null)
// 表单数据
const formData = reactive({
address: '', // 来访地址
const form = reactive({
address: '桂花园别墅2号楼2层', // 来访地址默认值
name: '', // 访客姓名
gender: '', // 访客性别
gender: '', // 性别默认值
phone: '', // 联系方式
carNumber: '', // 车牌号(同步输入的完整车牌
escortNum: '', // 随行人数
visitTime: '', // 来访时间
carNumber: ['', '', '', '', '', '', ''], // 车牌号7位
peopleNum: '', // 随行人数
visitTime: '', // 来访时间默认值
leaveTime: '' // 离开时间
});
// 表单Ref用于调用校验方法
const formRef = ref(null);
// 表单校验规则
const formRules = reactive({
address: {
rules: [{ required: true, errorMessage: '请选择来访地址' }]
},
name: {
rules: [{ required: true, errorMessage: '请输入访客姓名' }]
},
gender: {
rules: [{ required: true, errorMessage: '请选择访客性别' }]
},
phone: {
rules: [
{ required: true, errorMessage: '请输入正确的手机号' },
{ pattern: /^1[3-9]\d{9}$/, errorMessage: '请输入正确的手机号' }
]
},
carNumber: {
rules: [
{
required: true,
errorMessage: "请输入车牌号",
},
{
validateFunction: (rule, value, callback) => {
// 仅车辆来访时生效
if (activeTab.value !== 'car') return callback();
// 1. 校验省份是否选择
if (!plateChars.value[0]) {
return callback('请选择省份简称');
}
// 2. 拼接完整车牌号
const fullPlate = plateChars.value.join('').trim();
// 3. 校验车牌号长度(省份+5/6位字符
if (fullPlate.length < 7) {
return callback('请输入完整车牌号(省份+5位字符');
}
if (fullPlate.length > 8) {
return callback('车牌号长度超出限制最多7位');
}
// 4. 同步到formData.carNumber供接口提交
formData.carNumber = fullPlate;
callback();
}
}
]
},
visitTime: {
rules: [{ required: true, errorMessage: '请选择来访时间' }]
},
leaveTime: {
rules: [
{ required: true, errorMessage: '请选择离开时间' },
{
validateFunction: (rule, value, callback) => {
// 1. 空值校验
if (!value) return callback('请选择离开时间');
if (!formData.visitTime) return callback('请先选择来访时间');
// 2. 校验时间格式有效性
const visitTime = new Date(formData.visitTime);
const leaveTime = new Date(value);
if (isNaN(visitTime.getTime()) || isNaN(leaveTime.getTime())) {
return callback('请选择有效的时间');
}
// 3. 校验离开时间不能早于来访时间
if (leaveTime <= visitTime) {
return callback('离开时间不能早于来访时间');
}
// 4. 校验时间间隔≤24小时
const diffHours = (leaveTime.getTime() - visitTime.getTime()) / (1000 * 60 * 60);
if (diffHours > 24) {
return callback('来访和离开时间间隔不能超过24小时');
}
callback();
}
}
]
}
});
// 地址列表
// 地址列表(模拟数据
const addressList = ref([
{ text: '桂花园别墅1号楼1层', value: '桂花园别墅1号楼1层' },
{ text: '桂花园别墅2号楼2层', value: '桂花园别墅2号楼2层' }
'桂花园别墅1号楼1层',
'桂花园别墅2号楼2层'
]);
// 性别列表
const sexList = ref([
{ text: '男', value: '男' },
{ text: '女', value: '女' }
]);
const genderList = ref(['男', '女']);
// 省份简称列表(国标规范)
const provinceList = ref([
{ text: '京', value: '京' },
{ text: '沪', value: '沪' },
{ text: '粤', value: '粤' },
{ text: '苏', value: '' },
{ text: '浙', value: '浙' },
{ text: '鲁', value: '鲁' },
{ text: '川', value: '川' },
{ text: '渝', value: '渝' },
{ text: '湘', value: '湘' },
{ text: '鄂', value: '鄂' }
]);
// 弹窗/选择器实例
const addressModalRef = ref(null);
const genderModalRef = ref(null);
const timePickerRef = ref(null);
// 标记当前选择的是来访/离开时间
const currentTimeType = ref('');
// 车牌号逐位存储索引0省份1-6字符 → 共7位兼容普通/新能源车牌)
const plateChars = ref(['', '', '', '', '', '', '','']);
const showProvinceSelect = ref(false); // 省份选择弹窗
const plateInputRefs = ref([]); // 输入框refs用于自动聚焦
// 打开省份弹框
const showProvinceClick = () => {
popup.value.open()
};
// 选择省份后赋值
const onProvinceConfirm = () => {
showProvinceSelect.value = false;
popup.value.close();
// 省份选择后自动聚焦第一个字符输入框
nextTick(() => {
plateInputRefs.value[1]?.focus();
});
};
// 车牌号字符输入处理(优化过滤和自动聚焦)
const handlePlateInput = (index, e) => {
// 过滤非字母数字,转大写(车牌仅支持字母/数字)
let val = e.detail.value.replace(/[^A-Za-z0-9]/g, '').toUpperCase();
// 仅保留1个字符
val = val.slice(-1);
plateChars.value[index] = val;
// 自动聚焦下一个输入框(如果当前有值且不是最后一位)
if (val && index < 7) { // 最后一位是索引6无需再聚焦
nextTick(() => {
plateInputRefs.value[index + 1]?.focus();
});
}
// 输入完成后触发表单校验
if (activeTab.value === 'car') {
formRef.value.validateField('carNumber');
}
};
// 车牌号删除键处理(优化回退逻辑)
const handlePlateKeydown = (index, e) => {
// 监听回退键keyCode 8
if (e.keyCode === 8) {
// 当前输入框为空,聚焦上一个
if (!plateChars.value[index] && index > 1) {
nextTick(() => {
plateInputRefs.value[index - 1]?.focus();
});
} else {
// 清空当前输入框
plateChars.value[index] = '';
}
}
};
// 时间变更时重新校验离开时间
const handleTimeChange = () => {
if (formData.leaveTime) {
formRef.value.validateField('leaveTime');
}
};
// 切换Tab
// 页面初始化
onLoad(() => {
// 可在这里请求接口获取地址/默认时间等数据
});
// 切换tab
const switchTab = (tab) => {
activeTab.value = tab;
// 切换Tab后重置表单
if (tab === 'person') {
resetForm();
}
// resetForm();
resetForm();
nextTick(() =>{
formRef.value.clearValidate() // 清空所有校验提示
// formRef.value.validate();
})
};
// 空方法占位
const changeAddress = () => {};
const changeSex = (e) => {};
// 返回上一页
const navigateBack = () => {
uni.navigateBack();
};
// 提交前表单校验
const submitForm = async () => {
try {
// 调用uni-forms内置校验
await formRef.value.validate();
return true;
} catch (err) {
return false;
// 打开地址弹窗
const openAddressModal = () => {
addressModalRef.value.open();
};
// 关闭地址弹窗
const closeAddressModal = () => {
addressModalRef.value.close();
};
// 选择地址
const selectAddress = (item) => {
form.address = item;
closeAddressModal();
};
// 打开性别弹窗
const openGenderModal = () => {
genderModalRef.value.open();
};
// 选择性别
const selectGender = (item) => {
form.gender = item;
genderModalRef.value.close();
};
// 打开时间选择器
// const openTimePicker = (type) => {
// currentTimeType.value = type;
// timePickerRef.value.open();
// };
// 校验来访/离开时间间隔
const checkTimeInterval = () => {
if (!form.visitTime || !form.leaveTime) return;
const visitTime = new Date(form.visitTime).getTime();
const leaveTime = new Date(form.leaveTime).getTime();
const diffHours = (leaveTime - visitTime) / (1000 * 60 * 60);
if (diffHours > 24) {
uni.showToast({
title: '时间间隔不能超过24小时',
icon: 'none'
});
form.leaveTime = '';
}
};
// 车辆来访:提交确认邀请
const submitInvite = async () => {
const isValid = await submitForm();
if (!isValid) return;
// 模拟接口提交
uni.showToast({
title: '邀请成功',
icon: 'success',
duration: 2000
});
// 表单提交
const submitForm = () => {
// 必填项校验
if (!form.phone) {
uni.showToast({ title: '请输入访客联系方式', icon: 'none' });
return;
}
if (!/^1[3-9]\d{9}$/.test(form.phone)) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
return;
}
if (activeTab === 'car' && form.carNumber.join('').length < 8) {
uni.showToast({ title: '请填写完整车牌号', icon: 'none' });
return;
}
if (!form.peopleNum || form.peopleNum < 0) {
uni.showToast({ title: '请输入正确的随行人数', icon: 'none' });
return;
}
if (!form.leaveTime) {
uni.showToast({ title: '请选择离开时间', icon: 'none' });
return;
}
checkTimeInterval();
if (!form.leaveTime) return; // 时间校验失败则终止提交
// 提交逻辑(替换为实际接口请求)
uni.showLoading({ title: '提交中...' });
setTimeout(() => {
resetForm();
}, 2000);
};
uni.hideLoading();
uni.showToast({
title: activeTab === 'car' ? '邀请成功' : '二维码生成成功',
icon: 'success'
});
}, 1000);
// 跳转到二维码页面(人员来访)
const goToQrcode = async () => {
const isValid = await submitForm();
if (!isValid) return;
const formStr = encodeURIComponent(JSON.stringify(formData));
uni.navigateTo({
url: `/pages/visitor/qrcode-page?form=${formStr}`
});
};
// 重置表单
const resetForm = () => {
formData.address = '';
formData.name = '';
formData.gender = '';
formData.phone = '';
formData.carNumber = '';
formData.escortNum = '';
formData.visitTime = '';
formData.leaveTime = '';
plateChars.value = ['', '', '', '', '', '', '']; // 重置车牌号输入
};
// 重置表单
const resetForm = () => {
form.address = '';
form.name = '';
form.gender = '';
form.phone = '';
form.carNumber = '';
form.escortNum = '';
form.visitTime = '';
form.leaveTime = '';
form.carNumber = ['', '', '', '', '', '', '']; // 重置车牌号输入
};
</script>
<style scoped>
.visitor-add-page {
background-color: #f8f8f8;
.visitor-invite {
background-color: #f5f5f5;
min-height: 100vh;
}
/* Tab 切换样式 */
.tab-bar {
/* 导航栏 */
.nav-bar {
display: flex;
background: #fff;
align-items: center;
padding: 20rpx;
background-color: #fff;
}
.nav-title {
font-size: 36rpx;
font-weight: 500;
margin-left: 20rpx;
}
/* 标签切换 */
.tab-wrap {
display: flex;
background-color: #fff;
border-bottom: 1rpx solid #eee;
}
.tab-item {
flex: 1;
text-align: center;
padding: 20rpx 0;
font-size: 32rpx;
color: #666;
border-bottom: 4rpx solid transparent;
color: #333;
}
.tab-item.active {
color: #007aff;
border-bottom-color: #007aff;
border-bottom: 4rpx solid #007aff;
}
/* 表单样式 */
.form-scroll {
height: calc(100vh - 220rpx);
/* 表单区域 */
.form-wrap {
padding: 10rpx;
}
.form-section {
background: #fff;
margin-top: 20rpx;
padding: 20rpx;
background-color: #fff;
margin-bottom: 10rpx;
padding: 20rpx 40rpx;
}
/* 车牌号逐位输入样式 */
.plate-input-wrap {
flex: 1;
.section-title {
font-size: 32rpx;
font-weight: 500;
margin-bottom: 20rpx;
}
.form-item {
display: flex;
align-items: center;
gap: 4rpx;
padding: 20rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.plate-item {
width: 52rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
border: 1rpx solid #ddd;
border-radius: 4rpx;
font-size: 28rpx;
.form-item:last-child {
border-bottom: none;
}
.label {
width: 200rpx;
font-size: 30rpx;
color: #333;
}
.province-item {
background-color: #f8f8f8;
.required {
color: red;
margin-right: 4rpx;
}
.char-item {
border: 1px solid #666;
outline: none;
padding: 0;
margin: 0 3rpx;
.value {
flex: 1;
font-size: 30rpx;
color: #666;
display: flex;
justify-content: flex-end;
align-items: center;
}
.char-item:focus {
border-color: #007aff;
box-shadow: 0 0 4rpx rgba(0, 122, 255, 0.5);
.input {
flex: 1;
font-size: 30rpx;
color: #666;
text-align: right;
}
/* 省份选择弹窗样式 */
.popup-select-wrap {
background: #fff;
border-radius: 12rpx;
padding: 30rpx;
width: 600rpx;
margin: 0 auto;
/* 车牌号输入 */
.car-number-wrap {
flex: 1;
display: flex;
justify-content: space-between;
}
.popup-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 20rpx;
display: block;
.car-input {
width: 52rpx;
height: 60rpx;
border: 1rpx solid #eee;
text-align: center;
font-size: 30rpx;
}
/* 提示文字 */
.tips-text {
margin: 20rpx;
.tips {
font-size: 24rpx;
color: #999;
line-height: 1.6;
margin-top: 10rpx;
text-align: center;
}
/* 底部按钮 */
.btn-footer {
.btn-wrap {
padding: 20rpx;
background: #fff;
}
.main-btn {
.submit-btn {
background-color: #007aff;
color: #fff;
border-radius: 8rpx;
height: 88rpx;
font-size: 32rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
}
/* 弹窗样式 */
.modal-wrap {
background-color: #fff;
padding: 30rpx;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
position: relative;
}
.modal-title {
font-size: 32rpx;
text-align: center;
margin-bottom: 30rpx;
}
.modal-close {
position: absolute;
top: 20rpx;
right: 20rpx;
color: #999;
}
.address-list, .gender-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.address-item, .gender-item {
padding: 20rpx;
background-color: #f5f5f5;
border-radius: 8rpx;
text-align: center;
font-size: 30rpx;
}
.address-item.active, .gender-item.active {
background-color: #007aff;
color: #fff;
}
</style>

View File

@@ -1,5 +1,14 @@
<template>
<view class="visitor-page">
<view class="status_bar"></view>
<!-- 顶部导航栏 -->
<view class="nav-bar">
<view class="nav-left" @tap="goBack">
<image src="/static/首页/arr-left.png" style="width: 48rpx; height: 48rpx;"></image>
</view>
<view class="nav-title">访客邀请</view>
<view class="nav-right"></view>
</view>
<!-- 标签切换栏 -->
<view class="tab-bar">
@@ -112,7 +121,10 @@ const visitorList = ref([
const filterdList = computed(() => {
return visitorList.value.filter(item => item.status === activeTab.value)
})
// 返回上一页
const goBack = () => {
uni.navigateBack()
}
// 查看详情
const viewDetail = (item) => {
@@ -134,19 +146,57 @@ const addInvitation = () => {
<style scoped>
/* 页面整体样式 */
.visitor-page {
background-color: #f5f5f5;
background: linear-gradient(to bottom left, #E2F0FF 0%, #f9f9f9 50%);
min-height: 100vh;
padding: 0 40rpx;
}
.status_bar {
height: 32px;
width: 100%;
}
/* 顶部导航栏 */
.nav-bar {
height: 90rpx;
display: flex;
align-items: center;
/* padding: 0 30rpx; */
color: #fff;
position: sticky;
top: 44px;
z-index: 100;
margin-bottom: 20px;
}
.nav-left {
width: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.nav-title {
flex: 1;
text-align: center;
font-size: 32rpx;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 20rpx;
color: #000;
}
.nav-right {
width: 60rpx;
}
/* 标签切换栏 */
.tab-bar {
display: flex;
background-color: #fff;
border-bottom: 2px solid #f5f5f5;
}
.tab-item {
flex: 1;
text-align: center;
text-align: left;
padding: 12px 0;
font-size: 16px;
color: #666;
@@ -161,11 +211,13 @@ const addInvitation = () => {
content: '';
position: absolute;
bottom: -2px;
left: 50%;
left: 18%;
transform: translateX(-50%);
width: 40px;
height: 2px;
background-color: #007aff;
width: 64px;
height: 4px;
border-radius: 6rpx;
background-color: #2F77FD;
/* background-color: linear-gradient(to bottom, #2F77FD, #CEDFFF); */
}
/* 列表容器 */
@@ -176,7 +228,7 @@ const addInvitation = () => {
/* 访客列表项 */
.visitor-item {
background-color: #fff;
margin: 10px 15px;
margin: 10px 0px;
padding: 15px;
border-radius: 8px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B