hookehuyr

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

修复info.vue中初始打卡状态检查逻辑,确保正确更新check_in_status状态。在map.vue中添加组件渲染后调用打卡状态检查的逻辑。同时更新.env文件中的反向代理配置。
......@@ -2,9 +2,9 @@
VITE_PORT = 8006
# 反向代理服务器地址
# VITE_PROXY_TARGET = https://oa-dev.onwall.cn
VITE_PROXY_TARGET = https://oa-dev.onwall.cn
# VITE_PROXY_TARGET = https://bm.jiqun.com
VITE_PROXY_TARGET = https://oa.onwall.cn
# VITE_PROXY_TARGET = https://oa.onwall.cn
# API请求前缀
VITE_PROXY_PREFIX = /srv/
......
<!--
* @Date: 2024-09-15 22:08:49
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-04 17:36:17
* @LastEditTime: 2025-09-04 18:43:59
* @FilePath: /map-demo/src/views/checkin/info.vue
* @Description: 文件描述
-->
......@@ -120,15 +120,20 @@ const props = defineProps({
const page_details = ref({});
// 监听props.info变化,更新页面数据并检查打卡状态
watch(
() => props.info,
(v) => {
if (v.details.length) {
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 };
async (newInfo) => {
if (newInfo && newInfo.details && newInfo.details.length) {
// 更新page_details数据
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 };
// 获取浏览器可视范围的高度
$('.info-page').height(props.height + 'px');
// 检查打卡状态
await checkInitialCheckinStatus();
}
}
},
{ immediate: true }
)
const images = ref([
......@@ -425,8 +430,26 @@ watch(
{ immediate: true }
);
// 检查初始打卡状态
const checkInitialCheckinStatus = async () => {
try {
const detail_id = page_details.value.id;
const openid = page_details.value.openid;
if (detail_id && openid) {
const res = await isCheckedAPI({ detail_id, openid });
if (res.code) {
check_in_status.value = res.data.is_checked;
}
}
} catch (error) {
console.error('检查打卡状态失败:', error);
}
};
defineExpose({
outerStopAudio
outerStopAudio,
checkInitialCheckinStatus
})
......@@ -516,25 +539,6 @@ const checkInRange = (current_lng, current_lat, point_range) => {
const check_in_status = ref(false);
/**
* 检查用户初始打卡状态
*/
const checkInitialCheckinStatus = async () => {
try {
const detail_id = page_details.value.id;
const openid = page_details.value.openid;
if (detail_id && openid) {
const res = await isCheckedAPI({ detail_id, openid });
if (res.code) {
check_in_status.value = true;
}
}
} catch (error) {
console.error('检查打卡状态失败:', error);
}
};
const checkIn = async () => { // 打卡
if (check_in_status.value) {
show_toast.value = true;
......
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-04 16:41:50
* @LastEditTime: 2025-09-04 18:38:29
* @FilePath: /map-demo/src/views/checkin/map.vue
* @Description: 公众地图主体页面
-->
......@@ -547,6 +547,12 @@ export default {
// 使用 panBy 方法进行视图偏移
this.map.panBy(0, offsetY);
// 等待组件渲染完成后调用打卡状态检查
await this.$nextTick();
if (this.$refs.pageInfo && this.$refs.pageInfo.checkInitialCheckinStatus) {
await this.$refs.pageInfo.checkInitialCheckinStatus();
}
})
// if (entity_info[i]?.writing_mode === 'vertical') { // 标题文字垂直
// let textMarker = new AMap.Text({
......