user1
2024-06-13 59b7c7975f7ee38fc5a048a6b63cdaf9312908ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!-- 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>