yujialong 4 years ago
parent 707e739922
commit 1efe8a8843
  1. 320
      src/components/doReview/index.vue
  2. 19
      src/layouts/navbar/index.vue
  3. 3
      src/libs/auth/generateBtnPermission.js
  4. 13
      src/libs/route/addRoutes.js
  5. 4
      src/libs/util.js
  6. 35
      src/mixins/file/index.js
  7. 12
      src/pages/achievement/list/examResults.vue
  8. 30
      src/pages/achievement/list/index.vue
  9. 5
      src/pages/achievement/list/practiceResults.vue
  10. 2
      src/pages/achievement/list/wrongBook.vue
  11. 27
      src/pages/assessment/detail/index.vue
  12. 39
      src/pages/assessment/doReview/index.vue
  13. 2
      src/pages/assessment/scoreQuery/index.vue
  14. 58
      src/pages/practice/detail/index.vue
  15. 47
      src/pages/practice/doReview/index.vue
  16. 6
      src/pages/quesBank/list/globalQuesBank.vue
  17. 33
      src/pages/quesBank/list/index.vue
  18. 45
      src/pages/quesBank/list/myQuesBank.vue
  19. 8
      src/pages/quesBank/list/quesBankType.vue
  20. 7
      src/pages/setting/person/index.vue
  21. 11
      src/pages/student/list/index.vue
  22. 37
      src/pages/system/list/index.vue
  23. 10
      src/pages/system/list/role.vue
  24. 14
      src/pages/system/list/staff.vue
  25. 2
      src/pages/testPaper/add/index.vue
  26. 4
      src/pages/testPaper/list/allTestPaper.vue
  27. 24
      src/pages/testPaper/list/index.vue
  28. 51
      src/pages/testPaper/list/myTestPaper.vue
  29. 8
      src/plugins/auth/index.js
  30. 2
      src/setting.js

@ -1,320 +0,0 @@
<template>
<div class="box">
<h1 class="title">{{paperName}}</h1>
<div class="metas">
<div>
<span class="name">学生姓名</span>
<span class="val">{{userName}}</span>
</div>
<div>
<span class="name">学生得分</span>
<span class="val">{{(reviewStatus == 2 || reviewStatus == 3) ? this_score : '--'}}</span>
</div>
<div>
<span class="name">试卷总分</span>
<span class="val">100</span>
</div>
<div>
<span class="name">练习时长</span>
<span class="val">{{duration}}</span>
</div>
</div>
<div class="wrap">
<div class="select">
<el-radio v-model="look" label="1">查看全部</el-radio>
<el-radio v-model="look" label="2" v-if="reviewStatus == 2 || reviewStatus == 3">只看错题</el-radio>
</div>
<div class="item" v-for="(item,index) in list" :key="index">
<div class="status" :class="{done: item.isCorrecting}">{{item.isSub ? '简答题' : '客观题'}}{{getCorrectingName(item.isCorrecting)}}</div>
<div class="name" v-html="item.question_stem"></div>
<div class="answer">
<div class="info" v-if="!item.isSub">
<p class="key">正确答案</p>
<p class="val">{{item.answer}}</p>
</div>
<div class="info">
<p class="key">学生答案</p>
<p class="val">{{item.user_answer}}</p>
</div>
</div>
<div class="meta">
<span class="key">知识点</span>
<span class="val">{{item.knowledge_points}}</span>
</div>
<div class="meta" v-if="item.isSub">
<p class="key">附件</p>
<div class="val">
<el-button v-if="item.fileUrl || item.videoAudio" type="text" @click="preview(item)">{{item.fileName}}</el-button>
<el-button v-if="item.fileUrl" type="primary" size="mini" @click="download(item)">下载</el-button>
</div>
</div>
<div class="meta">
<span class="key">答案解析</span>
<span class="val">{{item.answer_analysis}}</span>
</div>
<div class="flex a-center point">
<div class="meta">
<span class="key">题目分数</span>
<div class="val">{{item.question_points}} </div>
</div>
<div class="meta">
<span class="key">考试得分</span>
<div class="val">
<input type="text" v-model.number="item.question_score" :disabled="!isReview || !item.isSub">
</div>
</div>
</div>
</div>
</div>
<div class="btns" v-if="isReview">
<button type="button" class="submit" @click="save(1)">提交</button>
<button type="button" @click="save(0)">保存</button>
</div>
<div v-show="playAuth" class="el-image-viewer__wrapper" :class="{active: playAuth}" style="z-index: 2000">
<div class="el-image-viewer__mask"></div>
<span class="el-image-viewer__btn el-image-viewer__close" @click="closePlayer"><i class="el-icon-circle-close" style="color: #fff"></i></span>
<div class="player" id="player"></div>
</div>
<pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf>
</div>
</template>
<script>
import setBackground from '@/mixins/setBackground'
import file from '@/mixins/file'
import { mapState,mapGetters,mapActions } from 'vuex'
import pdf from '@/components/pdf'
export default {
mixins: [ setBackground,file ],
data() {
return {
paperName: '',
userName: '',
this_score: '',
duration: '',
list: [],
look: '1',
};
},
computed: {
...mapState('user', [
'userId','clientId'
]),
...mapState('assessment', [
'reviewId','paperId','isReview','reviewStatus','stuId'
]),
...mapGetters('assessment', [
'getCorrectingName'
])
},
watch: {
look(val,oldVal){
val == 1 ? this.getData() : this.getWrong()
}
},
components: { pdf },
mounted() {
this.getData()
},
methods: {
getData() {
this.$post(`${this.api.correcting}?assessmentId=${this.reviewId}&userId=${this.stuId}&paperId=${this.paperId}`)
.then(res => {
let list = res.data.list
list.forEach(n => {
n.isCorrecting == 0 && (n.question_score = '')
n.isSub = n.typeName == '简答题'
if(n.typeName == '填空题'){
let answer = []
for(let i in n){
if(i.includes('option_')) answer.push(n[i])
}
n.answer = answer.join('|')
n.user_answer = n.user_answer.replace(/&lt;&gt;/g,'|')
}
if(n.fileUrl){
let file = n.fileUrl.split(',')
n.fileName = file[0]
n.fileurl = file[1]
}
if(n.videoAudio){
let file = n.videoAudio.split(',')
n.fileName = file[0]
n.fileurl = file[1]
}
})
this.list = list
this.paperName = list[0].name
this.userName = list[0].userName
this.this_score = list[0].this_score
this.duration = list[0].duration
})
.catch(err => {})
},
getWrong(){
this.$post(`${this.api.getWrong}?assessmentId=${this.reviewId}&userId=${this.stuId}&paperId=${this.paperId}`)
.then(res => {
this.list = res.data.list
}).catch(err => {})
},
save(status) {
let isEmpty = false
let isNotNum = false
let invalid = false
this.list.map(n => {
if(n.question_score === '') isEmpty = true
if(isNaN(n.question_score)) isNotNum = true
if(Number(n.question_score) > Number(n.question_points)) invalid = true
})
if(status){
if(isEmpty) return this.$message.warning('请批阅完所有题目')
if(isNotNum) return this.$message.warning('考试得分请输入数字')
}
if(invalid) return this.$message.warning('考试得分不得大于题目分数')
let data = {
review: [],
assessmentId: this.reviewId,
userId: this.stuId,
paperId: this.paperId,
teacherId: this.userId,
}
let totalScore = 0
this.list.map(n => {
n.question_score !== '' && n.isSub && data.review.push({
detailId: Number(n.detailId) ,
score: Number(n.question_score)
})
totalScore += Number(n.question_score)
})
if(!data.review.length) return this.$message.warning('请至少批阅一道题目')
if(status || this.list.filter(n => n.isSub).length == data.review.length){
data.totalScore = totalScore
}
this.$post(this.api.reviewByid,data).then(res => {
this.$message.success(status ? '提交成功' : '保存成功')
this.$router.back()
}).catch(err => {})
},
},
};
</script>
<style lang="scss" scoped>
.title{
text-align: center;
font-size: 18px;
font-weight: 600;
}
.metas{
display: flex;
justify-content: space-between;
margin: 20px 0 30px;
.name{
font-size: 12px;
color: #717171;
}
.val{
font-size: 12px;
color: #929292;
}
}
.wrap{
padding: 20px;
background-color: #fbfbfb;
.select{
padding: 10px;
margin-bottom: 20px;
border-bottom: 1px solid #f4f4f4;
}
.item{
padding-bottom: 30px;
margin-bottom: 30px;
border-bottom: 1px dashed #d2d2d2;
&:last-child{
border-bottom: 0;
}
.status{
color: #cb221c;
&.done{
color: #56d5bf;
}
}
.name{
margin-top: 15px;
font-size: 14px;
color: #555555;
}
.key{
font-weight: bold;
color: #333;
}
.val{
color: #757575;
}
.answer{
display: flex;
align-items: center;
padding: 15px;
margin: 15px 0;
font-size: 12px;
border: 1px solid #e8e8e8;
background-color: #f3f2f2;
.info{
display: inline-flex;
align-items: center;
margin-right: 30px;
}
}
.meta{
display: flex;
align-items: center;
padding-left: 10px;
margin: 10px 0;
font-size: 12px;
.key{
width: 80px;
margin-right: 10px;
text-align: right;
white-space: nowrap;
}
input{
width: 60px;
height: 28px;
padding: 0 5px;
margin-right: 5px;
color: #444;
background-color: #fff;
border: 1px solid #ebebeb;
box-sizing: border-box;
&:focus{
outline: none;
}
&:disabled{
background-color: #e8e8e8;
cursor: not-allowed;
}
}
}
.point{
.meta{
margin: 0;
}
}
}
}
.player{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 1200px !important;
height: 600px !important;
}
</style>

