yujialong 4 years ago
parent b95dbbad0e
commit 0505255dd2
  1. 25
      src/api/index.js
  2. BIN
      src/assets/img/login_bg.png
  3. 62
      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. 341
      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 uploadURL = Setting.apiUploadURL
export default {
logins: `management/userInfo/login`, //登录 
save: `management/userInfo/add`, //注册
// 登录注册
logins: `management/userInfo/login`,
save: `management/userInfo/add`,
//查询电话是否存在
queryPhone: `${loginhost}/userInfo/queryPhone`,
// oss文件管理
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`,
queryCity: `enterprise/city/queryCity`,
queryClient: `enterprise/client/list`,
@ -30,4 +37,12 @@ export default {
queryGzAnswerDetails: `/user/exam/queryGzAnswerDetails`,
coverGzAnswerDetails: `/user/exam/coverGzAnswerDetails`,
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>
<span class="user-avator">{{userName}}</span>
</div>
<el-divider class="ml20" direction="vertical"></el-divider>
<el-button type="text" class="ml20" @click="loginout">退出</el-button>
<el-divider class="m-l-20" direction="vertical"></el-divider>
<el-button type="text" class="m-l-20" @click="loginout">退出</el-button>
</div>
</div>
</div>
</template>
<script>
import { mapState,mapActions } from 'vuex';
import bus from '@/libs/bus';
import Setting from '@/setting';
import { mapState,mapActions } from 'vuex'
import Setting from '@/setting'
export default {
data() {
return {
showBackList: Setting.layout.hideNavList
showBackList: Setting.layout.hideNavList,
};
},
computed: {
...mapState('user', [
'userName','avatar'
'userId','avatar','userName'
]),
showBack(){
let route = this.$route.name
@ -40,15 +39,14 @@ export default {
},
methods: {
...mapActions('user', [
'logout'
]),
loginout() {
this.logout()
},
toPerson(){
this.$router.push('/setting/person')
},
loginout() {
sessionStorage.removeItem(Setting.usernameKey);
sessionStorage.removeItem(Setting.storeKey);
location.reload()
},
back(){
this.$router.back()
}
@ -63,11 +61,11 @@ export default {
font-size: 16px;
font-weight: bold;
margin-left: 20px;
}
.goBack i{
i{
color: #cb221c;
font-size: 20px;
}
}
.header {
position: relative;
box-sizing: border-box;
@ -76,52 +74,48 @@ export default {
font-size: 16px;
color: #333;
border-bottom: 1px solid #efefef;
box-shadow: 0 0 1.5625rem 0.125rem rgba(255,45,45,0.14);
}
.header .logo {
box-shadow: 0 0 1.5625rem 0.125rem rgba(255, 45, 45, 0.14);
.logo {
float: left;
width: 170px;
height: 40px;
margin-left: 20px;
}
.header .logo img{
img{
height: 100%;
}
}
.header-right {
float: right;
padding-right: 50px;
}
.header-user-con {
display: flex;
height: 70px;
align-items: center;
.user{
display: inline-flex;
align-items: center;
cursor: pointer;
}
}
.user-avator {
margin-left: 10px;
.el-button--text{
color: #333;
}
.ml20{
margin-left: 20px;
.el-divider--vertical{
width: 2px;
height: 15px;
}
.el-divider{
background-color: #333;
}
.user-avator img {
.user-avator {
margin-left: 10px;
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>

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

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

@ -15,7 +15,7 @@
</el-form-item> -->
<el-form-item prop="phone">
<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>
</div>

@ -46,10 +46,14 @@
{{(scope.row.timeCost / 60).toFixed(2)}}
</template>
</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">
<template slot-scope="scope">
{{scope.row.state == 2 ? '已提交' : '未提交'}}
{{getAssessmentStateName(scope.row.assessmentState)}}
</template>
</el-table-column>
<el-table-column label="操作" width="150">
@ -81,7 +85,8 @@ export default {
page: 1,
pageSize: 10,
total: 0,
searchTimer: null
searchTimer: null,
timer: null
};
},
computed: {
@ -92,9 +97,14 @@ export default {
'typeList'
]),
...mapGetters('exam', [
'getDegreeName','getTypeName','getStateName'
'getDegreeName','getTypeName','getAssessmentStateName'
])
},
filters: {
transferScore(val){
return val ? val : '--'
}
},
watch: {
keyword: function(val) {
clearTimeout(this.searchTimer)
@ -105,6 +115,7 @@ export default {
},
mounted() {
this.getData()
this.addInterval()
},
methods: {
...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.listData = res.data.Assessment
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) {
this.page = val;

@ -5,117 +5,304 @@
<div class="item">
<p class="type">单选题</p>
<p class="total">10题合计20</p>
<p class="total">{{singleCount}}合计{{singlePoint}}</p>
<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 class="item">
<p class="type">多选题</p>
<p class="total">10题合计20</p>
<p class="total">{{multipleCount}}合计{{multipleChoiceScore}}</p>
<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 class="item">
<p class="type">判断题</p>
<p class="total">10题合计20</p>
<p class="total">{{judgeCount}}合计{{judgeScore}}</p>
<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 class="item">
<p class="type">填空题</p>
<p class="total">10题合计20</p>
<p class="total">{{fillBlankCount}}合计{{fillBlanksScore}}</p>
<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 class="item">
<p class="type">简答题</p>
<p class="total">10题合计20</p>
<p class="total">{{briefAnswerCount}}合计{{briefAnswerScore}}</p>
<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 class="btn">
<el-button size="mini" type="primary">提交练习</el-button>
<el-button size="mini" type="primary" @click="save">提交练习</el-button>
</div>
</div>
<div class="middle">
<p class="title">单选题共10题合计20分</p>
<div class="ques">
<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>
<template v-for="(subject,k) in subjects">
<div class="item" v-if="subject.length" :key="k">
<p v-if="subjects[k].length" class="title">{{questionType[k]}}{{subjects[k].length}}合计{{scoreList[k]}}</p>
<div class="ques-wrap" v-for="(item,index) in subject" :key="index">
<div class="name-wrap">
<span class="index">{{index+1}}.</span>
<div class="name" :class="'stem' + k + index" v-html="item.questionStem"></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>
<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 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>
</template>
</div>
</div>
<div class="right">
<p class="title">剩余时间</p>
<p class="time">00:59:00</p>
<div class="ans">答题进度</div>
<el-progress :percentage="50"></el-progress>
<el-progress :percentage="progress"></el-progress>
</div>
</div>
</template>
<script>
import mixins from '@/mixins/setBackground';
import { mapState,mapGetters,mapActions } from 'vuex'
import mixins from '@/mixins/setBackground'
import util from '@/libs/util'
export default {
mixins: [ mixins ],
data() {
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() {
this.getData()
this.addLeaveEvent()
},
beforeDestroy(){
window.onbeforeunload = null
this.addRecords()
},
methods: {
getData() {
// this.$get(`${this.api.getCourse}/${this.id}`)
// .then(res => {
// let data = res.data.course
// this.name = data.name
// this.classificationId = data.classificationId
// this.description = data.description
// this.coverUrl = data.coverUrl
// this.uploadList.push({
// name: 'cover.jpg',
// url: this.coverUrl
// })
// })
// .catch(err => {
this.$post(`${this.api.previewtestPaper}?id=${this.paperId}`)
.then(res => {
let data = res.data
let subjects = [
[...data.list1],
[...data.list2],
[...data.list4],
[...data.list3],
[...data.list5],
]
this.singleCount = data.list1.length
this.multipleCount = data.list2.length
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>
<style lang="scss" scoped>
@ -152,21 +339,22 @@ export default {
}
.nums{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
span{
width: 24px;
margin: 2px 1px;
line-height: 24px;
text-align: center;
color: #888;
font-size: 10px;
box-sizing: border-box;
border: 1px solid #f8f8f8;
border: 1px solid #e6e6e6;
border-radius: 50%;
}
&.active{
.active{
color: #fff;
background-color: #e80909;
border-color: #e80909;
}
}
}
@ -181,30 +369,67 @@ export default {
overflow: auto;
.title{
padding: 10px;
margin-bottom: 10px;
font-size: 14px;
color: #444;
border-bottom: 1px solid $borderColor;
}
.ques{
padding: 15px;
.ques-wrap{
padding: 0 15px;
margin: 10px 0 20px;
}
.item{
margin: 10px 0 20px;
.name{
&:first-child{
margin-top: 0;
}
.name-wrap{
display: flex;
align-items: center;
margin-bottom: 10px;
font-size: 13px;
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{
margin-top: 10px;
font-size: 14px;
color: #8b8b8b;
.option{
margin: 3px 0;
margin: 5px 0;
&.selected{
font-weight: bold;
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}}
</template>
</el-table-column>
<el-table-column prop="name" label="练习名称" align="center"></el-table-column>
<el-table-column prop="gmtCreate" label="所属课程" align="center"></el-table-column>
<el-table-column prop="founder" label="知识点" align="center"></el-table-column>
<el-table-column prop="classification" label="难易程度" align="center"></el-table-column>
<el-table-column prop="classification" label="时长(分钟)" align="center"></el-table-column>
<el-table-column prop="classification" label="练习次数" align="center"></el-table-column>
<el-table-column prop="classification" label="最后一次得分" align="center"></el-table-column>
<el-table-column prop="practiseName" label="练习名称" align="center"></el-table-column>
<el-table-column prop="courses" label="所属课程" align="center"></el-table-column>
<el-table-column label="难易程度" align="center">
<template slot-scope="scope">
{{getDegreeName(scope.row.degree)}}
</template>
</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">
<template slot-scope="scope">
<el-button type="text" @click="practice(scope.row)">进入练习</el-button>
@ -46,6 +49,7 @@
</template>
<script>
import { mapState,mapGetters,mapActions } from 'vuex'
export default {
data() {
return {
@ -59,6 +63,14 @@ export default {
searchTimer: null
};
},
computed: {
...mapState('user', [
'userId','clientId'
]),
...mapGetters('practice', [
'getDegreeName'
])
},
watch: {
keyword: function(val) {
clearTimeout(this.searchTimer)
@ -71,16 +83,14 @@ export default {
this.getData()
},
methods: {
...mapActions('practice', [
'setInfo'
]),
getData() {
// let data = {
// classificationId: this.classificationId,
// name: this.keyword,
// schoolId: this.schoolId
// }
// this.$get(`${this.api.queryCourseByCondition}/${this.page}/${this.pageSize}`,data).then(res => {
// this.listData = res.data.courseList
// this.total = res.data.total
// }).catch(res => {})
this.$post(`${this.api.getMinePractise}?pageNum=${this.page}&pageSize=${this.pageSize}&userId=${this.userId}&practiseName=${this.keyword}`).then(res => {
this.listData = res.data.pageUtils.list
this.total = res.data.pageUtils.totalCount
}).catch(res => {})
},
handleDelete(row) {
this.$confirm('确定要删除吗?', '提示', {
@ -102,6 +112,28 @@ export default {
this.getData();
},
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')
}
}

@ -1,26 +1,14 @@
<template>
<div
style="width:100%;height:100%;display:flex;
align-items: center;flex-direction:column "
>
<!-- 头像部分 -->
<div style="width:100%;height:100%;display:flex;align-items: center;flex-direction:column">
<div class="header">
<img :src="avatar" class="HeadPortrait" />
<div style="color:#cb221c;font-size:14px;font-family:MicrosoftYaHei;margin-top:5px;">
<el-upload
class="upload-demo"
action="http://www.liuwanr.cn:8080/user/uploadUserAvatars"
:data="{userId:this.userId}"
name="file"
:limit="3"
:on-success="getRes"
>
<el-upload :action="this.api.fileupload" :on-success="changeAvatar">
<div>点击更改头像</div>
</el-upload>
</div>
</div>
<!-- 用户信息 -->
<div class="card">
<p class="block-title" style="display: flex;justify-content: space-between;align-items: center;">
用户信息
@ -398,11 +386,8 @@ export default {
}).catch(res => {});
},
//
getRes(res) {
this.setAvatar(res.message)
},
uploadHeadImg: function() {
this.$el.querySelector('.hiddenInput').click();
changeAvatar(res) {
this.setAvatar(res.data.filesResult.fileUrl)
},
getdata() {
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:9000',
// oss文件管理接口地址
apiUploadURL: 'http://8.134.8.197:8001',
// 接口请求返回错误时,弹窗的持续时间,单位:秒
modalDuration: 3,
// 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice

@ -19,13 +19,25 @@ export default {
stateList: [
{
id: 0,
name: '未考'
name: '待开始'
},{
id: 1,
name: '在考'
name: '进行中'
},{
id: 2,
name: '已考'
name: '已提交'
}
],
assessmentStateList: [
{
id: 1,
name: '待开始'
},{
id: 2,
name: '进行中'
},{
id: 3,
name: '已结束'
}
],
degreeList: [
@ -61,6 +73,9 @@ export default {
getStateName: state => id => {
return state.stateList.find(n => n.id == id).name
},
getAssessmentStateName: state => id => {
return state.assessmentStateList.find(n => n.id == id).name
},
},
mutations: {
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 {
namespaced: true,
state: {
avatar:'http://liuwanr.oss-cn-shenzhen.aliyuncs.com/userAvatars/20200710155726.jpg',
avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
token: '',
userId: '',
roleId: '',
@ -23,6 +23,7 @@ export default {
},
mutations: {
SET_INFO: (state, info) => {
info.avatar && (state.avatar = info.avatar)
state.userId = info.userId
state.roleId = info.roleId
state.userName = info.userName
@ -60,6 +61,7 @@ export default {
if(user.roleId == 4){
let routes = res.data.permissions[0].children
commit('SET_INFO',{
avatar: user.userAvatars,
userId: user.userId,
roleId: user.roleId,
userName: user.userName,
@ -92,8 +94,13 @@ export default {
resolve()
})
},
setAvatar({ commit },avatar) {
setAvatar({ state,commit },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;
}
button:focus{
outline: none;
}
button,
html [type="button"],
[type="reset"],

Loading…
Cancel
Save