diff --git a/.env b/.env index 94c3629..689ef1f 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VITE_APP_VERSION=1.2.20250825-21 \ No newline at end of file +VITE_APP_VERSION=1.2.20251216-10 \ No newline at end of file diff --git a/package.json b/package.json index 81bcd9e..30c73e2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "styy-mobile", "private": true, - "version": "0.0.0", + "version": "1.2.20250825-23", "scripts": { "dev": "vite --mode development", "build": "vite build --mode production", diff --git a/src/views/Invitation copy.vue b/src/views/Invitation copy.vue deleted file mode 100644 index fb74438..0000000 --- a/src/views/Invitation copy.vue +++ /dev/null @@ -1,310 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/apply copy 2.vue b/src/views/apply copy 2.vue deleted file mode 100644 index dbee729..0000000 --- a/src/views/apply copy 2.vue +++ /dev/null @@ -1,720 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/apply copy.vue b/src/views/apply copy.vue deleted file mode 100644 index dbee729..0000000 --- a/src/views/apply copy.vue +++ /dev/null @@ -1,720 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/apply.vue b/src/views/apply.vue index 37456e4..a1f5bd8 100644 --- a/src/views/apply.vue +++ b/src/views/apply.vue @@ -9,26 +9,6 @@ 拜访信息(我找谁)
- - - @@ -123,8 +103,6 @@ import { uploadGuestFaceApi } from '@/api/upload' visitingNum: '', }) const isSubmit = ref(false) - const visitDict = ref([]) // 被访客数据 - const visitAllDict = ref([]) // 被访客数据 const isDisabled = ref(false) // 是否能提交 const isSuccess = ref(false) // 是否提交成功 const isSelect = ref( false) // 是否显示下拉选择 @@ -156,58 +134,28 @@ import { uploadGuestFaceApi } from '@/api/upload' } const onBlurTel = (phone) =>{ - console.log(phone) - if(rulesPhone(phone)){ - getUserNameByTel(phone).then(res =>{ - console.log(res) - if(res.data){ - telName.value = res.data + if (rulesPhone(phone)) { + getUserNameByTel(phone).then(res => { + if (res.data) { + telName.value = res.data; + } else { + Toast.fail('未找到该手机号对应的被访人'); + telName.value = ''; } - }).catch(err =>{ + }).catch(err => { Toast.clear(); - console.log(err) + console.log(err); Dialog.alert({ - message: err.msg, - }).then(() => { - // on close + message: err.msg || '查询失败', }); - }) + telName.value = ''; + }); + } else { + Toast.fail('请输入正确的手机号'); + telName.value = ''; } - } - // const onBlurVisitor = () =>{ - // isSelect.value = false - // let item = visitAllDict.value.find(item =>{ return item.userId == form.visitingTel }) - // if(item){ - // visitorName.value = item.name - // visitDict.value = visitAllDict.value - // }else{ - // visitorName.value = '' // 是否显示下拉选择的名字 - // visitDict.value = visitAllDict.value - // } - // } - // 输入框 - // const onInputVisior = (e) =>{ - // visitorName.value = e.target.value - // let arr = [] - // visitAllDict.value.map( item =>{ - // if(item.name.search(e.target.value) != -1){ - // arr.push(item) - // } - // }) - // visitDict.value = [ ...arr ] - // } - // 点击选择了拜访对象 - // const onClickSelect = (item) =>{ - // form.visitingTel = item.userId - // visitorName.value = item.name - // isSelect.value = false - - // } - // const onClickVisitor = () =>{ - // isSelect.value = true - // } // 点击确认模态框 const onClickAffirm = () =>{ router.go(-1) @@ -365,10 +313,6 @@ import { uploadGuestFaceApi } from '@/api/upload' form.visitingTel = route.query.tel onBlurTel(route.query.tel) } - getVisitor().then( res=>{ - visitDict.value = res.data - visitAllDict.value = res.data - }) diff --git a/src/views/apply颠倒后.vue b/src/views/apply颠倒后.vue deleted file mode 100644 index b59a329..0000000 --- a/src/views/apply颠倒后.vue +++ /dev/null @@ -1,786 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/userHome.vue b/src/views/userHome.vue index 3263dfb..4b4f640 100644 --- a/src/views/userHome.vue +++ b/src/views/userHome.vue @@ -5,6 +5,7 @@

欢迎进入鼎盛无际智能访客系统

+

v {{ appVersion }}