@ -52,6 +52,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import bus from '@/libs/bus'; import bus from '@/libs/bus';
import Setting from '@/setting'; import Setting from '@/setting';
export default { export default {
@ -62,7 +63,7 @@ export default {
{ {
icon: 'el-icon-folder-checked', icon: 'el-icon-folder-checked',
index: '/index/list', index: '/index/list',
title: '首页' title: '我的首页'
}, },
{ {
icon: 'el-icon-user', icon: 'el-icon-user',
@ -111,7 +112,10 @@ export default {
computed: { computed: {
onRoutes() { onRoutes() {
return this.$route.path return this.$route.path
} },
...mapState('auth', [
'routes'
])
}, },
created() { created() {
this.initMenu() this.initMenu()
@ -124,12 +128,19 @@ export default {
methods: { methods: {
initMenu(){ initMenu(){
if(Setting.dynamicRoute){ if(Setting.dynamicRoute){
let routes = this.$store.state.routes[1].children let routes = this.routes
let menus = [] let menus = [
{
icon: 'el-icon-folder-checked',
index: '/index/list',
title: '我的首页'
}
]
this.defaultMenus.map(e => { this.defaultMenus.map(e => {
routes.find(n => n.path == e.index) && menus.push(e) routes.find(n => n.path == e.index) && menus.push(e)
}) })
this.menus = menus this.menus = menus
this.active = menus[0].index
}else{ }else{
this.menus = this.defaultMenus this.menus = this.defaultMenus
} }

@ -21,6 +21,7 @@ export default function(data){
}) })
} }
}) })
store.auth.commit('addBtnAuth',{btns: result}) // console.log(33,result,store)
store.dispatch('auth/addBtnAuth',result)
// console.log('geneBtn:',result) // console.log('geneBtn:',result)
} }

@ -16,7 +16,7 @@ function createRoute(data){
newRoutes.push({ newRoutes.push({
name: e.component, name: e.component,
path: e.component, path: e.component,
component: () => import(`@/pages/${e.component}.vue`), component: () => import(`@/pages${e.component}`),
meta meta
}) })
} }
@ -27,8 +27,11 @@ function createRoute(data){
export default function(data,path){ export default function(data,path){
generateBtnPermission(data) generateBtnPermission(data)
createRoute(data) createRoute(data)
let routes = router.options.routes // let routes = router.options.routes
routes[1].children = [...routes[1].children,...newRoutes] // routes[1].children = [...routes[1].children,...newRoutes]
store.auth.commit("addRoutes", { routes }) store.dispatch('auth/addRoutes',newRoutes)
router.addRoutes(routes) // router.addRoutes(routes)
// setTimeout(() => {
// !newRoutes.find(n => n.name == '/index/list') && router.push(newRoutes[0].path)
// },10)
} }

@ -85,6 +85,10 @@ const util = {
}) })
return list return list
}, },
// 传入文件名获取文件后缀
getFileExt(fileName) {
return fileName.substring(fileName.lastIndexOf('.') + 1)
},
} }
export default util export default util

@ -6,40 +6,40 @@ export default {
player: null, player: null,
iframeSrc: '', iframeSrc: '',
pdfVisible: false, pdfVisible: false,
pdfSrc: '' pdfSrc: '',
imgName: '',
imgSrc: ''
} }
}, },
mounted() { mounted() {
this.insertScript() this.insertScript()
}, },
methods: { methods: {
preview(row){ preview(url,isVideo){
let ext = row.fileurl.substring(row.fileurl.lastIndexOf('.') + 1) let ext = util.getFileExt(url)
console.log(11,row.fileurl,row.fileurl.lastIndexOf('.'),ext) if(isVideo){
if(row.videoAudio){ this.$get(`${this.api.getPlayAuth}/${url}`).then(res => {
this.$get(`${this.api.getPlayAuth}/${row.fileurl}`).then(res => {
this.playAuth = res.data.playAuth this.playAuth = res.data.playAuth
if(this.player){ if(this.player){
this.player.replayByVidAndPlayAuth(row.fileurl,this.playAuth) this.player.replayByVidAndPlayAuth(url,this.playAuth)
}else{ }else{
console.log(11,row,res.data.playAuth)
this.player = new Aliplayer({ this.player = new Aliplayer({
id: 'player', id: 'player',
width: '100%', width: '100%',
autoplay: false, autoplay: false,
vid : row.fileurl, vid : url,
playauth : this.playAuth, playauth : this.playAuth,
encryptType:1, //当播放私有加密流时需要设置。 encryptType:1, //当播放私有加密流时需要设置。
}) })
} }
}).catch(res => {}) }).catch(res => {})
}else if(ext == 'pdf'){ }else if(ext == 'pdf'){
this.pdfSrc = row.fileurl this.pdfSrc = url
this.pdfVisible = true this.pdfVisible = true
}else if(util.isDoc(ext)){ }else if(util.isDoc(ext)){
window.open(`https://view.officeapps.live.com/op/view.aspx?src=${row.fileurl}`) window.open(`https://view.officeapps.live.com/op/view.aspx?src=${url}`)
}else if(util.isImg(ext)){ }else if(util.isImg(ext)){
window.open(row.fileurl) window.open(url)
} }
}, },
insertScript(){ insertScript(){
@ -63,8 +63,15 @@ export default {
this.playAuth = '' this.playAuth = ''
this.player.pause() this.player.pause()
}, },
download(row){ download(fileName,url){
window.open(row.fileurl) let ext = util.getFileExt(url)
if(util.isImg(ext)){
this.imgName = fileName
this.imgSrc = url
this.$refs.picLink.click()
}else{
window.open(url)
}
} }
} }
} }

