修复bug

This commit is contained in:
zhouyanli
2026-08-22 08:08:01 +08:00
parent a078513221
commit 453f563a6e
8 changed files with 49 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
// 服务器地址(与 request.js 保持一致)
const baseUrl = 'https://wuyeapi.ckdzkj.com';
// const baseUrl = "http://192.168.1.222:8080"
// const baseUrl = "http://192.168.1.6:8080"
/**
* 图片上传 Hook

View File

@@ -543,6 +543,39 @@
}
}
// 18位居民身份证号码校验含出生日期与校验码
const isValidIdCard = (id) => {
const reg = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/
if (!reg.test(id)) return false
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
const checkCodes = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']
let sum = 0
for (let i = 0; i < 17; i++) {
sum += parseInt(id[i], 10) * weights[i]
}
return checkCodes[sum % 11] === id[17].toUpperCase()
}
// 按证件类型校验证件号码格式
const validateCardNo = () => {
const cardNo = (form.cardNo || '').toUpperCase()
const cardTypeId = String(form.cardType.id ?? '')
// 居民身份证18位含校验码
if (cardTypeId === '0') {
return isValidIdCard(cardNo)
}
// 护照:字母开头 + 7~8位数字
if (cardTypeId === '1') {
return /^[A-Z]\d{7,8}$/.test(cardNo)
}
// 港澳通行证H/M/C 开头 + 8位数字
if (cardTypeId === '2') {
return /^[HMC]\d{8}$/.test(cardNo)
}
// 其他类型:字母数字 5~18 位
return /^[A-Z0-9]{5,18}$/.test(cardNo)
}
const openCardType = () => {
showCardType.value = true
}
@@ -663,6 +696,10 @@
title: '请输入证件号',
icon: 'none'
})
if (!validateCardNo()) return uni.showToast({
title: '证件号码格式错误',
icon: 'none'
})
if (!form.relation && form.relation != 0) return uni.showToast({
title: '请选择关系',
icon: 'none'

View File

@@ -41,11 +41,10 @@
</view>
<view class="info-row">
<text class="info-label">房间状态</text>
<text class="info-value" :style="{color: form.status === '0' ? '#00aaff' : form.status === '1' ?
'#FF700A' : form.status === '2' ? '#00aa00' : form.status === '3' ? '#00557f' : '#999' }">{{
form.status === '0' ? '自住' : form.status === '1' ?
'闲置' : form.status === '2' ? '租赁' : form.status === '3' ? '其他' : ''
}}</text>
<text class="info-value" :style="{color: form.houseStatus === '0' ? '#00aaff' : form.houseStatus === '1' ?
'#FF700A' : form.houseStatus === '2' ? '#00aa00' : form.houseStatus === '3' ? '#00557f' : '#999' }">
{{form.houseStatus === '0' ? '自住' : form.houseStatus === '1' ?
'闲置' : form.houseStatus === '2' ? '租赁' : form.houseStatus === '3' ? '其他' : ''}}</text>
</view>
</view>

View File

@@ -184,7 +184,7 @@
weixin.launchMiniProgram({
id: 'gh_a765aef0172c',
type: 1, // 0 正式版 / 1测试版 / 2预览
type: 1, // 0 正式版 / 1开发版 / 2体验
path: 'pages/arrearsPayment/arrearsPayment?' + queryString,
}, (res) => {
console.log('回调---回调结果App', JSON.stringify(res))