|
@@ -710,52 +710,88 @@ const updateReduction = () => {
|
|
|
|
|
|
const getDate = async (id) => {
|
|
const getDate = async (id) => {
|
|
// currentData
|
|
// currentData
|
|
- let dataList = []
|
|
|
|
- getUpdateCourseId.value = id
|
|
|
|
- let m = currentData.value
|
|
|
|
- await top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/selectCourseDetailSz", [id], function (res) {
|
|
|
|
- console.log(res)
|
|
|
|
- if (res.value[0].length > 0 && res.value[0][0].chapters.length > 0) {
|
|
|
|
- let datachapters = JSON.parse(res.value[0][0].chapters)
|
|
|
|
|
|
+ let dataList = [];
|
|
|
|
+
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/selectCourseDetailSz", [id], function (res) {
|
|
|
|
+ console.log(res);
|
|
|
|
+ if (!res || !res.value || res.value[0].length === 0 || res.value[0][0].chapters.length === 0) {
|
|
|
|
+ reject(new Error("Invalid response or no chapters found"));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const datachapters = JSON.parse(res.value[0][0].chapters);
|
|
|
|
+
|
|
for (let i = 0; i < datachapters.length; i++) {
|
|
for (let i = 0; i < datachapters.length; i++) {
|
|
- let data = datachapters[i]
|
|
|
|
|
|
+ const data = datachapters[i];
|
|
for (let j = 0; j < data.chapterInfo.length; j++) {
|
|
for (let j = 0; j < data.chapterInfo.length; j++) {
|
|
- let dataChapterInfo = data.chapterInfo[j]
|
|
|
|
|
|
+ const dataChapterInfo = data.chapterInfo[j];
|
|
for (let k = 0; k < dataChapterInfo.taskJson.length; k++) {
|
|
for (let k = 0; k < dataChapterInfo.taskJson.length; k++) {
|
|
- let DatahapterData = dataChapterInfo.taskJson[k]
|
|
|
|
|
|
+ const DatahapterData = dataChapterInfo.taskJson[k];
|
|
for (let l = 0; l < DatahapterData.chapterData.length; l++) {
|
|
for (let l = 0; l < DatahapterData.chapterData.length; l++) {
|
|
- let obj = DatahapterData.chapterData[l]
|
|
|
|
- // let obj = chapterDatas
|
|
|
|
- obj.checked = false
|
|
|
|
- dataList.push(obj)
|
|
|
|
|
|
+ const obj = DatahapterData.chapterData[l];
|
|
|
|
+ obj.checked = false;
|
|
|
|
+ dataList.push(obj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- }, [], { "type": "POST", "withCredentials": true });
|
|
|
|
|
|
|
|
- await m.xia.map(x => {
|
|
|
|
- if (x.dataId == id) {
|
|
|
|
- x.dataList = dataList
|
|
|
|
- }
|
|
|
|
- return x
|
|
|
|
|
|
+ resolve(dataList);
|
|
|
|
+ }, [], { "type": "POST", "withCredentials": true });
|
|
})
|
|
})
|
|
|
|
+ .then((dataList) => {
|
|
|
|
+ getUpdateCourse(dataList, id);
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.error("Error fetching data:", error);
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const getUpdateCourse = async (dataList, id) => {
|
|
|
|
+ let m = currentData.value
|
|
|
|
+
|
|
|
|
+ if (volumes.value) {
|
|
|
|
+ await m.shang.map(x => {
|
|
|
|
+ if (x.dataId == id) {
|
|
|
|
+ x.dataList = dataList
|
|
|
|
+ }
|
|
|
|
+ return x
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ await m.xia.map(x => {
|
|
|
|
+ if (x.dataId == id) {
|
|
|
|
+ x.dataList = dataList
|
|
|
|
+ }
|
|
|
|
+ return x
|
|
|
|
+ })
|
|
|
|
+ }
|
|
currentData.value = m
|
|
currentData.value = m
|
|
- // console.log("currentData", currentData)
|
|
|
|
|
|
+ getUpdateCourseId.value = id
|
|
}
|
|
}
|
|
|
|
|
|
const checkedAll = (id) => {
|
|
const checkedAll = (id) => {
|
|
let data = currentData.value
|
|
let data = currentData.value
|
|
- data.xia.map(x => {
|
|
|
|
- if (x.dataId == id) {
|
|
|
|
- x.dataList.map(y => {
|
|
|
|
- y.checked = !checked1.value
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- return x
|
|
|
|
- })
|
|
|
|
- console.log(id, checked1.value)
|
|
|
|
|
|
+
|
|
|
|
+ if (volumes.value) {
|
|
|
|
+ data.shang.map(x => {
|
|
|
|
+ if (x.dataId == id) {
|
|
|
|
+ x.dataList.map(y => {
|
|
|
|
+ y.checked = !checked1.value
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ return x
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ data.xia.map(x => {
|
|
|
|
+ if (x.dataId == id) {
|
|
|
|
+ x.dataList.map(y => {
|
|
|
|
+ y.checked = !checked1.value
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ return x
|
|
|
|
+ })
|
|
|
|
+ }
|
|
console.log(data)
|
|
console.log(data)
|
|
currentData.value = data
|
|
currentData.value = data
|
|
// checked1.value = true
|
|
// checked1.value = true
|
|
@@ -792,17 +828,29 @@ const downloadCourseOne = (url, fileName) => {
|
|
const DownloadProcessing = async () => {
|
|
const DownloadProcessing = async () => {
|
|
let data = currentData.value
|
|
let data = currentData.value
|
|
let urls = []
|
|
let urls = []
|
|
- await data.xia.map(x => {
|
|
|
|
- console.log(x)
|
|
|
|
- x.dataList.length > 0 && x.dataList.map(m => {
|
|
|
|
- if (m.checked) {
|
|
|
|
- urls.push(m)
|
|
|
|
- }
|
|
|
|
- return m
|
|
|
|
|
|
+ if (volumes.value) {
|
|
|
|
+ await data.shang.map(x => {
|
|
|
|
+ // console.log(x)
|
|
|
|
+ x.dataList.length > 0 && x.dataList.map(m => {
|
|
|
|
+ if (m.checked) {
|
|
|
|
+ urls.push(m)
|
|
|
|
+ }
|
|
|
|
+ return m
|
|
|
|
+ })
|
|
|
|
+ return x
|
|
})
|
|
})
|
|
- return x
|
|
|
|
- })
|
|
|
|
- console.log("urls", urls)
|
|
|
|
|
|
+ } else {
|
|
|
|
+ await data.xia.map(x => {
|
|
|
|
+ // console.log(x)
|
|
|
|
+ x.dataList.length > 0 && x.dataList.map(m => {
|
|
|
|
+ if (m.checked) {
|
|
|
|
+ urls.push(m)
|
|
|
|
+ }
|
|
|
|
+ return m
|
|
|
|
+ })
|
|
|
|
+ return x
|
|
|
|
+ })
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
console.log("urls", [user.user.userid, getUpdateCourseId.value, '4', urls.length])
|
|
console.log("urls", [user.user.userid, getUpdateCourseId.value, '4', urls.length])
|
|
top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, getUpdateCourseId.value, '4', urls.length], function (res) {
|
|
top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, getUpdateCourseId.value, '4', urls.length], function (res) {
|