@ -35,12 +35,14 @@
size="small" size="small"
round round
@click="toStat" @click="toStat"
v-auth="'/achievement/list:考试成绩:成绩统计'"
>成绩统计</el-button> >成绩统计</el-button>
<el-button <el-button
type="primary" type="primary"
size="small" size="small"
round round
@click="exportData" @click="exportData"
v-auth="'/achievement/list:考试成绩:导出'"
>导出</el-button> >导出</el-button>
</div> </div>
</div> </div>
@ -72,7 +74,7 @@
<el-table-column prop="openingTime" label="考试时间" align="center"></el-table-column> <el-table-column prop="openingTime" label="考试时间" align="center"></el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="show(scope.row)">查看详情</el-button> <el-button type="text" @click="show(scope.row)" v-auth="'/achievement/list:考试成绩:查看详情'">查看详情</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -187,14 +189,18 @@ export default {
}, },
toStat(){ toStat(){
if(this.listData.length){ if(this.listData.length){
let invalid = false
this.listData.map(n => {
if(n.thisScore == null) invalid = true
})
if(invalid) return this.$message.warning('考核未全部批阅完,无法统计成绩,请先批阅')
this.assessmentName = this.assessmentNameList.find(n => n.assessmentId == this.assessmentId).assessmentName this.assessmentName = this.assessmentNameList.find(n => n.assessmentId == this.assessmentId).assessmentName
this.setAssDetailInfo({ this.setAssDetailInfo({
id: this.listData[0].paperId, id: this.listData[0].paperId,
assessmentId: this.assessmentId, assessmentId: this.assessmentId,
assessmentName: this.assessmentName, assessmentName: this.assessmentName,
classId: this.classId, classId: this.classId,
stuId: this.userId, stuId: this.userId
}) })
this.$router.push('statistics') this.$router.push('statistics')
}else{ }else{

@ -4,12 +4,14 @@
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{item}}</a> <a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{item}}</a>
</div> </div>
<practice-results v-if="active == 'practice'"></practice-results> <practice-results v-if="active == 'practice'" v-auth="'成绩管理:练习成绩'"></practice-results>
<exam-results v-else-if="active == 'exam'"></exam-results> <exam-results v-else-if="active == 'exam'" v-auth="'成绩管理:考试成绩'"></exam-results>
<wrong-book v-else></wrong-book> <wrong-book v-else v-auth="'成绩管理:错题收藏'"></wrong-book>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import Setting from '@/setting'
import practiceResults from './practiceResults' import practiceResults from './practiceResults'
import examResults from './examResults' import examResults from './examResults'
import wrongBook from './wrongBook' import wrongBook from './wrongBook'
@ -29,9 +31,31 @@ export default {
examResults, examResults,
wrongBook, wrongBook,
}, },
computed: {
...mapState('auth', [
'btns'
])
},
created() {
Setting.dynamicRoute && this.initTabs()
},
methods: { methods: {
tabChange(index){ tabChange(index){
this.active = index this.active = index
},
initTabs(){
let tab1 = this.btns.includes('成绩管理:练习成绩')
let tab2 = this.btns.includes('成绩管理:考试成绩')
let tab3 = this.btns.includes('成绩管理:错题收藏')
if(!tab1 && tab2){
this.active = 'exam'
}else if(!tab1 && !tab2 && tab3){
this.active = 'wrong'
}
if(!tab1) delete this.tabs.practice
if(!tab2) delete this.tabs.exam
if(!tab3) delete this.tabs.wrong
} }
} }
}; };

