ltx 647bc39d27 feat: 完成体质报告小程序入口与教练资源播放优化
教练端在学生报告页录入体质数据并生成报告,新增报告查看页;学员端从报告页查看最新评估结果、体测指标与运动建议。请求统一走现有 QA 后端并携带登录令牌。

教学资源改用后台音频管理器,支持进度拖动、曲目切换、时长探测及网络异常时下载恢复;修正跳绳和开合跳动作提示文案。

验证:相关 JS 语法、页面 JSON 解析和 git diff --cached --check 均通过。
2026-10-23 16:48:58 +08:00

41 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { ipAddress } = require('../http');
function request(url, method, data) {
return new Promise((resolve, reject) => {
const token = wx.getStorageSync('token');
wx.request({
url,
method,
data,
timeout: 45000,
header: {
'content-type': 'application/json',
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
success(res) {
const body = res.data || {};
if (res.statusCode < 200 || res.statusCode >= 300 || body.success === false) {
reject(new Error(body.errorMsg || body.message || body.errorInfo || `请求失败(${res.statusCode})`));
return;
}
resolve(body);
},
fail(err) {
reject(new Error(err.errMsg || '网络请求失败'));
},
});
});
}
export function generatePostureReport(studentNo, input) {
return request(`${ipAddress}Teacher/GeneratePostureReport`, 'POST', { studentNo, input });
}
export function getTeacherPostureReport(studentNo) {
return request(`${ipAddress}Teacher/GetPostureReport?studentNo=${encodeURIComponent(studentNo)}`, 'GET', null);
}
export function getTraineePostureReport() {
return request(`${ipAddress}Patriarch/GetPostureReport`, 'GET', null);
}