1
1
<template >
2
2
<h1 class =" text-h3 text-sm-h3" >从Electron Class Schedule迁移</h1 >
3
3
4
- <v-file-input
5
- v-model =" file"
6
- label =" 上传配置文件"
7
- @multiple =" false"
8
- @change =" loadFile()"
9
- ></v-file-input >
10
4
<br />
11
5
12
- <v-btn v-if =" isFileLoaded" @click =" convert()" >开始转换</v-btn >
6
+ <v-stepper :items =" ['说明', '上传ECS配置', '转换']" >
7
+ <template v-slot :item .1 >
8
+ <v-card flat >
9
+ <v-card-item >
10
+ <v-card-title >转换说明</v-card-title >
11
+ </v-card-item >
12
+
13
+ <v-card-text >
14
+ 本转换向导将提供将Electron Class Schedule基于JS的配置文件
15
+ (scheduleConfig.js) 转换为ClassIsland档案文件的服务。
16
+ <br />
17
+ 上传您的ECS配置文件 (基于JS),然后点击开始转换。
18
+ <br />
19
+ 转换完成后,ClassIsland档案文件将会自动下载,您可以将其导入到ClassIsland中
20
+ (直接放入Profiles文件夹)。
21
+ </v-card-text >
22
+ </v-card >
23
+ </template >
24
+
25
+ <template v-slot :item .2 >
26
+ <v-card flat >
27
+ <v-card-item >
28
+ <v-card-title >上传ECS配置</v-card-title >
29
+ </v-card-item >
30
+
31
+ <v-card-text >
32
+ 请上传您的ECS配置文件 (scheduleConfig.js)。
33
+ <br />
34
+ <br />
35
+ <v-file-input
36
+ v-model =" file"
37
+ label =" 上传配置文件"
38
+ @multiple =" false"
39
+ @change =" loadFile()"
40
+ ></v-file-input >
41
+ </v-card-text >
42
+ </v-card >
43
+ </template >
44
+
45
+ <template v-slot :item .3 >
46
+ <v-card flat >
47
+ <v-card-item >
48
+ <v-card-title >转换</v-card-title >
49
+ </v-card-item >
50
+
51
+ <v-card-text >
52
+ 确认上传文件无误后,请点击“开始转换”。
53
+
54
+ <br />
55
+ <br />
56
+ <v-btn v-show =" isFileLoaded" @click =" convert()" >开始转换</v-btn >
57
+
58
+ <br />
59
+ <br />
60
+
61
+ <v-expand-transition >
62
+ <v-alert
63
+ v-show =" isConverted"
64
+ title =" 转换完成"
65
+ text =" ClassIsland档案文件将会自动下载,您可以将其导入到ClassIsland中(直接放入Profiles文件夹)。"
66
+ type =" success"
67
+ ></v-alert >
68
+ </v-expand-transition >
69
+ <v-expand-transition >
70
+ <v-alert
71
+ v-show =" !isFileLoaded"
72
+ title =" 请先上传文件"
73
+ text =" 请先上传您的ECS配置文件 (scheduleConfig.js)。"
74
+ type =" warning"
75
+ ></v-alert >
76
+ </v-expand-transition >
77
+ <v-expand-transition >
78
+ <v-alert
79
+ v-show =" convertingError"
80
+ title =" 转换失败"
81
+ :text =" '转换过程中发生错误,请检查您的配置文件。'+convertingError"
82
+ type =" error"
83
+ ></v-alert >
84
+ </v-expand-transition >
85
+ </v-card-text >
86
+ </v-card >
87
+ </template >
88
+ </v-stepper >
13
89
</template >
14
90
15
91
<script lang="ts" setup>
@@ -25,6 +101,8 @@ const isFileLoaded = ref(false);
25
101
const convertingError = ref (null );
26
102
27
103
function loadFile() {
104
+ isConverted .value = false ;
105
+ convertingError .value = null ;
28
106
// console.log(file.value);
29
107
if (file .value ) {
30
108
const reader = new FileReader ();
@@ -37,16 +115,15 @@ function loadFile() {
37
115
}
38
116
39
117
function downloadJson(fileName , json ) {
40
- const jsonStr = (json instanceof Object ) ? JSON .stringify (json , null , 4 ) : json ;
41
-
42
- const url = window .URL || window .webkitURL || window ;
43
- const blob = new Blob ([jsonStr ]);
44
- const saveLink = document .createElement (' a' );
45
- saveLink .href = url .createObjectURL (blob );
46
- saveLink .download = fileName ;
47
- saveLink .click ();
48
- }
118
+ const jsonStr = json instanceof Object ? JSON .stringify (json , null , 4 ) : json ;
49
119
120
+ const url = window .URL || window .webkitURL || window ;
121
+ const blob = new Blob ([jsonStr ]);
122
+ const saveLink = document .createElement (" a" );
123
+ saveLink .href = url .createObjectURL (blob );
124
+ saveLink .download = fileName ;
125
+ saveLink .click ();
126
+ }
50
127
51
128
function convert() {
52
129
try {
0 commit comments