@ -35,6 +35,7 @@
size="small" size="small"
round round
@click="exportData" @click="exportData"
v-auth="'/achievement/list:练习成绩:导出'"
>导出</el-button> >导出</el-button>
</div> </div>
</div> </div>
@ -66,7 +67,7 @@
<el-table-column prop="avg" label="平均分" align="center"></el-table-column> <el-table-column prop="avg" label="平均分" align="center"></el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showDetail(scope.row)">查看详情</el-button> <el-button type="text" @click="showDetail(scope.row)" v-auth="'/achievement/list:练习成绩:查看详情'">查看详情</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -229,7 +230,7 @@ export default {
}, },
show(row){ show(row){
this.setPracDetailInfo({ this.setPracDetailInfo({
practiseId: this.practiseId, practiseId: row.id,
score: row.score score: row.score
}) })
this.$router.push('/practice/detail') this.$router.push('/practice/detail')

@ -73,7 +73,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="show(scope.row,1)">查看</el-button> <el-button type="text" @click="show(scope.row,1)" v-auth="'/achievement/list:错题收藏:查看'">查看</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -61,8 +61,18 @@
<div class="meta" v-if="active == 4"> <div class="meta" v-if="active == 4">
<p class="key">附件</p> <p class="key">附件</p>
<div class="val"> <div class="val">
<el-button v-if="item.fileUrl || item.videoAudio" type="text" @click="preview(item)">{{item.fileName}}</el-button> <template v-if="item.fileUrl">
<el-button v-if="item.fileUrl" type="primary" size="mini" @click="download(item)">下载</el-button> <div v-for="(url,fileName) in item.fileUrl" :key="fileName">
<el-button type="text" @click="preview(url,0)">{{fileName}}</el-button>
<el-button type="primary" size="mini" @click="download(fileName,url)">下载</el-button>
</div>
</template>
<template v-if="item.videoAudio">
<div v-for="(url,fileName) in item.videoAudio" :key="fileName">
<el-button type="text" @click="preview(url,1)">{{fileName}}</el-button>
<!-- <el-button type="primary" size="mini" @click="download(url)">下载</el-button> -->
</div>
</template>
</div> </div>
</div> </div>
<div class="meta"> <div class="meta">
@ -78,6 +88,7 @@
<div class="player" id="player"></div> <div class="player" id="player"></div>
</div> </div>
<pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf> <pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf>
<a ref="picLink" style="display: none;" crossOrigin="anonymous" download="用户上传图片.png" :href="imgSrc">下载图片</a>
</div> </div>
</template> </template>
<script> <script>
@ -141,16 +152,8 @@ export default {
this.ranking = res.ranking this.ranking = res.ranking
res.data.list4.map(n => { res.data.list4.map(n => {
if(n.fileUrl){ if(n.fileUrl) n.fileUrl = JSON.parse(n.fileUrl)
let file = n.fileUrl.split(',') if(n.videoAudio) n.videoAudio = JSON.parse(n.videoAudio)
n.fileName = file[0]
n.fileurl = file[1]
}
if(n.videoAudio){
let file = n.videoAudio.split(',')
n.fileName = file[0]
n.fileurl = file[1]
}
}) })
this.allData = res.data this.allData = res.data
let tabs = this.tabs let tabs = this.tabs

@ -46,8 +46,18 @@
<div class="meta" v-if="item.isSub"> <div class="meta" v-if="item.isSub">
<p class="key">附件</p> <p class="key">附件</p>
<div class="val"> <div class="val">
<el-button v-if="item.fileUrl || item.videoAudio" type="text" @click="preview(item)">{{item.fileName}}</el-button> <template v-if="item.fileUrl">
<el-button v-if="item.fileUrl" type="primary" size="mini" @click="download(item)">下载</el-button> <div v-for="(url,fileName) in item.fileUrl" :key="fileName">
<el-button type="text" @click="preview(url,0)">{{fileName}}</el-button>
<el-button type="primary" size="mini" @click="download(fileName,url)">下载</el-button>
</div>
</template>
<template v-if="item.videoAudio">
<div v-for="(url,fileName) in item.videoAudio" :key="fileName">
<el-button type="text" @click="preview(url,1)">{{fileName}}</el-button>
<!-- <el-button type="primary" size="mini" @click="download(url)">下载</el-button> -->
</div>
</template>
</div> </div>
</div> </div>
<div class="meta"> <div class="meta">
@ -80,6 +90,7 @@
<div class="player" id="player"></div> <div class="player" id="player"></div>
</div> </div>
<pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf> <pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf>
<a ref="picLink" style="display: none;" crossOrigin="anonymous" download="用户上传图片.png" :href="imgSrc">下载图片</a>
</div> </div>
</template> </template>
<script> <script>
@ -135,16 +146,8 @@ export default {
n.answer = answer.join('|') n.answer = answer.join('|')
n.user_answer = n.user_answer.replace(/&lt;&gt;/g,'|') n.user_answer = n.user_answer.replace(/&lt;&gt;/g,'|')
} }
if(n.fileUrl){ if(n.fileUrl) n.fileUrl = JSON.parse(n.fileUrl)
let file = n.fileUrl.split(',') if(n.videoAudio) n.videoAudio = JSON.parse(n.videoAudio)
n.fileName = file[0]
n.fileurl = file[1]
}
if(n.videoAudio){
let file = n.videoAudio.split(',')
n.fileName = file[0]
n.fileurl = file[1]
}
}) })
this.list = list this.list = list
this.paperName = list[0].name this.paperName = list[0].name
@ -169,16 +172,8 @@ export default {
n.answer = answer.join('|') n.answer = answer.join('|')
n.user_answer = n.user_answer.replace(/&lt;&gt;/g,'|') n.user_answer = n.user_answer.replace(/&lt;&gt;/g,'|')
} }
if(n.fileUrl){ if(n.fileUrl) n.fileUrl = JSON.parse(n.fileUrl)
let file = n.fileUrl.split(',') if(n.videoAudio) n.videoAudio = JSON.parse(n.videoAudio)
n.fileName = file[0]
n.fileurl = file[1]
}
if(n.videoAudio){
let file = n.videoAudio.split(',')
n.fileName = file[0]
n.fileurl = file[1]
}
}) })
this.list = list this.list = list
}).catch(err => {}) }).catch(err => {})

@ -194,7 +194,7 @@ export default {
assessmentId: this.assessmentId, assessmentId: this.assessmentId,
assessmentName: this.assessmentName, assessmentName: this.assessmentName,
classId: this.classId, classId: this.classId,
stuId: this.listData[0].stuId stuId: this.userId
}) })
this.$router.push('/achievement/statistics') this.$router.push('/achievement/statistics')
}else{ }else{

@ -57,8 +57,18 @@
<div class="meta" v-if="active == 4"> <div class="meta" v-if="active == 4">
<p class="key">附件</p> <p class="key">附件</p>
<div class="val"> <div class="val">
<el-button v-if="item.fileUrl || item.videoAudio" type="text" @click="preview(item)">{{item.fileName}}</el-button> <template v-if="item.fileUrl">
<el-button v-if="item.fileUrl" type="primary" size="mini" @click="download(item)">下载</el-button> <div v-for="(url,fileName) in item.fileUrl" :key="fileName">
<el-button type="text" @click="preview(url,0)">{{fileName}}</el-button>
<el-button type="primary" size="mini" @click="download(fileName,url)">下载</el-button>
</div>
</template>
<template v-if="item.videoAudio">
<div v-for="(url,fileName) in item.videoAudio" :key="fileName">
<el-button type="text" @click="preview(url,1)">{{fileName}}</el-button>
<!-- <el-button type="primary" size="mini" @click="download(url)">下载</el-button> -->
</div>
</template>
</div> </div>
</div> </div>
<div class="meta"> <div class="meta">
@ -74,6 +84,7 @@
<div class="player" id="player"></div> <div class="player" id="player"></div>
</div> </div>
<pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf> <pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf>
<a ref="picLink" style="display: none;" crossOrigin="anonymous" download="用户上传图片.png" :href="imgSrc">下载图片</a>
</div> </div>
</template> </template>
<script> <script>
@ -146,16 +157,8 @@ export default {
n.userAnswer = n.userAnswer ? n.userAnswer.replace(/&lt;&gt;/g,'|') : '' n.userAnswer = n.userAnswer ? n.userAnswer.replace(/&lt;&gt;/g,'|') : ''
} }
if(n.typeName == '简答题'){ if(n.typeName == '简答题'){
if(n.fileUrl){ if(n.fileUrl) n.fileUrl = JSON.parse(n.fileUrl)
let file = n.fileUrl.split(',') if(n.videoAudio) n.videoAudio = JSON.parse(n.videoAudio)
n.fileName = file[0]
n.fileurl = file[1]
}
if(n.videoAudio){
let file = n.videoAudio.split(',')
n.fileName = file[0]
n.fileurl = file[1]
}
} }
}) })
this.list = data.list this.list = data.list
@ -303,29 +306,12 @@ export default {
} }
} }
} }
.btns{ .player{
display: flex; position: absolute;
justify-content: center; top: 50%;
margin-top: 20px; left: 50%;
button{ transform: translate(-50%,-50%);
height: 30px; width: 1200px !important;
padding: 0 30px; height: 600px !important;
margin: 0 15px;
font-size: 14px;
color: #333;
line-height: 30px;
background-color: #fff;
border: 1px solid #ededed;
border-radius: 4px;
cursor: pointer;
&.submit{
color: #fff;
background-color: $main-color;
border-color: $main-color;
}
&:hover{
opacity: .8;
}
}
} }
</style> </style>

