Commit dd5150c54ca378ceea77984dea0b5259c8eb13f5
1 parent
8f882f63
数据同步
Showing
9 changed files
with
582 additions
and
106 deletions
src/components/setAnswer.vue
1 | <template> | 1 | <template> |
2 | - <el-dialog :visible.sync="diaVisible" width="400" center> | ||
3 | - <div slot="title"> | ||
4 | - <p> | 2 | + <div class="el-dialog-wrapper" v-show="diaVisible" width="400" center @click.self="cancel"> |
3 | + <div class="el-dialog-content"> | ||
4 | + <p class="title"> | ||
5 | <!-- 设置答案 <i class="fa fa-exchange" @click="editType = !editType"></i> --> | 5 | <!-- 设置答案 <i class="fa fa-exchange" @click="editType = !editType"></i> --> |
6 | 设置答案 | 6 | 设置答案 |
7 | + <i class="el-icon-close" @click="cancel"></i> | ||
7 | </p> | 8 | </p> |
8 | - </div> | ||
9 | - <div v-show="editType"> | ||
10 | - <div v-for="(item, index) in FormQuestionList" :key="index"> | ||
11 | - <template v-for="(subQuestions, indexs) in item.subQuestions"> | ||
12 | - <div | ||
13 | - class="sub-questions" | ||
14 | - :key="indexs" | ||
15 | - v-if="subQuestions.correctAnswer" | ||
16 | - > | ||
17 | - <div class="qs-num">题{{ subQuestions.questionIndex }}</div> | ||
18 | - <div class="qs-options qs-options2"> | ||
19 | - <p v-if="subQuestions.questionType == 4" class="answer-box"> | ||
20 | - <span | ||
21 | - class="answer-s" | ||
22 | - :class="subQuestions.correctAnswer == 1 ? 'active' : ''" | ||
23 | - @click="subQuestions.correctAnswer = 1" | ||
24 | - >✓</span | ||
25 | - > | ||
26 | - <span | ||
27 | - class="answer-s" | ||
28 | - :class="subQuestions.correctAnswer == 2 ? 'active' : ''" | ||
29 | - @click="subQuestions.correctAnswer = 2" | ||
30 | - >✗</span | ||
31 | - > | ||
32 | - </p> | ||
33 | - <p v-if="subQuestions.questionType == 3" class="answer-box"> | ||
34 | - <span | ||
35 | - class="answer-s" | ||
36 | - v-for="option in subQuestions.answerOptions" | ||
37 | - :class=" | ||
38 | - subQuestions.correctAnswer.includes(option) ? 'active' : '' | ||
39 | - " | ||
40 | - :key="option" | ||
41 | - @click="changAnswer(subQuestions, option)" | ||
42 | - >{{ option }}</span | ||
43 | - > | ||
44 | - </p> | ||
45 | - <p v-if="subQuestions.questionType == 2" class="answer-box"> | ||
46 | - <span | ||
47 | - class="answer-s" | ||
48 | - v-for="option in subQuestions.answerOptions" | ||
49 | - :class="subQuestions.correctAnswer == option ? 'active' : ''" | ||
50 | - :key="option" | ||
51 | - @click="subQuestions.correctAnswer = option" | ||
52 | - >{{ option }}</span | ||
53 | - > | ||
54 | - </p> | 9 | + <div v-show="editType"> |
10 | + <div v-for="(item, index) in FormQuestionList" :key="index"> | ||
11 | + <template v-for="(subQuestions, indexs) in item.subQuestions"> | ||
12 | + <div | ||
13 | + class="sub-questions" | ||
14 | + :key="indexs" | ||
15 | + v-if="subQuestions.correctAnswer" | ||
16 | + > | ||
17 | + <div class="qs-num">题{{ subQuestions.questionIndex }}</div> | ||
18 | + <div class="qs-options qs-options2"> | ||
19 | + <p v-if="subQuestions.questionType == 4" class="answer-box"> | ||
20 | + <span | ||
21 | + class="answer-s" | ||
22 | + :class="subQuestions.correctAnswer == 1 ? 'active' : ''" | ||
23 | + @click="subQuestions.correctAnswer = 1" | ||
24 | + >✓</span | ||
25 | + > | ||
26 | + <span | ||
27 | + class="answer-s" | ||
28 | + :class="subQuestions.correctAnswer == 2 ? 'active' : ''" | ||
29 | + @click="subQuestions.correctAnswer = 2" | ||
30 | + >✗</span | ||
31 | + > | ||
32 | + </p> | ||
33 | + <p v-if="subQuestions.questionType == 3" class="answer-box"> | ||
34 | + <span | ||
35 | + class="answer-s" | ||
36 | + v-for="option in subQuestions.answerOptions" | ||
37 | + :class=" | ||
38 | + subQuestions.correctAnswer.includes(option) | ||
39 | + ? 'active' | ||
40 | + : '' | ||
41 | + " | ||
42 | + :key="option" | ||
43 | + @click="changAnswer(subQuestions, option)" | ||
44 | + >{{ option }}</span | ||
45 | + > | ||
46 | + </p> | ||
47 | + <p v-if="subQuestions.questionType == 2" class="answer-box"> | ||
48 | + <span | ||
49 | + class="answer-s" | ||
50 | + v-for="option in subQuestions.answerOptions" | ||
51 | + :class=" | ||
52 | + subQuestions.correctAnswer == option ? 'active' : '' | ||
53 | + " | ||
54 | + :key="option" | ||
55 | + @click="subQuestions.correctAnswer = option" | ||
56 | + >{{ option }}</span | ||
57 | + > | ||
58 | + </p> | ||
59 | + </div> | ||
55 | </div> | 60 | </div> |
56 | - </div> | ||
57 | - </template> | 61 | + </template> |
62 | + </div> | ||
58 | </div> | 63 | </div> |
59 | - </div> | ||
60 | - <!-- <div v-show="!editType"> | 64 | + <!-- <div v-show="!editType"> |
61 | <p class="dia-tips"> | 65 | <p class="dia-tips"> |
62 | 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” | 66 | 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” |
63 | </p> | 67 | </p> |
@@ -148,13 +152,16 @@ | @@ -148,13 +152,16 @@ | ||
148 | </div> | 152 | </div> |
149 | </div> | 153 | </div> |
150 | </div> --> | 154 | </div> --> |
151 | - <div slot="footer"> | ||
152 | - <el-button class="dia-btn" type="primary" @click="saveAnswer" | ||
153 | - >确 定</el-button | ||
154 | - > | ||
155 | - <el-button class="dia-btn" type="danger" @click="cancel">取 消</el-button> | 155 | + <div class="footer-box"> |
156 | + <el-button class="dia-btn" type="primary" @click="saveAnswer" | ||
157 | + >确 定</el-button | ||
158 | + > | ||
159 | + <el-button class="dia-btn" type="danger" @click="cancel" | ||
160 | + >取 消</el-button | ||
161 | + > | ||
162 | + </div> | ||
156 | </div> | 163 | </div> |
157 | - </el-dialog> | 164 | + </div> |
158 | </template> | 165 | </template> |
159 | 166 | ||
160 | <script> | 167 | <script> |
@@ -280,19 +287,59 @@ export default { | @@ -280,19 +287,59 @@ export default { | ||
280 | questionList: questionList, | 287 | questionList: questionList, |
281 | }); | 288 | }); |
282 | if (status == 0) { | 289 | if (status == 0) { |
283 | - this.$emit('saveSuccess') | 290 | + this.$emit("saveSuccess"); |
284 | } else { | 291 | } else { |
285 | this.$message.error(message); | 292 | this.$message.error(message); |
286 | } | 293 | } |
287 | }, | 294 | }, |
288 | cancel() { | 295 | cancel() { |
289 | - this.$emit('cancel') | 296 | + this.$emit("cancel"); |
290 | }, | 297 | }, |
291 | }, | 298 | }, |
292 | }; | 299 | }; |
293 | </script> | 300 | </script> |
294 | 301 | ||
295 | <style lang="scss" scoped> | 302 | <style lang="scss" scoped> |
303 | +.el-dialog-wrapper { | ||
304 | + position: fixed; | ||
305 | + top: 0; | ||
306 | + right: 0; | ||
307 | + bottom: 0; | ||
308 | + left: 0; | ||
309 | + overflow: auto; | ||
310 | + margin: 0; | ||
311 | + background: rgba(0, 0, 0, 0.5); | ||
312 | + display: flex; | ||
313 | + justify-content: center; | ||
314 | + align-items: center; | ||
315 | + z-index: 2022; | ||
316 | + .el-dialog-content { | ||
317 | + width: 600px; | ||
318 | + background:#fff; | ||
319 | + border-radius: 10px; | ||
320 | + padding:16px 20px 20px; | ||
321 | + } | ||
322 | + .title{ | ||
323 | + font-size: 18px; | ||
324 | + position: relative; | ||
325 | + margin-bottom:20px; | ||
326 | + .el-icon-close{ | ||
327 | + position: absolute; | ||
328 | + top:0; | ||
329 | + right:12px; | ||
330 | + padding:2px; | ||
331 | + font-size: 16px; | ||
332 | + cursor: pointer; | ||
333 | + &:hover{ | ||
334 | + color: #667ffa; | ||
335 | + } | ||
336 | + } | ||
337 | + } | ||
338 | +} | ||
339 | +.footer-box { | ||
340 | + text-align: center; | ||
341 | + padding-top:20px; | ||
342 | +} | ||
296 | .sub-questions { | 343 | .sub-questions { |
297 | width: 100%; | 344 | width: 100%; |
298 | display: flex; | 345 | display: flex; |
src/store/index.js
@@ -89,12 +89,9 @@ const store = new Vuex.Store({ | @@ -89,12 +89,9 @@ const store = new Vuex.Store({ | ||
89 | } | 89 | } |
90 | } | 90 | } |
91 | }).catch(() => { | 91 | }).catch(() => { |
92 | - // commit("setToken", Cookies.get("JSESSIONID")); | ||
93 | }) | 92 | }) |
94 | }, | 93 | }, |
95 | permissions({ state, commit }, that) { | 94 | permissions({ state, commit }, that) { |
96 | - // request.login(that.loginForm).then(res => { | ||
97 | - // if (res.status == 200) { | ||
98 | let userInfo = { | 95 | let userInfo = { |
99 | permissions: [ | 96 | permissions: [ |
100 | { | 97 | { |
@@ -107,8 +104,6 @@ const store = new Vuex.Store({ | @@ -107,8 +104,6 @@ const store = new Vuex.Store({ | ||
107 | }, | 104 | }, |
108 | ], | 105 | ], |
109 | name: "李老师", | 106 | name: "李老师", |
110 | - // avatar: data.avatar ? data.avatar : "", | ||
111 | - // uid: data.id, | ||
112 | authorityRouter:[ | 107 | authorityRouter:[ |
113 | "setUpAccount", | 108 | "setUpAccount", |
114 | "setUpSchool", | 109 | "setUpSchool", |
src/views/dataSync/index.vue
1 | <template> | 1 | <template> |
2 | - <div>数据同步</div> | 2 | + <div> |
3 | + <back-box> | ||
4 | + <template slot="title"> | ||
5 | + <span>数据同步</span> | ||
6 | + </template> | ||
7 | + </back-box> | ||
8 | + <div class="page-content"> | ||
9 | + <div class="down-item"> | ||
10 | + <p class="h-title">从U盘导入</p> | ||
11 | + <p class="txt"> | ||
12 | + 本功能帮助无法上网的授课端软件,将本地数据同步到云平台,需要先在数据包放到U盘。 | ||
13 | + </p> | ||
14 | + <el-upload | ||
15 | + class="upload-demo" | ||
16 | + ref="upload" | ||
17 | + :action="url" | ||
18 | + :multiple="false" | ||
19 | + :data="{ id: id }" | ||
20 | + :with-credentials="true" | ||
21 | + :limit="1" | ||
22 | + :on-change="change" | ||
23 | + :on-success="upSuccess" | ||
24 | + :on-error="upError" | ||
25 | + > | ||
26 | + <div class="btn-box"> | ||
27 | + <i class="fa fa-cloud-upload"></i> | ||
28 | + <el-button type="primary" round>选择文件</el-button> | ||
29 | + </div> | ||
30 | + </el-upload> | ||
31 | + </div> | ||
32 | + | ||
33 | + <div class="down-item"> | ||
34 | + <p class="h-title">数据导出至U盘</p> | ||
35 | + <p class="txt"> | ||
36 | + 本功能将云平台的数据导出到U盘。待导出数据包括4套答题卡。 | ||
37 | + </p> | ||
38 | + <div class="btn-box btn-box2"> | ||
39 | + <i class="fa fa-cloud-download" @click="getAppDownloadUrl"></i> | ||
40 | + <el-button type="primary" round>发卡软件下载</el-button> | ||
41 | + </div> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | + </div> | ||
3 | </template> | 45 | </template> |
4 | 46 | ||
5 | <script> | 47 | <script> |
6 | export default { | 48 | export default { |
49 | + data() { | ||
50 | + return { | ||
51 | + url: "xxx", | ||
52 | + id: "", | ||
53 | + }; | ||
54 | + }, | ||
55 | + methods: { | ||
56 | + async getAppDownloadUrl() { | ||
57 | + const { data, status, info } = await this.$request.getAppDownloadUrl(); | ||
58 | + if (status == 0) { | ||
59 | + // this.tableData = [...data.list] || []; | ||
60 | + const a = document.createElement("a"); | ||
61 | + a.href = data.downloadUrl; | ||
62 | + document.body.appendChild(a); | ||
63 | + a.click(); | ||
64 | + a.remove(); | ||
65 | + } else { | ||
66 | + this.$message.error(info); | ||
67 | + } | ||
68 | + }, | ||
69 | + async submitUpload() { | ||
70 | + this.$refs.upload.submit(); | ||
7 | 71 | ||
8 | -} | 72 | + // const formData = new FormData() |
73 | + // formData.append('id',this.componentId) | ||
74 | + // formData.append('file',new File(this.file.raw)) | ||
75 | + // let {status,info} = await uploadExcel(formData); | ||
76 | + // if(status===0){ | ||
77 | + // this.$message.success(info); | ||
78 | + // this.$emit("upSuccess") | ||
79 | + // } else { | ||
80 | + // this.$message.error(info); | ||
81 | + // } | ||
82 | + }, | ||
83 | + upSuccess(res) { | ||
84 | + if (res && res.code == 0 && res.success) { | ||
85 | + this.$message.success("上传成功"); | ||
86 | + this.$emit("upSuccess"); | ||
87 | + } else { | ||
88 | + this.$message.error(res.message); | ||
89 | + } | ||
90 | + }, | ||
91 | + upError(res) { | ||
92 | + if (res && res.status == 0) { | ||
93 | + this.$message.success("上传成功"); | ||
94 | + this.$emit("upSuccess"); | ||
95 | + } else { | ||
96 | + this.$message.error(res.message); | ||
97 | + } | ||
98 | + }, | ||
99 | + change(file) { | ||
100 | + this.file = file; | ||
101 | + }, | ||
102 | + }, | ||
103 | +}; | ||
9 | </script> | 104 | </script> |
10 | 105 | ||
11 | -<style> | ||
12 | - | 106 | +<style lang="scss" scoped> |
107 | +.page-content { | ||
108 | + padding: 50px; | ||
109 | + display: flex; | ||
110 | + justify-content: center; | ||
111 | + .down-item { | ||
112 | + width: 400px; | ||
113 | + border-radius: 20px; | ||
114 | + margin: 20px; | ||
115 | + background: #f8f8f8; | ||
116 | + box-shadow: 2px 2px 5px #ccc; | ||
117 | + .h-title { | ||
118 | + font-size: 16px; | ||
119 | + color: #667ffd; | ||
120 | + padding: 16px 0 16px 12px; | ||
121 | + } | ||
122 | + .txt { | ||
123 | + height: 80px; | ||
124 | + padding: 0 20px; | ||
125 | + font-size: 16px; | ||
126 | + color: #7f7f7f; | ||
127 | + line-height: 24px; | ||
128 | + text-align: center; | ||
129 | + } | ||
130 | + } | ||
131 | + .upload-demo{ | ||
132 | + display: flex; | ||
133 | + justify-content: center; | ||
134 | + } | ||
135 | + :deep(.el-upload) { | ||
136 | + margin:0 auto; | ||
137 | + } | ||
138 | + .btn-box { | ||
139 | + display: flex; | ||
140 | + flex-direction: column; | ||
141 | + justify-content: center; | ||
142 | + align-items: center; | ||
143 | + padding-bottom: 40px; | ||
144 | + .fa { | ||
145 | + font-size: 80px; | ||
146 | + color: #aeaeae; | ||
147 | + padding-bottom: 10px; | ||
148 | + cursor: pointer; | ||
149 | + } | ||
150 | + } | ||
151 | + .btn-box { | ||
152 | + width: 100%; | ||
153 | + } | ||
154 | +} | ||
13 | </style> | 155 | </style> |
14 | \ No newline at end of file | 156 | \ No newline at end of file |
src/views/device/index.vue
@@ -606,7 +606,7 @@ export default { | @@ -606,7 +606,7 @@ export default { | ||
606 | if (this.loadingUpDate) return; | 606 | if (this.loadingUpDate) return; |
607 | this.loadingUpDate = true; | 607 | this.loadingUpDate = true; |
608 | let data = await this.$request.modifyUpgradeFlag({ | 608 | let data = await this.$request.modifyUpgradeFlag({ |
609 | - deviceId: id ? id : this.selectionTabIds, | 609 | + deviceIds: id ? [id] : this.selectionTabIds, |
610 | upgradeFlag: 1, | 610 | upgradeFlag: 1, |
611 | }); | 611 | }); |
612 | this.loadingUpDate = false; | 612 | this.loadingUpDate = false; |
@@ -625,7 +625,7 @@ export default { | @@ -625,7 +625,7 @@ export default { | ||
625 | if (this.loadingUpDate) return; | 625 | if (this.loadingUpDate) return; |
626 | this.loadingUpDate = true; | 626 | this.loadingUpDate = true; |
627 | let data = await this.$request.modifyUpgradeFlag({ | 627 | let data = await this.$request.modifyUpgradeFlag({ |
628 | - deviceId: id ? id : this.selectionTabIds, | 628 | + deviceIds: id ? [id] : this.selectionTabIds, |
629 | upgradeFlag: 0, | 629 | upgradeFlag: 0, |
630 | }); | 630 | }); |
631 | this.loadingUpDate = false; | 631 | this.loadingUpDate = false; |
src/views/login/index.vue
@@ -90,8 +90,10 @@ export default { | @@ -90,8 +90,10 @@ export default { | ||
90 | disableClick: true, | 90 | disableClick: true, |
91 | passwordType: "password", | 91 | passwordType: "password", |
92 | loginForm: { | 92 | loginForm: { |
93 | - username: "13610050254", | ||
94 | - password: "Pw050254#", | 93 | + // username: "13610050254", |
94 | + // password: "Pw050254#", | ||
95 | + username: "18946034886", | ||
96 | + password: "Pw034886#", | ||
95 | }, | 97 | }, |
96 | loginRules: { | 98 | loginRules: { |
97 | username: [ | 99 | username: [ |
src/views/setUp/school.vue
@@ -91,6 +91,41 @@ | @@ -91,6 +91,41 @@ | ||
91 | <el-button @click="diaUp = false">取 消</el-button> | 91 | <el-button @click="diaUp = false">取 消</el-button> |
92 | </div> | 92 | </div> |
93 | </el-dialog> | 93 | </el-dialog> |
94 | + <el-dialog title="修改年级信息" :visible.sync="diaGrade" width="400"> | ||
95 | + <el-form | ||
96 | + class="form-box" | ||
97 | + :model="formGrade" | ||
98 | + :rules="rulesGrade" | ||
99 | + label-width="160px" | ||
100 | + > | ||
101 | + <el-form-item label="科目:" prop="subjectNames"> | ||
102 | + <el-checkbox-group v-model="formGrade.subjectNames"> | ||
103 | + <el-checkbox | ||
104 | + v-for="item in subjectList" | ||
105 | + :label="item" | ||
106 | + :key="item" | ||
107 | + >{{ item }}</el-checkbox | ||
108 | + > | ||
109 | + </el-checkbox-group> | ||
110 | + <el-col :span="8"> | ||
111 | + <el-input placeholder="添加科目" v-model.trim="subjectName" maxlength="30"> | ||
112 | + <i slot="suffix" class="el-input__icon el-icon-plus" @click="addSubjectName"></i> | ||
113 | + </el-input> | ||
114 | + </el-col> | ||
115 | + </el-form-item> | ||
116 | + <el-form-item label="班级:"> | ||
117 | + <span v-for="(item, index) in formGrade.classList" :key="item.id">{{ | ||
118 | + `${item.className}${ | ||
119 | + index == formGrade.classList.length - 1 ? "" : "、" | ||
120 | + }` | ||
121 | + }}</span> | ||
122 | + </el-form-item> | ||
123 | + </el-form> | ||
124 | + <div class="dialog-footer" slot="footer"> | ||
125 | + <el-button @click="editGrade">确 定</el-button> | ||
126 | + <el-button @click="diaGrade = false">取 消</el-button> | ||
127 | + </div> | ||
128 | + </el-dialog> | ||
94 | <el-dialog title="修改学校信息" :visible.sync="diaSchool" width="400"> | 129 | <el-dialog title="修改学校信息" :visible.sync="diaSchool" width="400"> |
95 | <el-form | 130 | <el-form |
96 | class="form-box" | 131 | class="form-box" |
@@ -183,13 +218,14 @@ export default { | @@ -183,13 +218,14 @@ export default { | ||
183 | url: "xxx", | 218 | url: "xxx", |
184 | diaUp: false, | 219 | diaUp: false, |
185 | diaSchool: false, | 220 | diaSchool: false, |
221 | + diaGrade: false, | ||
186 | school: { | 222 | school: { |
187 | - schoolName: "长水实验中学", | ||
188 | - managePwd: "123456", | ||
189 | - contactPerson: "张老师", | ||
190 | - contactPhone: "13548645321", | ||
191 | - sections: "初中", | ||
192 | - tenantName: "长水集团", | 223 | + schoolName: "", |
224 | + managePwd: "", | ||
225 | + contactPerson: "", | ||
226 | + contactPhone: "", | ||
227 | + sections: "", | ||
228 | + tenantName: "", | ||
193 | }, | 229 | }, |
194 | tableData: [], | 230 | tableData: [], |
195 | formSchool: { | 231 | formSchool: { |
@@ -204,6 +240,17 @@ export default { | @@ -204,6 +240,17 @@ export default { | ||
204 | { required: true, message: "请填写管理密码", trigger: "blur" }, | 240 | { required: true, message: "请填写管理密码", trigger: "blur" }, |
205 | ], | 241 | ], |
206 | }, | 242 | }, |
243 | + formGrade: { | ||
244 | + gradeName: "", | ||
245 | + subjectNames: [], | ||
246 | + classList: [], | ||
247 | + }, | ||
248 | + rulesGrade: { | ||
249 | + subjectNames: [ | ||
250 | + { required: true, message: "请选择科目", trigger: "blur" }, | ||
251 | + ], | ||
252 | + }, | ||
253 | + subjectName:"", | ||
207 | sectionsList: [ | 254 | sectionsList: [ |
208 | { id: "1", name: "小学" }, | 255 | { id: "1", name: "小学" }, |
209 | { id: "2", name: "初中" }, | 256 | { id: "2", name: "初中" }, |
@@ -211,14 +258,30 @@ export default { | @@ -211,14 +258,30 @@ export default { | ||
211 | { id: "4", name: "大学" }, | 258 | { id: "4", name: "大学" }, |
212 | { id: "7", name: "高补" }, | 259 | { id: "7", name: "高补" }, |
213 | ], | 260 | ], |
261 | + subjectList: [], | ||
214 | }; | 262 | }; |
215 | }, | 263 | }, |
216 | created() { | 264 | created() { |
217 | this._QueryDataSchool(); | 265 | this._QueryDataSchool(); |
218 | this._QueryDataGrade(); | 266 | this._QueryDataGrade(); |
267 | + this._QuerySubject(); | ||
219 | }, | 268 | }, |
220 | methods: { | 269 | methods: { |
221 | - setGrade(obj) {}, | 270 | + setGrade(obj) { |
271 | + this.formGrade.subjectNames = obj.subjectNames; | ||
272 | + this.formGrade.classList = obj.classList; | ||
273 | + this.formGrade.gradeName = obj.gradeName; | ||
274 | + this.diaGrade = true; | ||
275 | + }, | ||
276 | + addSubjectName(){ | ||
277 | + if(!this.subjectName){ | ||
278 | + this.$message.warning("请填写科目名称") | ||
279 | + return | ||
280 | + } | ||
281 | + this.subjectList.push(this.subjectName) | ||
282 | + this.formGrade.subjectNames.push(this.subjectName) | ||
283 | + this.subjectName = "" | ||
284 | + }, | ||
222 | async editSchool() { | 285 | async editSchool() { |
223 | if (!this.formSchool.sections.length) { | 286 | if (!this.formSchool.sections.length) { |
224 | this.$message.error("请选择学段!"); | 287 | this.$message.error("请选择学段!"); |
@@ -232,9 +295,11 @@ export default { | @@ -232,9 +295,11 @@ export default { | ||
232 | return; | 295 | return; |
233 | } | 296 | } |
234 | this.loading = true; | 297 | this.loading = true; |
235 | - let form = {...this.formSchool} | ||
236 | - form.sections = this.formSchool.sections.join(',') | ||
237 | - const { data, status, info } = await this.$request.updateSchool({...form}); | 298 | + let form = { ...this.formSchool }; |
299 | + form.sections = this.formSchool.sections.join(","); | ||
300 | + const { data, status, info } = await this.$request.updateSchool({ | ||
301 | + ...form, | ||
302 | + }); | ||
238 | this.loading = false; | 303 | this.loading = false; |
239 | if (status === 0) { | 304 | if (status === 0) { |
240 | this.$message.success("修改成功~"); | 305 | this.$message.success("修改成功~"); |
@@ -244,6 +309,28 @@ export default { | @@ -244,6 +309,28 @@ export default { | ||
244 | this.$message.error(info); | 309 | this.$message.error(info); |
245 | } | 310 | } |
246 | }, | 311 | }, |
312 | + async editGrade() { | ||
313 | + if (!this.formGrade.subjectNames.length) { | ||
314 | + this.$message.error("请选择科目!"); | ||
315 | + return; | ||
316 | + } | ||
317 | + if (this.loading) { | ||
318 | + return; | ||
319 | + } | ||
320 | + this.loading = true; | ||
321 | + const { data, status, info } = await this.$request.updateGrade({ | ||
322 | + gradeName: this.formGrade.gradeName, | ||
323 | + subjectNames: this.formGrade.subjectNames, | ||
324 | + }); | ||
325 | + this.loading = false; | ||
326 | + if (status === 0) { | ||
327 | + this.$message.success("修改成功~"); | ||
328 | + this.diaGrade = false; | ||
329 | + this._QueryDataGrade(); | ||
330 | + } else { | ||
331 | + this.$message.error(info); | ||
332 | + } | ||
333 | + }, | ||
247 | async _QueryDataSchool() { | 334 | async _QueryDataSchool() { |
248 | this.loading = true; | 335 | this.loading = true; |
249 | const { data, status, info } = await this.$request.schoolDetail(); | 336 | const { data, status, info } = await this.$request.schoolDetail(); |
@@ -270,6 +357,15 @@ export default { | @@ -270,6 +357,15 @@ export default { | ||
270 | this.$message.error(info); | 357 | this.$message.error(info); |
271 | } | 358 | } |
272 | }, | 359 | }, |
360 | + async _QuerySubject() { | ||
361 | + const { data, status, info } = await this.$request.subjectList(); | ||
362 | + console.log(status); | ||
363 | + if (status === 0) { | ||
364 | + this.subjectList = [...data.subjectNames] || []; | ||
365 | + } else { | ||
366 | + this.$message.error(info); | ||
367 | + } | ||
368 | + }, | ||
273 | async downExcel() { | 369 | async downExcel() { |
274 | let data = await this.$request.downDevice({ | 370 | let data = await this.$request.downDevice({ |
275 | id: this.id, | 371 | id: this.id, |
@@ -374,4 +470,10 @@ export default { | @@ -374,4 +470,10 @@ export default { | ||
374 | .form-box { | 470 | .form-box { |
375 | margin: 0 20px; | 471 | margin: 0 20px; |
376 | } | 472 | } |
473 | +.el-icon-plus{ | ||
474 | + cursor: pointer; | ||
475 | + &:hover{ | ||
476 | + color:#667ffd | ||
477 | + } | ||
478 | +} | ||
377 | </style> | 479 | </style> |
378 | \ No newline at end of file | 480 | \ No newline at end of file |
src/views/setUp/student.vue
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | size="mini" | 12 | size="mini" |
13 | plain | 13 | plain |
14 | circle | 14 | circle |
15 | + @click="openAddDia" | ||
15 | ></el-button> | 16 | ></el-button> |
16 | </el-tooltip> | 17 | </el-tooltip> |
17 | </template> | 18 | </template> |
@@ -41,7 +42,7 @@ | @@ -41,7 +42,7 @@ | ||
41 | v-for="item in classList" | 42 | v-for="item in classList" |
42 | :key="item.classCode" | 43 | :key="item.classCode" |
43 | :class="query.classId == item.id ? 'active' : ''" | 44 | :class="query.classId == item.id ? 'active' : ''" |
44 | - @click="classDetail(item.id)" | 45 | + @click="classDetail(item)" |
45 | > | 46 | > |
46 | <i class="el-icon-edit-outline"></i> | 47 | <i class="el-icon-edit-outline"></i> |
47 | {{ item.className }}({{ item.studentCount }}) | 48 | {{ item.className }}({{ item.studentCount }}) |
@@ -78,11 +79,14 @@ | @@ -78,11 +79,14 @@ | ||
78 | </div> | 79 | </div> |
79 | </div> | 80 | </div> |
80 | <ul class="s-ul" v-loading="loading"> | 81 | <ul class="s-ul" v-loading="loading"> |
81 | - <li class="s-li" v-for="item in studentList" :key="item.id"> | ||
82 | - <i class="el-icon-delete"></i> | 82 | + <li class="s-li" v-for="(item,index) in studentList" :key="item.id"> |
83 | + <i class="el-icon-delete" @click="removeStu(item,index)"></i> | ||
83 | <p class="name">{{ item.studentName }}</p> | 84 | <p class="name">{{ item.studentName }}</p> |
84 | <p class="p1"> | 85 | <p class="p1"> |
85 | - 答题器:{{ (item.clickerList.length && item.clickerList[0].clickerSn) || "--" }} | 86 | + 答题器:{{ |
87 | + (item.clickerList.length && item.clickerList[0].clickerSn) || | ||
88 | + "--" | ||
89 | + }} | ||
86 | </p> | 90 | </p> |
87 | <p class="p1">长学号:{{ item.studentCode }}</p> | 91 | <p class="p1">长学号:{{ item.studentCode }}</p> |
88 | <p class="p1">短学号:{{ item.shortNumber || "--" }}</p> | 92 | <p class="p1">短学号:{{ item.shortNumber || "--" }}</p> |
@@ -96,15 +100,46 @@ | @@ -96,15 +100,46 @@ | ||
96 | </div> | 100 | </div> |
97 | </div> | 101 | </div> |
98 | </div> | 102 | </div> |
99 | - <el-dialog title="导入学校名单" :visible.sync="diaUp" width="400"> | ||
100 | - <up-load id="downTeacher" :url="url" fileName="教师名单"> | ||
101 | - <p class="down-txt" slot="down"> | ||
102 | - 通过Excel名单导入教师名单,点击 | ||
103 | - <el-link type="danger" @click="downExcel">模板下载</el-link> 。 | ||
104 | - </p> | ||
105 | - </up-load> | 103 | + <el-dialog title="添加学生" :visible.sync="diaStu" width="400"> |
104 | + <el-form | ||
105 | + class="form-box" | ||
106 | + :model="formStu" | ||
107 | + :rules="rulesStu" | ||
108 | + label-width="160px" | ||
109 | + > | ||
110 | + <el-form-item label="所在班级:"> | ||
111 | + <span>{{ formStu.className }}</span> | ||
112 | + </el-form-item> | ||
113 | + <el-form-item label="学生姓名:" prop="studentName"> | ||
114 | + <el-col :span="10"> | ||
115 | + <el-input maxlength="30" v-model.trim="formStu.studentName" /> | ||
116 | + </el-col> | ||
117 | + </el-form-item> | ||
118 | + <el-form-item label="长学号:" prop="studentCode"> | ||
119 | + <el-col :span="10"> | ||
120 | + <el-input maxlength="30" v-model.trim="formStu.studentCode" /> | ||
121 | + </el-col> | ||
122 | + </el-form-item> | ||
123 | + <el-form-item label="短学号:"> | ||
124 | + <el-col :span="10"> | ||
125 | + <el-input maxlength="30" v-model.trim="formStu.shortNumber" /> | ||
126 | + </el-col> | ||
127 | + </el-form-item> | ||
128 | + <el-form-item label="性别:"> | ||
129 | + <el-radio-group v-model="formStu.sex"> | ||
130 | + <el-radio :label="1">男</el-radio> | ||
131 | + <el-radio :label="2">女</el-radio> | ||
132 | + </el-radio-group> | ||
133 | + </el-form-item> | ||
134 | + <el-form-item label="答题器编码:"> | ||
135 | + <el-col :span="10"> | ||
136 | + <el-input maxlength="30" v-model.trim="formStu.clickerSn" /> | ||
137 | + </el-col> | ||
138 | + </el-form-item> | ||
139 | + </el-form> | ||
106 | <div class="dialog-footer" slot="footer"> | 140 | <div class="dialog-footer" slot="footer"> |
107 | - <el-button @click="diaUp = false">取 消</el-button> | 141 | + <el-button @click="addStu">确 定</el-button> |
142 | + <el-button @click="diaStu = false">取 消</el-button> | ||
108 | </div> | 143 | </div> |
109 | </el-dialog> | 144 | </el-dialog> |
110 | </div> | 145 | </div> |
@@ -116,13 +151,29 @@ export default { | @@ -116,13 +151,29 @@ export default { | ||
116 | data() { | 151 | data() { |
117 | return { | 152 | return { |
118 | url: "", | 153 | url: "", |
119 | - diaUp: false, | 154 | + diaStu: false, |
120 | query: { | 155 | query: { |
121 | gradeName: "", | 156 | gradeName: "", |
122 | classId: "", | 157 | classId: "", |
123 | studentCode: "", | 158 | studentCode: "", |
124 | studentName: "", | 159 | studentName: "", |
125 | }, | 160 | }, |
161 | + formStu: { | ||
162 | + className: "", | ||
163 | + studentName: "", | ||
164 | + studentCode: "", | ||
165 | + shortNumber: "", | ||
166 | + sex: 1, | ||
167 | + clickerSn: "", | ||
168 | + }, | ||
169 | + rulesStu: { | ||
170 | + studentName: [ | ||
171 | + { required: true, message: "请输入学生名称", trigger: "blur" }, | ||
172 | + ], | ||
173 | + studentCode: [ | ||
174 | + { required: true, message: "请输入学生长学号", trigger: "blur" }, | ||
175 | + ], | ||
176 | + }, | ||
126 | gradeName: "", | 177 | gradeName: "", |
127 | gradeList: [], | 178 | gradeList: [], |
128 | classList: [], | 179 | classList: [], |
@@ -144,15 +195,57 @@ export default { | @@ -144,15 +195,57 @@ export default { | ||
144 | this._QueryData(3); | 195 | this._QueryData(3); |
145 | }, | 196 | }, |
146 | methods: { | 197 | methods: { |
147 | - changeGrade(val) { | ||
148 | - this.query.classId = ""; | ||
149 | - this._QueryClass(val); | 198 | + openAddDia() { |
199 | + this.formStu.studentName = ""; | ||
200 | + this.formStu.studentCode = ""; | ||
201 | + this.formStu.shortNumber = ""; | ||
202 | + this.formStu.sex = 1; | ||
203 | + this.formStu.clickerSn = ""; | ||
204 | + this.diaStu = true; | ||
205 | + }, | ||
206 | + classDetail(obj) { | ||
207 | + this.query.classId = obj.id; | ||
208 | + this.formStu.className = obj.className; | ||
150 | this._QueryData(3); | 209 | this._QueryData(3); |
151 | }, | 210 | }, |
152 | - classDetail(id) { | ||
153 | - this.query.classId = id; | 211 | + async removeStu(obj,index) { |
212 | + const { data, status, info } = await this.$request.delStudent({ | ||
213 | + studentId: obj.id, | ||
214 | + }); | ||
215 | + if (status === 0) { | ||
216 | + this.$message.success("删除成功"); | ||
217 | + this.studentList.splice(index,1) | ||
218 | + } else { | ||
219 | + this.$message.error(info); | ||
220 | + } | ||
221 | + }, | ||
222 | + async changeGrade(val) { | ||
223 | + this.query.classId = ""; | ||
224 | + await this._QueryClass(val); | ||
154 | this._QueryData(3); | 225 | this._QueryData(3); |
155 | }, | 226 | }, |
227 | + async addStu() { | ||
228 | + let query = {}; | ||
229 | + for (let key in this.formStu) { | ||
230 | + if (key != "className" && this.formStu[key]) { | ||
231 | + query[key] = this.formStu[key]; | ||
232 | + } | ||
233 | + } | ||
234 | + this.loading = true; | ||
235 | + const { data, status, info } = await this.$request.addStudent({ | ||
236 | + classId: this.query.classId, | ||
237 | + ...query, | ||
238 | + }); | ||
239 | + this.loading = false; | ||
240 | + console.log(status); | ||
241 | + if (status === 0) { | ||
242 | + this.$message.success(info); | ||
243 | + this.diaStu = false; | ||
244 | + this._QueryData(); | ||
245 | + } else { | ||
246 | + this.$message.error(info); | ||
247 | + } | ||
248 | + }, | ||
156 | async _QueryData(type) { | 249 | async _QueryData(type) { |
157 | let query = {}; | 250 | let query = {}; |
158 | query.gradeName = this.query.gradeName; | 251 | query.gradeName = this.query.gradeName; |
@@ -202,6 +295,7 @@ export default { | @@ -202,6 +295,7 @@ export default { | ||
202 | if (status === 0) { | 295 | if (status === 0) { |
203 | this.classList = [...data.list] || []; | 296 | this.classList = [...data.list] || []; |
204 | this.query.classId = this.classList[0]?.id; | 297 | this.query.classId = this.classList[0]?.id; |
298 | + this.formStu.className = this.classList[0]?.className; | ||
205 | } else { | 299 | } else { |
206 | this.$message.error(info); | 300 | this.$message.error(info); |
207 | } | 301 | } |
src/views/setUp/teacher.vue
@@ -192,7 +192,7 @@ | @@ -192,7 +192,7 @@ | ||
192 | </div> | 192 | </div> |
193 | </div> | 193 | </div> |
194 | </div> | 194 | </div> |
195 | - <el-dialog title="导入学校名单" :visible.sync="diaUp" width="400"> | 195 | + <el-dialog title="导入教师名单" :visible.sync="diaUp" width="400"> |
196 | <up-load id="downTeacher" :url="url" fileName="教师名单"> | 196 | <up-load id="downTeacher" :url="url" fileName="教师名单"> |
197 | <p class="down-txt" slot="down"> | 197 | <p class="down-txt" slot="down"> |
198 | 通过Excel名单导入教师名单,点击 | 198 | 通过Excel名单导入教师名单,点击 |
@@ -203,6 +203,38 @@ | @@ -203,6 +203,38 @@ | ||
203 | <el-button @click="diaUp = false">取 消</el-button> | 203 | <el-button @click="diaUp = false">取 消</el-button> |
204 | </div> | 204 | </div> |
205 | </el-dialog> | 205 | </el-dialog> |
206 | + <el-dialog title="添加学生" :visible.sync="diaTeacher" width="400"> | ||
207 | + <el-form | ||
208 | + class="form-box" | ||
209 | + :model="formTeacher" | ||
210 | + :rules="rulesTeacher" | ||
211 | + label-width="160px" | ||
212 | + > | ||
213 | + <el-form-item label="手机号码:" prop="loginName"> | ||
214 | + <el-col :span="10"> | ||
215 | + <el-input maxlength="30" v-model.trim="formTeacher.loginName" /> | ||
216 | + </el-col> | ||
217 | + </el-form-item> | ||
218 | + <el-form-item label="教师姓名:" prop="teacherName"> | ||
219 | + <el-col :span="10"> | ||
220 | + <el-input maxlength="30" v-model.trim="formTeacher.teacherName" /> | ||
221 | + </el-col> | ||
222 | + </el-form-item> | ||
223 | + <el-form-item label="性别:"> | ||
224 | + <el-radio-group v-model="formTeacher.sex"> | ||
225 | + <el-radio :label="1">男</el-radio> | ||
226 | + <el-radio :label="2">女</el-radio> | ||
227 | + </el-radio-group> | ||
228 | + </el-form-item> | ||
229 | + <el-form-item label="教师角色:"> | ||
230 | + | ||
231 | + </el-form-item> | ||
232 | + </el-form> | ||
233 | + <div class="dialog-footer" slot="footer"> | ||
234 | + <el-button @click="addTeacher">确 定</el-button> | ||
235 | + <el-button @click="diaTeacher = false">取 消</el-button> | ||
236 | + </div> | ||
237 | + </el-dialog> | ||
206 | </div> | 238 | </div> |
207 | </template> | 239 | </template> |
208 | 240 | ||
@@ -211,16 +243,17 @@ import { downloadFile } from "@/utils"; | @@ -211,16 +243,17 @@ import { downloadFile } from "@/utils"; | ||
211 | export default { | 243 | export default { |
212 | data() { | 244 | data() { |
213 | return { | 245 | return { |
214 | - loading:false, | 246 | + loading: false, |
215 | url: "", | 247 | url: "", |
216 | diaUp: false, | 248 | diaUp: false, |
249 | + diaTeacher:false, | ||
217 | query: { | 250 | query: { |
218 | gradeName: "", | 251 | gradeName: "", |
219 | teacherName: "", | 252 | teacherName: "", |
220 | phone: "", | 253 | phone: "", |
221 | }, | 254 | }, |
222 | gradeList: [], | 255 | gradeList: [], |
223 | - teacherList: [ ], | 256 | + teacherList: [], |
224 | teacherDetail: { | 257 | teacherDetail: { |
225 | teacherName: "", | 258 | teacherName: "", |
226 | loginName: "", | 259 | loginName: "", |
@@ -231,6 +264,13 @@ export default { | @@ -231,6 +264,13 @@ export default { | ||
231 | teacherGradeList: [], | 264 | teacherGradeList: [], |
232 | }, | 265 | }, |
233 | showTId: "", //显示详情 教师ID | 266 | showTId: "", //显示详情 教师ID |
267 | + formTeacher:{ | ||
268 | + teacherName:"", | ||
269 | + loginName:"", | ||
270 | + sex:1, | ||
271 | + managerList:[] | ||
272 | + }, | ||
273 | + rulesTeacher:{}, | ||
234 | }; | 274 | }; |
235 | }, | 275 | }, |
236 | async created() { | 276 | async created() { |
@@ -249,6 +289,7 @@ export default { | @@ -249,6 +289,7 @@ export default { | ||
249 | this.showTId = obj.id; | 289 | this.showTId = obj.id; |
250 | this.teacherDetail = { ...obj }; | 290 | this.teacherDetail = { ...obj }; |
251 | }, | 291 | }, |
292 | + addTeacher(){}, | ||
252 | async _QueryData(type) { | 293 | async _QueryData(type) { |
253 | let query = {}; | 294 | let query = {}; |
254 | if (type == 1) { | 295 | if (type == 1) { |
src/views/test/index.vue
@@ -297,6 +297,59 @@ export default { | @@ -297,6 +297,59 @@ export default { | ||
297 | lianghao: 40, | 297 | lianghao: 40, |
298 | jige: 30, | 298 | jige: 30, |
299 | bujige: 20, | 299 | bujige: 20, |
300 | + questionList: [ | ||
301 | + { | ||
302 | + questionTitle: "f", | ||
303 | + score: 1, | ||
304 | + subQuestions: [ | ||
305 | + { | ||
306 | + questionIndex: 1, | ||
307 | + questionType: 2, | ||
308 | + score: 1, | ||
309 | + partScore: 0, | ||
310 | + selectNum: 4, | ||
311 | + answerOptions: ["A", "B", "C", "D"], | ||
312 | + correctAnswer: "B", | ||
313 | + }, | ||
314 | + { | ||
315 | + questionIndex: 2, | ||
316 | + questionType: 2, | ||
317 | + score: 1, | ||
318 | + partScore: 0, | ||
319 | + selectNum: 4, | ||
320 | + answerOptions: ["A", "B", "C", "D", "E", "F"], | ||
321 | + correctAnswer: "A", | ||
322 | + }, | ||
323 | + { | ||
324 | + questionIndex: 2, | ||
325 | + questionType: 3, | ||
326 | + score: 1, | ||
327 | + partScore: 0, | ||
328 | + selectNum: 4, | ||
329 | + answerOptions: ["A", "B", "C", "D", "E", "F"], | ||
330 | + correctAnswer: "AB", | ||
331 | + }, | ||
332 | + { | ||
333 | + questionIndex: 2, | ||
334 | + questionType: 3, | ||
335 | + score: 1, | ||
336 | + partScore: 0, | ||
337 | + selectNum: 4, | ||
338 | + answerOptions: ["A", "B", "C", "D", "E", "F"], | ||
339 | + correctAnswer: "AB", | ||
340 | + }, | ||
341 | + { | ||
342 | + questionIndex: 3, | ||
343 | + questionType: 4, | ||
344 | + score: 1, | ||
345 | + partScore: 0, | ||
346 | + selectNum: 0, | ||
347 | + answerOptions: [], | ||
348 | + correctAnswer: "1", | ||
349 | + }, | ||
350 | + ], | ||
351 | + }, | ||
352 | + ], | ||
300 | }, | 353 | }, |
301 | { | 354 | { |
302 | title: "试卷二", | 355 | title: "试卷二", |