| | |
| | | props: { |
| | | cardList: { |
| | | type: Array, |
| | | default: [], |
| | | }, |
| | | primaryColor: { |
| | | type: String, |
| | |
| | | cardData:[] |
| | | }; |
| | | }, |
| | | inject:['changeQuestionData'], |
| | | mounted() { |
| | | this.cardData = this.cardList |
| | | }, |
| | | computed:{ |
| | | cardLists() { |
| | | return this.props.cardList |
| | | } |
| | | console.log('this.cardList',this.cardList); |
| | | console.log('this.cardData',this.cardData); |
| | | }, |
| | | methods: { |
| | | // 数组转为字符串方法 |
| | |
| | | } |
| | | }, |
| | | redo() { |
| | | for (let index = 0; index < this.cardList.length; index++) { |
| | | const item = this.cardList[index]; |
| | | for (let index = 0; index < this.cardData.length; index++) { |
| | | const item = this.cardData[index]; |
| | | for (let cindex = 0; cindex < item.infoList.length; cindex++) { |
| | | const citem = item.infoList[cindex]; |
| | | citem.userAnswer = ""; |
| | | citem.isComplete = false; |
| | | } |
| | | } |
| | | console.log('重做',this.cardList); |
| | | }, |
| | | openAnswers() { |
| | | this.$data.loading = true; |
| | | for (let index = 0; index < this.cardList.length; index++) { |
| | | const item = this.cardList[index]; |
| | | for (let index = 0; index < this.cardData.length; index++) { |
| | | const item = this.cardData[index]; |
| | | for (let cindex = 0; cindex < item.infoList.length; cindex++) { |
| | | const citem = item.infoList[cindex]; |
| | | citem.isComplete = true; |
| | |
| | | }, |
| | | // 批改题目 (练习,我的做题,我的收藏模式下) |
| | | handleQuestion() { |
| | | const list = this.$props.cardList; |
| | | const list = this.cardData; |
| | | for (let index = 0; index < list.length; index++) { |
| | | const item = list[index]; |
| | | for (let cindex = 0; cindex < item.infoList.length; cindex++) { |
| | |
| | | } |
| | | } |
| | | } |
| | | this.$props.cardList = list; |
| | | console.log(this.$props.cardList); |
| | | this.cardData = list; |
| | | console.log(this.cardData); |
| | | }, |
| | | getParentWithClass(element, className) { |
| | | while (element.parentElement) { |
| | |
| | | ); |
| | | let oldData = oldAnswerData ? JSON.parse(oldAnswerData) : {}; |
| | | const asnwerList = []; |
| | | for (let index = 0; index < this.$props.cardList.length; index++) { |
| | | const item = this.$props.cardList[index]; |
| | | for (let index = 0; index < this.cardData.length; index++) { |
| | | const item = this.cardData[index]; |
| | | for (let cindex = 0; cindex < item.infoList.length; cindex++) { |
| | | const citem = item.infoList[cindex]; |
| | | asnwerList.push({ |
| | |
| | | } |
| | | } |
| | | if(oldData[pageNum]) { |
| | | oldData[pageNum].push(asnwerList) |
| | | oldData[pageNum] = oldData[pageNum].filter(citem => asnwerList.findIndex(ditem => ditem.id == citem.id) == -1 ) |
| | | oldData[pageNum].push(...asnwerList) |
| | | } else { |
| | | oldData[pageNum] = asnwerList |
| | | } |