hookehuyr

fix(打卡): 修复初始打卡状态检查逻辑并更新代理配置

修复info.vue中初始打卡状态检查逻辑,确保正确更新check_in_status状态。在map.vue中添加组件渲染后调用打卡状态检查的逻辑。同时更新.env文件中的反向代理配置。
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
2 VITE_PORT = 8006 2 VITE_PORT = 8006
3 3
4 # 反向代理服务器地址 4 # 反向代理服务器地址
5 -# VITE_PROXY_TARGET = https://oa-dev.onwall.cn 5 +VITE_PROXY_TARGET = https://oa-dev.onwall.cn
6 # VITE_PROXY_TARGET = https://bm.jiqun.com 6 # VITE_PROXY_TARGET = https://bm.jiqun.com
7 -VITE_PROXY_TARGET = https://oa.onwall.cn 7 +# VITE_PROXY_TARGET = https://oa.onwall.cn
8 8
9 # API请求前缀 9 # API请求前缀
10 VITE_PROXY_PREFIX = /srv/ 10 VITE_PROXY_PREFIX = /srv/
......
1 <!-- 1 <!--
2 * @Date: 2024-09-15 22:08:49 2 * @Date: 2024-09-15 22:08:49
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-09-04 17:36:17 4 + * @LastEditTime: 2025-09-04 18:43:59
5 * @FilePath: /map-demo/src/views/checkin/info.vue 5 * @FilePath: /map-demo/src/views/checkin/info.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -120,15 +120,20 @@ const props = defineProps({ ...@@ -120,15 +120,20 @@ const props = defineProps({
120 120
121 const page_details = ref({}); 121 const page_details = ref({});
122 122
123 +// 监听props.info变化,更新页面数据并检查打卡状态
123 watch( 124 watch(
124 () => props.info, 125 () => props.info,
125 - (v) => { 126 + async (newInfo) => {
126 - if (v.details.length) { 127 + if (newInfo && newInfo.details && newInfo.details.length) {
127 - page_details.value = { ...v.details[0], position: v.position, path: v.path, current_lng: v.current_lng, current_lat: v.current_lat, openid: v.openid }; 128 + // 更新page_details数据
129 + page_details.value = { ...newInfo.details[0], position: newInfo.position, path: newInfo.path, current_lng: newInfo.current_lng, current_lat: newInfo.current_lat, openid: newInfo.openid };
128 // 获取浏览器可视范围的高度 130 // 获取浏览器可视范围的高度
129 $('.info-page').height(props.height + 'px'); 131 $('.info-page').height(props.height + 'px');
132 + // 检查打卡状态
133 + await checkInitialCheckinStatus();
130 } 134 }
131 - } 135 + },
136 + { immediate: true }
132 ) 137 )
133 138
134 const images = ref([ 139 const images = ref([
...@@ -425,8 +430,26 @@ watch( ...@@ -425,8 +430,26 @@ watch(
425 { immediate: true } 430 { immediate: true }
426 ); 431 );
427 432
433 +// 检查初始打卡状态
434 +const checkInitialCheckinStatus = async () => {
435 + try {
436 + const detail_id = page_details.value.id;
437 + const openid = page_details.value.openid;
438 +
439 + if (detail_id && openid) {
440 + const res = await isCheckedAPI({ detail_id, openid });
441 + if (res.code) {
442 + check_in_status.value = res.data.is_checked;
443 + }
444 + }
445 + } catch (error) {
446 + console.error('检查打卡状态失败:', error);
447 + }
448 +};
449 +
428 defineExpose({ 450 defineExpose({
429 - outerStopAudio 451 + outerStopAudio,
452 + checkInitialCheckinStatus
430 }) 453 })
431 454
432 455
...@@ -516,25 +539,6 @@ const checkInRange = (current_lng, current_lat, point_range) => { ...@@ -516,25 +539,6 @@ const checkInRange = (current_lng, current_lat, point_range) => {
516 539
517 const check_in_status = ref(false); 540 const check_in_status = ref(false);
518 541
519 -/**
520 - * 检查用户初始打卡状态
521 - */
522 -const checkInitialCheckinStatus = async () => {
523 - try {
524 - const detail_id = page_details.value.id;
525 - const openid = page_details.value.openid;
526 -
527 - if (detail_id && openid) {
528 - const res = await isCheckedAPI({ detail_id, openid });
529 - if (res.code) {
530 - check_in_status.value = true;
531 - }
532 - }
533 - } catch (error) {
534 - console.error('检查打卡状态失败:', error);
535 - }
536 -};
537 -
538 const checkIn = async () => { // 打卡 542 const checkIn = async () => { // 打卡
539 if (check_in_status.value) { 543 if (check_in_status.value) {
540 show_toast.value = true; 544 show_toast.value = true;
......
1 <!-- 1 <!--
2 * @Date: 2023-05-19 14:54:27 2 * @Date: 2023-05-19 14:54:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-09-04 16:41:50 4 + * @LastEditTime: 2025-09-04 18:38:29
5 * @FilePath: /map-demo/src/views/checkin/map.vue 5 * @FilePath: /map-demo/src/views/checkin/map.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -547,6 +547,12 @@ export default { ...@@ -547,6 +547,12 @@ export default {
547 547
548 // 使用 panBy 方法进行视图偏移 548 // 使用 panBy 方法进行视图偏移
549 this.map.panBy(0, offsetY); 549 this.map.panBy(0, offsetY);
550 +
551 + // 等待组件渲染完成后调用打卡状态检查
552 + await this.$nextTick();
553 + if (this.$refs.pageInfo && this.$refs.pageInfo.checkInitialCheckinStatus) {
554 + await this.$refs.pageInfo.checkInitialCheckinStatus();
555 + }
550 }) 556 })
551 // if (entity_info[i]?.writing_mode === 'vertical') { // 标题文字垂直 557 // if (entity_info[i]?.writing_mode === 'vertical') { // 标题文字垂直
552 // let textMarker = new AMap.Text({ 558 // let textMarker = new AMap.Text({
......