Commit dd5150c54ca378ceea77984dea0b5259c8eb13f5
1 parent
8f882f63
数据同步
Showing
9 changed files
with
582 additions
and
106 deletions
src/components/setAnswer.vue
1 | 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 | 5 | <!-- 设置答案 <i class="fa fa-exchange" @click="editType = !editType"></i> --> |
6 | 6 | 设置答案 |
7 | + <i class="el-icon-close" @click="cancel"></i> | |
7 | 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 | 60 | </div> |
56 | - </div> | |
57 | - </template> | |
61 | + </template> | |
62 | + </div> | |
58 | 63 | </div> |
59 | - </div> | |
60 | - <!-- <div v-show="!editType"> | |
64 | + <!-- <div v-show="!editType"> | |
61 | 65 | <p class="dia-tips"> |
62 | 66 | 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” |
63 | 67 | </p> |
... | ... | @@ -148,13 +152,16 @@ |
148 | 152 | </div> |
149 | 153 | </div> |
150 | 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 | 163 | </div> |
157 | - </el-dialog> | |
164 | + </div> | |
158 | 165 | </template> |
159 | 166 | |
160 | 167 | <script> |
... | ... | @@ -280,19 +287,59 @@ export default { |
280 | 287 | questionList: questionList, |
281 | 288 | }); |
282 | 289 | if (status == 0) { |
283 | - this.$emit('saveSuccess') | |
290 | + this.$emit("saveSuccess"); | |
284 | 291 | } else { |
285 | 292 | this.$message.error(message); |
286 | 293 | } |
287 | 294 | }, |
288 | 295 | cancel() { |
289 | - this.$emit('cancel') | |
296 | + this.$emit("cancel"); | |
290 | 297 | }, |
291 | 298 | }, |
292 | 299 | }; |
293 | 300 | </script> |
294 | 301 | |
295 | 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 | 343 | .sub-questions { |
297 | 344 | width: 100%; |
298 | 345 | display: flex; | ... | ... |
src/store/index.js
... | ... | @@ -89,12 +89,9 @@ const store = new Vuex.Store({ |
89 | 89 | } |
90 | 90 | } |
91 | 91 | }).catch(() => { |
92 | - // commit("setToken", Cookies.get("JSESSIONID")); | |
93 | 92 | }) |
94 | 93 | }, |
95 | 94 | permissions({ state, commit }, that) { |
96 | - // request.login(that.loginForm).then(res => { | |
97 | - // if (res.status == 200) { | |
98 | 95 | let userInfo = { |
99 | 96 | permissions: [ |
100 | 97 | { |
... | ... | @@ -107,8 +104,6 @@ const store = new Vuex.Store({ |
107 | 104 | }, |
108 | 105 | ], |
109 | 106 | name: "李老师", |
110 | - // avatar: data.avatar ? data.avatar : "", | |
111 | - // uid: data.id, | |
112 | 107 | authorityRouter:[ |
113 | 108 | "setUpAccount", |
114 | 109 | "setUpSchool", | ... | ... |
src/views/dataSync/index.vue
1 | 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 | 45 | </template> |
4 | 46 | |
5 | 47 | <script> |
6 | 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 | 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 | 155 | </style> |
14 | 156 | \ No newline at end of file | ... | ... |
src/views/device/index.vue
... | ... | @@ -606,7 +606,7 @@ export default { |
606 | 606 | if (this.loadingUpDate) return; |
607 | 607 | this.loadingUpDate = true; |
608 | 608 | let data = await this.$request.modifyUpgradeFlag({ |
609 | - deviceId: id ? id : this.selectionTabIds, | |
609 | + deviceIds: id ? [id] : this.selectionTabIds, | |
610 | 610 | upgradeFlag: 1, |
611 | 611 | }); |
612 | 612 | this.loadingUpDate = false; |
... | ... | @@ -625,7 +625,7 @@ export default { |
625 | 625 | if (this.loadingUpDate) return; |
626 | 626 | this.loadingUpDate = true; |
627 | 627 | let data = await this.$request.modifyUpgradeFlag({ |
628 | - deviceId: id ? id : this.selectionTabIds, | |
628 | + deviceIds: id ? [id] : this.selectionTabIds, | |
629 | 629 | upgradeFlag: 0, |
630 | 630 | }); |
631 | 631 | this.loadingUpDate = false; | ... | ... |
src/views/login/index.vue
... | ... | @@ -90,8 +90,10 @@ export default { |
90 | 90 | disableClick: true, |
91 | 91 | passwordType: "password", |
92 | 92 | loginForm: { |
93 | - username: "13610050254", | |
94 | - password: "Pw050254#", | |
93 | + // username: "13610050254", | |
94 | + // password: "Pw050254#", | |
95 | + username: "18946034886", | |
96 | + password: "Pw034886#", | |
95 | 97 | }, |
96 | 98 | loginRules: { |
97 | 99 | username: [ | ... | ... |
src/views/setUp/school.vue
... | ... | @@ -91,6 +91,41 @@ |
91 | 91 | <el-button @click="diaUp = false">取 消</el-button> |
92 | 92 | </div> |
93 | 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 | 129 | <el-dialog title="修改学校信息" :visible.sync="diaSchool" width="400"> |
95 | 130 | <el-form |
96 | 131 | class="form-box" |
... | ... | @@ -183,13 +218,14 @@ export default { |
183 | 218 | url: "xxx", |
184 | 219 | diaUp: false, |
185 | 220 | diaSchool: false, |
221 | + diaGrade: false, | |
186 | 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 | 230 | tableData: [], |
195 | 231 | formSchool: { |
... | ... | @@ -204,6 +240,17 @@ export default { |
204 | 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 | 254 | sectionsList: [ |
208 | 255 | { id: "1", name: "小学" }, |
209 | 256 | { id: "2", name: "初中" }, |
... | ... | @@ -211,14 +258,30 @@ export default { |
211 | 258 | { id: "4", name: "大学" }, |
212 | 259 | { id: "7", name: "高补" }, |
213 | 260 | ], |
261 | + subjectList: [], | |
214 | 262 | }; |
215 | 263 | }, |
216 | 264 | created() { |
217 | 265 | this._QueryDataSchool(); |
218 | 266 | this._QueryDataGrade(); |
267 | + this._QuerySubject(); | |
219 | 268 | }, |
220 | 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 | 285 | async editSchool() { |
223 | 286 | if (!this.formSchool.sections.length) { |
224 | 287 | this.$message.error("请选择学段!"); |
... | ... | @@ -232,9 +295,11 @@ export default { |
232 | 295 | return; |
233 | 296 | } |
234 | 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 | 303 | this.loading = false; |
239 | 304 | if (status === 0) { |
240 | 305 | this.$message.success("修改成功~"); |
... | ... | @@ -244,6 +309,28 @@ export default { |
244 | 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 | 334 | async _QueryDataSchool() { |
248 | 335 | this.loading = true; |
249 | 336 | const { data, status, info } = await this.$request.schoolDetail(); |
... | ... | @@ -270,6 +357,15 @@ export default { |
270 | 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 | 369 | async downExcel() { |
274 | 370 | let data = await this.$request.downDevice({ |
275 | 371 | id: this.id, |
... | ... | @@ -374,4 +470,10 @@ export default { |
374 | 470 | .form-box { |
375 | 471 | margin: 0 20px; |
376 | 472 | } |
473 | +.el-icon-plus{ | |
474 | + cursor: pointer; | |
475 | + &:hover{ | |
476 | + color:#667ffd | |
477 | + } | |
478 | +} | |
377 | 479 | </style> |
378 | 480 | \ No newline at end of file | ... | ... |
src/views/setUp/student.vue
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | size="mini" |
13 | 13 | plain |
14 | 14 | circle |
15 | + @click="openAddDia" | |
15 | 16 | ></el-button> |
16 | 17 | </el-tooltip> |
17 | 18 | </template> |
... | ... | @@ -41,7 +42,7 @@ |
41 | 42 | v-for="item in classList" |
42 | 43 | :key="item.classCode" |
43 | 44 | :class="query.classId == item.id ? 'active' : ''" |
44 | - @click="classDetail(item.id)" | |
45 | + @click="classDetail(item)" | |
45 | 46 | > |
46 | 47 | <i class="el-icon-edit-outline"></i> |
47 | 48 | {{ item.className }}({{ item.studentCount }}) |
... | ... | @@ -78,11 +79,14 @@ |
78 | 79 | </div> |
79 | 80 | </div> |
80 | 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 | 84 | <p class="name">{{ item.studentName }}</p> |
84 | 85 | <p class="p1"> |
85 | - 答题器:{{ (item.clickerList.length && item.clickerList[0].clickerSn) || "--" }} | |
86 | + 答题器:{{ | |
87 | + (item.clickerList.length && item.clickerList[0].clickerSn) || | |
88 | + "--" | |
89 | + }} | |
86 | 90 | </p> |
87 | 91 | <p class="p1">长学号:{{ item.studentCode }}</p> |
88 | 92 | <p class="p1">短学号:{{ item.shortNumber || "--" }}</p> |
... | ... | @@ -96,15 +100,46 @@ |
96 | 100 | </div> |
97 | 101 | </div> |
98 | 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 | 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 | 143 | </div> |
109 | 144 | </el-dialog> |
110 | 145 | </div> |
... | ... | @@ -116,13 +151,29 @@ export default { |
116 | 151 | data() { |
117 | 152 | return { |
118 | 153 | url: "", |
119 | - diaUp: false, | |
154 | + diaStu: false, | |
120 | 155 | query: { |
121 | 156 | gradeName: "", |
122 | 157 | classId: "", |
123 | 158 | studentCode: "", |
124 | 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 | 177 | gradeName: "", |
127 | 178 | gradeList: [], |
128 | 179 | classList: [], |
... | ... | @@ -144,15 +195,57 @@ export default { |
144 | 195 | this._QueryData(3); |
145 | 196 | }, |
146 | 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 | 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 | 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 | 249 | async _QueryData(type) { |
157 | 250 | let query = {}; |
158 | 251 | query.gradeName = this.query.gradeName; |
... | ... | @@ -202,6 +295,7 @@ export default { |
202 | 295 | if (status === 0) { |
203 | 296 | this.classList = [...data.list] || []; |
204 | 297 | this.query.classId = this.classList[0]?.id; |
298 | + this.formStu.className = this.classList[0]?.className; | |
205 | 299 | } else { |
206 | 300 | this.$message.error(info); |
207 | 301 | } | ... | ... |
src/views/setUp/teacher.vue
... | ... | @@ -192,7 +192,7 @@ |
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | </div> |
195 | - <el-dialog title="导入学校名单" :visible.sync="diaUp" width="400"> | |
195 | + <el-dialog title="导入教师名单" :visible.sync="diaUp" width="400"> | |
196 | 196 | <up-load id="downTeacher" :url="url" fileName="教师名单"> |
197 | 197 | <p class="down-txt" slot="down"> |
198 | 198 | 通过Excel名单导入教师名单,点击 |
... | ... | @@ -203,6 +203,38 @@ |
203 | 203 | <el-button @click="diaUp = false">取 消</el-button> |
204 | 204 | </div> |
205 | 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 | 238 | </div> |
207 | 239 | </template> |
208 | 240 | |
... | ... | @@ -211,16 +243,17 @@ import { downloadFile } from "@/utils"; |
211 | 243 | export default { |
212 | 244 | data() { |
213 | 245 | return { |
214 | - loading:false, | |
246 | + loading: false, | |
215 | 247 | url: "", |
216 | 248 | diaUp: false, |
249 | + diaTeacher:false, | |
217 | 250 | query: { |
218 | 251 | gradeName: "", |
219 | 252 | teacherName: "", |
220 | 253 | phone: "", |
221 | 254 | }, |
222 | 255 | gradeList: [], |
223 | - teacherList: [ ], | |
256 | + teacherList: [], | |
224 | 257 | teacherDetail: { |
225 | 258 | teacherName: "", |
226 | 259 | loginName: "", |
... | ... | @@ -231,6 +264,13 @@ export default { |
231 | 264 | teacherGradeList: [], |
232 | 265 | }, |
233 | 266 | showTId: "", //显示详情 教师ID |
267 | + formTeacher:{ | |
268 | + teacherName:"", | |
269 | + loginName:"", | |
270 | + sex:1, | |
271 | + managerList:[] | |
272 | + }, | |
273 | + rulesTeacher:{}, | |
234 | 274 | }; |
235 | 275 | }, |
236 | 276 | async created() { |
... | ... | @@ -249,6 +289,7 @@ export default { |
249 | 289 | this.showTId = obj.id; |
250 | 290 | this.teacherDetail = { ...obj }; |
251 | 291 | }, |
292 | + addTeacher(){}, | |
252 | 293 | async _QueryData(type) { |
253 | 294 | let query = {}; |
254 | 295 | if (type == 1) { | ... | ... |
src/views/test/index.vue
... | ... | @@ -297,6 +297,59 @@ export default { |
297 | 297 | lianghao: 40, |
298 | 298 | jige: 30, |
299 | 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 | 355 | title: "试卷二", | ... | ... |