@ -46,8 +46,18 @@
<div class="meta" v-if="item.isSub"> <div class="meta" v-if="item.isSub">
<p class="key">附件</p> <p class="key">附件</p>
<div class="val"> <div class="val">
<el-button v-if="item.fileUrl || item.videoAudio" type="text" @click="preview(item)">{{item.fileName}}</el-button> <template v-if="item.fileUrl">
<el-button v-if="item.fileUrl" type="primary" size="mini" @click="download(item)">下载</el-button> <div v-for="(url,fileName) in item.fileUrl" :key="fileName">
<el-button type="text" @click="preview(url,0)">{{fileName}}</el-button>
<el-button type="primary" size="mini" @click="download(fileName,url)">下载</el-button>
</div>
</template>
<template v-if="item.videoAudio">
<div v-for="(url,fileName) in item.videoAudio" :key="fileName">
<el-button type="text" @click="preview(url,1)">{{fileName}}</el-button>
<!-- <el-button type="primary" size="mini" @click="download(url)">下载</el-button> -->
</div>
</template>
</div> </div>
</div> </div>
<div class="meta"> <div class="meta">
@ -80,6 +90,7 @@
<div class="player" id="player"></div> <div class="player" id="player"></div>
</div> </div>
<pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf> <pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf>
<a ref="picLink" style="display: none;" crossOrigin="anonymous" download="用户上传图片.png" :href="imgSrc">下载图片</a>
</div> </div>
</template> </template>
<script> <script>
@ -135,16 +146,8 @@ export default {
n.answer = answer.join('|') n.answer = answer.join('|')
n.userAnswer = n.userAnswer ? n.userAnswer.replace(/&lt;&gt;/g,'|') : '' n.userAnswer = n.userAnswer ? n.userAnswer.replace(/&lt;&gt;/g,'|') : ''
} }
if(n.fileUrl){ if(n.fileUrl) n.fileUrl = JSON.parse(n.fileUrl)
let file = n.fileUrl.split(',') if(n.videoAudio) n.videoAudio = JSON.parse(n.videoAudio)
n.fileName = file[0]
n.fileurl = file[1]
}
if(n.videoAudio){
let file = n.videoAudio.split(',')
n.fileName = file[0]
n.fileurl = file[1]
}
}) })
this.list = data.list this.list = data.list
this.paperName = data.paperName this.paperName = data.paperName
@ -164,16 +167,8 @@ export default {
n.questionPoints = n.question_points n.questionPoints = n.question_points
n.questionScore = n.question_score n.questionScore = n.question_score
n.questionStem = n.question_stem n.questionStem = n.question_stem
if(n.fileUrl){ if(n.fileUrl) n.fileUrl = JSON.parse(n.fileUrl)
let file = n.fileUrl.split(',') if(n.videoAudio) n.videoAudio = JSON.parse(n.videoAudio)
n.fileName = file[0]
n.fileurl = file[1]
}
if(n.videoAudio){
let file = n.videoAudio.split(',')
n.fileName = file[0]
n.fileurl = file[1]
}
}) })
this.list = list this.list = list
}).catch(err => {}) }).catch(err => {})
@ -326,4 +321,12 @@ export default {
} }
} }
} }
.player{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 1200px !important;
height: 600px !important;
}
</style> </style>

@ -31,7 +31,7 @@
<div class="flex j-between m-b-20"> <div class="flex j-between m-b-20">
<div class="p-title">公共题库</div> <div class="p-title">公共题库</div>
<div> <div>
<el-button type="primary" size="small" round @click="delAllData" v-auth>批量取消共享</el-button> <el-button type="primary" size="small" round @click="delAllData" v-auth="'/quesBank/list:公共题库:批量取消共享'">批量取消共享</el-button>
</div> </div>
</div> </div>
<el-table :data="listData" class="table" stripe header-align="center" row-key="id" @selection-change="handleSelectionChange"> <el-table :data="listData" class="table" stripe header-align="center" row-key="id" @selection-change="handleSelectionChange">
@ -47,8 +47,8 @@
<el-table-column prop="createUser" label="创建人" width="100" align="center"></el-table-column> <el-table-column prop="createUser" label="创建人" width="100" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="120"> <el-table-column label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="show(scope.row)" v-auth>查看</el-button> <el-button type="text" @click="show(scope.row)" v-auth="'/quesBank/list:公共题库:查看'">查看</el-button>
<el-button type="text" @click="delData(scope.row)" v-auth>取消共享</el-button> <el-button type="text" @click="delData(scope.row)" v-auth="'/quesBank/list:公共题库:取消共享'">取消共享</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -4,12 +4,14 @@
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{item}}</a> <a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{item}}</a>
</div> </div>
<ques-bank-type v-if="active == 'type'"></ques-bank-type> <ques-bank-type v-if="active == 'type'" v-auth="'题库管理:题库分类'"></ques-bank-type>
<my-ques-bank v-else-if="active == 'my'"></my-ques-bank> <my-ques-bank v-else-if="active == 'my'" v-auth="'题库管理:我上传的题库'"></my-ques-bank>
<global-ques-bank v-else></global-ques-bank> <global-ques-bank v-else v-auth="'题库管理:公共题库'"></global-ques-bank>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import Setting from '@/setting'
import quesBankType from './quesBankType' import quesBankType from './quesBankType'
import myQuesBank from './myQuesBank' import myQuesBank from './myQuesBank'
import globalQuesBank from './globalQuesBank' import globalQuesBank from './globalQuesBank'
@ -21,7 +23,7 @@ export default {
type: '题库分类', type: '题库分类',
my: '我上传的题库', my: '我上传的题库',
global: '公共题库' global: '公共题库'
} },
}; };
}, },
components: { components: {
@ -29,12 +31,31 @@ export default {
myQuesBank, myQuesBank,
globalQuesBank, globalQuesBank,
}, },
mounted() { computed: {
...mapState('auth', [
'btns'
])
},
created() {
Setting.dynamicRoute && this.initTabs()
}, },
methods: { methods: {
tabChange(index){ tabChange(index){
this.active = index this.active = index
},
initTabs(){
let tab1 = this.btns.includes('题库管理:题库分类')
let tab2 = this.btns.includes('题库管理:我上传的题库')
let tab3 = this.btns.includes('题库管理:公共题库')
if(!tab1 && tab2){
this.active = 'my'
}else if(!tab1 && !tab2 && tab3){
this.active = 'global'
}
if(!tab1) delete this.tabs.type
if(!tab2) delete this.tabs.my
if(!tab3) delete this.tabs.global
} }
} }
}; };

