- 修改数据库配置将MYSQL_DB从mys_info_v3改为mys_info_test - 新增auth_users表wechat_openid字段并建立唯一索引 - 为plan_checkins表添加计划性能索引(idx_plan_period_student) - 将checkin_records_old表关联方式从student_id改为user_id - 将plan_checkins表关联方式从student_id改为user_id并更新附件路径 - 移除routes/auth.py中的uuid导入使用安全token生成函数 - 重构routes/checkin.py打卡逻辑去除course_type字段并优化返回结构 - 添加打卡时间限制验证功能防止过期打卡操作 - 实现小组统计功能支持老师查看各组打卡情况 - 更新主页index.html界面适配新的打卡和计划功能 - 调整计划提交时间规则为周五至周四周期 - 添加月度和年度计划提交状态验证机制
62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
const api = require('../../utils/api');
|
|
|
|
// 允许加载的域名白名单
|
|
const ALLOWED_HOSTS = ['m.muguaclub.cn', 'muguaclub.cn'];
|
|
|
|
function isAllowedUrl(url) {
|
|
if (!url) return false;
|
|
try {
|
|
// 简单解析 hostname
|
|
const match = url.match(/^https?:\/\/([^/:?#]+)/i);
|
|
if (!match) return false;
|
|
const host = match[1].toLowerCase();
|
|
return ALLOWED_HOSTS.some((h) => host === h || host.endsWith('.' + h));
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
Page({
|
|
data: {
|
|
url: '',
|
|
invalid: false
|
|
},
|
|
onLoad(options) {
|
|
if (!options.url) {
|
|
this.setData({ invalid: true });
|
|
return;
|
|
}
|
|
const url = decodeURIComponent(options.url);
|
|
if (!isAllowedUrl(url)) {
|
|
console.warn('[webview] blocked url:', url);
|
|
this.setData({ invalid: true, url: '' });
|
|
return;
|
|
}
|
|
this.setData({ url, invalid: false });
|
|
},
|
|
|
|
onRetry() {
|
|
if (this.data.url) {
|
|
// 触发重新加载
|
|
this.setData({ url: '' });
|
|
setTimeout(() => {
|
|
this.setData({ url: this.data._url || '' });
|
|
}, 50);
|
|
}
|
|
},
|
|
// ---- 分享 ----
|
|
onShareAppMessage() {
|
|
return {
|
|
title: '明缘云道场',
|
|
path: '/pages/home/home'
|
|
};
|
|
},
|
|
|
|
onShareTimeline() {
|
|
return {
|
|
title: '明缘云道场 · 学习成长,每日精进',
|
|
query: 'from=timeline'
|
|
};
|
|
}
|
|
});
|