|
@@ -3,6 +3,7 @@ import styles from "./index.module.less";
|
|
// import { verifyMembershipServices } from "../vip-verify";
|
|
// import { verifyMembershipServices } from "../vip-verify";
|
|
import { api_lessonTrainingSubmitTraining, api_lessonTrainingTrainingStudentDetail } from "../../api";
|
|
import { api_lessonTrainingSubmitTraining, api_lessonTrainingTrainingStudentDetail } from "../../api";
|
|
import state, { handleSetSpeed, hanldeDirectSelection, setSection } from "/src/state";
|
|
import state, { handleSetSpeed, hanldeDirectSelection, setSection } from "/src/state";
|
|
|
|
+import { getQuery } from "/src/utils/queryString";
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: "HomeWork",
|
|
name: "HomeWork",
|
|
@@ -14,6 +15,7 @@ export default defineComponent({
|
|
},
|
|
},
|
|
emits: ["change"],
|
|
emits: ["change"],
|
|
setup(props, {expose}) {
|
|
setup(props, {expose}) {
|
|
|
|
+ const query = getQuery();
|
|
const training = reactive({
|
|
const training = reactive({
|
|
trainingTimes: "",
|
|
trainingTimes: "",
|
|
trainingSpeed: 0,
|
|
trainingSpeed: 0,
|
|
@@ -40,17 +42,11 @@ export default defineComponent({
|
|
const getWorkData = async () => {
|
|
const getWorkData = async () => {
|
|
const workeData = props.workeData;
|
|
const workeData = props.workeData;
|
|
if (workeData.id) {
|
|
if (workeData.id) {
|
|
- let trainingContent: any = {};
|
|
|
|
- try {
|
|
|
|
- trainingContent = JSON.parse(workeData.trainingContent);
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log("🚀 ~ error:", error);
|
|
|
|
- }
|
|
|
|
- training.times = trainingContent.trainingTimes || 0;
|
|
|
|
- training.trainingTimes = (workeData.trainingTimes / 60).toFixed(1) || "0";
|
|
|
|
- training.trainingSpeed = trainingContent.practiceSpeed;
|
|
|
|
- training.start = Number(trainingContent.practiceChapterBegin);
|
|
|
|
- training.end = Number(trainingContent.practiceChapterEnd);
|
|
|
|
|
|
+ training.times = workeData.times || 0;
|
|
|
|
+ training.trainingTimes = workeData.trainingTimes || 0;
|
|
|
|
+ training.trainingSpeed = workeData.trainingSpeed;
|
|
|
|
+ training.start = Number(workeData.start);
|
|
|
|
+ training.end = Number(workeData.end);
|
|
state.userChooseEndIndex = training.end
|
|
state.userChooseEndIndex = training.end
|
|
if (training.isAddOk === 0) {
|
|
if (training.isAddOk === 0) {
|
|
// 设置小节
|
|
// 设置小节
|
|
@@ -60,9 +56,9 @@ export default defineComponent({
|
|
};
|
|
};
|
|
|
|
|
|
const getWorkDetail = async () => {
|
|
const getWorkDetail = async () => {
|
|
- const res = await api_lessonTrainingTrainingStudentDetail(props.workeData.id);
|
|
|
|
|
|
+ const res = await api_lessonTrainingTrainingStudentDetail(props.workeData.id, 'homeWork');
|
|
if (res?.code === 200) {
|
|
if (res?.code === 200) {
|
|
- training.trainingTimes = (res.data.trainingTimes / 60).toFixed(1) || "0";
|
|
|
|
|
|
+ training.trainingTimes = res.data.trainingTimes || 0;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -71,9 +67,8 @@ export default defineComponent({
|
|
let total = Math.ceil((Date.now() - training.starTime) / 1000);
|
|
let total = Math.ceil((Date.now() - training.starTime) / 1000);
|
|
try {
|
|
try {
|
|
const res = await api_lessonTrainingSubmitTraining({
|
|
const res = await api_lessonTrainingSubmitTraining({
|
|
- id: props.workeData.id,
|
|
|
|
- trainingTimes: total,
|
|
|
|
- });
|
|
|
|
|
|
+ id: props.workeData.id
|
|
|
|
+ }, 'homeWork');
|
|
if (res?.code == 200) {
|
|
if (res?.code == 200) {
|
|
getWorkDetail();
|
|
getWorkDetail();
|
|
}
|
|
}
|
|
@@ -107,7 +102,7 @@ export default defineComponent({
|
|
})
|
|
})
|
|
return () => (
|
|
return () => (
|
|
<div class={styles.homework}>
|
|
<div class={styles.homework}>
|
|
- {training.trainingTimes} / {training.times} 分钟
|
|
|
|
|
|
+ {training.trainingTimes} / {training.times} 次
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
},
|
|
},
|