yujialong 4 years ago
parent f54b1ddcff
commit 4e0d06ed0c
  1. 2
      src/App.vue
  2. 22
      src/api/index.js
  3. BIN
      src/assets/img/login_bg.png
  4. 69
      src/layouts/header/index.vue
  5. 2
      src/pages/account/login/index.vue
  6. 9
      src/pages/quesBank/list/globalQuesBank.vue
  7. 77
      src/pages/quesBank/list/myQuesBank.vue
  8. 2
      src/pages/quesBank/list/quesBankType.vue
  9. 83
      src/pages/quesBank/list/quesDialog.vue
  10. 23
      src/pages/setting/person/index.vue
  11. 2
      src/setting.js
  12. 9
      src/store/modules/user.js
  13. 4
      src/styles/lib/_reset.scss
  14. 1
      src/styles/lib/index.scss
  15. 9
      src/styles/lib/mixin.scss

@ -10,12 +10,10 @@
export default {
name: 'App',
created () {
//sessionStorage
if (util.session.get(Setting.storeKey) ) {
this.$store.replaceState(Object.assign({}, this.$store.state,JSON.parse(util.session.get(Setting.storeKey))))
}
//vuexsessionStorage
window.addEventListener("beforeunload",()=>{
util.session.get(Setting.usernameKey) && util.session.set(Setting.storeKey,JSON.stringify(this.$store.state))
})

@ -1,14 +1,25 @@
import Setting from '@/setting'
let uploadURL = Setting.apiUploadURL
export default {
logins: `management/userInfo/login`, //登录 
// 登录 
logins: `management/userInfo/login`,
// 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`,
// 查询省份城市
queryCity: `cjEnterprise/city/queryCity`,
queryProvince: `cjEnterprise/province/queryProvince`,
// 个人中心
userinfoUpdate:`management/userInfo/update`,//个人中心信息修改
userinfo:`management/userInfo/getUserInfo`,//个人中心信息展示
getAccount:`management/userInfo/getAccount`,//账号判重
userinfoUpdate:`management/userInfo/update`,
userinfo:`management/userInfo/getUserInfo`,
getAccount:`management/userInfo/getAccount`,
// 组织架构
addStaffPro: `management/staffProfessionalArchitecture/addStaffProfessionalArchitecture`,
@ -63,9 +74,6 @@ export default {
exportFailureUser: `cjEnterprise/user/exportFailure`,
downloadUserTemp: 'http://liuwanr.oss-cn-shenzhen.aliyuncs.com/xlsx/20201102/1604658619702.xlsx',
fileupload: `oss/manage/fileupload`,
fileDeletion: `oss/manage/fileDeletion`, //批量删除文件
// 题库分类
AddOneLevel:`cjEnterprise/questionBank/AddOneLevel`,
AddSecondLevel:`cjEnterprise/questionBank/AddSecondLevel`,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 985 KiB

@ -10,48 +10,45 @@
<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 } from 'vuex';
import { mapActions } from 'vuex';
import bus from '@/libs/bus';
import Setting from '@/setting';
import util from '@/libs/util';
import { mapState,mapActions } from 'vuex'
import Setting from '@/setting'
export default {
data() {
return {
collapse: false,
fullscreen: false,
name: 'huoran',
message: 2,
circleUrl: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
showBackList: Setting.layout.hideNavList,
};
},
computed: {
...mapState('user', [
'userName','avatar'
'userId','avatar','userName'
]),
showBack(){
let route = this.$route.name
if(this.showBackList.includes(route)) return true
return false
}
},
mounted(){
},
methods: {
...mapActions('user', [
'logout'
]),
toPerson(){
this.$router.push('/setting/person')
},
loginout() {
this.logout()
sessionStorage.removeItem(Setting.usernameKey);
sessionStorage.removeItem(Setting.storeKey);
location.reload()
},
back(){
this.$router.back()
}
},
};
@ -64,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,51 +73,49 @@ export default {
height: 60px;
font-size: 16px;
color: #333;
}
.header .logo {
border-bottom: 1px solid #efefef;
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>

@ -109,7 +109,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;

@ -143,7 +143,7 @@ export default {
this.getData();
},
handleSelectionChange(val) {
this.multipleSelection = val;
this.multipleSelection = val
},
delData(row) {
this.$confirm('确定要删除吗?', '提示', {
@ -172,11 +172,12 @@ export default {
this.multipleSelection = [];
this.$message.success('删除成功')
this.getData()
}).catch(res => {});
this.$refs.table.clearSelection()
}).catch(res => {})
})
.catch(() => {});
.catch(() => {})
}else{
this.$message.error('请先选择数据!');
this.$message.error('请先选择数据!')
}
},
dialogGetData(){

@ -91,7 +91,7 @@
</el-table-column>
<el-table-column prop="questionStem" label="题干" align="center">
<template slot-scope="scope">
<div v-html="scope.row.questionStem"></div>
<div class="ellipsis" v-html="scope.row.questionStem"></div>
</template>
</el-table-column>
<el-table-column prop="name" label="试题类型" width="120" align="center"></el-table-column>
@ -181,7 +181,6 @@ export default {
pageGlobal: 1,
pageSizeGlobal: 10,
totalGlobal: 0,
multipleSelectionGlobal: []
};
},
computed: {
@ -212,7 +211,11 @@ export default {
userId: this.userId
})
.then(res => {
this.listData = res.data.list.list
let list = res.data.list.list
list.map(n => {
n.questionStem = n.questionStem.replace(/<\/?.+?>/gi,'')
})
this.listData = list
this.total = res.data.list.totalCount
})
.catch(err => {})
@ -299,7 +302,7 @@ export default {
this.multipleSelection = val;
},
shareDataBatch() {
if(this.multipleSelection.length != ''){
if(this.multipleSelection.length){
let newArr = this.multipleSelection
let shareList = newArr.map(item => {
return item.id
@ -317,6 +320,7 @@ export default {
this.multipleSelection = [];
this.$message.success('共享成功')
this.getData()
this.$refs.table.clearSelection()
}).catch(res => {
this.getData()
})
@ -325,62 +329,6 @@ export default {
}else{
this.$message.error('请先选择数据')
}
},
cancelShareBatch() {
this.cancelShareVisible = true
this.getGlobalData()
return false
if(this.multipleSelection.length != ''){
let newArr = this.multipleSelection
let shareList = newArr.map(item => {
return item.id
})
this.$confirm('确定要取消共享吗?', '提示', {
type: 'info'
})
.then(() => {
let data = {
userId: this.userId,
qid: shareList
}
this.$post(this.api.saveSharing,data).then(res => {
this.multipleSelection = [];
this.$message.success('取消共享成功');
this.getData()
}).catch(res => {});
})
.catch(() => {});
}else{
this.$message.error('请先选择数据!');
}
},
getGlobalData() {
this.$post(this.api.pageByConditionSharing, {
pageNum: this.pageGlobal,
pageSize: this.pageSizeGlobal,
questionStem: '',
createUser: '',
name: ''
})
.then(res => {
this.globalData = res.data.list.list
this.totalGlobal = res.data.list.totalCount
})
.catch(err => {})
},
handleSelectionChange(val) {
this.multipleSelectionGlobal = val;
},
handleGlobalCurrentChange(val) {
this.pageGlobal = val
this.getGlobalData()
},
closeCancelShare(){
},
cancelShareSubmit(){
},
delAllData() {
if(this.multipleSelection.length){
@ -397,15 +345,16 @@ export default {
this.multipleSelection = [];
this.$message.success('删除成功');
this.getData()
}).catch(res => {});
this.$refs.table.clearSelection()
}).catch(res => {})
})
.catch(() => {});
.catch(() => {})
}else{
this.$message.error('请先选择数据!');
this.$message.error('请先选择数据!')
}
},
downLoad() {
location.href = this.api.getExcel
location.href = 'http://39.108.250.202:9000/cjEnterprise/questions/getExcel'
},
showimportVisible() {
this.importVisible = true

@ -28,7 +28,7 @@
</div>
<el-table :data="listData" class="table" stripe header-align="center" row-key="cid" :tree-props="treeProps">
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="typeName" label="分类名称" align="center"></el-table-column>
<el-table-column prop="typeName" label="分类名称"></el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button type="text" v-if="scope.row.parentId == 0" @click="addSecond(scope.row)" v-auth>添加</el-button>

@ -31,6 +31,7 @@
</el-form-item>
<el-form-item label="上传" prop="source">
<el-upload
:accept="acceptExt"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
@ -39,17 +40,28 @@
:on-exceed="handleExceed"
:action="this.api.fileupload"
:file-list="uploadList"
name="file"
>
<el-button type="primary" class="ml20">上传视频/音频</el-button>
</el-upload>
<el-link v-if="uploadFaild" type="primary" @click="showFaild">导入失败查看原因</el-link>
</el-form-item>
<el-form-item label="题干" prop="questionStem">
<quill :border="true" :readonly="isDetail" :key="isDetail" v-model="topicForm.questionStem" :minHeight="150" :height="150" />
</el-form-item>
<el-form-item label="选项" prop="optionA" v-if="topicForm.questionType != '填空题' && topicForm.questionType != '简答题'">
<template v-if="topicForm.questionType == '判断题'">
<div class="input flex_around bt">
<span>A</span>
<el-input placeholder="请输入题目" v-model="topicForm.judgeOptionA" disabled></el-input>
<el-radio v-model="topicForm.aisTrue" label="1">设为正确答案</el-radio>
</div>
<div class="input flex_around bt">
<span>B</span>
<el-input placeholder="请输入题目" v-model="topicForm.judgeOptionB" disabled></el-input>
<el-radio v-model="topicForm.aisTrue" label="2">设为正确答案</el-radio>
</div>
</template>
<template v-else>
<div class="input flex_around bt">
<span>A</span>
<el-input placeholder="请输入题目" v-model="topicForm.optionA"></el-input>
@ -60,7 +72,6 @@
<el-input placeholder="请输入题目" v-model="topicForm.optionB"></el-input>
<el-checkbox v-model="topicForm.bisTrue">设为正确答案</el-checkbox>
</div>
<template v-if="topicForm.questionType != '判断题'">
<div class="input flex_around bt">
<span>C</span>
<el-input placeholder="请输入题目" v-model="topicForm.optionC"></el-input>
@ -119,6 +130,7 @@ export default {
props: ['visible','title','isDetail'],
data() {
return {
acceptExt: '.avi,.wmv,.mpg,.mpeg,.mov,.rm,.ram,.swf,.flv,.mp4,.mp3,.wma,.avi,.rm,.rmvb,.flv,.mpg,.mkv',
quesBankList: [],
typeList: [],
topicForm: {
@ -142,6 +154,8 @@ export default {
disTrue: false,
eisTrue: false,
fisTrue: false,
judgeOptionA: '正确',
judgeOptionB: '错误',
answerAnalysis: '',
videoAudio: ''
},
@ -151,14 +165,11 @@ export default {
knowledgePoints: [{ required: true, message: '请填写知识点', trigger: 'blur' }],
questionType: [{ required: true, message: '请选择题型', trigger: 'change' }],
questionStem: [{ required: true, message: '请填写题干', trigger: 'blur' }],
// optionA: [{ required: true, message: '', trigger: 'change' }],
// optionB: [{ required: true, message: '', trigger: 'change' }]
},
options: 'ABCDEF',
questionType: ['','单选题','多选题','判断题','简答题','填空题'],
fillList: [''],
uploadList: [],
uploadFaild: false
};
},
computed: {
@ -197,16 +208,24 @@ export default {
disTrue: false,
eisTrue: false,
fisTrue: false,
judgeOptionA: '正确',
judgeOptionB: '错误',
answerAnalysis: list.answerAnalysis,
videoAudio: list.videoAudio
},
this.topicForm.questionType = this.questionType[this.topicForm.typeId]
let typeId = this.topicForm.typeId
if(typeId == 1 || typeId == 2 || typeId == 3){
if(typeId == 1 || typeId == 2){
let answer = this.topicForm.answer.toLowerCase().split('')
answer.forEach(n => {
this.topicForm[`${n}isTrue`] = true
})
}else if(typeId == 3){
if(this.topicForm.answer == 'A'){
this.topicForm.aisTrue = '1'
}else{
this.topicForm.aisTrue = '2'
}
}else if(typeId == 5){
let fillList = []
for(let n in this.topicForm) {
@ -232,6 +251,9 @@ export default {
for(let i in this.topicForm){
if(i.includes('isTrue')) this.topicForm[i] = false
}
if(this.topicForm.questionType == '判断题'){
this.topicForm.aisTrue = '1'
}
},
saveTopics() {
this.$refs.topicForm.validate((valid) => {
@ -241,7 +263,18 @@ export default {
let answer = ''
let isInvalidAnswer = false
this.topicForm.typeId = this.questionType.indexOf(topicForm.questionType)
if(topicForm.typeId != 4 && topicForm.typeId != 5){
if(this.topicForm.typeId == 3){
this.topicForm.optionA = '正确'
this.topicForm.optionB = '错误'
if(this.topicForm.aisTrue == 1){
this.topicForm.aisTrue = true
this.topicForm.answer = 'A'
}else{
this.topicForm.bisTrue = true
this.topicForm.answer = 'B'
}
}
if(topicForm.typeId == 1 || topicForm.typeId == 2 || topicForm.typeId == 3){
for(let n in topicForm) {
if(n.includes('option')) {
topicForm[n] != '' && ++optionCount
@ -252,9 +285,10 @@ export default {
if(!topicForm[`option${curOpt.toUpperCase()}`].length) isInvalidAnswer = true
}
}
if(optionCount < 2) return this.$message.warning('请至少添加两个选项!');
if(!answer) return this.$message.warning('请设置正确答案!');
if(topicForm.questionType != '多选题' && answer.length > 1) return this.$message.warning('单选题、判断题只能设置一个正确答案!');
if(optionCount < 2) return this.$message.warning('请至少添加两个选项!')
if(!answer) return this.$message.warning('请设置正确答案!')
if(topicForm.questionType == '单选题' && answer.length > 1) return this.$message.warning('单选题只能设置一个正确选项!')
if(topicForm.questionType == '多选题' && answer.length < 2) return this.$message.warning('多选题必须设置至少两个正确选项!')
if(isInvalidAnswer) return this.$message.warning('正确答案选项为空,请重新设置!');
this.topicForm.answer = answer.toUpperCase()
}else if(this.topicForm.typeId == 5){
@ -271,24 +305,24 @@ export default {
if(this.topicForm.id) {
this.$post(this.api.updateQuestions,this.topicForm).then(res => {
if(res.success) {
this.$message.success('修改成功');
this.$message.success('修改成功')
this.$emit('getData')
}else{
this.$message.error(res.data.message);
this.$message.error(res.data.message)
}
}).catch(res => {});
}).catch(res => {})
}else{
this.$post(this.api.addQuestions,this.topicForm).then(res => {
if(res.success) {
this.$message.success('新增成功');
this.$message.success('新增成功')
this.$emit('getData')
}else{
this.$message.error(res.data.message);
this.$message.error(res.data.message)
}
}).catch(res => {});
}).catch(res => {})
}
}else{
return false;
return false
}
})
},
@ -317,6 +351,8 @@ export default {
disTrue: false,
eisTrue: false,
fisTrue: false,
judgeOptionA: '正确',
judgeOptionB: '错误',
answerAnalysis: '',
videoAudio: ''
}
@ -331,7 +367,7 @@ export default {
this.topicForm.id = id
this.topicForm.questionType = this.questionType[this.topicForm.questionType]
this.NewTopics = true
}).catch(res => {});
}).catch(res => {})
},
addFill(){
if(this.fillList.some(n => n === '')) return this.$message.warning('请先填写当前答案')
@ -343,14 +379,10 @@ export default {
handleExceed(files, fileList) {
this.$message.warning(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
);
)
},
uploadSuccess(res, file, fileList) {
this.uploadFaild = false
if(res.data.token){
this.token = res.data.token
this.uploadFaild = true
}
this.topicForm.videoAudio = res.data.filesResult.fileId
},
showFaild(){
location.href = `${this.api.export_failure}?token=${this.token}`
@ -429,4 +461,3 @@ export default {
overflow: auto;
}
</style>

@ -1,26 +1,15 @@
<template>
<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">
<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;">
用户信息
@ -390,12 +379,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

@ -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.isPort == 0 || user.isPort == 1){
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"],

@ -26,3 +26,4 @@
@import "white-space";
@import "style";
@import "mixin";

@ -0,0 +1,9 @@
@mixin ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ellipsis{
@include ellipsis();
}
Loading…
Cancel
Save