diff --git a/src/components/DbQuestionInfoItem/index.vue b/src/components/DbQuestionInfoItem/index.vue index cf076d9..1aa85fa 100644 --- a/src/components/DbQuestionInfoItem/index.vue +++ b/src/components/DbQuestionInfoItem/index.vue @@ -10,12 +10,12 @@ -
  • A、{{ data.answerA }}
  • -
  • B、{{ data.answerB }}
  • -
  • C、{{ data.answerC }}
  • -
  • D、{{ data.answerD }}
  • -
  • E、{{ data.answerE }}
  • -
  • F、{{ data.answerF }}
  • +
  • A、{{ data.answerA }}
  • +
  • B、{{ data.answerB }}
  • +
  • C、{{ data.answerC }}
  • +
  • D、{{ data.answerD }}
  • +
  • E、{{ data.answerE }}
  • +
  • F、{{ data.answerF }}
  • @@ -101,6 +101,9 @@ export default { li{ line-height: 2; } + .error-li{ + color: red; + } .success-li{ color: #52c41a; } diff --git a/src/components/Table/index.js b/src/components/Table/index.js index 85cbd1d..f4e4b25 100644 --- a/src/components/Table/index.js +++ b/src/components/Table/index.js @@ -1,6 +1,8 @@ import T from 'ant-design-vue/es/table/Table' import get from 'lodash.get' - +const defaultPagination = { + pageSizeOptions: ['5', '10', '20', '30', '40'] +} export default { data () { return { @@ -9,7 +11,7 @@ export default { selectedRowKeys: [], localLoading: false, localDataSource: [], - localPagination: Object.assign({}, this.pagination) + localPagination: Object.assign({}, defaultPagination) } }, props: Object.assign({}, T.props, { @@ -121,7 +123,7 @@ export default { * 如果参数为 true, 则强制刷新到第一页 * @param Boolean bool */ - refresh (bool = false) { + refresh (bool = true) { bool && (this.localPagination = Object.assign({}, { current: 1, pageSize: this.pageSize })) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index f127cb1..c5c723d 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -41,43 +41,50 @@ const user = { // 登录 Login ({ commit }, userInfo) { return new Promise((resolve, reject) => { - login(userInfo).then(response => { - storage.set(ACCESS_TOKEN, response.token, 24 * 60 * 60 * 1000) - commit('SET_TOKEN', response.token) - resolve() - }).catch(error => { - reject('后端未启动或代理错误') - }) + login(userInfo) + .then(response => { + storage.set(ACCESS_TOKEN, response.token, 24 * 60 * 60 * 1000) + commit('SET_TOKEN', response.token) + resolve() + }) + .catch(error => { + reject(error) + }) }) }, // 获取用户信息 GetInfo ({ commit, state }) { return new Promise((resolve, reject) => { - getLoginUser().then(response => { - if (response.code === 200) { - const data = response.data - commit('SET_ROLES', 1) - commit('SET_BUTTONS', data.permissions) - commit('SET_INFO', data.user) - state.person = data.person - commit('SET_NAME', { name: data.user.userName, welcome: welcome() }) - if (data.user.avatar != null) { - commit('SET_AVATAR', process.env.VUE_APP_API_BASE_URL + '/sysFileInfo/preview?id=' + data.user.avatar) + getLoginUser() + .then(response => { + if (response.code === 200) { + const data = response.data + commit('SET_ROLES', 1) + commit('SET_BUTTONS', data.permissions) + commit('SET_INFO', data.user) + state.person = data.person + commit('SET_NAME', { name: data.user.userName, welcome: welcome() }) + if (data.user.avatar != null) { + commit( + 'SET_AVATAR', + process.env.VUE_APP_API_BASE_URL + '/sysFileInfo/preview?id=' + data.user.avatar + ) + } + resolve(data) + } else { + reject(new Error(response.msg)) } - resolve(data) - } else { - reject(new Error(response.msg)) - } - }).catch(error => { - reject(error) - }) + }) + .catch(error => { + reject(error) + }) }) }, // 登出 Logout ({ commit, state }) { - return new Promise((resolve) => { + return new Promise(resolve => { const clear = function () { commit('SET_TOKEN', '') commit('SET_ROLES', []) @@ -85,17 +92,20 @@ const user = { commit('SET_ROUTERS', []) storage.remove(ACCESS_TOKEN) } - logout().then(() => { - clear() - setTimeout(() => { + logout() + .then(() => { + clear() + setTimeout(() => { + resolve() + }, 300) resolve() - }, 300) - resolve() - }).catch(() => { - resolve() - }).finally(() => { - clear() - }) + }) + .catch(() => { + resolve() + }) + .finally(() => { + clear() + }) }) } } diff --git a/src/views/course/CourseDetail.vue b/src/views/course/CourseDetail.vue index 6cd9c41..f990924 100644 --- a/src/views/course/CourseDetail.vue +++ b/src/views/course/CourseDetail.vue @@ -1,111 +1,127 @@ @@ -120,4 +136,4 @@ export default { text-align: center; margin-top: 10px; } - \ No newline at end of file + diff --git a/src/views/mycourse/courseLearn/index.vue b/src/views/mycourse/courseLearn/index.vue index e6a3cd6..4983126 100644 --- a/src/views/mycourse/courseLearn/index.vue +++ b/src/views/mycourse/courseLearn/index.vue @@ -181,11 +181,16 @@ export default { title: '课中检查', content: '课程学习完成后都会随机出现1道小题,答对题目,方可继续下一部分学习,您有2次机会。否则之前上一小段学习时间不计算学时,需要重新学习!', + okCancel: false, onOk () { _this.$refs.examDialog.show() _this.$refs.examDialog.getExamQuestion() }, - onCancel () {} + onCancel () { + return new Promise((resolve, reject) => { + }).catch(() => console.log('Oops errors!')) + }, + wrapClassName: 'dialogTest' }) }, // 禁止快进 @@ -230,4 +235,8 @@ export default { width: 100%; margin: 0 auto; } + +.learn-exam-dialog ::v-deep .ant-modal-confirm-btns:first-child{ + display: none; +} diff --git a/src/views/mycourse/mycourseList/MyCourseList.vue b/src/views/mycourse/mycourseList/MyCourseList.vue index f492834..e75d5a3 100644 --- a/src/views/mycourse/mycourseList/MyCourseList.vue +++ b/src/views/mycourse/mycourseList/MyCourseList.vue @@ -151,7 +151,7 @@ export default { }, // 获取数据词典 dictionaryDropDown () { - dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => { + dictionaryDropDown({ dictionaryCode: '0009' }).then((res) => { this.queryOptions[1].options = dictToTree(res.data, [], 0) this.loading = false }) diff --git a/src/views/mycourse/mycourseList/TrainingPlan.vue b/src/views/mycourse/mycourseList/TrainingPlan.vue index c634efa..fa636df 100644 --- a/src/views/mycourse/mycourseList/TrainingPlan.vue +++ b/src/views/mycourse/mycourseList/TrainingPlan.vue @@ -123,10 +123,10 @@ export default { tabChange (key) { console.log('key', key) if (key == 1) { - this.$refs.yearTable.refresh() + this.$refs.yearTable && this.$refs.yearTable.refresh() } if (key == 2) { - this.$refs.unitTable.refresh() + this.$refs.unitTable && this.$refs.unitTable.refresh() } }, // 点击详情 @@ -134,7 +134,19 @@ export default { this.$refs.aycourseDetail.visible = true }, handlerAddCourse (row) { - this.$emit('add', { row: row }) + const _this = this + const activeTab = this.activeTab + this.$emit('add', { + row: row, + callback: function () { + if (activeTab == 1) { + _this.$refs.yearTable && _this.$refs.yearTable.refresh() + } + if (activeTab == 2) { + _this.$refs.unitTable && _this.$refs.unitTable.refresh() + } + } + }) }, handlerContinue (row) { this.$emit('continue', { row: row }) diff --git a/src/views/myexam/index.vue b/src/views/myexam/index.vue index 7c07916..e64276d 100644 --- a/src/views/myexam/index.vue +++ b/src/views/myexam/index.vue @@ -187,7 +187,7 @@ export default { }, methods: { dictionaryDropDown () { - dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => { + dictionaryDropDown({ dictionaryCode: '0009' }).then((res) => { const result = dictToTree(res.data, [], 0) this.queryOptions[0].options = result this.loading = false