hookehuyr

fix 细节逻辑优化

1 <!-- 1 <!--
2 * @Date: 2024-01-16 10:06:47 2 * @Date: 2024-01-16 10:06:47
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 16:12:21 4 + * @LastEditTime: 2024-01-16 17:06:21
5 * @FilePath: /xysBooking/src/components/qrCode.vue 5 * @FilePath: /xysBooking/src/components/qrCode.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -67,10 +67,6 @@ const props = defineProps({ ...@@ -67,10 +67,6 @@ const props = defineProps({
67 67
68 const id_number = ref('511522190103214279'); 68 const id_number = ref('511522190103214279');
69 69
70 -const formatId = computed(() => {
71 - return xctcCheck.formatInfoHide(id_number.value)
72 -});
73 -
74 const has_qrcode = ref(true); 70 const has_qrcode = ref(true);
75 71
76 const select_index = ref(0); 72 const select_index = ref(0);
...@@ -119,10 +115,36 @@ const nextCode = () => { ...@@ -119,10 +115,36 @@ const nextCode = () => {
119 } 115 }
120 }; 116 };
121 117
118 +/**
119 + * 生成15位身份证号中间8位替换为*号
120 + * @param {*} inputString
121 + */
122 + function replaceMiddleCharacters(inputString) {
123 + if (inputString.length < 15) {
124 + return inputString; // 字符串长度不足,不进行替换
125 + }
126 +
127 + const start = Math.floor((inputString.length - 8) / 2); // 开始替换的索引位置
128 + const end = start + 8; // 结束替换的索引位置
129 +
130 + const replacement = '*'.repeat(8); // 生成包含8个*号的字符串
131 +
132 + const replacedString = inputString.substring(0, start) + replacement + inputString.substring(end);
133 + return replacedString;
134 +}
135 +
136 +const formatId = (id) => {
137 + if (id.length === 15) {
138 + return replaceMiddleCharacters(id);
139 + } else {
140 + return xctcCheck.formatInfoHide(id)
141 + }
142 +};
143 +
122 const userinfo = computed(() => { 144 const userinfo = computed(() => {
123 return { 145 return {
124 name: userList.value[select_index.value]['username'], 146 name: userList.value[select_index.value]['username'],
125 - id: xctcCheck.formatInfoHide(userList.value[select_index.value]['id_code']) 147 + id: formatId(userList.value[select_index.value]['id_code'])
126 }; 148 };
127 }); 149 });
128 150
...@@ -158,9 +180,26 @@ const selectUser = (index) => { ...@@ -158,9 +180,26 @@ const selectUser = (index) => {
158 select_index.value = index; 180 select_index.value = index;
159 } 181 }
160 182
161 -onMounted(() => { 183 +// TODO: 轮询查二维码的使用
184 +
185 +// const count = ref(0);
186 +
187 +// // 定义轮询函数
188 +// const poll = () => {
189 +// // 每秒增加计数值
190 +// count.value++;
191 +// console.log(count.value);
192 +// };
193 +// // 在组件挂载时启动轮询
194 +// onMounted(() => {
195 +// // 每秒执行一次轮询函数
196 +// const intervalId = setInterval(poll, 1000);
162 197
163 -}) 198 +// // 在组件卸载时清除定时器
199 +// onUnmounted(() => {
200 +// clearInterval(intervalId);
201 +// });
202 +// });
164 </script> 203 </script>
165 204
166 <style lang="less" scoped> 205 <style lang="less" scoped>
......
1 <!-- 1 <!--
2 * @Date: 2024-01-15 17:39:29 2 * @Date: 2024-01-15 17:39:29
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 15:48:05 4 + * @LastEditTime: 2024-01-16 17:08:33
5 * @FilePath: /xysBooking/src/views/addVisitor.vue 5 * @FilePath: /xysBooking/src/views/addVisitor.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -83,6 +83,9 @@ const checkUsername = () => { ...@@ -83,6 +83,9 @@ const checkUsername = () => {
83 const checkIdCode = () => { 83 const checkIdCode = () => {
84 const res = xctcCheck.checkIdCard(idCode.value); 84 const res = xctcCheck.checkIdCard(idCode.value);
85 let flag = true; 85 let flag = true;
86 + if (idCode.value.length === 15) { // 15位身份证号码不校验
87 + flag = true;
88 + } else {
86 if (res.status) { 89 if (res.status) {
87 90
88 } else { 91 } else {
...@@ -90,6 +93,7 @@ const checkIdCode = () => { ...@@ -90,6 +93,7 @@ const checkIdCode = () => {
90 error_message.value = res.msg; 93 error_message.value = res.msg;
91 flag = false; 94 flag = false;
92 } 95 }
96 + }
93 return flag; 97 return flag;
94 } 98 }
95 99
...@@ -154,4 +158,8 @@ const onConfirm = ({ selectedOptions }) => { ...@@ -154,4 +158,8 @@ const onConfirm = ({ selectedOptions }) => {
154 } 158 }
155 } 159 }
156 } 160 }
161 +
162 +:deep(.van-picker__confirm) {
163 + color: #A67939;
164 +}
157 </style> 165 </style>
......
1 <!-- 1 <!--
2 * @Date: 2024-01-15 13:35:51 2 * @Date: 2024-01-15 13:35:51
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 15:15:07 4 + * @LastEditTime: 2024-01-16 16:29:11
5 * @FilePath: /xysBooking/src/views/booking.vue 5 * @FilePath: /xysBooking/src/views/booking.vue
6 * @Description: 预约页面 6 * @Description: 预约页面
7 * @Version: 1.0.0 7 * @Version: 1.0.0
...@@ -207,6 +207,8 @@ const chooseDay = (date) => { // 点击日期回调 ...@@ -207,6 +207,8 @@ const chooseDay = (date) => { // 点击日期回调
207 if (findDatesInfo(date).num) { // 有余数可约 207 if (findDatesInfo(date).num) { // 有余数可约
208 checked_day.value = date; 208 checked_day.value = date;
209 checked_day_price.value = findDatesInfo(date).price; 209 checked_day_price.value = findDatesInfo(date).price;
210 + // TODO: 选择日期后,查询时间段信息
211 + console.warn(checked_day.value);
210 } 212 }
211 }; 213 };
212 214
...@@ -228,6 +230,8 @@ const onConfirm = ({ selectedValues, selectedOptions }) => { // 选择日期回 ...@@ -228,6 +230,8 @@ const onConfirm = ({ selectedValues, selectedOptions }) => { // 选择日期回
228 // 清空选择 230 // 清空选择
229 checked_day.value = ''; 231 checked_day.value = '';
230 checked_time.value = -1; 232 checked_time.value = -1;
233 + // TODO: 选择日期后,查询月份信息
234 + console.warn(selectedValues);
231 } 235 }
232 const onCancel = () => { 236 const onCancel = () => {
233 showPicker.value = false; 237 showPicker.value = false;
...@@ -383,4 +387,8 @@ const nextBtn = () => { ...@@ -383,4 +387,8 @@ const nextBtn = () => {
383 } 387 }
384 } 388 }
385 } 389 }
390 +
391 +:deep(.van-picker__confirm) {
392 + color: #A67939;
393 +}
386 </style> 394 </style>
......
1 <!-- 1 <!--
2 * @Date: 2024-01-16 13:19:23 2 * @Date: 2024-01-16 13:19:23
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 16:01:04 4 + * @LastEditTime: 2024-01-16 17:14:34
5 * @FilePath: /xysBooking/src/views/bookingDetail.vue 5 * @FilePath: /xysBooking/src/views/bookingDetail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -61,10 +61,12 @@ const cancelBooking = (item) => { ...@@ -61,10 +61,12 @@ const cancelBooking = (item) => {
61 title: '温馨提示', 61 title: '温馨提示',
62 message: '是否取消预约?', 62 message: '是否取消预约?',
63 confirmButtonColor: '#A67939', 63 confirmButtonColor: '#A67939',
64 + width: '80vw'
64 }) 65 })
65 .then(() => { 66 .then(() => {
66 // on confirm 67 // on confirm
67 showSuccessToast('取消成功'); 68 showSuccessToast('取消成功');
69 + $router.go(-1);
68 }) 70 })
69 .catch(() => { 71 .catch(() => {
70 // on cancel 72 // on cancel
......
1 <!-- 1 <!--
2 * @Date: 2023-06-21 10:23:09 2 * @Date: 2023-06-21 10:23:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 14:09:56 4 + * @LastEditTime: 2024-01-16 16:15:12
5 * @FilePath: /xysBooking/src/views/index.vue 5 * @FilePath: /xysBooking/src/views/index.vue
6 * @Description: 预约页首页 6 * @Description: 预约页首页
7 --> 7 -->
...@@ -61,16 +61,16 @@ useTitle($route.meta.title); ...@@ -61,16 +61,16 @@ useTitle($route.meta.title);
61 61
62 const go = useGo(); 62 const go = useGo();
63 63
64 -const toBooking = () => { 64 +const toBooking = () => { // 跳转到预约须知
65 go('/notice'); 65 go('/notice');
66 } 66 }
67 -const toRecord = () => { 67 +const toRecord = () => { // 跳转到预约记录
68 go('/bookingList'); 68 go('/bookingList');
69 } 69 }
70 -const toCode = () => { 70 +const toCode = () => { // 跳转到预约码
71 go('/bookingCode'); 71 go('/bookingCode');
72 } 72 }
73 -const toMy = () => { 73 +const toMy = () => { // 跳转到我的
74 go('/me'); 74 go('/me');
75 } 75 }
76 76
......
1 <!-- 1 <!--
2 * @Date: 2024-01-16 13:33:36 2 * @Date: 2024-01-16 13:33:36
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 13:47:01 4 + * @LastEditTime: 2024-01-16 17:13:07
5 * @FilePath: /xysBooking/src/views/me.vue 5 * @FilePath: /xysBooking/src/views/me.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -50,6 +50,7 @@ const removeItem = (item) => { ...@@ -50,6 +50,7 @@ const removeItem = (item) => {
50 title: '温馨提示', 50 title: '温馨提示',
51 message: '是否确认删除参观者信息?', 51 message: '是否确认删除参观者信息?',
52 confirmButtonColor: '#A67939', 52 confirmButtonColor: '#A67939',
53 + width: '80vw'
53 }) 54 })
54 .then(() => { 55 .then(() => {
55 // on confirm 56 // on confirm
......
1 <!-- 1 <!--
2 * @Date: 2024-01-15 11:43:01 2 * @Date: 2024-01-15 11:43:01
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 14:15:52 4 + * @LastEditTime: 2024-01-16 16:18:14
5 * @FilePath: /xysBooking/src/views/notice.vue 5 * @FilePath: /xysBooking/src/views/notice.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -35,7 +35,7 @@ import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@ ...@@ -35,7 +35,7 @@ import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@
35 //import { } from '@/utils/generateIcons.js' 35 //import { } from '@/utils/generateIcons.js'
36 //import { } from '@/composables' 36 //import { } from '@/composables'
37 import { useGo } from '@/hooks/useGo' 37 import { useGo } from '@/hooks/useGo'
38 -import { showSuccessToast, showFailToast } from 'vant'; 38 +import { showSuccessToast, showFailToast, showToast } from 'vant';
39 const $route = useRoute(); 39 const $route = useRoute();
40 const $router = useRouter(); 40 const $router = useRouter();
41 useTitle($route.meta.title); 41 useTitle($route.meta.title);
...@@ -43,15 +43,12 @@ useTitle($route.meta.title); ...@@ -43,15 +43,12 @@ useTitle($route.meta.title);
43 const go = useGo(); 43 const go = useGo();
44 44
45 const checked = ref(['0']); 45 const checked = ref(['0']);
46 -const checkedChange = () => {
47 - // checked.value[0] = !checked.value[0];
48 -};
49 46
50 const confirmBtn = () => { 47 const confirmBtn = () => {
51 if (checked.value[1] === '1') { 48 if (checked.value[1] === '1') {
52 go('/booking'); 49 go('/booking');
53 } else { 50 } else {
54 - showFailToast('请勾选同意须知'); 51 + showToast('请勾选同意须知');
55 } 52 }
56 } 53 }
57 </script> 54 </script>
......
1 <!-- 1 <!--
2 * @Date: 2024-01-15 16:25:51 2 * @Date: 2024-01-15 16:25:51
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 15:39:18 4 + * @LastEditTime: 2024-01-16 16:53:24
5 * @FilePath: /xysBooking/src/views/submit.vue 5 * @FilePath: /xysBooking/src/views/submit.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
21 <van-icon v-else name="https://cdn.ipadbiz.cn/xys/booking/%E5%A4%9A%E9%80%8902@2x.png" />&nbsp; 21 <van-icon v-else name="https://cdn.ipadbiz.cn/xys/booking/%E5%A4%9A%E9%80%8902@2x.png" />&nbsp;
22 </div> 22 </div>
23 <div> 23 <div>
24 - <p style="color: #A67939;">张雨燕</p> 24 + <p style="color: #A67939;">{{ item.name }}</p>
25 - <p>证件号:3101******234</p> 25 + <p>证件号:{{ formatId(item.idCard) }}</p>
26 - <p style="color: #9C9A9A; font-size: 0.8rem;">*已预约过2024-01-10参观,请不要重复预约</p> 26 + <p v-if="item.today" style="color: #9C9A9A; font-size: 0.8rem;">*已预约过2024-01-10参观,请不要重复预约</p>
27 </div> 27 </div>
28 </div> 28 </div>
29 </div> 29 </div>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
42 <script setup> 42 <script setup>
43 import { ref } from 'vue' 43 import { ref } from 'vue'
44 import { useRoute, useRouter } from 'vue-router' 44 import { useRoute, useRouter } from 'vue-router'
45 - 45 +import xctcCheck from "xctc-check"
46 import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js' 46 import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
47 //import { } from '@/utils/generateModules.js' 47 //import { } from '@/utils/generateModules.js'
48 //import { } from '@/utils/generateIcons.js' 48 //import { } from '@/utils/generateIcons.js'
...@@ -55,10 +55,45 @@ useTitle($route.meta.title); ...@@ -55,10 +55,45 @@ useTitle($route.meta.title);
55 55
56 const go = useGo(); 56 const go = useGo();
57 57
58 -const visitorList = ref([{ id: '1', name: '张雨燕1', idCard: '3101******234' }, { id: '2', name: '张雨燕2', idCard: '3101******234' }, { id: '3',name: '张雨燕3', idCard: '3101******234' }, { id: '4',name: '张雨燕4', idCard: '3101******234' }]); 58 +const visitorList = ref([
59 + { id: '1', name: '张雨燕1', idCard: '311522190103214', today: false },
60 + { id: '2', name: '张雨燕2', idCard: '311522190103214279', today: true },
61 + { id: '3',name: '张雨燕3', idCard: '311522190103214279', today: false },
62 + { id: '4',name: '张雨燕4', idCard: '311522190103214279', today: false }
63 +]);
64 +
65 +/**
66 + * 生成15位身份证号中间8位替换为*号
67 + * @param {*} inputString
68 + */
69 +function replaceMiddleCharacters(inputString) {
70 + if (inputString.length < 15) {
71 + return inputString; // 字符串长度不足,不进行替换
72 + }
73 +
74 + const start = Math.floor((inputString.length - 8) / 2); // 开始替换的索引位置
75 + const end = start + 8; // 结束替换的索引位置
76 +
77 + const replacement = '*'.repeat(8); // 生成包含8个*号的字符串
78 +
79 + const replacedString = inputString.substring(0, start) + replacement + inputString.substring(end);
80 + return replacedString;
81 +}
82 +
83 +const formatId = (id) => {
84 + if (id.length === 15) {
85 + return replaceMiddleCharacters(id);
86 + } else {
87 + return xctcCheck.formatInfoHide(id)
88 + }
89 +};
59 90
60 const checked_visitors = ref([]); 91 const checked_visitors = ref([]);
61 const addVisitor = (item) => { 92 const addVisitor = (item) => {
93 + if (item.today) { // 今天已经预约
94 + showToast('已预约过参观,请不要重复预约!')
95 + return;
96 + }
62 if (checked_visitors.value.includes(item.id)) { 97 if (checked_visitors.value.includes(item.id)) {
63 checked_visitors.value = checked_visitors.value.filter((v) => v !== item.id); 98 checked_visitors.value = checked_visitors.value.filter((v) => v !== item.id);
64 } else { 99 } else {
......