feat: 问题修复

This commit is contained in:
cgd_mac 2022-02-24 10:33:50 +08:00
parent 4b9e970a6e
commit b3b9720595
8 changed files with 161 additions and 109 deletions

View File

@ -10,12 +10,12 @@
<!-- <li :class="{'success-li' : index == 2}" v-for="(item, index) in options" :key="index">
<span>{{ optionKeys[index] }}</span>{{ item.label }}
</li> -->
<li v-if="data.answerA || data.answerA === 0" :class="{'success-li' : data.rightAnswers.indexOf('A') !== -1}"><span>A</span>{{ data.answerA }}</li>
<li v-if="data.answerB || data.answerB === 0" :class="{'success-li' : data.rightAnswers.indexOf('B') !== -1}"><span>B</span>{{ data.answerB }}</li>
<li v-if="data.answerC || data.answerC === 0" :class="{'success-li' : data.rightAnswers.indexOf('C') !== -1}"><span>C</span>{{ data.answerC }}</li>
<li v-if="data.answerD || data.answerD === 0" :class="{'success-li' : data.rightAnswers.indexOf('D') !== -1}"><span>D</span>{{ data.answerD }}</li>
<li v-if="data.answerE || data.answerE === 0" :class="{'success-li' : data.rightAnswers.indexOf('E') !== -1}"><span>E</span>{{ data.answerE }}</li>
<li v-if="data.answerF || data.answerF === 0" :class="{'success-li' : data.rightAnswers.indexOf('F') !== -1}"><span>F</span>{{ data.answerF }}</li>
<li v-if="data.answerA || data.answerA === 0" :class="[{'error-li': data.myAnswerList.indexOf('A') !== -1},{'success-li' : data.rightAnswers.indexOf('A') !== -1}]"><span>A</span>{{ data.answerA }}</li>
<li v-if="data.answerB || data.answerB === 0" :class="[{'error-li': data.myAnswerList.indexOf('B') !== -1},{'success-li' : data.rightAnswers.indexOf('B') !== -1}]"><span>B</span>{{ data.answerB }}</li>
<li v-if="data.answerC || data.answerC === 0" :class="[{'error-li': data.myAnswerList.indexOf('C') !== -1},{'success-li' : data.rightAnswers.indexOf('C') !== -1}]"><span>C</span>{{ data.answerC }}</li>
<li v-if="data.answerD || data.answerD === 0" :class="[{'error-li': data.myAnswerList.indexOf('D') !== -1},{'success-li' : data.rightAnswers.indexOf('D') !== -1}]"><span>D</span>{{ data.answerD }}</li>
<li v-if="data.answerE || data.answerE === 0" :class="[{'error-li': data.myAnswerList.indexOf('E') !== -1},{'success-li' : data.rightAnswers.indexOf('E') !== -1}]"><span>E</span>{{ data.answerE }}</li>
<li v-if="data.answerF || data.answerF === 0" :class="[{'error-li': data.myAnswerList.indexOf('F') !== -1},{'success-li' : data.rightAnswers.indexOf('F') !== -1}]"><span>F</span>{{ data.answerF }}</li>
</ul>
</div>
<div class="flex-center justify-between" style="margin-top: 10px;">
@ -101,6 +101,9 @@ export default {
li{
line-height: 2;
}
.error-li{
color: red;
}
.success-li{
color: #52c41a;
}

View File

@ -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
}))

View File