@ -28,36 +28,10 @@
<div class="p-title m-b-20">题目列表</div> <div class="p-title m-b-20">题目列表</div>
<div> <div>
<el-button <el-button type="primary" size="small" round @click="addTopics" v-auth="'/quesBank/list:我上传的题库:单题上传'">单题上传</el-button>
type="primary" <el-button type="primary" size="small" round @click="showimportVisible" v-auth="'/quesBank/list:我上传的题库:批量上传'">批量上传</el-button>
size="small" <el-button type="primary" size="small" round @click="shareDataBatch" v-auth="'/quesBank/list:我上传的题库:批量共享'">批量共享</el-button>
round <el-button type="primary" size="small" round @click="delAllData" v-auth="'/quesBank/list:我上传的题库:批量删除'">批量删除</el-button>
@click="addTopics"
>单题上传</el-button>
<el-button
type="primary"
size="small"
round
@click="showimportVisible"
>批量上传</el-button>
<el-button
type="primary"
size="small"
round
@click="shareDataBatch"
>批量共享</el-button>
<!-- <el-button
type="primary"
size="small"
round
@click="cancelShareBatch"
>取消共享</el-button> -->
<el-button
type="primary"
size="small"
round
@click="delAllData"
>批量删除</el-button>
</div> </div>
</div> </div>
@ -91,11 +65,11 @@
<el-table-column prop="createTime" label="上传时间" width="140" align="center"></el-table-column> <el-table-column prop="createTime" label="上传时间" width="140" align="center"></el-table-column>
<el-table-column label="操作" width="230"> <el-table-column label="操作" width="230">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="show(scope.row)">查看</el-button> <el-button type="text" @click="show(scope.row)" v-auth="'/quesBank/list:我上传的题库:查看'">查看</el-button>
<el-button type="text" @click="edit(scope.row)">修改</el-button> <el-button type="text" @click="edit(scope.row)" v-auth="'/quesBank/list:我上传的题库:修改'">修改</el-button>
<el-button type="text" @click="delData(scope.row)">删除</el-button> <el-button type="text" @click="delData(scope.row)" v-auth="'/quesBank/list:我上传的题库:删除'">删除</el-button>
<el-button v-if="!scope.row.myShare" type="text" @click="share(scope.row)">共享</el-button> <el-button v-if="!scope.row.myShare" type="text" @click="share(scope.row)" v-auth="'/quesBank/list:我上传的题库:共享'">共享</el-button>
<el-button v-else type="text" @click="cancelShare(scope.row)">取消共享</el-button> <el-button v-else type="text" @click="cancelShare(scope.row)" v-auth="'/quesBank/list:我上传的题库:共享'">取消共享</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -365,7 +339,6 @@ export default {
} }
}, },
downLoad() { downLoad() {
// location.href = 'http://39.108.250.202:9000/cjEnterprise/questions/getExcel'
location.href = 'http://39.108.250.202/cjEnterprise/题库导入模板.xlsx' location.href = 'http://39.108.250.202/cjEnterprise/题库导入模板.xlsx'
}, },
showimportVisible() { showimportVisible() {

@ -17,7 +17,7 @@
<div class="p-title">分类管理</div> <div class="p-title">分类管理</div>
<div> <div>
<el-button type="primary" size="small" round @click="addFirst" v-auth>添加一级分类</el-button> <el-button type="primary" size="small" round @click="addFirst" v-auth="'/quesBank/list:题库分类:添加一级分类'">添加一级分类</el-button>
</div> </div>
</div> </div>
<el-table :data="listData" class="table" stripe header-align="center" row-key="cid" :tree-props="treeProps" :indent="9"> <el-table :data="listData" class="table" stripe header-align="center" row-key="cid" :tree-props="treeProps" :indent="9">
@ -28,9 +28,9 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="200"> <el-table-column label="操作" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" v-if="scope.row.parentId == 0" @click="addSecond(scope.row)" v-auth>添加</el-button> <el-button type="text" v-if="scope.row.parentId == 0" @click="addSecond(scope.row)" v-auth="'/quesBank/list:题库分类:添加'">添加</el-button>
<el-button type="text" @click="editType(scope.row)" v-auth>编辑</el-button> <el-button type="text" @click="editType(scope.row)" v-auth="'/quesBank/list:题库分类:编辑'">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button> <el-button type="text" @click="handleDelete(scope.row)" v-auth="'/quesBank/list:题库分类:删除'">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -135,12 +135,12 @@
</el-select> </el-select>
</div> </div>
<div class="block"> <!-- <div class="block">
<p class="block-left">当前所在学校</p> <p class="block-left">当前所在学校</p>
<el-select v-model="personalInformation.clientId" filterable placeholder="请选择学校"> <el-select v-model="personalInformation.clientId" filterable placeholder="请选择学校">
<el-option v-for="(item,index) in schoolList" :key="index" :label="item.clientName" :value="item.id"></el-option> <el-option v-for="(item,index) in schoolList" :key="index" :label="item.clientName" :value="item.id"></el-option>
</el-select> </el-select>
</div> </div> -->
</div> </div>
</div> </div>
@ -385,6 +385,7 @@ export default {
.then(res => { .then(res => {
this.personalInformation = res.data.userInfo this.personalInformation = res.data.userInfo
this.personalInformation.countries = '中国' this.personalInformation.countries = '中国'
this.personalInformation.clientName = this.schoolList.find(n => n.id == this.personalInformation.clientId).clientName
this.curPassword = this.personalInformation.password this.curPassword = this.personalInformation.password
this.$nextTick(() => { this.$nextTick(() => {
if(this.personalInformation.provinceId){ if(this.personalInformation.provinceId){
@ -449,7 +450,7 @@ export default {
phone: personalInformation.phone, phone: personalInformation.phone,
provinceId: personalInformation.provinceId, provinceId: personalInformation.provinceId,
clientId: personalInformation.clientId, clientId: personalInformation.clientId,
clientName: this.schoolList.find(n => n.id == personalInformation.clientId).clientName, clientName: personalInformation.clientName,
sex: personalInformation.sex, sex: personalInformation.sex,
userId: personalInformation.userId, userId: personalInformation.userId,
userName: personalInformation.userName, userName: personalInformation.userName,

@ -13,9 +13,9 @@
<el-input placeholder="请输入学生名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> <el-input placeholder="请输入学生名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
</div> </div>
<div> <div>
<el-button type="primary" size="small" round @click="addstudent">新增学生</el-button> <el-button type="primary" size="small" round @click="addstudent" v-auth>新增学生</el-button>
<el-button type="primary" size="small" round class="mag" @click="batchImport">批量导入</el-button> <el-button type="primary" size="small" round class="mag" @click="batchImport" v-auth>批量导入</el-button>
<el-button type="primary" size="small" round @click="delAllSelection">批量删除</el-button> <el-button type="primary" size="small" round @click="delAllSelection" v-auth>批量删除</el-button>
</div> </div>
</div> </div>
<el-table :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange"> <el-table :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange">
@ -43,10 +43,9 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180" align="center"> <el-table-column label="操作" width="180" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-button type="text">查看</el-button> --> <el-button type="text" @click="editstudent(scope.row)" v-auth>编辑</el-button>
<el-button type="text" @click="editstudent(scope.row)">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)" v-auth>重置密码</el-button> <el-button type="text" @click="resetPassword(scope.row)" v-auth>重置密码</el-button>
<el-button type="text" @click="delstudent(scope.row)">删除</el-button> <el-button type="text" @click="delstudent(scope.row)" v-auth>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div class="tabs" v-if="showTabs"> <div class="tabs m-b-20" v-if="showTabs">
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == activeName}" @click="tabChange(index)">{{item}}</a> <a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == activeName}" @click="tabChange(index)">{{item}}</a>
</div> </div>
@ -14,6 +14,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import Setting from '@/setting'; import Setting from '@/setting';
import staff from './staff.vue'; import staff from './staff.vue';
import role from './role.vue'; import role from './role.vue';
@ -21,7 +22,6 @@ export default {
data() { data() {
return { return {
activeName: 'staff', activeName: 'staff',
userId: this.$store.state.userId,
tabs: { tabs: {
staff: '员工管理', staff: '员工管理',
role: '角色权限' role: '角色权限'
@ -33,6 +33,11 @@ export default {
staff, staff,
role role
}, },
computed: {
...mapState('auth', [
'btns'
])
},
created() { created() {
Setting.dynamicRoute && this.initTabs() Setting.dynamicRoute && this.initTabs()
}, },
@ -41,9 +46,8 @@ export default {
this.activeName = index this.activeName = index
}, },
initTabs(){ initTabs(){
let btnPermissions = this.$store.state.btnPermissions let showStaff = this.btns.includes('系统设置:员工管理')
let showStaff = btnPermissions.includes('系统设置:员工管理') let showRole = this.btns.includes('系统设置:角色权限')
let showRole = btnPermissions.includes('系统设置:角色权限')
if(!showStaff || !showRole){ if(!showStaff || !showRole){
this.showTabs = false this.showTabs = false
@ -55,28 +59,5 @@ export default {
</script> </script>
<style lang="scss" scopted> <style lang="scss" scopted>
.tabs{
display: flex;
align-items: center;
padding: 20px 1.5% 20px;
margin-bottom: 20px;
z-index: 999;
background-color: #fff;
.item{
padding: 12px 20px;
margin-right: 10px;
color:#606266;
line-height: 1;
border-radius: 4px;
background-color: #fff;
border: 1px solid #dcdfe6;
cursor: pointer;
&.active{
color: #fff;
background-color: #cb221c;
border-color: #cb221c;
}
}
}
</style> </style>

@ -15,8 +15,8 @@
<div class="flex j-between m-b-20"> <div class="flex j-between m-b-20">
<div class="p-title">角色列表</div> <div class="p-title">角色列表</div>
<div> <div>
<el-button type="primary" size="small" round @click="addRole" v-auth="'system:角色权限:新增角色'">新增角色</el-button> <el-button type="primary" size="small" round @click="addRole" v-auth="'/system/list:角色权限:新增角色'">新增角色</el-button>
<el-button type="primary" size="small" round @click="delAllSelection" v-auth="'system:角色权限:批量删除'">批量删除</el-button> <el-button type="primary" size="small" round @click="delAllSelection" v-auth="'/system/list:角色权限:批量删除'">批量删除</el-button>
</div> </div>
</div> </div>
<el-table :data="roleData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys"> <el-table :data="roleData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys">
@ -32,10 +32,10 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180"> <el-table-column label="操作" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showRole(scope.row)" v-auth="'system:角色权限:查看'">查看</el-button> <el-button type="text" @click="showRole(scope.row)" v-auth="'/system/list:角色权限:查看'">查看</el-button>
<!-- <template v-if="scope.row.id != 1"> --> <!-- <template v-if="scope.row.id != 1"> -->
<el-button type="text" @click="editRole(scope.row)" v-auth="'system:角色权限:编辑'">编辑</el-button> <el-button type="text" @click="editRole(scope.row)" v-auth="'/system/list:角色权限:编辑'">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth="'system:角色权限:删除'">删除</el-button> <el-button type="text" @click="handleDelete(scope.row)" v-auth="'/system/list:角色权限:删除'">删除</el-button>
<!-- </template> --> <!-- </template> -->
</template> </template>
</el-table-column> </el-table-column>

@ -13,9 +13,9 @@
<el-input placeholder="请输入员工姓名/工号" v-model="keyword" prefix-icon="el-icon-search" clearable></el-input> <el-input placeholder="请输入员工姓名/工号" v-model="keyword" prefix-icon="el-icon-search" clearable></el-input>
</div> </div>
<div> <div>
<el-button type="primary" size="small" round @click="addTeacher" v-auth="'system:员工管理:新增员工'">新增员工</el-button> <el-button type="primary" size="small" round @click="addTeacher" v-auth="'/system/list:员工管理:新增员工'">新增员工</el-button>
<el-button type="primary" size="small" round @click="batchImport" v-auth="'system:员工管理:批量导入'">批量导入</el-button> <el-button type="primary" size="small" round @click="batchImport" v-auth="'/system/list:员工管理:批量导入'">批量导入</el-button>
<el-button type="primary" size="small" round @click="delAllSelection" v-auth="'system:员工管理:批量删除'">批量删除</el-button> <el-button type="primary" size="small" round @click="delAllSelection" v-auth="'/system/list:员工管理:批量删除'">批量删除</el-button>
</div> </div>
</div> </div>
<el-table :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange"> <el-table :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange">
@ -43,10 +43,10 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="200"> <el-table-column label="操作" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showTeacher(scope.row)" v-auth="'system:员工管理:查看'">查看</el-button> <el-button type="text" @click="showTeacher(scope.row)" v-auth="'/system/list:员工管理:查看'">查看</el-button>
<el-button type="text" @click="editTeacher(scope.row)" v-auth="'system:员工管理:编辑'">编辑</el-button> <el-button type="text" @click="editTeacher(scope.row)" v-auth="'/system/list:员工管理:编辑'">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)" v-auth="'system:员工管理:重置密码'">重置密码</el-button> <el-button type="text" @click="resetPassword(scope.row)" v-auth="'/system/list:员工管理:重置密码'">重置密码</el-button>
<el-button type="text" @click="delTeacher(scope.row)" v-auth="'system:员工管理:删除'">删除</el-button> <el-button type="text" @click="delTeacher(scope.row)" v-auth="'/system/list:员工管理:删除'">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -28,7 +28,7 @@
</div> </div>
<div class="item lg"> <div class="item lg">
<p class="key">建议时长分钟</p> <p class="key">建议时长分钟</p>
<el-input v-model.number="duration" type="number"></el-input> <el-input v-model.number="duration" type="number" min="0"></el-input>
</div> </div>
</div> </div>
<div class="line"> <div class="line">

@ -73,8 +73,8 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="120"> <el-table-column label="操作" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" v-if="scope.row.state == 0 && userId == scope.row.userId" @click="publish(scope.row)" v-auth>发布</el-button> <el-button type="text" v-if="scope.row.state == 0 && userId == scope.row.userId" @click="publish(scope.row)" v-auth="'/testPaper/list:所有试卷:发布'">发布</el-button>
<el-button type="text" @click="preview(scope.row)" v-auth>预览</el-button> <el-button type="text" @click="preview(scope.row)" v-auth="'/testPaper/list:所有试卷:预览'">预览</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -4,11 +4,13 @@
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{item}}</a> <a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{item}}</a>
</div> </div>
<my-test-paper v-if="active == 'my'"></my-test-paper> <my-test-paper v-if="active == 'my'" v-auth="'试卷管理:我的试卷'"></my-test-paper>
<all-test-paper v-else></all-test-paper> <all-test-paper v-else v-auth="'试卷管理:所有试卷'"></all-test-paper>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import Setting from '@/setting'
import myTestPaper from './myTestPaper' import myTestPaper from './myTestPaper'
import allTestPaper from './allTestPaper' import allTestPaper from './allTestPaper'
export default { export default {
@ -25,9 +27,27 @@ export default {
myTestPaper, myTestPaper,
allTestPaper, allTestPaper,
}, },
computed: {
...mapState('auth', [
'btns'
])
},
created() {
Setting.dynamicRoute && this.initTabs()
},
methods: { methods: {
tabChange(index){ tabChange(index){
this.active = index this.active = index
},
initTabs(){
let tab1 = this.btns.includes('试卷管理:我的试卷')
let tab2 = this.btns.includes('试卷管理:所有试卷')
if(!tab1 && tab2){
this.active = 'all'
}
if(!tab1) delete this.tabs.my
if(!tab2) delete this.tabs.all
} }
} }
}; };

@ -123,8 +123,8 @@
<div class="flex j-between m-b-20"> <div class="flex j-between m-b-20">
<div class="p-title">我的试卷</div> <div class="p-title">我的试卷</div>
<div> <div>
<el-button type="primary" size="small" round @click="addTestPaper" v-auth>创建试卷</el-button> <el-button type="primary" size="small" round @click="addTestPaper" v-auth="'/testPaper/list:我的试卷:创建试卷'">创建试卷</el-button>
<el-button type="primary" size="small" round @click="delAllSelection" v-auth>批量删除</el-button> <el-button type="primary" size="small" round @click="delAllSelection" v-auth="'/testPaper/list:我的试卷:批量删除'">批量删除</el-button>
</div> </div>
</div> </div>
<el-table :data="listData" class="table" stripe header-align="center" row-key="id" @selection-change="handleSelecteChange"> <el-table :data="listData" class="table" stripe header-align="center" row-key="id" @selection-change="handleSelecteChange">
@ -157,12 +157,12 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="250"> <el-table-column label="操作" width="250">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" v-if="scope.row.state == 0" @click="publish(scope.row)" v-auth>发布</el-button> <el-button type="text" v-if="scope.row.state == 0" @click="publish(scope.row)" v-auth="'/testPaper/list:我的试卷:发布'">发布</el-button>
<el-button type="text" @click="preview(scope.row)" v-auth>预览</el-button> <el-button type="text" @click="preview(scope.row)" v-auth="'/testPaper/list:我的试卷:预览'">预览</el-button>
<el-button type="text" @click="copy(scope.row)" v-auth>复制</el-button> <el-button type="text" @click="copy(scope.row)" v-auth="'/testPaper/list:我的试卷:复制'">复制</el-button>
<el-button type="text" @click="edit(scope.row)" v-auth>修改</el-button> <el-button type="text" @click="edit(scope.row)" v-auth="'/testPaper/list:我的试卷:修改'">修改</el-button>
<el-button type="text" @click="delData(scope.row)" v-auth>删除</el-button> <el-button type="text" @click="delData(scope.row)" v-auth="'/testPaper/list:我的试卷:删除'">删除</el-button>
<el-button type="text" @click="exportData(scope.row)" v-auth>导出</el-button> <el-button type="text" @click="exportData(scope.row)" v-auth="'/testPaper/list:我的试卷:导出'">导出</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -180,6 +180,23 @@
import { mapState,mapGetters,mapActions } from 'vuex' import { mapState,mapGetters,mapActions } from 'vuex'
import html2Canvas from 'html2canvas' import html2Canvas from 'html2canvas'
import JsPDF from 'jspdf' import JsPDF from 'jspdf'
function getUrlBase64(url, ext, callback) {
var canvas = document.createElement("canvas"); //canvas DOM
var ctx = canvas.getContext("2d");
var img = new Image;
img.crossOrigin = 'Anonymous';
img.src = url;
img.onload = function () {
canvas.height = 60; //,
canvas.width = 85; //
ctx.drawImage(img, 0, 0, 60, 85); //
var dataURL = canvas.toDataURL("image/" + ext);
callback.call(this, dataURL); //Base64
canvas = null;
};
}
export default { export default {
data() { data() {
return { return {
@ -316,9 +333,23 @@ export default {
this.loading = true this.loading = true
this.exportVisible = true this.exportVisible = true
this.paperName = row.name this.paperName = row.name
this.$post(`${this.api.previewtestPaper}?id=1`) this.$post(`${this.api.previewtestPaper}?id=${row.id}`)
.then(res => { .then(res => {
this.paperList = res.data let list = res.data
let reg = /<img src=".*?">/gi
for(let i in list){
list[i].map(n => {
let src = reg.exec(n.questionStem)
// n.questionStem = n.questionStem.replace(/<img.*?(?:>|\/>)/gi,'')
if(src){
src = src[0].replace('<img src="','').replace('">','')
getUrlBase64(src, 'jpg', function (base64) {
n.questionStem = n.questionStem.replace(reg,`<img src="${base64}">`)
})
}
})
}
this.paperList = list
this.handleOptions() this.handleOptions()
var title = row.name var title = row.name
this.$nextTick(() => { this.$nextTick(() => {

@ -1,20 +1,21 @@
/** /**
* @description 鉴权指令 * @description 鉴权指令
* 当传入的权限当前用户没有时会移除该组件 * 当传入的权限当前用户没有时会移除该组件
* 用例<Tag v-auth>text</Tag> <Tag v-auth="'user:'">text</Tag> * 用例<Tag v-auth">text</Tag> 或者:<Tag v-auth="'user:编辑'">text</Tag>
* */ * */
import store from '@/store' import store from '@/store'
import Setting from '@/setting'
export default { export default {
inserted (el, binding, vnode) { inserted (el, binding, vnode) {
if(Setting.dynamicRoute){
let btnText = '' let btnText = ''
if(binding.value){ if(binding.value){
btnText = binding.value btnText = binding.value
}else{ }else{
btnText = `${vnode.context.$route.name}:${el.innerText}` btnText = `${vnode.context.$route.path}:${el.innerText}`
} }
const btnPermissions = store.state.auth.btns const btnPermissions = store.state.auth.btns
// console.log(22,btnText,btnPermissions)
if (btnText && btnPermissions && btnPermissions.length) { if (btnText && btnPermissions && btnPermissions.length) {
const isPermission = btnPermissions.includes(btnText) const isPermission = btnPermissions.includes(btnText)
@ -24,3 +25,4 @@ export default {
} }
} }
} }
}

@ -62,7 +62,7 @@ const Setting = {
maxSize: 30, maxSize: 30,
}, },
// 是否使用动态路由 // 是否使用动态路由
dynamicRoute: false dynamicRoute: true
}; };
export default Setting; export default Setting;

Loading…
Cancel
Save