恢复接口
This commit is contained in:
@@ -2,11 +2,9 @@
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
// console.log('App Launch')
|
||||
uni.removeStorageSync('token');
|
||||
},
|
||||
onShow: function() {
|
||||
// console.log('App Show')
|
||||
uni.removeStorageSync('token');
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide')
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
import { ref, watch } from 'vue'
|
||||
import { onLoad, onUnload, onShow } from '@dcloudio/uni-app'
|
||||
import moment from 'moment';
|
||||
// import { getActivityList } from '../api/api.js'
|
||||
import { getActivityList } from '../api/api.js'
|
||||
|
||||
// ===================== 响应式数据 =====================
|
||||
const activeTab = ref('list') // 'list' 或 'my'
|
||||
@@ -298,12 +298,6 @@ onLoad(() => {
|
||||
uni.$on('refreshActivityList', (data) => {
|
||||
console.log('收到活动列表刷新通知:', data)
|
||||
getActivityListData(1)
|
||||
|
||||
// 方式2:局部更新(性能更好,可选启用)
|
||||
// const index = displayedActivities.value.findIndex(item => item.id === data.activityId)
|
||||
// if (index > -1) {
|
||||
// displayedActivities.value[index].applied = data.isSigned
|
||||
// }
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import {onLoad,onUnload} from '@dcloudio/uni-app'
|
||||
import moment from 'moment'
|
||||
// import {getActivityDetails,confirmResident,cancelActivity,getActivityLive} from '../api/api.js'
|
||||
import {getActivityDetails,confirmResident,cancelActivity,getActivityLive} from '../api/api.js'
|
||||
|
||||
// 响应式数据
|
||||
const activeTab = ref('detail') // 'detail' 或 'status'
|
||||
@@ -249,7 +249,6 @@ const liveRecords = ref([
|
||||
// 时间格式化函数
|
||||
const formatTime = (timeStr) => {
|
||||
if (!timeStr) return ''
|
||||
// 格式化:YYYY-MM-DD HH:mm:ss → 简化为 YYYY-MM-DD HH:mm
|
||||
return moment(timeStr).format('YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
@@ -409,10 +408,10 @@ const getLiveActivityList = async () =>{
|
||||
liveRecords.value = res.rows || []
|
||||
}else{
|
||||
liveRecords.value = []
|
||||
// uni.showToast({
|
||||
// title: res.msg ||"实况列表获取失败",
|
||||
// icon:"error"
|
||||
// })
|
||||
uni.showToast({
|
||||
title: res.msg ||"实况列表获取失败",
|
||||
icon:"error"
|
||||
})
|
||||
}
|
||||
}catch(err){
|
||||
uni.showToast({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
let baseUrl = '';
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
baseUrl = 'http://192.168.0.224:8080'; // 开发环境
|
||||
baseUrl = 'http://192.168.1.215:8080'; // 开发环境
|
||||
} else {
|
||||
baseUrl = 'http://192.168.1.224:8080'; // 生产环境
|
||||
}
|
||||
@@ -16,7 +16,7 @@ export default function request(url, data = {}, method = "GET") {
|
||||
data: data,
|
||||
method: method,
|
||||
header: {
|
||||
// "Authorization": "Bearer " + (uni.getStorageSync("token") || ''),
|
||||
"Authorization": "Bearer " + (uni.getStorageSync("token") || ''),
|
||||
"clientid": "resident",
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
v-else
|
||||
></uni-icons>
|
||||
</view>
|
||||
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text class="agreePrivacy" :class="{active:isClicked}">《用户隐私政策》</text></text>
|
||||
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text class="agreePrivacy">《用户隐私政策》</text></text>
|
||||
</view>
|
||||
|
||||
<!-- 登录按钮 -->
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onUnmounted } from 'vue';
|
||||
// import {getLoginBySms,getSendCode} from '../api/api.js'
|
||||
import {getLoginBySms,getSendCode} from '../api/api.js'
|
||||
|
||||
// ========== 响应式数据 ==========
|
||||
// 手机号
|
||||
@@ -101,7 +101,7 @@ const countDown = ref(0);
|
||||
// 定时器
|
||||
let timer = null;
|
||||
// 控制点击变色
|
||||
const isClicked = ref(false)
|
||||
// const isClicked = ref(false)
|
||||
|
||||
// ========== 计算属性 ==========
|
||||
// 是否可以获取验证码(手机号格式正确)
|
||||
@@ -131,7 +131,7 @@ const toggleAgreement = () => {
|
||||
// 跳转隐私协议
|
||||
const goToPrivacy = () => {
|
||||
// 点击变色
|
||||
isClicked.value = true
|
||||
// isClicked.value = true
|
||||
uni.navigateTo({
|
||||
url:'/pageSubPack/loginSub/privacy',
|
||||
})
|
||||
@@ -179,55 +179,55 @@ const getVerifyCode = () => {
|
||||
// 登录处理
|
||||
const handleLogin = () => {
|
||||
if (!canLogin.value) return;
|
||||
// uni.showLoading({ title: '登录中...', mask: true });
|
||||
uni.showLoading({ title: '登录中...', mask: true });
|
||||
let params = {
|
||||
phone:phoneNumber.value,
|
||||
smsCode:'123456',
|
||||
scene:'login',
|
||||
}
|
||||
// getLoginBySms(params).then(res =>{
|
||||
// if(res.code === 200){
|
||||
// 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: 'error' });
|
||||
// }
|
||||
getLoginBySms(params).then(res =>{
|
||||
if(res.code === 200){
|
||||
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: 'error' });
|
||||
}
|
||||
|
||||
// }else{
|
||||
// uni.showToast({ title:'登录失败', icon: 'error' });
|
||||
// }
|
||||
}else{
|
||||
uni.showToast({ title:'登录失败', icon: 'error' });
|
||||
}
|
||||
|
||||
// }).catch(err => {
|
||||
// uni.showToast({
|
||||
// title: '网络异常,请重试',
|
||||
// icon: 'error'
|
||||
// });
|
||||
// })
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: '网络异常,请重试',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
// 模拟登录请求
|
||||
uni.showLoading({
|
||||
title: '登录中...'
|
||||
});
|
||||
uni.showToast({
|
||||
title:"登录成功",
|
||||
icon:'success'
|
||||
})
|
||||
setTimeout(() =>{
|
||||
uni.switchTab({ url: '/pages/index/index' });
|
||||
},1500)
|
||||
// uni.showLoading({
|
||||
// title: '登录中...'
|
||||
// });
|
||||
// uni.showToast({
|
||||
// title:"登录成功",
|
||||
// icon:'success'
|
||||
// })
|
||||
// setTimeout(() =>{
|
||||
// uni.switchTab({ url: '/pages/index/index' });
|
||||
// },1500)
|
||||
uni.hideLoading()
|
||||
};
|
||||
|
||||
@@ -340,11 +340,11 @@ onUnmounted(() => {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.agreePrivacy{
|
||||
color: #666;
|
||||
}
|
||||
.agreePrivacy.active{
|
||||
color: #2F77FD;
|
||||
}
|
||||
/* .agreePrivacy.active{
|
||||
color: #2F77FD;
|
||||
} */
|
||||
/* 登录按钮 */
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
<template>
|
||||
<view class="privacy-page">
|
||||
<!-- 导航栏 -->
|
||||
<!-- <view class="nav-bar">
|
||||
<view class="nav-back" @click="goToBack">
|
||||
<uni-icons type="left" size="20" color="#333"></uni-icons>
|
||||
<text class="back-text">返回</text>
|
||||
</view>
|
||||
<view class="nav-title">隐私协议</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 协议内容 -->
|
||||
<scroll-view class="privacy-content" scroll-y>
|
||||
@@ -32,15 +24,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 底部同意按钮(新增) -->
|
||||
@@ -54,25 +37,25 @@
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
// 返回上一页
|
||||
const navigateBack = () => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
};
|
||||
// const navigateBack = () => {
|
||||
// uni.navigateBack({
|
||||
// delta: 1
|
||||
// });
|
||||
// };
|
||||
// 页面加载
|
||||
onLoad((options) => {
|
||||
// 判断是否需要同意
|
||||
if (options.needAgree === '1') {
|
||||
needAgree.value = true;
|
||||
}
|
||||
});
|
||||
// onLoad((options) => {
|
||||
// // 判断是否需要同意
|
||||
// if (options.needAgree === '1') {
|
||||
// needAgree.value = true;
|
||||
// }
|
||||
// });
|
||||
|
||||
// 返回上一页
|
||||
const goToBack = () => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
};
|
||||
// const goToBack = () => {
|
||||
// uni.navigateBack({
|
||||
// delta: 1
|
||||
// });
|
||||
// };
|
||||
|
||||
// 同意隐私政策(新增)
|
||||
// const agreePrivacy = () => {
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</view>
|
||||
|
||||
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意
|
||||
<text class="agreePrivacy" :class="{ active:isClicked }">《用户隐私政策》</text>
|
||||
<text class="agreePrivacy" >《用户隐私政策》</text>
|
||||
</text>
|
||||
</view>
|
||||
<navigator class="forget-pwd" url="/pageSubPack/loginSub/forget-pwd">忘记密码?</navigator>
|
||||
@@ -72,7 +72,7 @@
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import {onLoad} from "@dcloudio/uni-app"
|
||||
// import {getLoginPassword} from '../api/api.js'
|
||||
import {getLoginPassword} from '../api/api.js'
|
||||
|
||||
// 响应式数据
|
||||
const phoneNumber = ref('');
|
||||
@@ -80,7 +80,7 @@ const password = ref('');
|
||||
const agreeAgreement = ref(false); // 默认勾选
|
||||
const placeholderStyle = ref('font-size:24rpx')
|
||||
// 控制点击变色
|
||||
const isClicked = ref(false)
|
||||
// const isClicked = ref(false)
|
||||
|
||||
// 计算属性:是否可登录(帐号+密码+协议都满足)
|
||||
const canLogin = computed(() => {
|
||||
@@ -97,7 +97,7 @@ const toggleAgreement = () => {
|
||||
// 跳转隐私协议
|
||||
const goToPrivacy = () => {
|
||||
// 点击变色
|
||||
isClicked.value = true
|
||||
// isClicked.value = true
|
||||
uni.navigateTo({
|
||||
url:'/pageSubPack/loginSub/privacy',
|
||||
})
|
||||
@@ -134,43 +134,43 @@ const handleLogin = () => {
|
||||
username:phoneNumber.value,
|
||||
password:password.value
|
||||
}
|
||||
// getLoginPassword(params).then(res =>{
|
||||
// // console.log('33333',res)
|
||||
// if(res.code === 200){
|
||||
// uni.setStorageSync('token', res.data.token);
|
||||
// // 存用户ID
|
||||
// if(res.data) {
|
||||
// // 存当前绑定的小区ID,0 表示未绑定
|
||||
// const currentVillageId = res.data.currentVillageId || 0;
|
||||
// uni.setStorageSync('currentVillageId', currentVillageId);
|
||||
// }
|
||||
// uni.hideLoading();
|
||||
// uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
// setTimeout(() =>{
|
||||
// uni.switchTab({
|
||||
// url: '/pages/index/index'
|
||||
// },1000);
|
||||
// })
|
||||
// }else{
|
||||
// uni.showToast({ title: res.msg, icon: 'error' });
|
||||
// }
|
||||
getLoginPassword(params).then(res =>{
|
||||
// console.log('33333',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.hideLoading();
|
||||
uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
setTimeout(() =>{
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
},1000);
|
||||
})
|
||||
}else{
|
||||
uni.showToast({ title: res.msg, icon: 'error' });
|
||||
}
|
||||
|
||||
// }).catch(err => {
|
||||
// uni.showToast({
|
||||
// title: '网络异常',
|
||||
// icon: 'error'
|
||||
// });
|
||||
// })
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: '网络异常',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
// 测试
|
||||
uni.showLoading({
|
||||
title: '登录中...',
|
||||
mask:true
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.switchTab({ url: '/pages/index/index' });
|
||||
}, 1500);
|
||||
uni.hideLoading()
|
||||
// uni.showLoading({
|
||||
// title: '登录中...',
|
||||
// mask:true
|
||||
// });
|
||||
// setTimeout(() => {
|
||||
// uni.switchTab({ url: '/pages/index/index' });
|
||||
// }, 1500);
|
||||
// uni.hideLoading()
|
||||
|
||||
};
|
||||
</script>
|
||||
@@ -237,11 +237,11 @@ const handleLogin = () => {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.agreePrivacy{
|
||||
color: #666;
|
||||
}
|
||||
.agreePrivacy.active{
|
||||
color: #2F77FD;
|
||||
}
|
||||
/* .agreePrivacy.active{
|
||||
color: #2F77FD;
|
||||
} */
|
||||
|
||||
.forget-pwd {
|
||||
font-size: 28rpx;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad ,onShow,onUnload} from '@dcloudio/uni-app'
|
||||
// import { getNoticeList } from '../api/api.js'
|
||||
import { getNoticeList } from '../api/api.js'
|
||||
|
||||
const noticeList = ref([])
|
||||
const refreshing = ref(false)
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
// import {getNoticeDetails} from '../api/api.js'
|
||||
import {getNoticeDetails} from '../api/api.js'
|
||||
|
||||
const isLoading = ref(false)
|
||||
const noticeDetail = ref({})
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import {onLoad} from '@dcloudio/uni-app'
|
||||
// import {getAccessDevices,getAccessOpen} from '../api/api.js'
|
||||
import {getAccessDevices,getAccessOpen} from '../api/api.js'
|
||||
|
||||
// 响应式数据:选中的门索引、开门成功提示
|
||||
const selectedDoor = ref(-1) // -1表示未选中
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
// import { getVillageList, getVillageSwitch } from "../api/api.js"
|
||||
import { getVillageList, getVillageSwitch } from "../api/api.js"
|
||||
|
||||
// 响应式数据
|
||||
const searchText = ref('')
|
||||
|
||||
@@ -178,9 +178,9 @@ const goBack = () => {
|
||||
}
|
||||
// 跳转报修详情
|
||||
const goDetail = (item) => {
|
||||
// const itemStr = encodeURIComponent(JSON.stringify(item))
|
||||
const itemStr = encodeURIComponent(JSON.stringify(item))
|
||||
uni.navigateTo({
|
||||
url: `/pageSubPack/online-repair/repairDetail?item = ${encodeURIComponent(JSON.stringify(item))}`
|
||||
url: `/pageSubPack/online-repair/repairDetail?item = ${itemStr}`
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
<!-- 维修流程模块 -->
|
||||
<view class="info-section">
|
||||
<!-- <uni-section title="维修流程" type="line" style="margin-bottom: 20rpx;"> -->
|
||||
<view class="section-title">维修流程</view>
|
||||
<uni-row class="demo-uni-row" :width="nvueWidth">
|
||||
<uni-col :span="12">
|
||||
@@ -19,13 +18,10 @@
|
||||
<view class="step-time-3">2026-03-28 09:30:38</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
<!-- </uni-section> -->
|
||||
</view>
|
||||
|
||||
<!-- 报修信息模块 -->
|
||||
<view class="info-section">
|
||||
<!-- <uni-section title="报修信息" type="line" style="margin-bottom: 20rpx;"> -->
|
||||
<view class="section-title">报修信息</view>
|
||||
<view class="info-item">
|
||||
<view class="info-label">报修房屋</view>
|
||||
@@ -59,7 +55,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- </uni-section> -->
|
||||
</view>
|
||||
|
||||
<!-- 联系物业按钮 -->
|
||||
@@ -70,15 +65,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
// 步骤条当前激活的步骤(0=待处理,1=已派单,2=已完成)
|
||||
const currentStep = ref(2)
|
||||
const nvueWidth = ref('300')
|
||||
|
||||
// 报修信息数据
|
||||
@@ -91,21 +80,25 @@
|
||||
time: '2023-08-01 15:30'
|
||||
})
|
||||
|
||||
// 步骤状态
|
||||
const currentStep = ref(1)
|
||||
|
||||
onLoad((option) => {
|
||||
const decodeStr = decodeURIComponent(JSON.stringify(option))
|
||||
// let item = JSON.parse(decodeStr)
|
||||
// repairInfo.value = optionStr
|
||||
console.log('item', decodeStr)
|
||||
const status = decodeStr.statusClass
|
||||
// console.log('status',status)
|
||||
const optionstr = decodeURIComponent(JSON.stringify(option))
|
||||
// console.log('接收参数:', optionstr)
|
||||
|
||||
// ✅ 正确解析参数
|
||||
const status = optionstr.statusClass
|
||||
|
||||
// ✅ 正确赋值
|
||||
switch (status) {
|
||||
case 'pending': //待处理
|
||||
currentStep.value = 0
|
||||
break
|
||||
case 'assignde':
|
||||
case 'assignde': //已派单
|
||||
currentStep.value = 1
|
||||
break
|
||||
case 'completed':
|
||||
case 'completed': //已完成
|
||||
currentStep.value = 2
|
||||
break
|
||||
default:
|
||||
@@ -135,7 +128,6 @@
|
||||
border-radius: 8px;
|
||||
padding: 13px;
|
||||
margin-bottom: 16px;
|
||||
/* margin-top: 20rpx; */
|
||||
}
|
||||
|
||||
.repair-steps-container {
|
||||
@@ -153,21 +145,16 @@
|
||||
.step-time {
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
/* font-size: 22rpx;
|
||||
color: #999;
|
||||
text-align: right;
|
||||
margin-top: 5rpx; */
|
||||
}
|
||||
.step-time-3{
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* -------- */
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
@@ -184,32 +171,18 @@
|
||||
|
||||
.slot-desc {
|
||||
font-size: 10px;
|
||||
|
||||
}
|
||||
|
||||
/* .step-time {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
} */
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
padding: 12px 0;
|
||||
/* border-bottom: 1px solid #f0f0f0; */
|
||||
}
|
||||
.info-item-desc {
|
||||
/* display: flex; */
|
||||
padding: 12px 0;
|
||||
/* border-bottom: 1px solid #f0f0f0; */
|
||||
}
|
||||
|
||||
.info-section.active {
|
||||
color: #007AFF;
|
||||
/* font-weight: 500; */
|
||||
}
|
||||
|
||||
.info-item:last-child {
|
||||
@@ -270,4 +243,14 @@
|
||||
.contact-btn::after {
|
||||
border: none;
|
||||
}
|
||||
/* ========== 颜色的代码 ========== */
|
||||
/* u-text__value u-text__value--main */
|
||||
/* 激活的步骤标题 + 描述 强制蓝色 */
|
||||
::v-deep .u-text__value .u-text__value--main {
|
||||
color: #007aff !important;
|
||||
}
|
||||
::v-deep .up-steps-item--active .up-steps-item__desc {
|
||||
color: #007aff !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -106,7 +106,7 @@
|
||||
<text class="required">*</text>来访时间
|
||||
</view>
|
||||
<view class="value">
|
||||
<uni-datetime-picker type="datetime" v-model="form.visitTime" @change="handleTimeChange('visit')" :border="false"/>
|
||||
<uni-datetime-picker type="datetime" v-model="form.visitTime" @change="handleTimeChange" :border="false"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
@@ -114,7 +114,7 @@
|
||||
<text class="required">*</text>离开时间
|
||||
</view>
|
||||
<view class="value">
|
||||
<uni-datetime-picker type="datetime" v-model="form.leaveTime" @change="handleTimeChange('leave')" :border="false"/>
|
||||
<uni-datetime-picker type="datetime" v-model="form.leaveTime" @change="handleTimeChange" :border="false"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips">预计来访时间和预计离开时间间隔不能超过24小时</view>
|
||||
@@ -183,19 +183,19 @@ import moment from 'moment';
|
||||
// 标签激活状态
|
||||
const activeTab = ref('car');
|
||||
|
||||
// 表单数据(完全保留原有默认值)
|
||||
// 表单数据
|
||||
const form = reactive({
|
||||
address: '',
|
||||
name: '',
|
||||
gender: '',
|
||||
phone: '',
|
||||
carNumber: ['', '', '', '', '', '', ''],
|
||||
carNumber: ['', '', '', '', '', '', '', ''], // 修复:8位车牌
|
||||
peopleNum: '',
|
||||
visitTime: '',
|
||||
leaveTime: ''
|
||||
});
|
||||
|
||||
// 地址列表(原数据不变)
|
||||
// 地址列表
|
||||
const addressList = ref([
|
||||
'桂花园(别墅)1号楼1层',
|
||||
'桂花园(别墅)2号楼2层'
|
||||
@@ -208,13 +208,8 @@ const genderList = ref(['男', '女']);
|
||||
const addressModalRef = ref(null);
|
||||
const genderModalRef = ref(null);
|
||||
|
||||
// 页面初始化
|
||||
onLoad(() => {
|
||||
// 用moment设置默认时间,格式与原逻辑一致
|
||||
// const now = moment();
|
||||
// form.visitTime = now.format('YYYY-MM-DD HH:mm');
|
||||
// 默认离开时间为1小时后
|
||||
// form.leaveTime = now.clone().add(1, 'hours').format('YYYY-MM-DD HH:mm');
|
||||
|
||||
});
|
||||
|
||||
// 切换tab
|
||||
@@ -250,24 +245,24 @@ const selectGender = (item) => {
|
||||
genderModalRef.value.close();
|
||||
};
|
||||
|
||||
// 用moment处理时间
|
||||
const handleTimeChange = (type) => {
|
||||
if (!form.visitTime || !form.leaveTime) return;
|
||||
// 时间校验
|
||||
const handleTimeChange = () => {
|
||||
if (!form.visitTime || !form.leaveTime) return true;
|
||||
|
||||
const visitMoment = moment(form.visitTime);
|
||||
const leaveMoment = moment(form.leaveTime);
|
||||
|
||||
// 校验1:离开时间不能早于来访时间
|
||||
// 离开时间不能早于来访时间
|
||||
if (leaveMoment.isBefore(visitMoment)) {
|
||||
uni.showToast({
|
||||
title: '离开时间不能早于来访时间',
|
||||
icon: 'none'
|
||||
});
|
||||
form.leaveTime = visitMoment.clone().add(1, 'hours').format('YYYY-MM-DD HH:mm');
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 校验2:间隔不超过24小时
|
||||
// 不能超过24小时
|
||||
const diffHours = leaveMoment.diff(visitMoment, 'hours', true);
|
||||
if (diffHours > 24) {
|
||||
uni.showToast({
|
||||
@@ -275,44 +270,26 @@ const handleTimeChange = (type) => {
|
||||
icon: 'none'
|
||||
});
|
||||
form.leaveTime = visitMoment.clone().add(24, 'hours').format('YYYY-MM-DD HH:mm');
|
||||
}
|
||||
};
|
||||
|
||||
// 提交前时间校验
|
||||
const checkTimeInterval = () => {
|
||||
if (!form.visitTime) {
|
||||
uni.showToast({ title: '请选择来访时间', icon: 'none' });
|
||||
return false;
|
||||
}
|
||||
if (!form.leaveTime) {
|
||||
uni.showToast({ title: '请选择离开时间', icon: 'none' });
|
||||
return false;
|
||||
}
|
||||
|
||||
const visitMoment = moment(form.visitTime);
|
||||
const leaveMoment = moment(form.leaveTime);
|
||||
|
||||
if (!visitMoment.isValid() || !leaveMoment.isValid()) {
|
||||
uni.showToast({ title: '时间格式错误,请重新选择', icon: 'none' });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (leaveMoment.isBefore(visitMoment)) {
|
||||
uni.showToast({ title: '离开时间不能早于来访时间', icon: 'none' });
|
||||
return false;
|
||||
}
|
||||
|
||||
const diffHours = leaveMoment.diff(visitMoment, 'hours', true);
|
||||
if (diffHours > 24) {
|
||||
uni.showToast({ title: '时间间隔不能超过24小时', icon: 'none' });
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
// 表单提交(仅替换时间校验逻辑,其余完全不变)
|
||||
// 提交表单
|
||||
const submitForm = () => {
|
||||
// 1. 必填项校验
|
||||
if (!form.address) {
|
||||
uni.showToast({ title: '请选择来访地址', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!form.name) {
|
||||
uni.showToast({ title: '请输入访客姓名', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!form.gender) {
|
||||
uni.showToast({ title: '请选择性别', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!form.phone) {
|
||||
uni.showToast({ title: '请输入访客联系方式', icon: 'none' });
|
||||
return;
|
||||
@@ -325,18 +302,23 @@ const submitForm = () => {
|
||||
uni.showToast({ title: '请填写完整车牌号', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!form.peopleNum || form.peopleNum < 0) {
|
||||
if (!form.peopleNum || form.peopleNum <= 0) {
|
||||
uni.showToast({ title: '请输入正确的随行人数', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!form.visitTime) {
|
||||
uni.showToast({ title: '请选择来访时间', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!form.leaveTime) {
|
||||
uni.showToast({ title: '请选择离开时间', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 时间校验
|
||||
if (!checkTimeInterval()) return;
|
||||
// 2. 时间规则校验
|
||||
if (!handleTimeChange()) return;
|
||||
|
||||
// 3. 提交成功
|
||||
uni.showLoading({ title: '提交中...' });
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
@@ -345,6 +327,12 @@ const submitForm = () => {
|
||||
icon: 'success'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() =>{
|
||||
uni.navigateTo({
|
||||
url:"/pageSubPack/visitor/qrcode-page"
|
||||
})
|
||||
},1500)
|
||||
|
||||
};
|
||||
|
||||
// 重置表单
|
||||
@@ -353,7 +341,7 @@ const resetForm = () => {
|
||||
form.name = '';
|
||||
form.gender = '';
|
||||
form.phone = '';
|
||||
form.carNumber = ['', '', '', '', '', '', ''];
|
||||
form.carNumber = ['', '', '', '', '', '', '', ''];
|
||||
form.peopleNum = '';
|
||||
form.visitTime = '';
|
||||
form.leaveTime = '';
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<view class="iconClass">
|
||||
<image src="http://47.104.199.163:9090/images/home/lifePay.png" class="iconClass-img"></image>
|
||||
</view>
|
||||
<view class="title-dome-calss">物业费</view>
|
||||
<view class="title-dome-calss">生活缴费</view>
|
||||
</view>
|
||||
</up-col>
|
||||
<up-col span="3">
|
||||
|
||||
Reference in New Issue
Block a user