签到调整
This commit is contained in:
parent
510d12282f
commit
daf902029b
@ -66,8 +66,8 @@ function goByJs(js: any) {
|
||||
if (globalData.rqgqtime) {
|
||||
confirmUrl += `&rqgqtime=${globalData.rqgqtime}`;
|
||||
}
|
||||
if (globalData.timestamp) {
|
||||
confirmUrl += `×tamp=${globalData.timestamp}`;
|
||||
if (globalData.timestampqd) {
|
||||
confirmUrl += `×tampqd=${globalData.timestampqd}`;
|
||||
}
|
||||
|
||||
console.log('重定向到签到确认页面:', confirmUrl);
|
||||
|
||||
@ -215,8 +215,8 @@ const options = ref<any>({});
|
||||
// 页面加载时接收参数
|
||||
onLoad((params) => {
|
||||
console.log('confirm.vue onLoad - 接收到的参数:', params);
|
||||
options.value = params || {};
|
||||
|
||||
options.value = params ;
|
||||
|
||||
if (params && params.from === "login") {
|
||||
options.value = getGlobal;
|
||||
console.log('confirm.vue onLoad - 从登录页面来,使用global数据:', options.value);
|
||||
@ -226,7 +226,7 @@ onLoad((params) => {
|
||||
type: "qd"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 如果是从launchPage重定向过来的,直接执行页面初始化
|
||||
if (params && params.qdId) {
|
||||
console.log('confirm.vue onLoad - 检测到qdId参数,准备初始化页面');
|
||||
@ -293,10 +293,10 @@ const initializePage = async () => {
|
||||
// 获取二维码过期时间参数(单位:秒)
|
||||
if (options.value?.rqgqtime) {
|
||||
qrExpireTime.value = parseInt(options.value.rqgqtime) || 60;
|
||||
console.log('confirm.vue initializePage - 设置qrExpireTime:', qrExpireTime.value, '秒');
|
||||
console.log('confirm.vue initializePage - 从URL参数获取rqgqtime:', options.value.rqgqtime, '设置qrExpireTime:', qrExpireTime.value, '秒');
|
||||
} else {
|
||||
qrExpireTime.value = 60; // 默认60秒
|
||||
console.log('confirm.vue initializePage - 使用默认qrExpireTime:', qrExpireTime.value, '秒');
|
||||
console.log('confirm.vue initializePage - 未找到rqgqtime参数,使用默认qrExpireTime:', qrExpireTime.value, '秒');
|
||||
}
|
||||
|
||||
// 第一步:获取缓存的教师信息
|
||||
@ -317,28 +317,38 @@ const initializePage = async () => {
|
||||
}, 1500);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 验证二维码时间戳是否过期
|
||||
if (options.value?.timestamp) {
|
||||
const qrTimestamp = parseInt(options.value.timestamp);
|
||||
console.log('confirm.vue initializePage - 开始验证时间戳,options.value.timestamp:', options.value.qdtimestamp);
|
||||
|
||||
if (options.value.qdtimestamp) {
|
||||
const qrTimestamp = parseInt(options.value.qdtimestamp);
|
||||
const currentTimestamp = Date.now();
|
||||
const timeDiff = currentTimestamp - qrTimestamp;
|
||||
const maxValidTime = qrExpireTime.value * 1000; // qrExpireTime是秒,转换为毫秒
|
||||
|
||||
// 转换时间戳为可读格式
|
||||
const qrTime = new Date(qrTimestamp).toLocaleString('zh-CN');
|
||||
const currentTime = new Date(currentTimestamp).toLocaleString('zh-CN');
|
||||
|
||||
console.log('confirm.vue initializePage - 验证二维码时间戳:', {
|
||||
rawTimestamp: options.value.qdtimestamp,
|
||||
qrTimestamp,
|
||||
qrTime: qrTime,
|
||||
currentTimestamp,
|
||||
currentTime: currentTime,
|
||||
timeDiff: timeDiff + '毫秒',
|
||||
timeDiffSeconds: Math.round(timeDiff / 1000) + '秒',
|
||||
maxValidTime: maxValidTime + '毫秒',
|
||||
qrExpireTime: qrExpireTime.value + '秒'
|
||||
maxValidTimeSeconds: qrExpireTime.value + '秒'
|
||||
});
|
||||
|
||||
if (timeDiff > maxValidTime) {
|
||||
console.log('confirm.vue initializePage - 二维码已过期,时间差:', timeDiff, '毫秒,超过最大有效时间:', maxValidTime, '毫秒');
|
||||
console.log('confirm.vue initializePage - 二维码已过期,时间差:', timeDiff, '毫秒(', Math.round(timeDiff / 1000), '秒),超过最大有效时间:', maxValidTime, '毫秒(', qrExpireTime.value, '秒)');
|
||||
currentStep.value = 'qrExpired';
|
||||
return;
|
||||
} else {
|
||||
console.log('confirm.vue initializePage - 二维码未过期,时间差:', timeDiff, '毫秒,小于最大有效时间:', maxValidTime, '毫秒');
|
||||
console.log('confirm.vue initializePage - 二维码未过期,时间差:', timeDiff, '毫秒(', Math.round(timeDiff / 1000), '秒),小于最大有效时间:', maxValidTime, '毫秒(', qrExpireTime.value, '秒)');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user