feat(database): 迁移用户关联字段并优化打卡系统
- 修改数据库配置将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界面适配新的打卡和计划功能 - 调整计划提交时间规则为周五至周四周期 - 添加月度和年度计划提交状态验证机制
This commit is contained in:
@@ -111,7 +111,7 @@ Page({
|
||||
record,
|
||||
content: record ? (record.content || '') : '',
|
||||
attachments,
|
||||
attachmentThumbs: attachments.map((p) => this.planFileUrl(p))
|
||||
attachmentThumbs: attachments.map((p) => api.planFileUrl(p))
|
||||
});
|
||||
},
|
||||
|
||||
@@ -120,7 +120,7 @@ Page({
|
||||
.then((res) => {
|
||||
const history = (res.list || []).map((item) => ({
|
||||
...item,
|
||||
thumbSrcs: (item.attachments || []).map((p) => this.planFileUrl(p))
|
||||
thumbSrcs: (item.attachments || []).map((p) => api.planFileUrl(p))
|
||||
}));
|
||||
this.setData({ history });
|
||||
}).catch(() => {});
|
||||
@@ -130,16 +130,6 @@ Page({
|
||||
this.setData({ content: e.detail.value });
|
||||
},
|
||||
|
||||
planFileUrl(path) {
|
||||
if (!path) return '';
|
||||
if (/^https?:\/\//i.test(path)) return path;
|
||||
const parts = String(path).replace(/^attachments\//, '').split('/');
|
||||
if (parts.length < 4) {
|
||||
return '';
|
||||
}
|
||||
return api.STATIC_BASE_URL + '/clock/static/plan/' + parts.slice(0, 4).map(encodeURIComponent).join('/');
|
||||
},
|
||||
|
||||
chooseImages() {
|
||||
const remain = MAX_IMAGES - this.data.attachments.length;
|
||||
if (remain <= 0) {
|
||||
@@ -173,7 +163,7 @@ Page({
|
||||
if (index >= paths.length) {
|
||||
this.setData({
|
||||
uploading: false,
|
||||
attachmentThumbs: attachments.map((p) => this.planFileUrl(p))
|
||||
attachmentThumbs: attachments.map((p) => api.planFileUrl(p))
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -196,7 +186,7 @@ Page({
|
||||
attachments = attachments.concat(data.attachments).slice(0, MAX_IMAGES);
|
||||
this.setData({
|
||||
attachments,
|
||||
attachmentThumbs: attachments.map((p) => this.planFileUrl(p))
|
||||
attachmentThumbs: attachments.map((p) => api.planFileUrl(p))
|
||||
});
|
||||
} else {
|
||||
wx.showToast({ title: data.error || '上传失败', icon: 'none' });
|
||||
@@ -252,7 +242,7 @@ Page({
|
||||
attachments.splice(index, 1);
|
||||
this.setData({
|
||||
attachments,
|
||||
attachmentThumbs: attachments.map((p) => this.planFileUrl(p))
|
||||
attachmentThumbs: attachments.map((p) => api.planFileUrl(p))
|
||||
});
|
||||
};
|
||||
if (parts.length < 4) {
|
||||
@@ -346,5 +336,20 @@ Page({
|
||||
} else {
|
||||
doPost();
|
||||
}
|
||||
},
|
||||
// ---- 分享 ----
|
||||
onShareAppMessage() {
|
||||
const typeLabel = this.data.typeLabel;
|
||||
return {
|
||||
title: '明缘云道场 · ' + typeLabel + '提交',
|
||||
path: '/pages/plan/plan'
|
||||
};
|
||||
},
|
||||
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: '明缘云道场 · 周/月/年计划,让成长有迹可循',
|
||||
query: 'from=timeline'
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user