yujialong 4 years ago
parent b95dbbad0e
commit 0505255dd2
  1. 25
      src/api/index.js
  2. BIN
      src/assets/img/login_bg.png
  3. 120
      src/layouts/header/index.vue
  4. 1
      src/layouts/home/index.vue
  5. 2
      src/pages/account/login/index.vue
  6. 2
      src/pages/account/register/index.vue
  7. 29
      src/pages/exam/list/index.vue
  8. 351
      src/pages/practice/do/index.vue
  9. 64
      src/pages/practice/list/myPractice.vue
  10. 23
      src/pages/setting/person/index.vue
  11. 2
      src/setting.js
  12. 21
      src/store/modules/exam.js
  13. 45
      src/store/modules/practice.js
  14. 11
      src/store/modules/user.js
  15. 4
      src/styles/lib/_reset.scss

@ -1,13 +1,20 @@
let loginhost = 'http://www.liuwanr.cn/liuwanr' import Setting from '@/setting'
let host = 'http://192.168.31.152:8001' let host = 'http://192.168.31.152:8001'
let uploadURL = Setting.apiUploadURL
export default { export default {
logins: `management/userInfo/login`, //登录  // 登录注册
save: `management/userInfo/add`, //注册 logins: `management/userInfo/login`,
save: `management/userInfo/add`,
//查询电话是否存在 // oss文件管理
queryPhone: `${loginhost}/userInfo/queryPhone`, fileDeletion: `${uploadURL}/oss/manage/fileDeletion`,
fileupload: `${uploadURL}/oss/manage/fileupload`,
getPlayAuth: `${uploadURL}/oss/manage/getPlayAuth`,
removeMoreVideo: `${uploadURL}/oss/manage/removeMoreVideo`,
removeVideo: `${uploadURL}/oss/manage/removeVideo`,
//查询电话是否存在
queryProvince: `enterprise/province/queryProvince`, queryProvince: `enterprise/province/queryProvince`,
queryCity: `enterprise/city/queryCity`, queryCity: `enterprise/city/queryCity`,
queryClient: `enterprise/client/list`, queryClient: `enterprise/client/list`,
@ -30,4 +37,12 @@ export default {
queryGzAnswerDetails: `/user/exam/queryGzAnswerDetails`, queryGzAnswerDetails: `/user/exam/queryGzAnswerDetails`,
coverGzAnswerDetails: `/user/exam/coverGzAnswerDetails`, coverGzAnswerDetails: `/user/exam/coverGzAnswerDetails`,
getStateById:`management/monitor/getStateById`, getStateById:`management/monitor/getStateById`,
// 我的练习
previewtestPaper:`management/testPaper/preview`,
addPractiseExamAnswerDetails: `/user/practise/addPractiseExamAnswerDetails`,
addPractiseRecord: `/user/practise/addPractiseRecord`,
calculationScorePractice: `/user/practise/calculationScore`,
enterPractise: `/user/practise/enterPractise`,
getMinePractise: `/user/practise/getMinePractise`,
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 985 KiB

@ -10,25 +10,24 @@
<el-avatar :size="40" :src="avatar"></el-avatar> <el-avatar :size="40" :src="avatar"></el-avatar>
<span class="user-avator">{{userName}}</span> <span class="user-avator">{{userName}}</span>
</div> </div>
<el-divider class="ml20" direction="vertical"></el-divider> <el-divider class="m-l-20" direction="vertical"></el-divider>
<el-button type="text" class="ml20" @click="loginout">退出</el-button> <el-button type="text" class="m-l-20" @click="loginout">退出</el-button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { mapState,mapActions } from 'vuex'; import { mapState,mapActions } from 'vuex'
import bus from '@/libs/bus'; import Setting from '@/setting'
import Setting from '@/setting';
export default { export default {
data() { data() {
return { return {
showBackList: Setting.layout.hideNavList showBackList: Setting.layout.hideNavList,
}; };
}, },
computed: { computed: {
...mapState('user', [ ...mapState('user', [
'userName','avatar' 'userId','avatar','userName'
]), ]),
showBack(){ showBack(){
let route = this.$route.name let route = this.$route.name
@ -40,15 +39,14 @@ export default {
}, },
methods: { methods: {
...mapActions('user', [
'logout'
]),
loginout() {
this.logout()
},
toPerson(){ toPerson(){
this.$router.push('/setting/person') this.$router.push('/setting/person')
}, },
loginout() {
sessionStorage.removeItem(Setting.usernameKey);
sessionStorage.removeItem(Setting.storeKey);
location.reload()
},
back(){ back(){
this.$router.back() this.$router.back()
} }
@ -63,10 +61,10 @@ export default {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
margin-left: 20px; margin-left: 20px;
} i{
.goBack i{ color: #cb221c;
color: #cb221c; font-size: 20px;
font-size: 20px; }
} }
.header { .header {
position: relative; position: relative;
@ -76,52 +74,48 @@ export default {
font-size: 16px; font-size: 16px;
color: #333; color: #333;
border-bottom: 1px solid #efefef; border-bottom: 1px solid #efefef;
box-shadow: 0 0 1.5625rem 0.125rem rgba(255,45,45,0.14); box-shadow: 0 0 1.5625rem 0.125rem rgba(255, 45, 45, 0.14);
} .logo {
.header .logo { float: left;
float: left; width: 170px;
width: 170px; height: 40px;
height: 40px; margin-left: 20px;
margin-left: 20px; img{
} height: 100%;
.header .logo img{ }
height: 100%; }
} .header-right {
.header-right { float: right;
float: right; padding-right: 50px;
padding-right: 50px; .header-user-con {
} display: flex;
.header-user-con { height: 70px;
display: flex; align-items: center;
height: 70px; .user{
align-items: center; display: inline-flex;
align-items: center;
.user{ cursor: pointer;
display: inline-flex; }
align-items: center; }
cursor: pointer; .el-button--text{
color: #333;
}
.el-divider--vertical{
width: 2px;
height: 15px;
}
.el-divider{
background-color: #333;
}
.user-avator {
margin-left: 10px;
img {
display: block;
width: 40px;
height: 40px;
border-radius: 50%;
}
}
} }
}
.user-avator {
margin-left: 10px;
}
.ml20{
margin-left: 20px;
}
.user-avator img {
display: block;
width: 40px;
height: 40px;
border-radius: 50%;
}
.header-right .el-button--text{
color: #333;
}
.header-right .el-divider--vertical{
width: 2px;
height: 15px;
}
.header-right .el-divider{
background-color: #333;
} }
</style> </style>

@ -40,7 +40,6 @@ export default {
computed: { computed: {
hideNavbar() { hideNavbar() {
let route = this.$route.name let route = this.$route.name
console.log(11,this.hideNavList.includes(route))
if(this.hideNavList.includes(route)) return false if(this.hideNavList.includes(route)) return false
return true return true
} }

@ -119,7 +119,7 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: #333; background-color: rgba(51,51,51,.7);
.inner{ .inner{
display: inline-flex; display: inline-flex;
justify-content: space-between; justify-content: space-between;

@ -15,7 +15,7 @@
</el-form-item> --> </el-form-item> -->
<el-form-item prop="phone"> <el-form-item prop="phone">
<p class="label">*手机号</p> <p class="label">*手机号</p>
<el-input v-model="regForm.phone" placeholder="手机号" maxlength="11" @change="phoneChange"></el-input> <el-input v-model="regForm.phone" placeholder="手机号" maxlength="11"></el-input>
</el-form-item> </el-form-item>
</div> </div>

@ -46,10 +46,14 @@
{{(scope.row.timeCost / 60).toFixed(2)}} {{(scope.row.timeCost / 60).toFixed(2)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="score" label="得分" width="100" align="center"></el-table-column> <el-table-column prop="score" label="得分" width="100" align="center">
<template slot-scope="scope">
{{scope.row.score | transferScore}}
</template>
</el-table-column>
<el-table-column prop="state" label="考试状态" width="100" align="center"> <el-table-column prop="state" label="考试状态" width="100" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.state == 2 ? '已提交' : '未提交'}} {{getAssessmentStateName(scope.row.assessmentState)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
@ -81,7 +85,8 @@ export default {
page: 1, page: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
searchTimer: null searchTimer: null,
timer: null
}; };
}, },
computed: { computed: {
@ -92,9 +97,14 @@ export default {
'typeList' 'typeList'
]), ]),
...mapGetters('exam', [ ...mapGetters('exam', [
'getDegreeName','getTypeName','getStateName' 'getDegreeName','getTypeName','getAssessmentStateName'
]) ])
}, },
filters: {
transferScore(val){
return val ? val : '--'
}
},
watch: { watch: {
keyword: function(val) { keyword: function(val) {
clearTimeout(this.searchTimer) clearTimeout(this.searchTimer)
@ -105,6 +115,7 @@ export default {
}, },
mounted() { mounted() {
this.getData() this.getData()
this.addInterval()
}, },
methods: { methods: {
...mapActions('exam', [ ...mapActions('exam', [
@ -114,7 +125,15 @@ export default {
this.$get(`${this.api.queryExam}?type=${this.type}&assessmentName=${this.keyword}&userId=${this.userId}`).then(res => { this.$get(`${this.api.queryExam}?type=${this.type}&assessmentName=${this.keyword}&userId=${this.userId}`).then(res => {
this.listData = res.data.Assessment this.listData = res.data.Assessment
this.total = res.data.total this.total = res.data.total
}).catch(res => {}); }).catch(err => {
clearInterval(this.timer)
})
},
addInterval(){
this.timer = setInterval(this.getData,1000)
this.$once('hook:beforeDestroy',() => {
clearInterval(this.timer)
})
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.page = val; this.page = val;

@ -5,117 +5,304 @@
<div class="item"> <div class="item">
<p class="type">单选题</p> <p class="type">单选题</p>
<p class="total">10题合计20</p> <p class="total">{{singleCount}}合计{{singlePoint}}</p>
<div class="nums"> <div class="nums">
<span v-for="n in 10">{{n}}</span> <span v-for="n in singleCount" :class="{active: n <= singleAnsweredCount}" :key="n">{{n}}</span>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<p class="type">多选题</p> <p class="type">多选题</p>
<p class="total">10题合计20</p> <p class="total">{{multipleCount}}合计{{multipleChoiceScore}}</p>
<div class="nums"> <div class="nums">
<span v-for="n in 10">{{n}}</span> <span v-for="n in multipleCount" :class="{active: n <= multipleAnsweredCount}" :key="n">{{n}}</span>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<p class="type">判断题</p> <p class="type">判断题</p>
<p class="total">10题合计20</p> <p class="total">{{judgeCount}}合计{{judgeScore}}</p>
<div class="nums"> <div class="nums">
<span v-for="n in 5">{{n}}</span> <span v-for="n in judgeCount" :class="{active: n <= judgeAnsweredCount}" :key="n">{{n}}</span>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<p class="type">填空题</p> <p class="type">填空题</p>
<p class="total">10题合计20</p> <p class="total">{{fillBlankCount}}合计{{fillBlanksScore}}</p>
<div class="nums"> <div class="nums">
<span v-for="n in 5">{{n}}</span> <span v-for="n in fillBlankCount" :class="{active: n <= fillBlankAnsweredCount}" :key="n">{{n}}</span>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<p class="type">简答题</p> <p class="type">简答题</p>
<p class="total">10题合计20</p> <p class="total">{{briefAnswerCount}}合计{{briefAnswerScore}}</p>
<div class="nums"> <div class="nums">
<span v-for="n in 5">{{n}}</span> <span v-for="n in briefAnswerCount" :class="{active: n <= briefAnswerAnsweredCount}" :key="n">{{n}}</span>
</div> </div>
</div> </div>
<div class="btn"> <div class="btn">
<el-button size="mini" type="primary">提交练习</el-button> <el-button size="mini" type="primary" @click="save">提交练习</el-button>
</div> </div>
</div> </div>
<div class="middle"> <div class="middle">
<p class="title">单选题共10题合计20分</p>
<div class="ques"> <div class="ques">
<div class="item"> <template v-for="(subject,k) in subjects">
<p class="name">测试题目测试题目测试题目测试题目测试题目</p> <div class="item" v-if="subject.length" :key="k">
<div class="options"> <p v-if="subjects[k].length" class="title">{{questionType[k]}}{{subjects[k].length}}合计{{scoreList[k]}}</p>
<p class="option">A.单选项</p> <div class="ques-wrap" v-for="(item,index) in subject" :key="index">
<p class="option">B.单选项</p> <div class="name-wrap">
<p class="option">C.单选项</p> <span class="index">{{index+1}}.</span>
<p class="option">D.单选项</p> <div class="name" :class="'stem' + k + index" v-html="item.questionStem"></div>
</div>
<div class="options">
<template v-if="item.name == '单项选择' || item.name == '判断题'">
<div class="option" v-for="(option,i) in item.options" :key="i">
<el-radio v-model="item.val" :label="i">
{{i}}.{{item.options[i]}}
</el-radio>
</div>
</template>
<template v-if="item.name == '多项选择'">
<el-checkbox-group v-model="item.val">
<el-checkbox class="option-check" :label="i" v-for="(option,i) in item.options" :key="i">
{{i}}.{{item.options[i]}}
</el-checkbox>
</el-checkbox-group>
</template>
<template v-if="item.name == '简答题'">
<el-input type="textarea" rows="5" v-model="item.val"></el-input>
</template>
</div>
</div>
</div> </div>
</div> </template>
<div class="item">
<p class="name">测试题目测试题目测试题目测试题目测试题目</p>
<div class="options">
<p class="option">A.单选项</p>
<p class="option">B.单选项</p>
<p class="option">C.单选项</p>
<p class="option">D.单选项</p>
</div>
</div>
<div class="item">
<p class="name">测试题目测试题目测试题目测试题目测试题目</p>
<div class="options">
<p class="option">A.单选项</p>
<p class="option">B.单选项</p>
<p class="option">C.单选项</p>
<p class="option">D.单选项</p>
</div>
</div>
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<p class="title">剩余时间</p>
<p class="time">00:59:00</p>
<div class="ans">答题进度</div> <div class="ans">答题进度</div>
<el-progress :percentage="50"></el-progress> <el-progress :percentage="progress"></el-progress>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import mixins from '@/mixins/setBackground'; import { mapState,mapGetters,mapActions } from 'vuex'
import mixins from '@/mixins/setBackground'
import util from '@/libs/util'
export default { export default {
mixins: [ mixins ], mixins: [ mixins ],
data() { data() {
return { return {
subjects: [],
singleCount: 0,
multipleCount: 0,
judgeCount: 0,
fillBlankCount: 0,
briefAnswerCount: 0,
singleAnsweredCount: 0,
multipleAnsweredCount: 0,
judgeAnsweredCount: 0,
fillBlankAnsweredCount: 0,
briefAnswerAnsweredCount: 0,
singlePoint: 0,
multipleChoiceScore: 0,
judgeScore: 0,
fillBlanksScore: 0,
briefAnswerScore: 0,
scoreList: [],
questionType: ['单选题','多选题','判断题','填空题','简答题'],
startTime: new Date().getTime(),
time: '00:00:00',
progress: 0,
isSubmit: false,
isDone: false
}; };
}, },
computed: {
...mapState('user', [
'userId'
]),
...mapState('practice', [
'practiseId','paperId','isContinue','identification'
]),
},
mounted() { mounted() {
this.getData() this.getData()
this.addLeaveEvent()
},
beforeDestroy(){
window.onbeforeunload = null
this.addRecords()
}, },
methods: { methods: {
getData() { getData() {
// this.$get(`${this.api.getCourse}/${this.id}`) this.$post(`${this.api.previewtestPaper}?id=${this.paperId}`)
// .then(res => { .then(res => {
// let data = res.data.course let data = res.data
// this.name = data.name let subjects = [
// this.classificationId = data.classificationId [...data.list1],
// this.description = data.description [...data.list2],
// this.coverUrl = data.coverUrl [...data.list4],
// this.uploadList.push({ [...data.list3],
// name: 'cover.jpg', [...data.list5],
// url: this.coverUrl ]
// }) this.singleCount = data.list1.length
// }) this.multipleCount = data.list2.length
// .catch(err => { this.fillBlankCount = data.list3.length
this.judgeCount = data.list4.length
this.briefAnswerCount = data.list5.length
this.singlePoint = data.list1.length ? data.list1[0].singleChoiceScore * this.singleCount : 0
this.multipleChoiceScore = data.list2.length ? data.list2[0].multipleChoiceScore * this.multipleCount : 0
this.judgeScore = data.list4.length ? data.list4[0].judgeScore * this.judgeCount : 0
this.fillBlanksScore = data.list3.length ? data.list3[0].fillBlanksScore * this.fillBlankCount : 0
this.briefAnswerScore = data.list5.length ? data.list5[0].briefAnswerScore * this.briefAnswerCount : 0
this.scoreList = [this.singlePoint,this.multipleChoiceScore,this.fillBlanksScore,this.briefAnswerScore,this.briefAnswerScore]
subjects.forEach((e,i) => {
e.forEach(n => {
if(i == 1){
this.$set(n,'val',[])
}else if(i == 3){
n.questionStem = n.questionStem.replace(/\(\)\(\)\(\)/g,`<input class="input"></input>`)
}else{
this.$set(n,'val','')
}
if(!n.options){
let options = {}
for(let i in n){
if(i.includes('option') && n[i]){
options[i.replace('option','')] = n[i]
}
}
n.options = options
}
n.questionStatus = 0
})
})
this.subjects = subjects
this.getAnswer()
}).catch(err => {})
},
getAnswer() {
this.$post(`${this.api.enterPractise}?paperId=${this.paperId}&userId=${this.userId}&practiseId=${this.practiseId}&isContinue=${this.isContinue}&identification=${this.identification}`)
.then(res => {
let records = [...res.data.list1,...res.data.list2,...res.data.list3,...res.data.list4,...res.data.list5]
records = records.filter(n => n.user_answer)
let len = 0
this.subjects.map(n => len += n.length)
this.progress = len ? Math.floor((records.length / len * 100)) : 0
this.singleAnsweredCount = records.filter(n => n.typeName == '单项选择').length
this.multipleAnsweredCount = records.filter(n => n.typeName == '多项选择').length
this.fillBlankAnsweredCount = records.filter(n => n.typeName == '填空题').length
this.judgeAnsweredCount = records.filter(n => n.typeName == '判断题').length
this.briefAnswerAnsweredCount = records.filter(n => n.typeName == '简答题').length
this.subjects.forEach((e,i) => {
e.forEach((n,k) => {
let answered = records.find(j => j.questionId == n.questionId)
if(answered){
if(i == 1){
n.val = answered.user_answer.split('')
}else if(i == 3){
let answer = answered.user_answer.split('&lt;&gt;');
[...document.querySelectorAll(`.stem${i}${k} input`)].map((n,j) => {
n.value = answer[j]
})
n.val = answered.user_answer
}else{
n.val = answered.user_answer
}
n.questionStatus = 1
}
})
})
console.log(22,this.subjects)
}).catch(err => {})
},
addLeaveEvent(){
window.onbeforeunload = e => {
e = e || window.event;
if (e) {
e.returnValue = '关闭提示'
}
this.addRecords()
return '关闭提示'
}
},
save(){
let data1 = []
this.subjects.map((e,i) => {
e.map((n,k) => {
let userAnswer = ''
if(i == 1){
userAnswer = n.val.join('')
}else if(i == 3){
userAnswer = [...document.querySelectorAll(`.stem${i}${k} input`)].map(n => n.value).join('&lt;&gt;')
}else{
userAnswer = n.val
}
data1.push({
identification: this.identification,
practiseId: this.practiseId,
questionId: n.questionId,
questionStatus : n.questionStatus,
testPaperId: this.paperId,
userAnswer,
userId: this.userId
})
})
})
// }); this.$post(`${this.api.addPractiseExamAnswerDetails}`,data1)
.then(res => {
this.$post(`${this.api.addPractiseRecord}?userId=${this.userId}&practiseId=${this.practiseId}&paperId=${this.paperId}&identification=${this.identification}`)
.then(res => {
this.$post(`${this.api.calculationScorePractice}`,data1)
.then(res => {
this.isSubmit = true
this.$message.success(this.isDone ? '练习已结束,已经自动为您提交练习!' : '提交成功')
this.$router.back()
})
.catch(err => {})
})
.catch(err => {})
})
.catch(err => {})
},
addRecords(){
if(!this.isSubmit){
let data1 = []
this.subjects.map((e,i) => {
e.map((n,k) => {
let userAnswer = ''
if(i == 1){
userAnswer = n.val.join('')
}else if(i == 3){
userAnswer = [...document.querySelectorAll(`.stem${i}${k} input`)].map(n => n.value).join('&lt;&gt;')
}else{
userAnswer = n.val
}
data1.push({
identification: this.identification,
practiseId: this.practiseId,
questionId: n.questionId,
questionStatus : n.questionStatus,
testPaperId: this.paperId,
userAnswer: userAnswer,
userId: this.userId
})
})
})
this.$post(`${this.api.addPractiseExamAnswerDetails}`,data1)
.then(res => {})
.catch(err => {})
}
} }
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -152,21 +339,22 @@ export default {
} }
.nums{ .nums{
display: flex; display: flex;
justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
span{ span{
width: 24px; width: 24px;
margin: 2px 1px;
line-height: 24px; line-height: 24px;
text-align: center; text-align: center;
color: #888; color: #888;
font-size: 10px; font-size: 10px;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #f8f8f8; border: 1px solid #e6e6e6;
border-radius: 50%; border-radius: 50%;
} }
&.active{ .active{
color: #fff; color: #fff;
background-color: #e80909; background-color: #e80909;
border-color: #e80909;
} }
} }
} }
@ -181,30 +369,67 @@ export default {
overflow: auto; overflow: auto;
.title{ .title{
padding: 10px; padding: 10px;
margin-bottom: 10px;
font-size: 14px; font-size: 14px;
color: #444; color: #444;
border-bottom: 1px solid $borderColor; border-bottom: 1px solid $borderColor;
} }
.ques{ .ques{
padding: 15px; .ques-wrap{
padding: 0 15px;
margin: 10px 0 20px;
}
.item{ .item{
margin: 10px 0 20px; margin: 10px 0 20px;
.name{ &:first-child{
margin-top: 0;
}
.name-wrap{
display: flex;
align-items: center;
margin-bottom: 10px; margin-bottom: 10px;
font-size: 13px; font-size: 13px;
color: #444; color: #444;
.index{
font-size: 13px;
color: #444;
}
/deep/.input{
width: 100px;
height: 28px;
padding: 0 5px;
margin: 0 5px;
color: #444;
background-color: #fff;
border: 1px solid #ebebeb;
box-sizing: border-box;
&:focus{
outline: none;
}
&:disabled{
background-color: #e8e8e8;
cursor: not-allowed;
}
}
} }
.options{ .options{
margin-top: 10px; margin-top: 10px;
font-size: 14px; font-size: 14px;
color: #8b8b8b; color: #8b8b8b;
.option{ .option{
margin: 3px 0; margin: 5px 0;
&.selected{ &.selected{
font-weight: bold; font-weight: bold;
color: #555; color: #555;
} }
} }
.option-check{
display: block;
margin-right: 6px;
}
/deep/.el-radio__label{
padding-left: 6px;
}
} }
} }
} }

@ -24,13 +24,16 @@
{{scope.$index + (page - 1) * pageSize + 1}} {{scope.$index + (page - 1) * pageSize + 1}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="练习名称" align="center"></el-table-column> <el-table-column prop="practiseName" label="练习名称" align="center"></el-table-column>
<el-table-column prop="gmtCreate" label="所属课程" align="center"></el-table-column> <el-table-column prop="courses" label="所属课程" align="center"></el-table-column>
<el-table-column prop="founder" label="知识点" align="center"></el-table-column> <el-table-column label="难易程度" align="center">
<el-table-column prop="classification" label="难易程度" align="center"></el-table-column> <template slot-scope="scope">
<el-table-column prop="classification" label="时长(分钟)" align="center"></el-table-column> {{getDegreeName(scope.row.degree)}}
<el-table-column prop="classification" label="练习次数" align="center"></el-table-column> </template>
<el-table-column prop="classification" label="最后一次得分" align="center"></el-table-column> </el-table-column>
<el-table-column prop="duration" label="时长(分钟)" align="center"></el-table-column>
<el-table-column prop="practiceNum" label="练习次数" align="center"></el-table-column>
<el-table-column prop="lastScore" label="最后一次得分" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="180"> <el-table-column label="操作" align="center" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="practice(scope.row)">进入练习</el-button> <el-button type="text" @click="practice(scope.row)">进入练习</el-button>
@ -46,6 +49,7 @@
</template> </template>
<script> <script>
import { mapState,mapGetters,mapActions } from 'vuex'
export default { export default {
data() { data() {
return { return {
@ -59,6 +63,14 @@ export default {
searchTimer: null searchTimer: null
}; };
}, },
computed: {
...mapState('user', [
'userId','clientId'
]),
...mapGetters('practice', [
'getDegreeName'
])
},
watch: { watch: {
keyword: function(val) { keyword: function(val) {
clearTimeout(this.searchTimer) clearTimeout(this.searchTimer)
@ -71,16 +83,14 @@ export default {
this.getData() this.getData()
}, },
methods: { methods: {
...mapActions('practice', [
'setInfo'
]),
getData() { getData() {
// let data = { this.$post(`${this.api.getMinePractise}?pageNum=${this.page}&pageSize=${this.pageSize}&userId=${this.userId}&practiseName=${this.keyword}`).then(res => {
// classificationId: this.classificationId, this.listData = res.data.pageUtils.list
// name: this.keyword, this.total = res.data.pageUtils.totalCount
// schoolId: this.schoolId }).catch(res => {})
// }
// this.$get(`${this.api.queryCourseByCondition}/${this.page}/${this.pageSize}`,data).then(res => {
// this.listData = res.data.courseList
// this.total = res.data.total
// }).catch(res => {})
}, },
handleDelete(row) { handleDelete(row) {
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
@ -102,6 +112,28 @@ export default {
this.getData(); this.getData();
}, },
practice(row){ practice(row){
if(row.isHava){
this.$confirm('是否要继续上次的考试?',{
title: '提示',
confirmButtonText: '是',
cancelButtonText: '否',
}).then(_ => {
this.toDo(row,0)
}).catch(() => {
this.toDo(row,1)
})
}else{
this.toDo(row,1)
}
},
toDo(row,isContinue){
let identification = row.identification.length ? row.identification[row.identification.length - 1] : ''
this.setInfo({
practiseId: row.practiseId,
paperId: row.testPaperId,
isContinue,
identification
})
this.$router.push('do') this.$router.push('do')
} }
} }

@ -1,26 +1,14 @@
<template> <template>
<div <div style="width:100%;height:100%;display:flex;align-items: center;flex-direction:column">
style="width:100%;height:100%;display:flex;
align-items: center;flex-direction:column "
>
<!-- 头像部分 -->
<div class="header"> <div class="header">
<img :src="avatar" class="HeadPortrait" /> <img :src="avatar" class="HeadPortrait" />
<div style="color:#cb221c;font-size:14px;font-family:MicrosoftYaHei;margin-top:5px;"> <div style="color:#cb221c;font-size:14px;font-family:MicrosoftYaHei;margin-top:5px;">
<el-upload <el-upload :action="this.api.fileupload" :on-success="changeAvatar">
class="upload-demo"
action="http://www.liuwanr.cn:8080/user/uploadUserAvatars"
:data="{userId:this.userId}"
name="file"
:limit="3"
:on-success="getRes"
>
<div>点击更改头像</div> <div>点击更改头像</div>
</el-upload> </el-upload>
</div> </div>
</div> </div>
<!-- 用户信息 -->
<div class="card"> <div class="card">
<p class="block-title" style="display: flex;justify-content: space-between;align-items: center;"> <p class="block-title" style="display: flex;justify-content: space-between;align-items: center;">
用户信息 用户信息
@ -398,11 +386,8 @@ export default {
}).catch(res => {}); }).catch(res => {});
}, },
// //
getRes(res) { changeAvatar(res) {
this.setAvatar(res.message) this.setAvatar(res.data.filesResult.fileUrl)
},
uploadHeadImg: function() {
this.$el.querySelector('.hiddenInput').click();
}, },
getdata() { getdata() {
this.$get(`${this.api.userinfo}?userId=${this.userId}`) this.$get(`${this.api.userinfo}?userId=${this.userId}`)

@ -17,6 +17,8 @@ const Setting = {
// 接口请求地址 // 接口请求地址
// apiBaseURL: env === 'development' ? 'http://192.168.31.152:8001' : 'http://39.108.250.202:8000', // apiBaseURL: env === 'development' ? 'http://192.168.31.152:8001' : 'http://39.108.250.202:8000',
apiBaseURL: env === 'development' ? 'http://192.168.31.152:8001' : 'http://39.108.250.202:9000', apiBaseURL: env === 'development' ? 'http://192.168.31.152:8001' : 'http://39.108.250.202:9000',
// oss文件管理接口地址
apiUploadURL: 'http://8.134.8.197:8001',
// 接口请求返回错误时,弹窗的持续时间,单位:秒 // 接口请求返回错误时,弹窗的持续时间,单位:秒
modalDuration: 3, modalDuration: 3,
// 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice // 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice

@ -19,15 +19,27 @@ export default {
stateList: [ stateList: [
{ {
id: 0, id: 0,
name: '未考' name: '待开始'
},{ },{
id: 1, id: 1,
name: '在考' name: '进行中'
},{ },{
id: 2, id: 2,
name: '已' name: '已提交'
} }
], ],
assessmentStateList: [
{
id: 1,
name: '待开始'
},{
id: 2,
name: '进行中'
},{
id: 3,
name: '已结束'
}
],
degreeList: [ degreeList: [
{ {
id: 0, id: 0,
@ -61,6 +73,9 @@ export default {
getStateName: state => id => { getStateName: state => id => {
return state.stateList.find(n => n.id == id).name return state.stateList.find(n => n.id == id).name
}, },
getAssessmentStateName: state => id => {
return state.assessmentStateList.find(n => n.id == id).name
},
}, },
mutations: { mutations: {
SET_INFO: (state, info) => { SET_INFO: (state, info) => {

@ -0,0 +1,45 @@
/**
* 试卷管理
* */
export default {
namespaced: true,
state: {
degreeList: [
{
id: 0,
label: '简单'
},{
id: 1,
label: '一般'
},{
id: 2,
label: '较难'
},{
id: 3,
label: '很难'
},
],
practiseId: '',
paperId: '',
isContinue: '',
identification: ''
},
getters: {
getDegreeName: state => id => {
return state.degreeList.find(n => n.id == id).label
}
},
mutations: {
SET_INFO: (state, info) => {
state.practiseId = info.practiseId
state.paperId = info.paperId
state.isContinue = info.isContinue
state.identification = info.identification
},
},
actions: {
setInfo({ commit },info) {
commit('SET_INFO',info)
},
}
}

@ -11,7 +11,7 @@ import api from '@/api';
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
avatar:'http://liuwanr.oss-cn-shenzhen.aliyuncs.com/userAvatars/20200710155726.jpg', avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
token: '', token: '',
userId: '', userId: '',
roleId: '', roleId: '',
@ -23,6 +23,7 @@ export default {
}, },
mutations: { mutations: {
SET_INFO: (state, info) => { SET_INFO: (state, info) => {
info.avatar && (state.avatar = info.avatar)
state.userId = info.userId state.userId = info.userId
state.roleId = info.roleId state.roleId = info.roleId
state.userName = info.userName state.userName = info.userName
@ -60,6 +61,7 @@ export default {
if(user.roleId == 4){ if(user.roleId == 4){
let routes = res.data.permissions[0].children let routes = res.data.permissions[0].children
commit('SET_INFO',{ commit('SET_INFO',{
avatar: user.userAvatars,
userId: user.userId, userId: user.userId,
roleId: user.roleId, roleId: user.roleId,
userName: user.userName, userName: user.userName,
@ -92,8 +94,13 @@ export default {
resolve() resolve()
}) })
}, },
setAvatar({ commit },avatar) { setAvatar({ state,commit },avatar) {
commit('SET_AVATAR',avatar) commit('SET_AVATAR',avatar)
let data = {
userId: state.userId,
userAvatars: avatar
}
post(api.userinfoUpdate,data).then(res => {}).catch(res => {})
}, },
} }
} }

@ -228,6 +228,10 @@ select {
text-transform: none; text-transform: none;
} }
button:focus{
outline: none;
}
button, button,
html [type="button"], html [type="button"],
[type="reset"], [type="reset"],

Loading…
Cancel
Save