diff --git a/pages_teacher/teacher_teachers/components/audiology.vue b/pages_teacher/teacher_teachers/components/audiology.vue
index fc50646..d25bd45 100644
--- a/pages_teacher/teacher_teachers/components/audiology.vue
+++ b/pages_teacher/teacher_teachers/components/audiology.vue
@@ -9,36 +9,42 @@
-
+
{{TextItem.name}}
-
+
-
-
+
+
{{partitem.name}}
-
+
- {{quesitem.typeText}}
+ {{quesitem.number}} {{quesitem.typeText}}
-
+
@@ -59,6 +65,7 @@
itemActive: {},
image: true,
tk: null,
+ selectwrite: [],
}
},
@@ -66,78 +73,165 @@
this.hearing()
},
methods: {
- // 听力调取接口渲染
+ updatawrite(data){
+ this.selectwrite=data
+
+ },
hearing() {
- this.$u.get('https://api.admin-v2.langsi.online/admin-api/ielts/paper/list', {
- classify: 1
- }).then(res => {
- this.listHearing = res.data
- let activeindex = {}
- let arr = res.data
- for (let parper of arr) {
- let test = parper.tests[0]
- activeindex[parper.id] = 0
- }
- this.itemActive = activeindex
- })
+ this.$u
+ .get("https://api.admin-v2.langsi.online/admin-api/ielts/paper/list", {
+ classify: 1,
+ })
+ .then((res) => {
+ this.listHearing = res.data;
+ let activeindex = {};
+ let arr = res.data;
+ for (let parper of arr) {
+ let test = parper.tests[0];
+ activeindex[parper.id] = 0;
+ }
+ this.itemActive = activeindex;
+ this.updateSubsetsInListHearing()
+ console.log(this.listHearing, "this.itemActivethis.itemActive");
+ });
},
- // 听力test点击事件
Bages_addActive(TextIndex, id) {
- this.itemActive[id] = TextIndex
- this.$forceUpdate()
+ this.itemActive[id] = TextIndex;
+ this.$forceUpdate();
},
- // 点击变化图表
icon(id) {
- this.image = !this.image
- this.tk = id
+ this.image = !this.image;
+ this.tk = id;
if (this.image == false) {
- this.tk = id
- }else {
- this.tk = null
+ this.tk = id;
+ } else {
+ this.tk = null;
}
},
- checkboxChange(parat, e) {
+ checkboxChange(partitem, e) {
if (e.value) {
- this.checked.push(parat.id)
- const allItemsNoSubsets = parat.modules.every(item => !('subsets' in item));
- parat.modules.forEach(item=>{
- this.$set(item, 'subsets', item.id);
- item.subsets = item.id;
- this.subsets.push(item.id)
- console.log( item.subsets)
- })
-
+ this.listHearing.forEach((paper) => {
+ paper.tests.forEach((test, testIndex) => {
+ test.parts.forEach((part) => {
+ if (part.id === partitem.id) {
+ part.modules.forEach((quesitem, quesIndex) => {
+ this.addToSelectWrite(
+ quesitem,
+ partitem.id,
+ testIndex + 1,
+ paper.title
+ );
+ });
+ }
+ });
+ });
+ });
} else {
- let index = this.checked.indexOf(parat.id);
- if (index !== -1) {
- this.checked.splice(index, 1);
- parat.modules.forEach(item=>{
- this.$delete(item, 'subsets');
- const index = this.subsets.indexOf(item.id);
- if (index !== -1) {
- this.subsets.splice(index, 1);
- }
- })
-
- }
+ partitem.modules.forEach((quesitem) => {
+ this.removeFromSelectWrite(quesitem.id);
+ });
}
- console.log(this.checked,'part数组')
- this.$forceUpdate()
+ this.$forceUpdate();
+ console.log(this.selectwrite, "selectwriteselectwrite");
+ console.log(this.listHearing, "this.listHearing");
+ // 在这里执行额外的操作,遍历 selectwrite 中的每一项,更新 listHearing 中的 subsets
+ this.updateSubsetsInListHearing();
+ this.$parent.updatalisten(this.selectwrite)
},
- checkoutzj(quesitem, id) {
- if (id.value) {
- this.subsets.push(quesitem.id)
- console.log(quesitem)
- } else {
- let index2 = this.subsets.indexOf(quesitem.id);
- if (index2 !== -1) {
- this.subsets.splice(index2, 1);
- }
+ handleCheckboxChange(quesitems) {
+ const existingIndex = this.selectwrite.findIndex(item => item.id === quesitems.id);
+
+ if (existingIndex !== -1) {
+ // 如果已存在,将 subsets 设为 false,并清除该项
+ this.selectwrite.splice(existingIndex, 1);
+ quesitems.subsets = false;
+ } else {
+ // 如果不存在,添加该项,并将 subsets 设为 true
+ this.listHearing.forEach((paper) => {
+ paper.tests.forEach((test, testIndex) => {
+ test.parts.forEach((part) => {
+ part.modules.forEach((quesitem, quesIndex) => {
+ if (quesitem.id == quesitems.id) {
+ this.addToSelectWrite(
+ quesitems,
+ quesitems.id, // 使用 quesitem 的 id
+ testIndex + 1, // 使用内层循环的 testIndex
+ paper.title // 使用 quesitem 的 paperTitle
+ );
+ }
+ });
+ });
+ });
+ });
+ quesitems.subsets = true;
+ }
+
+ console.log(this.selectwrite, 'selectwriteselectwrite');
+ this.updateSubsetsInListHearing()
+ this.$parent.updatalisten(this.selectwrite)
+ },
+
+
+
+ // 在这里添加一个新的方法,用于更新 listHearing 中的 subsets
+ updateSubsetsInListHearing() {
+ this.listHearing.forEach((paper) => {
+ paper.tests.forEach((test) => {
+ test.parts.forEach((part) => {
+ part.modules.forEach((quesitem) => {
+ const selected = this.selectwrite.find((item) => {
+ return item.id === quesitem.id;
+ });
+ if (selected) {
+ quesitem.subsets = true;
+ } else {
+ quesitem.subsets = false;
+ }
+ });
+ });
+ });
+ });
+
+ // 额外的逻辑,遍历 listHearing 中的每一个 part,判断是否全部 modules 的 subsets 都为 true
+ this.listHearing.forEach((paper) => {
+ paper.tests.forEach((test) => {
+ test.parts.forEach((part) => {
+ part.checked = part.modules.every((quesitem) => quesitem.subsets);
+ });
+ });
+ });
+ },
+
+ // 添加信息到selectwrite数组
+ addToSelectWrite(quesitem, partId, testIndex, paperTitle) {
+ // Split the guideText into words
+ const words = quesitem.guideText.split(/\s+/);
+
+ // Take the first five words excluding "Complete"
+ const questionname = words.slice(0, 5).filter(word => word !== "Complete").join(' ');
+
+ const item = {
+ id: quesitem.id,
+ paperId: quesitem.paperId,
+ papername: paperTitle,
+ partId: partId,
+ testId: quesitem.testId,
+ testname: `Test ${testIndex}`,
+ typeName: quesitem.typeText,
+ questionname: questionname,
+ };
+
+ this.selectwrite.push(item);
+ },
+
+ removeFromSelectWrite(itemId) {
+ const index = this.selectwrite.findIndex((item) => item.id === itemId);
+ if (index !== -1) {
+ this.selectwrite.splice(index, 1);
}
- console.log(this.subsets,'题型数组')
- }
- }
+ },
+ },
}
@@ -200,4 +294,4 @@
height: 20rpx;
margin-right: 10rpx;
}
-
+
\ No newline at end of file
diff --git a/pages_teacher/teacher_teachers/components/compose.vue b/pages_teacher/teacher_teachers/components/compose.vue
index 0bcbe65..9e8cb11 100644
--- a/pages_teacher/teacher_teachers/components/compose.vue
+++ b/pages_teacher/teacher_teachers/components/compose.vue
@@ -71,7 +71,28 @@ export default {
created() {
this.getCompose()
},
+
methods: {
+ updatawrite(data){
+ this.selectwrite=data
+
+ },
+ updateSubsetArr() {
+ // 遍历 this.transformedData 中的每个项
+ for (const item of this.transformedData) {
+ // 遍历 this.selectwrite 中的每个对象
+ for (const selectedItem of this.selectwrite) {
+ const { id, test, task } = selectedItem;
+
+ // 检查 task1 中的 id 是否匹配
+ if (item[test] && item[test][task] && String(item[test][task].id) === id) {
+ this.$set(item[test][task], 'subsetArr', true);
+ } else {
+ this.$set(item[test][task], 'subsetArr', false);
+ }
+ }
+ }
+ },
//写作接口
getCompose() {
this.$u.post('https://api.admin-v2.langsi.online/admin-api/writing/all/search', this.comsapi).then(res => {
@@ -81,8 +102,9 @@ export default {
}
this.transformedData = arr
this.orgtransformedData = JSON.parse(JSON.stringify(arr));
- // let json = JSON.stringify(this.transformedData)
- console.log(this.transformedData, 'this.transformedData');
+ let json = JSON.stringify(this.transformedData)
+ // console.log(json, 'this.transformedData');
+ this.updateSubsetArr()
})
},
textClick(item, text) {
diff --git a/pages_teacher/teacher_teachers/components/reading.vue b/pages_teacher/teacher_teachers/components/reading.vue
index c550597..9196442 100644
--- a/pages_teacher/teacher_teachers/components/reading.vue
+++ b/pages_teacher/teacher_teachers/components/reading.vue
@@ -9,36 +9,42 @@
-
+
{{TextItem.name}}
-
+
-
-
+
+
{{partitem.name}}
-
+
- {{quesitem.typeText}}
+ {{quesitem.number}}{{quesitem.typeText}}
-
+
@@ -59,6 +65,7 @@
itemActive: {},
image: true,
tk: null,
+ selectwrite: [],
}
},
@@ -66,6 +73,10 @@
this.hearing()
},
methods: {
+ updatawrite(data){
+ this.selectwrite=data
+
+ },
// 听力调取接口渲染
hearing() {
this.$u.get('https://api.admin-v2.langsi.online/admin-api/ielts/paper/list', {
@@ -79,6 +90,7 @@
activeindex[parper.id] = 0
}
this.itemActive = activeindex
+ this.updateSubsetsInListHearing()
})
},
// 听力test点击事件
@@ -92,51 +104,128 @@
this.tk = id
if (this.image == false) {
this.tk = id
- }else {
+ } else {
this.tk = null
}
},
- checkboxChange(parat, e) {
+ checkboxChange(partitem, e) {
if (e.value) {
- this.checked.push(parat.id)
- const allItemsNoSubsets = parat.modules.every(item => !('subsets' in item));
- parat.modules.forEach(item=>{
- this.$set(item, 'subsets', item.id);
- item.subsets = item.id;
- this.subsets.push(item.id)
- console.log( item.subsets)
- })
-
+ this.listHearing.forEach((paper) => {
+ paper.tests.forEach((test, testIndex) => {
+ test.parts.forEach((part) => {
+ if (part.id === partitem.id) {
+ part.modules.forEach((quesitem, quesIndex) => {
+ this.addToSelectWrite(
+ quesitem,
+ partitem.id,
+ testIndex + 1,
+ paper.title
+ );
+ });
+ }
+ });
+ });
+ });
} else {
- let index = this.checked.indexOf(parat.id);
- if (index !== -1) {
- this.checked.splice(index, 1);
- parat.modules.forEach(item=>{
- this.$delete(item, 'subsets');
- const index = this.subsets.indexOf(item.id);
- if (index !== -1) {
- this.subsets.splice(index, 1);
- }
- })
-
- }
+ partitem.modules.forEach((quesitem) => {
+ this.removeFromSelectWrite(quesitem.id);
+ });
}
- console.log(this.checked,'part数组')
- this.$forceUpdate()
+ this.$forceUpdate();
+
+ // 在这里执行额外的操作,遍历 selectwrite 中的每一项,更新 listHearing 中的 subsets
+ this.updateSubsetsInListHearing();
+ this.$parent.updataread(this.selectwrite)
},
- checkoutzj(quesitem, id) {
- if (id.value) {
- this.subsets.push(quesitem.id)
- console.log(quesitem)
+ handleCheckboxChange(quesitems) {
+ const existingIndex = this.selectwrite.findIndex(item => item.id === quesitems.id);
+
+ if (existingIndex !== -1) {
+ // 如果已存在,将 subsets 设为 false,并清除该项
+ this.selectwrite.splice(existingIndex, 1);
+ quesitems.subsets = false;
} else {
- let index2 = this.subsets.indexOf(quesitem.id);
- if (index2 !== -1) {
- this.subsets.splice(index2, 1);
- }
+ // 如果不存在,添加该项,并将 subsets 设为 true
+ this.listHearing.forEach((paper) => {
+ paper.tests.forEach((test, testIndex) => {
+ test.parts.forEach((part) => {
+ part.modules.forEach((quesitem, quesIndex) => {
+ if (quesitem.id == quesitems.id) {
+ this.addToSelectWrite(
+ quesitems,
+ quesitems.id, // 使用 quesitem 的 id
+ testIndex + 1, // 使用内层循环的 testIndex
+ paper.title // 使用 quesitem 的 paperTitle
+ );
+ }
+ });
+ });
+ });
+ });
+ quesitems.subsets = true;
}
- console.log(this.subsets,'题型数组')
- }
+
+ console.log(this.selectwrite, 'selectwriteselectwrite');
+ this.updateSubsetsInListHearing()
+ this.$parent.updataread(this.selectwrite)
+ },
+
+
+
+ // 在这里添加一个新的方法,用于更新 listHearing 中的 subsets
+ updateSubsetsInListHearing() {
+ this.listHearing.forEach((paper) => {
+ paper.tests.forEach((test) => {
+ test.parts.forEach((part) => {
+ part.modules.forEach((quesitem) => {
+ const selected = this.selectwrite.find((item) => {
+ return item.id === quesitem.id;
+ });
+ if (selected) {
+ quesitem.subsets = true;
+ } else {
+ quesitem.subsets = false;
+ }
+ });
+ });
+ });
+ });
+
+ // 额外的逻辑,遍历 listHearing 中的每一个 part,判断是否全部 modules 的 subsets 都为 true
+ this.listHearing.forEach((paper) => {
+ paper.tests.forEach((test) => {
+ test.parts.forEach((part) => {
+ part.checked = part.modules.every((quesitem) => quesitem.subsets);
+ });
+ });
+ });
+ },
+
+ // 添加信息到selectwrite数组
+ addToSelectWrite(quesitem, partId, testIndex, paperTitle) {
+ // Split the guideText into words
+
+ const item = {
+ id: quesitem.id,
+ paperId: quesitem.paperId,
+ papername: paperTitle,
+ partId: partId,
+ testId: quesitem.testId,
+ testname: `Test ${testIndex}`,
+ typeName: quesitem.typeText,
+ questionname: quesitem.number,
+ };
+
+ this.selectwrite.push(item);
+ },
+
+ removeFromSelectWrite(itemId) {
+ const index = this.selectwrite.findIndex((item) => item.id === itemId);
+ if (index !== -1) {
+ this.selectwrite.splice(index, 1);
+ }
+ },
}
}
@@ -200,4 +289,4 @@
height: 20rpx;
margin-right: 10rpx;
}
-
+
\ No newline at end of file
diff --git a/pages_teacher/teacher_teachers/teacher_addOperation.vue b/pages_teacher/teacher_teachers/teacher_addOperation.vue
index 8ed530b..350d9a2 100644
--- a/pages_teacher/teacher_teachers/teacher_addOperation.vue
+++ b/pages_teacher/teacher_teachers/teacher_addOperation.vue
@@ -118,73 +118,94 @@
作业安排
-
- IELTS 18
+
+
+
+
+ {{item.papername}}
+ style="background-color: #fff; padding: 32rpx 40rpx;border-radius: 20rpx 20rpx 20rpx 20rpx;">
-
+
-
-
- Test 2
-
- 听力
-
+
+
+ {{items.testname}}
+
+ 阅读
+
+
- Part 1:多选题
-
-
-
-
-
-
-
-
-
- Test 2
-
- 听力
-
-
-
- Part 1:多选题
-
-
-
-
-
-
-
-
-
- Test 2
-
- 听力
-
-
-
- Part 1:多选题
+ {{items.questionname}} {{items.typeName}}
+
-
- {{item.examName}}
-
-
-
- {{items.test}}
- 写作
+
+
+ {{item.papername}}
+
+
+
+
+
+
+
+ {{items.testname}}
+
+ 听力
+
+
+
+
+ {{items.questionname}} {{items.typeName}}
+
+
+
+
+
+
-
- {{items.task}}
+
+
+
+
+ {{item.examName}}
+
+
+
+
+
+
+
+ {{items.test}}
+
+ 写作
+
+
+
+ {{items.task}}
+
+
+
+
+
+
@@ -317,7 +338,9 @@ export default {
selectwrite: [],
selectlisten: [],
selectread: [],
- selectwritelist: []
+ selectwritelist: [],
+ selectlistenlist: [],
+ selectreadlist: [],
}
},
@@ -365,8 +388,8 @@ export default {
this.selectwrite = selectforwork.selectwrite
this.selectlisten = selectforwork.selectlisten
this.selectread = selectforwork.selectread
- this.selectwrite = selectforwork.selectwrite;
-
+ // this.selectwrite = selectforwork.selectwrite;
+ //处理写作数据
const groupedItems = {};
this.selectwrite.forEach(item => {
@@ -385,11 +408,66 @@ export default {
id: item.id
});
});
-
- // Convert groupedItems object to an array
+
+
this.selectwritelist = Object.values(groupedItems);
+ //处理听力数据
+ const groupedItems1 = {};
+
+ this.selectlisten.forEach(item => {
+ const papername = item.papername;
+
+ if (!groupedItems1[papername]) {
+ groupedItems1[papername] = {
+ papername: papername,
+ message: []
+ };
+ }
+
+ groupedItems1[papername].message.push({
+ id: item.id,
+ paperId: item.paperId,
+ // papername: paperTitle,
+ partId: item.partId,
+ testId: item.testId,
+ testname: item.testname,
+ typeName: item.typeName,
+ questionname:item. questionname,
+ });
+ });
+
+ // Convert groupedItems object to an array
+ this.selectlistenlist = Object.values(groupedItems1);
+
+ const groupedItems2 = {};
+
+ this.selectread.forEach(item => {
+ const papername = item.papername;
+
+ if (!groupedItems2[papername]) {
+ groupedItems2[papername] = {
+ papername: papername,
+ message: []
+ };
+ }
+
+ groupedItems2[papername].message.push({
+ id: item.id,
+ paperId: item.paperId,
+ // papername: paperTitle,
+ partId: item.partId,
+ testId: item.testId,
+ testname: item.testname,
+ typeName: item.typeName,
+ questionname:item. questionname,
+ });
+ });
+
+ // Convert groupedItems object to an array
+ this.selectreadlist = Object.values(groupedItems2);
- console.log(this.selectwritelist, 'selectwritelist');
+ console.log(this.selectreadlist, 'this.selectread');
+ console.log(this.selectlistenlist, 'this.selectlisten');
// Remove duplicates from this.classinfo
// this.stuinfo = this.stuinfo.filter(item => !selectedstuInfo.some(selectedItem => selectedItem.id === item.id));
@@ -400,52 +478,16 @@ export default {
},
methods: {
- mergeObjectsByExamName(existingArray, newArray) {
- const mergedArray = [];
-
- newArray.forEach(newObj => {
- const existingObjIndex = existingArray.findIndex(existingObj => existingObj.examName === newObj.examName);
-
- if (existingObjIndex !== -1) {
- // 如果存在相同的 examName,则合并对象
- const existingObj = existingArray[existingObjIndex];
- existingObj.message.push({
- test: newObj.test,
- task: newObj.task,
- id: newObj.id,
- // 其他属性...
- });
-
- // 更新数组中的对象
- existingArray[existingObjIndex] = existingObj;
- } else {
- // 如果不存在相同的 examName,则直接添加新对象
- mergedArray.push({
- examName: newObj.examName,
- message: [{
- test: newObj.test,
- task: newObj.task,
- id: newObj.id,
- // 其他属性...
- }],
- // 其他属性...
- });
- }
- });
-
- // 添加 existingArray 中未处理的对象
- existingArray.forEach(existingObj => {
- const existingObjIndex = mergedArray.findIndex(obj => obj.examName === existingObj.examName);
- if (existingObjIndex === -1) {
- mergedArray.push(existingObj);
- }
- });
-
- return mergedArray;
- },
+
addwork() {
+ const dataToSave = {
+ selectspeak: this.selectspeak,
+ selectwrite: this.selectwrite,
+ selectlisten: this.selectlisten,
+ selectread: this.selectread
+ };
uni.navigateTo({
- url: "/pages_teacher/teacher_teachers/teacher_writeadd?classinfo=" + encodeURIComponent(JSON.stringify(this.classinfo))
+ url: "/pages_teacher/teacher_teachers/teacher_writeadd?dataToSave=" + encodeURIComponent(JSON.stringify(dataToSave))
}).then(res => {
}).catch(err => {
diff --git a/pages_teacher/teacher_teachers/teacher_writeadd.vue b/pages_teacher/teacher_teachers/teacher_writeadd.vue
index 95eb75c..b4bb3c5 100644
--- a/pages_teacher/teacher_teachers/teacher_writeadd.vue
+++ b/pages_teacher/teacher_teachers/teacher_writeadd.vue
@@ -226,15 +226,15 @@
-
+
-
+
-
+
@@ -282,7 +282,7 @@ export default {
// 下拉框的v-if布尔值
radioValue: '',
part1: true,
- current: 1,
+ current: 0,
search: true,
listType: [],
idList: [],
@@ -341,16 +341,39 @@ export default {
reading,
compose
},
- created() {
+ onShow() {
this.getList()
},
-
+ onLoad(option) {
+
+ const dataToSave =JSON.parse(decodeURIComponent(option.dataToSave))
+
+ this.selectspeak=dataToSave.selectspeak
+ this.selectwrite=dataToSave.selectwrite
+ this.selectlisten=dataToSave.selectlisten
+ this.selectread=dataToSave.selectread
+
+ this.$refs.compose.updatawrite(this.selectwrite)
+ this.$refs.audiology.updatawrite(this.selectlisten)
+ this.$refs.reading.updatawrite(this.selectread)
+ this.calculateTotalLength()
+ },
methods: {
updatawrite(data){
this.selectwrite=data
console.log(this.selectwrite, ' this.selectwrite this.selectwrite');
this.calculateTotalLength()
},
+ updataread(data){
+ this.selectread=data
+ console.log(this.selectread, ' this.selectwrite this.selectwrite');
+ this.calculateTotalLength()
+ },
+ updatalisten(data){
+ this.selectlisten=data
+ console.log(this.selectlisten, ' this.selectwrite this.selectwrite');
+ this.calculateTotalLength()
+ },
submessage(){
const dataToSave = {
selectspeak: this.selectspeak,