|
@@ -36,9 +36,6 @@ export default {
|
|
|
bookStatus: {
|
|
bookStatus: {
|
|
|
default: 'online',
|
|
default: 'online',
|
|
|
},
|
|
},
|
|
|
- tempDir: {
|
|
|
|
|
- default: '',
|
|
|
|
|
- },
|
|
|
|
|
getCoursewareId: {},
|
|
getCoursewareId: {},
|
|
|
},
|
|
},
|
|
|
props: ['exercise_id', 'feed_back'],
|
|
props: ['exercise_id', 'feed_back'],
|
|
@@ -100,22 +97,16 @@ export default {
|
|
|
},
|
|
},
|
|
|
async handleData() {
|
|
async handleData() {
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
- if (this.bookStatus() === 'offline') {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (this.readFileContent) {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
- if (this.readFileContent()) {
|
|
|
|
|
- const content = await window.fileAPI.readZipFilesync(
|
|
|
|
|
- `${this.tempDir}/courseware`,
|
|
|
|
|
- `EX_${this.getCoursewareId()}/${this.exercise_id}`,
|
|
|
|
|
- );
|
|
|
|
|
- const text = new TextDecoder().decode(content);
|
|
|
|
|
- try {
|
|
|
|
|
- const res = JSON.parse(text);
|
|
|
|
|
- this.content = res.content_exercise;
|
|
|
|
|
- this.title = res.content_title;
|
|
|
|
|
- this.typeValue = res.content_exercise ? JSON.parse(res.content_exercise).type : '';
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- this.$message.warning('获取练习题数据失败');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const content = this.readFileContent(`EX_${this.getCoursewareId()}/${this.exercise_id}`, 'courseware');
|
|
|
|
|
+ if (content) {
|
|
|
|
|
+ this.content = content.content_exercise;
|
|
|
|
|
+ this.title = content.content_title;
|
|
|
|
|
+ this.typeValue = content.content_exercise ? JSON.parse(content.content_exercise).type : '';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.warning('获取练习题数据失败');
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
let data = {
|
|
let data = {
|