<!-- eslint-disable no-irregular-whitespace -->
|
<template>
|
<div class="chapter" num="2">
|
|
|
</div>
|
</template>
|
<script>
|
export default {
|
name: "chapter-2",
|
props: {
|
showPageList: {
|
type: Array,
|
},
|
questionData: {
|
type: Object,
|
},
|
isSearch: {
|
type: Boolean,
|
default: false,
|
},
|
},
|
data() {
|
return {
|
isShowScore1: false,
|
isShowScore2: false,
|
isShowScore3: false,
|
isShowScore4: false,
|
chapter002: {
|
isShowXyx01: true,
|
isShowXyx02: true,
|
isShowXyx03: true,
|
isShowXyx04: true,
|
isShowXyx05: true,
|
isShowXyx06: true,
|
isShowXyx07: true,
|
isShowXyx08: true,
|
isShowXyx09: true,
|
isShowXyx10: true,
|
isShowXyx11: true,
|
score1: 0,
|
score2: 0,
|
score3: 0,
|
score4: 0,
|
tablexyx1: {},
|
tablexyx02: {
|
text2: "第一次跑,感觉有点儿累,很枯燥",
|
text6: "和同学一起跑,很开心,感觉没那么累了",
|
text10: "下雨,明天补上",
|
},
|
tablebyb1: {},
|
tablecyc2: {},
|
tablecyc3: {},
|
tablecyc4: {},
|
tablecyc5: {},
|
tkItem01: {},
|
tkItem02: {},
|
},
|
};
|
},
|
created() {
|
const localData = JSON.parse(localStorage.getItem("chapter002"));
|
if (localData) {
|
this.chapter002 = { ...Object.assign(this.chapter002, localData) };
|
}
|
},
|
methods: {
|
readText(val) {
|
const textContent = (
|
this.container ? this.container : document
|
).getElementById(val);
|
const data = {
|
type: "readText",
|
data: textContent.innerText,
|
};
|
console.log(data.data);
|
this.$emit("eventPublic", data);
|
},
|
activityXyx1() {
|
this.chapter002.isShowXyx01 = !this.chapter002.isShowXyx01;
|
},
|
activityXyx2() {
|
this.chapter002.isShowXyx02 = !this.chapter002.isShowXyx02;
|
},
|
activityXyx3() {
|
this.chapter002.isShowXyx03 = !this.chapter002.isShowXyx03;
|
},
|
activityXyx4() {
|
this.chapter002.isShowXyx04 = !this.chapter002.isShowXyx04;
|
},
|
activityXyx5() {
|
this.chapter002.isShowXyx05 = !this.chapter002.isShowXyx05;
|
},
|
activityXyx6() {
|
this.chapter002.isShowXyx06 = !this.chapter002.isShowXyx06;
|
},
|
activityXyx7() {
|
this.chapter002.isShowXyx07 = !this.chapter002.isShowXyx07;
|
},
|
activityXyx8() {
|
this.chapter002.isShowXyx08 = !this.chapter002.isShowXyx08;
|
},
|
activityXyx9() {
|
this.chapter002.isShowXyx09 = !this.chapter002.isShowXyx09;
|
},
|
activityXyx10() {
|
this.chapter002.isShowXyx10 = !this.chapter002.isShowXyx10;
|
},
|
activityXyx11() {
|
this.chapter002.isShowXyx11 = !this.chapter002.isShowXyx11;
|
},
|
submit(val) {
|
if (val == 1) this.isShowScore1 = true;
|
if (val == 2) this.isShowScore2 = true;
|
if (val == 3) this.isShowScore3 = true;
|
if (val == 4) this.isShowScore4 = true;
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
resetData(val) {
|
const localData = JSON.parse(localStorage.getItem("chapter002"));
|
if (localData) {
|
if (val == 1) localData.tablexyx1 = {};
|
this.isShowScore1 = false;
|
localData.score1 = 0;
|
if (val == 2) localData.tablecyc2 = {};
|
this.isShowScore2 = false;
|
localData.score2 = 0;
|
if (val == 3) localData.tablecyc3 = {};
|
this.isShowScore3 = false;
|
localData.score3 = 0;
|
if (val == 4) localData.tablecyc4 = {};
|
this.isShowScore4 = false;
|
localData.score4 = 0;
|
this.chapter002 = { ...Object.assign(this.chapter002, localData) };
|
}
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changeBox(e, val) {
|
this.isShowScore1 = false;
|
this.chapter002.tablexyx1[val] = e.target.checked;
|
if (e.target.checked) {
|
this.chapter002.score1 += Number(e.target.value);
|
} else {
|
if (this.chapter002.score1 == 0) {
|
return false;
|
}
|
if (!e.target.checked) {
|
this.chapter002.score1 -= Number(e.target.value);
|
}
|
}
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changeByb(e, val) {
|
this.chapter002.tablebyb1[val] = e.target.checked;
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changecyc2(e, val) {
|
this.isShowScore2 = false;
|
this.chapter002.tablecyc2[val] = e.target.checked;
|
if (e.target.checked) {
|
this.chapter002.score2 += Number(e.target.value);
|
} else {
|
if (this.chapter002.score2 == 0) {
|
return false;
|
}
|
if (!e.target.checked) {
|
this.chapter002.score2 -= Number(e.target.value);
|
}
|
}
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changecyc3(e, val) {
|
this.isShowScore3 = false;
|
this.chapter002.tablecyc3[val] = e.target.checked;
|
if (e.target.checked) {
|
this.chapter002.score3 += Number(e.target.value);
|
} else {
|
if (this.chapter002.score3 == 0) {
|
return false;
|
}
|
if (!e.target.checked) {
|
this.chapter002.score3 -= Number(e.target.value);
|
}
|
}
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changecyc4(e, val, type) {
|
this.isShowScore4 = false;
|
this.chapter002.tablecyc4[val] = e.target.checked;
|
if (e.target.checked && type != "isReverse") {
|
this.chapter002.score4 += Number(e.target.value);
|
} else if (e.target.checked && type == "isReverse") {
|
let s = 5 - Number(e.target.value);
|
this.chapter002.score4 += s;
|
} else {
|
if (this.chapter002.score4 == 0) {
|
return false;
|
}
|
if (!e.target.checked) {
|
this.chapter002.score4 -= Number(e.target.value);
|
}
|
}
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changecyc5(e, val) {
|
this.chapter002.tablecyc5[val] = e.target.checked;
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changeAssess(e, val) {
|
this.chapter002.tkItem01[val] = e.target.value;
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changeAssess02(e, val) {
|
this.chapter002.tkItem02[val] = e.target.value;
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
changeFinish(e, val) {
|
this.chapter002.tablexyx02[val] = e.target.value;
|
localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
|
},
|
},
|
};
|
</script>
|