@ -41,12 +41,14 @@ const user = {
// 登录
Login ({ commit }, userInfo) {
return new Promise((resolve, reject) => {
login(userInfo).then(response => {
login(userInfo)
.then(response => {
storage.set(ACCESS_TOKEN, response.token, 24 * 60 * 60 * 1000)
commit('SET_TOKEN', response.token)
resolve()
}).catch(error => {
reject('后端未启动或代理错误')
})
.catch(error => {
reject(error)
})
})
},
@ -54,7 +56,8 @@ const user = {
// 获取用户信息
GetInfo ({ commit, state }) {
return new Promise((resolve, reject) => {
getLoginUser().then(response => {
getLoginUser()
.then(response => {
if (response.code === 200) {
const data = response.data
commit('SET_ROLES', 1)
@ -63,13 +66,17 @@ const 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)
commit(
'SET_AVATAR',
process.env.VUE_APP_API_BASE_URL + '/sysFileInfo/preview?id=' + data.user.avatar
)
}
resolve(data)
} else {
reject(new Error(response.msg))
}
}).catch(error => {
})
.catch(error => {
reject(error)
})
})
@ -77,7 +84,7 @@ const user = {
// 登出
Logout ({ commit, state }) {
return new Promise((resolve) => {
return new Promise(resolve => {
const clear = function () {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
@ -85,15 +92,18 @@ const user = {
commit('SET_ROUTERS', [])
storage.remove(ACCESS_TOKEN)
}
logout().then(() => {
logout()
.then(() => {
clear()
setTimeout(() => {
resolve()
}, 300)
resolve()
}).catch(() => {
})
.catch(() => {
resolve()
}).finally(() => {
})
.finally(() => {
clear()
})
})

View File

@ -3,19 +3,21 @@
<a-descriptions layout="horizontal" bordered size="small" :column="1">
<a-descriptions-item label="课程编号">{{ detailData.courseCode }}</a-descriptions-item>
<a-descriptions-item label="课程名称">{{ detailData.courseName }}</a-descriptions-item>
<a-descriptions-item label="课程类别"> {{detailData.courseTypeName}} </a-descriptions-item>
<a-descriptions-item label="课程类别">
{{ getDictLabelByKey('dictCourseType', detailData.courseType) }}
</a-descriptions-item>
<a-descriptions-item label="课时">{{ detailData.hour }}</a-descriptions-item>
<a-descriptions-item label="学习内容">{{ detailData.learningContent }}</a-descriptions-item>
<a-descriptions-item label="试题数量">{{ detailData.questionCount }}</a-descriptions-item>
<a-descriptions-item label="备注">{{ detailData.remark }}</a-descriptions-item>
<a-descriptions-item label="课程封面图">
<div>
<img style="width:75px;height:75px" :src="detailData.imagePath">
<img style="width:75px;height:75px" :src="detailData.imagePath" />
</div>
</a-descriptions-item>
<a-descriptions-item label="标签">
<a-tag color="blue" v-for="(item,index) in detailData.tags" :key="index ">
{{item}}
<a-tag color="blue" v-for="(item, index) in detailData.courseTags" :key="index">
{{ getDictLabelByKey('dictCourseTag', item.dictValue) }}
</a-tag>
</a-descriptions-item>
</a-descriptions>
@ -26,21 +28,22 @@
</a-card>
</template>
<script>
import _ from 'lodash'
import { getCourseDetails } from '@/api/course/course'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
export default {
name: 'details',
name: 'Details',
components: {},
data () {
return {
queryParam: { id: this.$route.query.id },
detailData: {
imagePath: '', //
coverPath:[],
coverPath: []
},
dictCourseType: [],
dictCourseTag: [],
tags: [], //
tags: [] //
}
},
created: function () {
@ -52,17 +55,17 @@ export default {
methods: {
//
loadData () {
let parameter = {}
getCourseDetails(Object.assign(parameter, this.queryParam)).then((res) => {
const parameter = {}
getCourseDetails(Object.assign(parameter, this.queryParam)).then(res => {
this.detailData = res.data
this.detailData.coverPath = JSON.parse(res.data.coverPath)
console.log('JSON:::::', this.detailData.coverPath)
if(this.detailData.coverPath.length != 0)
this.detailData.imagePath = this.detailData.coverPath[0].url;
if (this.detailData.coverPath.length != 0) {
this.detailData.imagePath = this.detailData.coverPath[0].url
}
console.log('url', this.detailData.imagePath)
})
},
@ -70,42 +73,55 @@ export default {
this.$router.push({ path: '/course/CourseList/' + this.$route.query.type, query: {} })
},
edit (record) {
this.$router.push({ path: '/course/CourseAdd', query: { id: this.queryParam.id, type: this.$route.query.type } })
this.$router.push({
path: '/course/CourseAdd',
query: { id: this.queryParam.id, type: this.$route.query.type }
})
},
getDictLabelByKey (name, value) {
let result = '-'
const list = this[name]
if (Array.isArray(list)) {
const item = _.find(list, ['value', value])
if (item) {
result = item.name
}
}
return result
},
//
dictionaryDropDown () {
//
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
dictionaryDropDown({ dictionaryCode: '0006' }).then(res => {
this.dictCourseType = res.data
//valuename
for (let i = 0; i < this.dictCourseType.length; i++) {
if (this.dictCourseType[i].value == this.detailData.courseType) {
this.detailData.courseTypeName = this.dictCourseType[i].name
}
}
// // valuename
// for (let i = 0; i < this.dictCourseType.length; i++) {
// if (this.dictCourseType[i].value == this.detailData.courseType) {
// this.detailData.courseTypeName = this.dictCourseType[i].name
// }
// }
})
},
getTagName () {
dictionaryDropDown({ dictionaryCode: '0008' }).then((res) => {
dictionaryDropDown({ dictionaryCode: '0008' }).then(res => {
this.dictCourseTag = res.data
console.log(this.dictCourseTag)
let tags = []
for (let i = 0; i < this.dictCourseTag.length; i++) {
for (let j = 0; j < this.detailData.courseTags.length; j++) {
if (this.dictCourseTag[i].value == this.detailData.courseTags[j].dictValue) {
tags.push(this.dictCourseTag[i].name)
}
}
}
console.log('tagagagaga', tags)
this.detailData.tags = tags
// const tags = []
// for (let i = 0; i < this.dictCourseTag.length; i++) {
// for (let j = 0; j < this.detailData.courseTags.length; j++) {
// if (this.dictCourseTag[i].value == this.detailData.courseTags[j].dictValue) {
// tags.push(this.dictCourseTag[i].name)
// }
// }
// }
// console.log('tagagagaga', tags)
// this.detailData.tags = tags
})
},
},
}
}
}
</script>

View File

@ -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;
}
</style>

View File

@ -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
})

View File

@ -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 })

View File

@ -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