@@ -59,6 +60,7 @@ import { getWeChatCode, login } from "../api/user"; import { Toast, ImagePreview } from "vant"; /* @data */ +const appVersion = ref(import.meta.env.VITE_APP_VERSION || '1.0.0') const router = useRouter(); const store = useStore(); const url = "https://visitor.scdswj.cn/?code=071ucW200YtsQR1AUj3007Tabj2ucW26&state=STATE"; @@ -177,6 +179,18 @@ if (isWXBrowser) { padding: 0 0 0 0.7467rem /* 56/75 */; box-sizing: border-box; } + + .version { + line-height: 0.4rem; + font-size: 0.2667rem /* 20/75 */; + font-family: Source Han Sans CN, Source Han Sans CN; + font-weight: 400; + color: #514e4b; + padding: 0 0 0 0.7467rem /* 56/75 */; + box-sizing: border-box; + margin-top: -0.1333rem /* 10/75 */; + } + } .plate-box { width: 100%; diff --git a/update.version.js b/update.version.js index 93c8c6c..cda60d2 100644 --- a/update.version.js +++ b/update.version.js @@ -4,42 +4,88 @@ const path = require('path'); function changeVersion() { // 直接读取.env文件中的版本号 const envPath = path.join(__dirname, '.env'); - let version = '1.0.0'; // 默认版本号 + let currentVersion = '1.0.0'; // 默认版本号 if (fs.existsSync(envPath)) { const fileContent = fs.readFileSync(envPath, 'utf-8'); const versionMatch = fileContent.match(/VITE_APP_VERSION\s*=\s*([^\r\n]+)/); if (versionMatch && versionMatch[1]) { - version = versionMatch[1].trim(); + currentVersion = versionMatch[1].trim(); } } + // 解析版本号 + const versionParts = currentVersion.split('.'); + if (versionParts.length < 3) { + throw new Error('Invalid version format'); + } + + // 获取当前环境 + const env = process.env.NODE_ENV || 'development'; let newVersion; - if (version) { - // 将版本号按点号分割 - const parts = version.split('.'); - const lastPart = parts[parts.length - 1]; + const lastPart = versionParts[versionParts.length - 1]; + const today = new Date().toISOString().slice(0, 10).replace(/-/g, ''); // YYYYMMDD 格式 (8位) - // 查找最后一部分中的数字 - const numberMatch = lastPart.match(/(\d+)([^\d]*)$/); - if (numberMatch) { - // 递增数字部分 - const number = parseInt(numberMatch[1]) + 1; - const suffix = numberMatch[2] || ''; // 非数字后缀 + // 检查最后一组是否以8位日期开头 (支持各种分隔符,如 20250906-01 或 20250906_01) + const dateMatch = lastPart.match(/^(\d{8})[^\d]?(\d*)$/); - // 替换最后一部分中的数字 - parts[parts.length - 1] = lastPart.replace(/(\d+)([^\d]*)$/, number + suffix); + if (dateMatch) { + // 最后一组以8位日期开头 + const currentDatePart = dateMatch[1]; + const sequencePart = dateMatch[2]; + + if (currentDatePart === today) { + // 日期相同,根据环境递增序号 + const currentSequence = sequencePart ? parseInt(sequencePart) : 0; + let newSequence; + + if (env === 'production') { + // 生产环境:递增到下一个十位整数 + newSequence = Math.ceil((currentSequence + 1) / 10) * 10; + } else if (env === 'test') { + // 测试环境:递增到下一个十位整数,但跳过二十及其倍数 + newSequence = getNextTestSequence(currentSequence); + } else { + // 开发环境:递增但避开十位整数 + newSequence = getNextDevSequence(currentSequence); + } + + // 保持三位数格式,不足三位前面补0 + const formattedSequence = newSequence.toString().padStart(2, '0'); + versionParts[versionParts.length - 1] = today + '-' + formattedSequence; } else { - // 如果最后一部分没有数字,则添加.1 - parts.push('1'); + // 日期不同,重置序号 + let resetSequence; + if (env === 'production' || env === 'prod') { + resetSequence = '20'; + } else if (env === 'test') { + resetSequence = '10'; + } else { + resetSequence = '01'; + } + versionParts[versionParts.length - 1] = today + '-' + resetSequence; } - - newVersion = parts.join('.'); } else { - // 如果没有找到版本号,使用默认值 - newVersion = '1.0.1'; + // 最后一组不是日期格式,检查是否为纯数字 + if (/^\d+$/.test(lastPart)) { + // 是纯数字,按照原来的方式递增 + versionParts[versionParts.length - 1] = parseInt(lastPart) + 1; + } else { + // 不是纯数字,添加新的日期序号 + let initialSequence; + if (env === 'production' || env === 'prod') { + initialSequence = '20'; + } else if (env === 'test') { + initialSequence = '10'; + } else { + initialSequence = '01'; + } + versionParts.push(today + '-' + initialSequence); + } } + newVersion = versionParts.join('.'); + // 修改版本号 if (fs.existsSync(envPath)) { const file = fs.readFileSync(envPath, 'utf-8'); @@ -57,4 +103,28 @@ function changeVersion() { return newVersion; } +// 获取下一个测试环境序号(十位整数但跳过百位整数) +function getNextTestSequence(current) { + let next = Math.ceil((current + 1) / 10) * 10; + + // 跳过百位整数 + while (next % 20 === 0) { + next += 10; + } + + return next; +} + +// 获取下一个开发环境序号(避开十位整数) +function getNextDevSequence(current) { + let next = current + 1; + + // 跳过十位整数和百位整数 + while (next % 10 === 0) { + next++; + } + + return next; +} + module.exports = changeVersion;