mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 11:26:43 +08:00
Merge branch 'master' of codeup.aliyun.com:6265f483e4166464dc2f9c14/boeu/portal
This commit is contained in:
65
src/api/boe/audience.js
Normal file
65
src/api/boe/audience.js
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
/** 受众管理 **/
|
||||
import ajax from './boeAjax';
|
||||
const baseURL ="/userbasic";
|
||||
|
||||
|
||||
/**
|
||||
* 获取受众列表
|
||||
*/
|
||||
const list = function(data){
|
||||
return ajax.postJson(baseURL,'/audience/list',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 受众发布/停用/启用接口
|
||||
*/
|
||||
const changeStatus = function(data){
|
||||
return ajax.postJson(baseURL,'/audience/changeStatus',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除受众(状态为未发布、已停用)
|
||||
*/
|
||||
const delAudience = function(data){
|
||||
return ajax.postJson(baseURL,'/audience/delete',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定受众详情
|
||||
*/
|
||||
const detail = function(data){
|
||||
return ajax.postJson(baseURL,'/audience/detail',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新受众
|
||||
*/
|
||||
const update = function(data){
|
||||
return ajax.postJson(baseURL,'/audience/update',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制受众
|
||||
*/
|
||||
const copy = function(data){
|
||||
return ajax.postJson(baseURL,'/audience/copy',data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
*/
|
||||
const userList = function(data){
|
||||
return ajax.postJson(baseURL,'/user/list',data);
|
||||
}
|
||||
|
||||
export default {
|
||||
list,
|
||||
changeStatus,
|
||||
delAudience,
|
||||
detail,
|
||||
update,
|
||||
userList,
|
||||
copy
|
||||
}
|
||||
197
src/api/manage/manage.js
Normal file
197
src/api/manage/manage.js
Normal file
@@ -0,0 +1,197 @@
|
||||
import axios from 'axios'
|
||||
import qs from 'qs'
|
||||
import { Notification, MessageBox, Message } from 'element-ui'
|
||||
import store from '@/store'
|
||||
import { getToken } from '@/utils/token'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
/**
|
||||
*request请求 axios.request(config)
|
||||
*requestJson请求 axios.request(config)
|
||||
*get请求 axios.get(url[, config])
|
||||
*post请求 axios.post(url[, data[, config]])
|
||||
*postJson请求 axios.post(url[, data[, config]])
|
||||
*put请求 axios.put(url[, data[, config]])
|
||||
*putJson请求 axios.put(url[, data[, config]])
|
||||
*patch请求 axios.patch(url[, data[, config]])
|
||||
*patchJson请求 axios.patch(url[, data[, config]])
|
||||
*delete请求 axios.delete(url[, config])
|
||||
*/
|
||||
|
||||
|
||||
// const ReLoginUrl=process.env.VUE_APP_LOGIN_URL;
|
||||
const TokenName='token';
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
//用于普通的发送请求
|
||||
const formRequest=axios.create({
|
||||
// headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
// baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
let curToken=getToken();
|
||||
//curToken='eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzIzMTE2MTIsImV4cCI6MTY3MjMxODgxMiwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.a4f41376e994c5fcd3ab537ce17572ef4c633863f87785cf7b6ffa353e2ed51c';
|
||||
if (curToken && !isToken) {
|
||||
config.headers[TokenName] = curToken // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
//console.log(res);
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code === 401){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err',error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "网络异常或接口错误,请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* request请求,可以自定义参数
|
||||
*/
|
||||
const request=formRequest.request;
|
||||
|
||||
/**
|
||||
* get请求 ,只有url
|
||||
*/
|
||||
const get = function(baseURL,url){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'get',
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求
|
||||
* @param {Object} url
|
||||
* @param {Object} postData
|
||||
*/
|
||||
const post=function(baseURL,url,postData){
|
||||
if(postData){
|
||||
postData=qs.stringify(postData);
|
||||
}
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
//post请求
|
||||
const postForm=function(baseURL,url,data){
|
||||
return request({
|
||||
baseURL,
|
||||
url,
|
||||
data,
|
||||
method: 'post',
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
});
|
||||
}
|
||||
// const postJson=jsonRequest.post;
|
||||
|
||||
const postJson=function(baseURL,url,postData){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/json'},
|
||||
})
|
||||
}
|
||||
|
||||
// 导出文件请求定义
|
||||
const postJsonToFile=function(baseURL,url,postData){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* put请求
|
||||
*/
|
||||
const put=function(baseURL,url,data){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data:data,
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
|
||||
const putJson=function(baseURL,url,data){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data:data,
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
tokenName:TokenName,
|
||||
request,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
postJsonToFile,
|
||||
put,
|
||||
putJson,
|
||||
}
|
||||
@@ -111,7 +111,7 @@
|
||||
<div v-show="content.contentType==41">
|
||||
<div style="display: flex;justify-content:space-between">
|
||||
<div>
|
||||
<el-input maxlength="50" @change="updateName" v-model="content.contentName" placeholder="内容的名称(限50字以内)"></el-input>
|
||||
<el-input maxlength="50" @change="updateName" v-model="content.contentName" placeholder="内容的名称(限20字以内)"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" @click="saveData()" >保存</el-button>
|
||||
|
||||
@@ -128,6 +128,15 @@
|
||||
return false;
|
||||
}
|
||||
});
|
||||
this.findCourseFile();
|
||||
},
|
||||
watch:{
|
||||
resType(newVal,oldVal){
|
||||
if(newVal!=oldVal){
|
||||
this.findCourseFile();
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
handleBeforeUpload(file) {
|
||||
|
||||
@@ -606,32 +606,32 @@ export default {
|
||||
}),
|
||||
loadUserGroup(){
|
||||
let $this=this;
|
||||
apiUserGroup.findByName('').then(rs=>{
|
||||
if(rs.status==200){
|
||||
let crowdList=[];
|
||||
rs.result.forEach(item=>{
|
||||
crowdList.push({
|
||||
id:item.key,
|
||||
name:item.value,
|
||||
disabled:false
|
||||
})
|
||||
})
|
||||
this.userGroupList=crowdList;
|
||||
}
|
||||
});
|
||||
// apiUserBasic.getUserCrowds().then(rs=>{
|
||||
// if(rs.status==200){
|
||||
// let crowdList=[];
|
||||
// rs.result.forEach(item=>{
|
||||
// crowdList.push({
|
||||
// id:item.kid,
|
||||
// name:item.audienceName,
|
||||
// apiUserGroup.findByName('').then(rs=>{
|
||||
// if(rs.status==200){
|
||||
// let crowdList=[];
|
||||
// rs.result.forEach(item=>{
|
||||
// crowdList.push({
|
||||
// id:item.key,
|
||||
// name:item.value,
|
||||
// disabled:false
|
||||
// })
|
||||
// });
|
||||
// this.userGroupList=crowdList;
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// this.userGroupList=crowdList;
|
||||
// }
|
||||
// });
|
||||
apiUserBasic.getUserCrowds().then(rs=>{
|
||||
if(rs.status==200){
|
||||
let crowdList=[];
|
||||
rs.result.forEach(item=>{
|
||||
crowdList.push({
|
||||
id:item.id,
|
||||
name:item.audienceName,
|
||||
disabled:false
|
||||
})
|
||||
});
|
||||
this.userGroupList=crowdList;
|
||||
}
|
||||
})
|
||||
},
|
||||
resOwnerName(code) {
|
||||
if (code == '') {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
<!--内容区-->
|
||||
<div style="margin-top: 10px;">
|
||||
<div v-if="cware.content.contentType<51 && cware.content.contentType!=41 && !cware.findShow">
|
||||
<div v-if="cware.content.contentType<51 && cware.content.contentType!=41 && !cware.findShow">
|
||||
<div v-if="cware.content.contentRefId==''">
|
||||
<div style="padding-top: 0px;">
|
||||
<!-- <div> -->
|
||||
|
||||
@@ -104,10 +104,12 @@ export const iframes=[
|
||||
{title:'课件管理', path:'/iframe/course/coursewares',hidden:false,component:'course/Courseware'},
|
||||
{title:'课程管理', path:'/iframe/course/manages',hidden:false,component:'course/ManageList'},
|
||||
{title:'考试试题管理', path:'/iframe/exam/questions',hidden:false,component:'exam/Question'},
|
||||
{title:'查看答卷', path:'/iframe/exam/viewanswer',hidden:false,component:'exam/viewAnswer'},
|
||||
{title:'考试试卷管理', path:'/iframe/exam/papers',hidden:false,component:'exam/TestPaper'},
|
||||
{title:'考试管理', path:'/iframe/exam/tests',hidden:false,component:'exam/ExamList'},
|
||||
{title:'案例管理', path:'/iframe/cases/manages',hidden:false,component:'case/ManageList'},
|
||||
{title:'文章管理', path:'/iframe/article/manages',hidden:false,component:'article/ManageList'},
|
||||
{title:'受众管理', path:'/iframe/ugroup/manages',hidden:false,component:'manage/UserGroupList'},
|
||||
{title:'问答管理', path:'/iframe/qa/manages',hidden:false,component:'qa/ManageList'},
|
||||
{title:'待审核课程', path:'/iframe/course/noapproved',hidden:false,component:'examine/NotApproved'},
|
||||
{title:'已审核课程', path:'/iframe/course/reviewed',hidden:false,component:'examine/Reviewed'}
|
||||
|
||||
@@ -73,6 +73,11 @@
|
||||
<div style="margin-right:30px;">
|
||||
<el-table style="margin:10px 32px 10px 22px;" :data="pageData" border stripe>
|
||||
<el-table-column label="序号" type="index" width="50"></el-table-column>
|
||||
<el-table-column v-if="forChoose" label="选择" width="60">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="default" size="mini" @click="handleChoose(scope.row)">选择</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" prop="name" width="200" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span class="previewStyle" @click="viewTopic(scope.row)">{{ scope.row.name }}</span>
|
||||
@@ -292,6 +297,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
forChoose:false,
|
||||
showDetails: false,
|
||||
examin:{
|
||||
detailType: '',
|
||||
@@ -370,6 +376,10 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
let chooseFlag=this.$route.query.f;
|
||||
if(chooseFlag && chooseFlag=='choose'){
|
||||
this.forChoose=true;
|
||||
}
|
||||
if (this.$route.query && this.$route.query.open && this.$route.query.open == 'new') {
|
||||
this.addNewCourse();
|
||||
}
|
||||
@@ -388,6 +398,9 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleChoose(row){ //选择课程
|
||||
window.parent.selectCourse(row);
|
||||
},
|
||||
myCopy(){
|
||||
var ele = document.getElementById("text");
|
||||
ele.select();
|
||||
@@ -607,7 +620,7 @@ export default {
|
||||
return this.$message.error(rs.message);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
viewTopic(row) {
|
||||
if(row.status == 1) {
|
||||
|
||||
@@ -547,11 +547,15 @@
|
||||
custom-class="g-dialog">
|
||||
<div style="padding: 10px; font-size: 20px" class="upaper">
|
||||
<div v-for="(ditem,didx) in answerData.paperDetail" :key="didx" class="upaper-item">
|
||||
<div class="upaper-item-q">{{didx +1}}.【{{getTypeName(ditem.type)}}】{{ditem.title}}</div>
|
||||
<div class="upaper-item-q">
|
||||
<div> {{didx +1}}.【{{getTypeName(ditem.type)}}】{{ditem.title}}</div>
|
||||
<div v-if="ditem.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+ditem.images"/> </div>
|
||||
</div>
|
||||
<div class="upaper-item-opts" style="padding-left: 20px;">
|
||||
<div v-for="(opt,optIdx) in ditem.optionList" :key="optIdx" class="upaper-item-opt" :class="{'upaper-item-opt-user':ditem.userOptIdxs.indexOf(optIdx)>-1}">
|
||||
<div>
|
||||
<div>{{toLetter(optIdx+1)}}, {{opt.content}}</div>
|
||||
<div>{{toLetter(optIdx+1)}}, {{opt.content}}</div>
|
||||
<div v-if="opt.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+opt.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="ditem.userOptIdxs.indexOf(optIdx)>-1 && ditem.correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00;font-size: 25px; ">√</span>
|
||||
@@ -687,6 +691,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
swichpublished:false,
|
||||
imageBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||
toScoreTow,
|
||||
qnum:0,//这里默认是30吧
|
||||
examDateTime:[],
|
||||
@@ -856,34 +861,34 @@ export default {
|
||||
this.pushLoading=false;
|
||||
},
|
||||
getUserGroup(){
|
||||
let params = {
|
||||
status:'1',
|
||||
name:this.pushData.keyword,
|
||||
pageIndex:this.pushData.pageIndex,
|
||||
pageSize:this.pushData.pageSize
|
||||
}
|
||||
usergroupApi.list(params).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.pushData.data = res.result.list;
|
||||
this.pushData.count = res.result.count;
|
||||
}
|
||||
});
|
||||
// let params = {
|
||||
// status:'1',
|
||||
// name:this.pushData.keyword,
|
||||
// pageIndex:this.pushData.pageIndex,
|
||||
// pageSize:this.pushData.pageSize
|
||||
// }
|
||||
// usergroupApi.list(params).then((res) => {
|
||||
// if (res.status == 200) {
|
||||
// this.pushData.data = res.result.list;
|
||||
// this.pushData.count = res.result.count;
|
||||
// }
|
||||
// });
|
||||
//从接口中获取受众数据,22/11/28
|
||||
// apiUserBasic.getUserCrowds().then(res=>{
|
||||
// if(res.status==200){
|
||||
// let list=[];
|
||||
// res.result.forEach(crowd=>{
|
||||
// list.push({
|
||||
// id:crowd.id,
|
||||
// kid:crowd.kid,
|
||||
// name:crowd.audienceName,
|
||||
// audienceType:crowd.audienceType,
|
||||
// type:crowd.type
|
||||
// })
|
||||
// });
|
||||
// this.pushData.data=list
|
||||
// }
|
||||
// })
|
||||
apiUserBasic.getUserCrowds().then(res=>{
|
||||
if(res.status==200){
|
||||
let list=[];
|
||||
res.result.forEach(crowd=>{
|
||||
list.push({
|
||||
id:crowd.id,
|
||||
kid:crowd.kid,
|
||||
name:crowd.audienceName,
|
||||
audienceType:crowd.audienceType,
|
||||
type:crowd.type
|
||||
})
|
||||
});
|
||||
this.pushData.data=list
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
getFindPage(){// 考试推送记录
|
||||
|
||||
@@ -626,7 +626,7 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log('实际得分:'+total)
|
||||
//console.log('实际得分:'+total)
|
||||
return total;
|
||||
},
|
||||
reStartTest(row){ //继续考试
|
||||
|
||||
277
src/views/exam/viewAnswer.vue
Normal file
277
src/views/exam/viewAnswer.vue
Normal file
@@ -0,0 +1,277 @@
|
||||
<template>
|
||||
<!--查看答卷-->
|
||||
<div>
|
||||
<div style="padding: 10px; font-size: 20px" class="upaper">
|
||||
<div v-for="(ditem,didx) in answerData.paperDetail" :key="didx" class="upaper-item">
|
||||
<div class="upaper-item-q">
|
||||
<div> {{didx +1}}.【{{getTypeName(ditem.type)}}】{{ditem.title}}</div>
|
||||
<div v-if="ditem.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+ditem.images"/> </div>
|
||||
</div>
|
||||
<div class="upaper-item-opts" style="padding-left: 20px;">
|
||||
<div v-for="(opt,optIdx) in ditem.optionList" :key="optIdx" class="upaper-item-opt" :class="{'upaper-item-opt-user':ditem.userOptIdxs.indexOf(optIdx)>-1}">
|
||||
<div>
|
||||
<div>{{toLetter(optIdx+1)}}, {{opt.content}}</div>
|
||||
<div v-if="opt.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+opt.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="ditem.userOptIdxs.indexOf(optIdx)>-1 && ditem.correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00;font-size: 25px; ">√</span>
|
||||
<span v-if="ditem.userOptIdxs.indexOf(optIdx)>-1 && ditem.correctOptIdxs.indexOf(optIdx)==-1" style="color: #ff0000;font-size: 25px; ">×</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upaper-item-answer" style="display: flex;">
|
||||
<div class="upaper-item-answer-cell">
|
||||
<span v-if="ditem.result" style="color: #00aa00; ">回答正确</span>
|
||||
<span v-else style="color: #ff0000; ">回答错误</span>
|
||||
</div>
|
||||
<div v-if="ditem.type !=3" style="display:flex">
|
||||
<div class="upaper-item-answer-cell" >
|
||||
<span class="response-tit">正确答案:</span>
|
||||
<span v-for="op in ditem.correctOptIdxs" :key="op">{{toLetter(op+1)}}</span>
|
||||
</div>
|
||||
<div class="upaper-item-answer-cell">
|
||||
<span class="response-tit">我的答案:</span>
|
||||
<span v-for="op in ditem.userOptIdxs" :key="op">{{toLetter(op+1)}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="display:flex"><!--判断题的问题-->
|
||||
<div class="upaper-item-answer-cell" >
|
||||
<span class="response-tit">正确答案:</span>
|
||||
<span>{{ditem.correctOptIdxs[0]=='true' ? '正确':'错误'}}</span>
|
||||
</div>
|
||||
<div class="upaper-item-answer-cell">
|
||||
<span class="response-tit">我的答案:</span>
|
||||
<span>{{ditem.userOptIdxs[0]=='' ? '': ditem.userOptIdxs[0]=='true'? '正确':'错误'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style="padding-top: 15px;font-size:16px">解析:{{ditem.analysis}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiTest from '@/api/modules/test.js'
|
||||
import apiPaper from '@/api/modules/paper.js';
|
||||
import apiTestPaper from '@/api/modules/testPaper.js'
|
||||
import {examType,numberToLetter} from '@/utils/tools.js';
|
||||
import {toScoreTow} from '@/utils/tools.js'
|
||||
import editPaper from "@/components/Exam/EditPaper";
|
||||
export default {
|
||||
name: 'articleItems',
|
||||
components:{editPaper},
|
||||
computed: {},
|
||||
data() {
|
||||
return {
|
||||
id:'',
|
||||
imageBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||
toLetter:numberToLetter,
|
||||
getTypeName:examType,
|
||||
answerData:{
|
||||
paperDetail:[],
|
||||
word: '',
|
||||
row:{},
|
||||
pageSize:10,
|
||||
pageIndex:1,
|
||||
count:0,
|
||||
data:[],
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.id=this.$route.query.id;
|
||||
if(this.id){
|
||||
this.loadData();
|
||||
}else{
|
||||
this.$message({ message: "参数错误", type: 'error'})
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
loadData(){
|
||||
apiTestPaper.getAnswerDetail(this.id).then(res=>{
|
||||
if(res.status === 200) {
|
||||
let answerJson = JSON.parse(res.result.answerJson);
|
||||
let paperJson = JSON.parse(res.result.paperJson);
|
||||
let answer = [];
|
||||
for(let key in answerJson){
|
||||
answer.push(key);
|
||||
paperJson.forEach((item,index) => {
|
||||
if(item.id == key) {
|
||||
if(item.type==1){
|
||||
item.userAnswer='';
|
||||
}else if(item.type==2){
|
||||
item.userAnswer=[];
|
||||
}else{
|
||||
item.userAnswer=''
|
||||
}
|
||||
item.correctOptIdxs=[];
|
||||
item.userOptIdxs=[];
|
||||
if(item.type==1){
|
||||
item.userAnswer=answerJson[key];
|
||||
}else if(item.type==2){
|
||||
item.userAnswer.push(...answerJson[key].split(','));
|
||||
}else{
|
||||
item.userAnswer=answerJson[key]
|
||||
}
|
||||
}
|
||||
item.result=true;
|
||||
});
|
||||
}
|
||||
this.answerData.paperDetail = paperJson;
|
||||
this.answerData.paperDetail.forEach((item,index)=>{
|
||||
if(item.type ==3) {
|
||||
item.correctOptIdxs.push(item.answer);
|
||||
item.userOptIdxs.push(item.userAnswer);
|
||||
}
|
||||
item.optionList.forEach((opt,idx)=>{
|
||||
//填充正确答案
|
||||
if(opt.isAnswer){
|
||||
item.correctOptIdxs.push(idx);
|
||||
}
|
||||
if(item.type==1){ //单选或判断
|
||||
if(opt.id==item.userAnswer){
|
||||
item.userOptIdxs.push(idx);
|
||||
}
|
||||
}else if(item.type==2){ //多选
|
||||
if(item.userAnswer.indexOf(opt.id)>-1){
|
||||
item.userOptIdxs.push(idx);
|
||||
}
|
||||
}
|
||||
});
|
||||
//判断答案是否正确
|
||||
if(item.correctOptIdxs.toString()==item.userOptIdxs.toString()){
|
||||
item.result=true;
|
||||
}else{
|
||||
item.result=false;
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.qimg{
|
||||
padding-left: 30px;
|
||||
width:100%;
|
||||
.qimg-fit{
|
||||
width:100%;
|
||||
object-fit:scale-down
|
||||
}
|
||||
}
|
||||
.upaper{
|
||||
text-align: left;
|
||||
.upaper-item{
|
||||
border-bottom: 1px solid #dadada;
|
||||
padding: 10px;
|
||||
.upaper-item-q{
|
||||
padding: 8px 0px;
|
||||
}
|
||||
.upaper-item-opts{
|
||||
padding: 8px 0px;
|
||||
line-height: 20px;
|
||||
.upaper-item-opt{
|
||||
min-height: 50px;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
background-color: #FFFFFF;
|
||||
justify-content: space-between;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
.upaper-item-opt-user{
|
||||
background-color: #fff3e5;
|
||||
}
|
||||
}
|
||||
.upaper-item-answer{
|
||||
display: flex;
|
||||
.upaper-item-answer-cell{
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-aside {
|
||||
padding: 0px 2px 10px 0px;
|
||||
|
||||
}
|
||||
.el-main {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
.article-status1 {
|
||||
padding: 3px;
|
||||
border: 1px dotted #1ea0fa;
|
||||
color: #1ea0fa;
|
||||
}
|
||||
.article-status2 {
|
||||
padding: 3px;
|
||||
border: 1px dotted #00aa00;
|
||||
color: #00aa00;
|
||||
}
|
||||
.article-status3 {
|
||||
padding: 3px;
|
||||
border: 1px dotted #ff0000;
|
||||
color: #ff0000;
|
||||
}
|
||||
.article-list {
|
||||
margin: 5px 0;
|
||||
border: 1px solid #dddddd;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.article-info {
|
||||
.article-info-title {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
.article-info-date {
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
float: right;
|
||||
font-weight: 200;
|
||||
color: #999999;
|
||||
i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.article-info-summary {
|
||||
height: 65px;
|
||||
color: #999999;
|
||||
}
|
||||
.article-info-tools {
|
||||
height: 30px;
|
||||
.article-info-tools-auth {
|
||||
float: left;
|
||||
font-size: 13px;
|
||||
color: #999999;
|
||||
img {
|
||||
margin-right: 10px;
|
||||
width: 30px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.article-info-tools-btns {
|
||||
float: right;
|
||||
.article-info-tools-btn {
|
||||
margin: 0 0 0 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.case-row-btn {
|
||||
line-height: 25px;
|
||||
|
||||
button {
|
||||
height: 20px;
|
||||
padding: 3px 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<el-table ref="multipleTable" :data="tableDataShow" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" align="center" width="55"> </el-table-column>
|
||||
<el-table-column label="姓名" prop="name" align="center" ></el-table-column>
|
||||
<el-table-column label="姓名" prop="realName" align="center" ></el-table-column>
|
||||
<el-table-column prop="userNo" label="工号" align="center"></el-table-column>
|
||||
<el-table-column prop="departName" label="部门" align="center"></el-table-column>
|
||||
<!-- <el-table-column prop="position" label="岗位" align="center"></el-table-column> -->
|
||||
@@ -46,13 +46,13 @@
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<div class="action">
|
||||
<el-input clearable style="width: 30%;margin-left: 10px;" v-model="userQueryForm.keyWord" placeholder="请输入姓名或工号"></el-input>
|
||||
<el-input clearable style="width: 30%;margin-left: 10px;" v-model="userQueryForm.keyword" placeholder="请输入姓名或工号"></el-input>
|
||||
<el-button type="primary" size="medium" @click="queryUserData">搜索</el-button>
|
||||
<el-button type="primary" class="findBtn" size="medium" @click="reset">重置</el-button>
|
||||
</div>
|
||||
<el-table ref="userTable" :data="userData" v-loading="userDataLoading" tooltip-effect="dark" @selection-change="userSelectionChange">
|
||||
<el-table-column type="selection" align="center" width="55"></el-table-column>
|
||||
<el-table-column label="姓名" prop="name" align="center"></el-table-column>
|
||||
<el-table-column label="姓名" prop="realName" align="center"></el-table-column>
|
||||
<el-table-column prop="userNo" label="工号" align="center"></el-table-column>
|
||||
<el-table-column prop="departName" label="部门" align="center"></el-table-column>
|
||||
<!-- <el-table-column prop="duty" label="岗位" align="center"></el-table-column> -->
|
||||
@@ -72,7 +72,7 @@
|
||||
<div style="padding: 10px 0px;color: #009ae7; ">注:单个导入文件受众成员请勿超过5000条记录,以员工号为准。必须是本系统人员</div>
|
||||
<el-row type="flex" align="middle" justify="start" style="margin-bottom: 10px;">
|
||||
文件名称:<el-input style="width: 200px;" disabled v-model="selectFile"></el-input>
|
||||
<el-upload
|
||||
<!-- <el-upload
|
||||
class="upload-demo"
|
||||
ref="upload"
|
||||
action="/systemapi/xboe/usergroup/import"
|
||||
@@ -86,15 +86,30 @@
|
||||
:file-list="fileList"
|
||||
:show-file-list="false"
|
||||
:auto-upload="false"
|
||||
>
|
||||
> -->
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
ref="upload"
|
||||
:action="importUrl"
|
||||
:headers="{'token':token}"
|
||||
accept=".xlsx"
|
||||
name="userExcel"
|
||||
:on-change="selectFileFun"
|
||||
:limit="1"
|
||||
:on-exceed="uploadExceed"
|
||||
:on-success="uploadSuccess"
|
||||
:file-list="fileList"
|
||||
:show-file-list="false"
|
||||
:auto-upload="false"
|
||||
>
|
||||
<el-button slot="trigger" style="margin-left: 10px;" size="small" type="primary">选择</el-button>
|
||||
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传</el-button>
|
||||
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">{{uploadBtnValue}}</el-button>
|
||||
</el-upload>
|
||||
<el-link style="margin-left:auto" @click="downloadTemplate">下载模板文件</el-link>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-table ref="userTable" :max-height="500" :min-height="200" :data="importUserData" tooltip-effect="dark" style="width: 100%;">
|
||||
<el-table-column label="姓名" prop="name" align="center" ></el-table-column>
|
||||
<el-table-column label="姓名" prop="realName" align="center" ></el-table-column>
|
||||
<el-table-column prop="userNo" label="工号" align="center" ></el-table-column>
|
||||
<el-table-column label="检查结果" align="center" >
|
||||
<template slot-scope="scope">
|
||||
@@ -106,7 +121,8 @@
|
||||
<!-- <el-table-column prop="departName" label="部门" align="center" ></el-table-column>
|
||||
<el-table-column prop="duty" label="岗位" align="center"></el-table-column> -->
|
||||
</el-table>
|
||||
<div v-if="importRepeatUsers" style="color: red;padding: 10px 0px;">重复的工号:{{importRepeatUsers}}</div>
|
||||
<div v-if="importResultStatus == false" style="color: red;padding: 10px 0px;">{{importRepeatUsers}}</div>
|
||||
<div v-if="importResultStatus" style="color: green;padding: 10px 0px;">{{importRepeatUsers}}</div>
|
||||
</el-row>
|
||||
<template #footer>
|
||||
<el-button @click="importUserShow = false">取 消</el-button>
|
||||
@@ -122,6 +138,7 @@
|
||||
import userApi from "@/api/system/user";
|
||||
import orgApi from "@/api/system/organiza";
|
||||
import apiUserBasic from "@/api/boe/userbasic";
|
||||
import apiAudience from "@/api/boe/audience.js";
|
||||
export default{
|
||||
data(){
|
||||
return{
|
||||
@@ -133,6 +150,9 @@
|
||||
description:'',
|
||||
userGroupItems:[]
|
||||
},
|
||||
uploadBtnValue:'上传',
|
||||
isUpdate:false,
|
||||
importUrl:process.env.VUE_APP_AUDIENCE_IMPORT_URL,
|
||||
searchValue:'',
|
||||
tableData:[],
|
||||
tableDataShow:[],
|
||||
@@ -149,7 +169,7 @@
|
||||
label: 'name'
|
||||
},
|
||||
userData:[],
|
||||
userQueryForm:{keyWord:'',departId:''},
|
||||
userQueryForm:{keyword:'',departId:''},
|
||||
userDataLoading:false,
|
||||
userDataPage:{
|
||||
total:0,
|
||||
@@ -159,6 +179,7 @@
|
||||
importUserShow:false,
|
||||
importUserData:[],
|
||||
importRepeatUsers:'',
|
||||
importResultStatus: false, // false: 导入失败;true: 导入成功
|
||||
selectFile:'',
|
||||
fileList:[],
|
||||
}
|
||||
@@ -166,14 +187,23 @@
|
||||
mounted() {
|
||||
let that = this;
|
||||
if (that.$route.query.id) {
|
||||
usergroupApi.detail(that.$route.query.id).then((res) => {
|
||||
if (res.status == 200) {
|
||||
that.form = res.result;
|
||||
// that.oldUserGroupItems = JSON.parse(JSON.stringify( res.result.userGroupItems ));
|
||||
that.tableData = res.result.userGroupItems;
|
||||
that.queryTableData();
|
||||
}
|
||||
let req = {audienceId:that.$route.query.id}
|
||||
this.isUpdate = true;
|
||||
apiAudience.detail(req).then((res) => {
|
||||
if (res.status == 200) {
|
||||
that.form = res.result;
|
||||
that.tableData = res.result.memberList;
|
||||
that.queryTableData();
|
||||
}
|
||||
});
|
||||
// usergroupApi.detail(that.$route.query.id).then((res) => {
|
||||
// if (res.status == 200) {
|
||||
// that.form = res.result;
|
||||
// // that.oldUserGroupItems = JSON.parse(JSON.stringify( res.result.userGroupItems ));
|
||||
// that.tableData = res.result.userGroupItems;
|
||||
// that.queryTableData();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
@@ -200,7 +230,7 @@
|
||||
});
|
||||
}else{
|
||||
parentId = node.data.id;
|
||||
|
||||
|
||||
apiUserBasic.getOrgInfo(parentId).then(rs=>{
|
||||
if(rs.status==200){
|
||||
let treeList=[];
|
||||
@@ -228,7 +258,7 @@
|
||||
},
|
||||
openDialog(){
|
||||
this.addUserShow = true;
|
||||
this.userQueryForm.keyWord = '';
|
||||
this.userQueryForm.keyword = '';
|
||||
this.userQueryForm.departId = '';
|
||||
// orgApi.treeList({}).then(res => {
|
||||
// if (res.status == 200) {
|
||||
@@ -237,9 +267,10 @@
|
||||
// });
|
||||
//默认不查询
|
||||
//this.loadUserData(this.userDataPage);
|
||||
this.queryUserData();
|
||||
},
|
||||
reset() {
|
||||
this.userQueryForm.keyWord = '';
|
||||
this.userQueryForm.keyword = '';
|
||||
this.userQueryForm.departId = '';
|
||||
this.userDataPage.pageIndex = 1;
|
||||
this.loadUserData(this.userDataPage, this.userQueryForm);
|
||||
@@ -247,6 +278,8 @@
|
||||
userSelectionChange(val) {
|
||||
this.userSelection = val;
|
||||
},
|
||||
|
||||
//搜索员工事件
|
||||
queryUserData(){
|
||||
this.userDataPage.pageIndex = 1;
|
||||
this.loadUserData(this.userDataPage, this.userQueryForm);
|
||||
@@ -255,13 +288,30 @@
|
||||
this.userDataLoading = true;
|
||||
params.pageIndex = page.pageIndex;
|
||||
params.pageSize = page.pageSize;
|
||||
userApi.list(Object.assign(params, this.userQueryForm)).then(res => {
|
||||
|
||||
let req = {
|
||||
page:page.pageIndex,
|
||||
pageSize:page.pageSize,
|
||||
keyword:this.userQueryForm.keyword,
|
||||
departId:this.userQueryForm.departId
|
||||
}
|
||||
apiAudience.userList(req).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.userData = res.result.list;
|
||||
this.userDataPage.total = res.result.count;
|
||||
console.log("搜索用户信息");
|
||||
console.log(res);
|
||||
this.userData = res.result.userInfoList;
|
||||
this.userDataPage.total = res.result.totalPage;
|
||||
this.userDataLoading = false;
|
||||
}
|
||||
})
|
||||
|
||||
// userApi.list(Object.assign(params, this.userQueryForm)).then(res => {
|
||||
// if (res.status == 200) {
|
||||
// this.userData = res.result.list;
|
||||
// this.userDataPage.total = res.result.count;
|
||||
// this.userDataLoading = false;
|
||||
// }
|
||||
// })
|
||||
},
|
||||
userDataCurrentChange(pageIndex){
|
||||
this.userDataPage.pageIndex = pageIndex;
|
||||
@@ -279,7 +329,7 @@
|
||||
for(let i = 0; i < this.userSelection.length; i++){
|
||||
let isAdd = true;
|
||||
for(let j = 0; j < this.tableData.length; j++){
|
||||
if(this.userSelection[i].id == this.tableData[j].aid){
|
||||
if(this.userSelection[i].id == this.tableData[j].id){
|
||||
isAdd = false;
|
||||
break;
|
||||
}
|
||||
@@ -287,12 +337,15 @@
|
||||
if(isAdd){
|
||||
let userItem = {}
|
||||
userItem.aid = this.userSelection[i].id;
|
||||
userItem.name = this.userSelection[i].name;
|
||||
userItem.id = this.userSelection[i].id;
|
||||
userItem.realName = this.userSelection[i].realName;
|
||||
userItem.userNo = this.userSelection[i].userNo;
|
||||
userItem.departId = this.userSelection[i].departId;
|
||||
userItem.departName = this.userSelection[i].departName;
|
||||
userItem.position = this.userSelection[i].duty;
|
||||
this.tableData.push(userItem);
|
||||
console.log(111);
|
||||
console.log(this.tableData);
|
||||
}
|
||||
}
|
||||
this.queryTableData();
|
||||
@@ -320,8 +373,8 @@
|
||||
const array = [];
|
||||
for (let i = 0; i < tableDataTemp.length; i += 1) {
|
||||
let match = false;
|
||||
if(tableDataTemp[i]['name'] || tableDataTemp[i]['userNo']){
|
||||
match |= (tableDataTemp[i]['name'].includes(searchValue) || tableDataTemp[i]['userNo'].includes(searchValue));
|
||||
if(tableDataTemp[i]['realName'] || tableDataTemp[i]['userNo']){
|
||||
match |= (tableDataTemp[i]['realName'].includes(searchValue) || tableDataTemp[i]['userNo'].includes(searchValue));
|
||||
}
|
||||
if ( match ) {
|
||||
array.push({
|
||||
@@ -402,15 +455,21 @@
|
||||
this.$refs['upload'].handleStart(files[0]);//选择文件后的赋值方法
|
||||
},
|
||||
submitUpload(){
|
||||
if(this.selectFile){this.uploadBtnValue = '上传中';}
|
||||
this.$refs.upload.submit();
|
||||
},
|
||||
uploadSuccess(res){
|
||||
console.log(111);
|
||||
if(res.status == 200){
|
||||
this.importUserData = res.result;
|
||||
this.importResultStatus = true;
|
||||
this.importRepeatUsers=res.message;
|
||||
}else{
|
||||
this.importResultStatus = false;
|
||||
this.importRepeatUsers = "导入失败";
|
||||
this.$message({ type: "error", message: res.message ,offset:50});
|
||||
}
|
||||
this.uploadBtnValue = '上传';
|
||||
},
|
||||
addImportUserToForm(){
|
||||
if(this.importUserData.length == 0){
|
||||
@@ -424,15 +483,16 @@
|
||||
}
|
||||
let isAdd = true;
|
||||
for(let j = 0; j < this.tableData.length; j++){
|
||||
if(udata.id == this.tableData[j].aid){
|
||||
if(udata.id == this.tableData[j].id){
|
||||
isAdd = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isAdd){
|
||||
let userItem = {}
|
||||
userItem.aid = udata.id;
|
||||
userItem.name = udata.name;
|
||||
// userItem.aid = udata.id;
|
||||
userItem.id = udata.id;
|
||||
userItem.realName = udata.realName;
|
||||
userItem.userNo = udata.userNo;
|
||||
userItem.departId = udata.departId;
|
||||
userItem.departName = udata.departName;
|
||||
@@ -443,6 +503,8 @@
|
||||
this.queryTableData();
|
||||
this.importUserShow = false;
|
||||
},
|
||||
|
||||
// 保存、保存并发布事件
|
||||
saveBack(status){
|
||||
if(status === 1 || status === 0){
|
||||
this.form.status = status;
|
||||
@@ -455,33 +517,70 @@
|
||||
this.form.userGroupItems = [];
|
||||
if(this.tableData.length > 0){
|
||||
for(let i = 0; i < this.tableData.length; i++){
|
||||
this.form.userGroupItems.push({aid:this.tableData[i].aid});
|
||||
// this.form.userGroupItems.push({aid:this.tableData[i].aid});
|
||||
this.form.userGroupItems.push(this.tableData[i].id);
|
||||
}
|
||||
}
|
||||
if (this.form.id != null && this.form.id != "") {
|
||||
usergroupApi
|
||||
.update(this.form)
|
||||
.then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.$message({ type: "success", message: "修改成功",offset:50 });
|
||||
this.$router.push('/manage/ugroups');
|
||||
}
|
||||
})
|
||||
.catch((res) => {
|
||||
this.$message({ type: "error", message: res.message ,offset:50});
|
||||
});
|
||||
} else {
|
||||
usergroupApi
|
||||
.save(this.form)
|
||||
.then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.$message({ type: "success", message: "新增成功" ,offset:50});
|
||||
this.$router.push('/manage/ugroups');
|
||||
}
|
||||
})
|
||||
.catch((res) => {
|
||||
this.$message({ type: "error", message: res.message ,offset:50});
|
||||
});
|
||||
if (this.form.id != null && this.form.id != "") { // 修改受众
|
||||
let req = {
|
||||
audienceId:this.form.id,
|
||||
audienceName:this.form.name,
|
||||
description:this.form.description,
|
||||
type:this.form.gtype,
|
||||
status:this.form.status,
|
||||
memberIdList:this.form.userGroupItems
|
||||
}
|
||||
apiAudience.update(req).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.$message({ type: "success", message: "修改成功",offset:50 });
|
||||
this.$router.push('/manage/ugroups');
|
||||
}else{
|
||||
console.log("更新受众异常");
|
||||
}
|
||||
})
|
||||
|
||||
// usergroupApi
|
||||
// .update(this.form)
|
||||
// .then((res) => {
|
||||
// if (res.status == 200) {
|
||||
// this.$message({ type: "success", message: "修改成功",offset:50 });
|
||||
// this.$router.push('/manage/ugroups');
|
||||
// }
|
||||
// })
|
||||
// .catch((res) => {
|
||||
// this.$message({ type: "error", message: res.message ,offset:50});
|
||||
// });
|
||||
} else { // 新增受众
|
||||
|
||||
let req = {
|
||||
audienceId:this.form.id,
|
||||
audienceName:this.form.name,
|
||||
description:this.form.description,
|
||||
type:this.form.gtype,
|
||||
status:this.form.status,
|
||||
memberIdList:this.form.userGroupItems
|
||||
}
|
||||
apiAudience.update(req).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.$message({ type: "success", message: "新增成功",offset:50 });
|
||||
this.$router.push('/manage/ugroups');
|
||||
}else{
|
||||
console.log("新增受众异常");
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// usergroupApi
|
||||
// .save(this.form)
|
||||
// .then((res) => {
|
||||
// if (res.status == 200) {
|
||||
// this.$message({ type: "success", message: "新增成功" ,offset:50});
|
||||
// this.$router.push('/manage/ugroups');
|
||||
// }
|
||||
// })
|
||||
// .catch((res) => {
|
||||
// this.$message({ type: "error", message: res.message ,offset:50});
|
||||
// });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<div class="two_search">
|
||||
<el-select v-model="query.status" clearable placeholder="全部" style="margin-left: 10px;">
|
||||
<el-option label="未发布" value="0"></el-option>
|
||||
<el-option label="已发布" value="1"></el-option>
|
||||
<el-option label="已停用" value="2"></el-option>
|
||||
<el-option label="已停用" value="1"></el-option>
|
||||
<el-option label="已发布" value="2"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button type="primary" style="margin-left: 10px;" @click="queryData()" icon="el-icon-search">搜索</el-button>
|
||||
@@ -24,24 +24,25 @@
|
||||
<el-container style="margin-left:20px">
|
||||
<el-main >
|
||||
<el-table :data="tableData" border v-loading="loading" style="width: 100%">
|
||||
<el-table-column prop="name" label="名称" show-overflow-tooltip>
|
||||
<el-table-column prop="audienceName" label="名称" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span class="previewStyle" @click="viewDetail(scope.row)">{{scope.row.name}}</span>
|
||||
<span class="previewStyle" @click="viewDetail(scope.row)">{{scope.row.audienceName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sysCreateTime" label="创建日期" align="center" width="160px"></el-table-column>
|
||||
<el-table-column prop="users" label="人数" width="50px" align="center"></el-table-column>
|
||||
<el-table-column prop="createAt" label="创建日期" align="center" width="160px"></el-table-column>
|
||||
<el-table-column prop="totalMember" label="人数" width="50px" align="center"></el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="80px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.status == 1">已发布</span>
|
||||
<span v-if="scope.row.status == 0">未发布</span>
|
||||
<span v-if="scope.row.status == 1">已发布</span>
|
||||
<!-- <span v-if="scope.row.status == 1" style="color: #da0000;">已发布</span> -->
|
||||
<span v-if="scope.row.status == 2" style="color: #da0000;">已停用</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="gtype" label="类型" width="80px" align="center">
|
||||
<el-table-column prop="type" label="类型" width="80px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.gtype == 1">普通受众</span>
|
||||
<span v-if="scope.row.gtype == 2">自动受众</span>
|
||||
<span v-if="scope.row.type == 1">普通受众</span>
|
||||
<span v-if="scope.row.type == 2">自动受众</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200px" align="center">
|
||||
@@ -51,7 +52,7 @@
|
||||
<el-button type="text" v-if="scope.row.status == 0" @click="publish(1,scope.row)">发布</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 1" @click="publish(2,scope.row)">停用</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 2" @click="publish(1,scope.row)">启用</el-button>
|
||||
<el-button v-if="scope.row.deletable" type="text" @click="del(scope.row)">删除</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 0 || scope.row.status == 1" @click="deleteItem(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -60,7 +61,7 @@
|
||||
<el-form ref="copyForm" :rules="copyRules" :model="copyForm" label-width="100px">
|
||||
<el-form-item label="受众名称:" prop="name">
|
||||
<el-input
|
||||
v-model="copyForm.name"
|
||||
v-model="copyForm.audienceName"
|
||||
placeholder="请输入受众名称"
|
||||
maxlength="50"
|
||||
></el-input>
|
||||
@@ -102,6 +103,8 @@
|
||||
<script>
|
||||
import usergroupApi from "@/api/modules/usergroup";
|
||||
import apiDeleteCheck from "@/api/modules/course";
|
||||
import apiAudience from "@/api/boe/audience.js";
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -119,23 +122,25 @@
|
||||
// 表格数据
|
||||
tableData: [],
|
||||
copyUserGroupShow:false,
|
||||
copyRules:{ name: [{ required: true, message: "请输入名称", trigger: "blur" }]},
|
||||
copyForm:{name:'',id:''},
|
||||
copyRules:{ audienceName: [{ required: true, message: "请输入名称", trigger: "blur" }]},
|
||||
copyForm:{audienceName:'',audienceId:''},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadData(this.page,this.query);
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
methods: {
|
||||
reset(){
|
||||
this.page.pageIndex = 1;
|
||||
this.query.name = ''
|
||||
this.query.status = ''
|
||||
|
||||
this.loadData(this.page,this.query);
|
||||
},
|
||||
handleSizePushChange(val){
|
||||
|
||||
handleSizePushChange(val){
|
||||
this.page.pageSize = val
|
||||
this.page.pageIndex = 1
|
||||
this.loadData(this.page,this.query);
|
||||
@@ -169,28 +174,53 @@
|
||||
this.loadData(this.page, this.query);
|
||||
},
|
||||
loadData(page, params = {}){
|
||||
this.loading = true;
|
||||
|
||||
if(this.query.status == ''){this.query.status = null;}
|
||||
let req = {
|
||||
// ownerId:'965342027497607168', // 开发测试时使用
|
||||
ownerId:this.userInfo.aid, // 正式环境使用
|
||||
status:this.query.status,
|
||||
audienceName:params.name,
|
||||
page:page.pageIndex,
|
||||
pageSize:page.pageSize
|
||||
}
|
||||
params.pageIndex = page.pageIndex;
|
||||
params.pageSize = page.pageSize;
|
||||
usergroupApi.list(Object.assign(params, this.query)).then((res) => {
|
||||
if (res.status == 200) {
|
||||
const result = res.result;
|
||||
let ids=[];
|
||||
result.list.forEach(item=>{
|
||||
item.deletable=false;
|
||||
ids.push(item.id);
|
||||
})
|
||||
this.tableData = result.list;
|
||||
this.page.total = result.count;
|
||||
if(ids.length>0){
|
||||
this.checkAllowDelete(ids);
|
||||
this.loading = true;
|
||||
apiAudience.list(req).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.tableData = res.result.audienceList;
|
||||
this.page.total = res.result.totalElement;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.$message({ type: "error", message: "查询失败:"+res.message,offset:50});
|
||||
}
|
||||
this.loading = false;
|
||||
}else{
|
||||
this.$message({ type: "error", message: "查询失败:"+res.message,offset:50});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// this.loading = true;
|
||||
// params.pageIndex = page.pageIndex;
|
||||
// params.pageSize = page.pageSize;
|
||||
// usergroupApi.list(Object.assign(params, this.query)).then((res) => {
|
||||
// if (res.status == 200) {
|
||||
// const result = res.result;
|
||||
// let ids=[];
|
||||
// result.list.forEach(item=>{
|
||||
// item.deletable=false;
|
||||
// ids.push(item.id);
|
||||
// })
|
||||
// this.tableData = result.list;
|
||||
// this.page.total = result.count;
|
||||
// if(ids.length>0){
|
||||
// this.checkAllowDelete(ids);
|
||||
// }
|
||||
// this.loading = false;
|
||||
// }else{
|
||||
// this.$message({ type: "error", message: "查询失败:"+res.message,offset:50});
|
||||
// }
|
||||
// });
|
||||
},
|
||||
|
||||
checkAllowDelete(ids){
|
||||
if(ids.length==0){
|
||||
return;
|
||||
@@ -210,6 +240,24 @@
|
||||
this.page.pageIndex = pageIndex;
|
||||
this.loadData(this.page,this.query);
|
||||
},
|
||||
|
||||
// 删除受众
|
||||
deleteItem(row){
|
||||
this.$confirm('您确定要删除所选受众吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let req = {audienceId:row.id}
|
||||
apiAudience.delAudience(req).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.loadData(this.page,this.query);
|
||||
this.$message({ type: "success", message: "删除受众成功",offset:50});
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
del(row){
|
||||
this.$confirm('您确定要删除所选受众吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -231,19 +279,18 @@
|
||||
},
|
||||
publish(status,row){
|
||||
let opt = "发布";
|
||||
if(status === 0){
|
||||
opt = "取消发布";
|
||||
}else if(status === 1){
|
||||
opt="启用";
|
||||
}else if(status === 2){
|
||||
opt="停用";
|
||||
}
|
||||
if(row.status == 1){opt="停用";}
|
||||
if(row.status == 2){opt="启用";}
|
||||
this.$confirm('您确定要'+opt+'所选受众吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
usergroupApi.publish(status,row.id).then((res) => {
|
||||
let req = {
|
||||
audienceId:row.id,
|
||||
status:status
|
||||
}
|
||||
apiAudience.changeStatus(req).then((res) => {
|
||||
if (res.status == 200) {
|
||||
row.status=status;
|
||||
this.$message({ type: "success", message: opt+"受众成功",offset:50});
|
||||
@@ -253,17 +300,44 @@
|
||||
}).catch((res) => {
|
||||
this.$message({ type: "error", message: res.message ,offset:50});
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
// let opt = "发布";
|
||||
// if(status === 0){
|
||||
// opt = "取消发布";
|
||||
// }else if(status === 1){
|
||||
// opt="启用";
|
||||
// }else if(status === 2){
|
||||
// opt="停用";
|
||||
// }
|
||||
// this.$confirm('您确定要'+opt+'所选受众吗?', '删除提示', {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning'
|
||||
// }).then(() => {
|
||||
// usergroupApi.publish(status,row.id).then((res) => {
|
||||
// if (res.status == 200) {
|
||||
// row.status=status;
|
||||
// this.$message({ type: "success", message: opt+"受众成功",offset:50});
|
||||
// }else{
|
||||
// this.$message({ type: "error", message: res.message ,offset:50});
|
||||
// }
|
||||
// }).catch((res) => {
|
||||
// this.$message({ type: "error", message: res.message ,offset:50});
|
||||
// });
|
||||
// })
|
||||
},
|
||||
copyDialog(row){
|
||||
this.copyUserGroupShow = true;
|
||||
this.copyForm.id = row.id;
|
||||
this.copyForm.name = row.name;
|
||||
this.copyForm.audienceId = row.id;
|
||||
this.copyForm.audienceName = row.name;
|
||||
},
|
||||
copy(){
|
||||
this.$refs.copyForm.validate((valid) => {
|
||||
if (valid) {
|
||||
usergroupApi.copy(this.copyForm).then((res) => {
|
||||
apiAudience.copy(this.copyForm).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.$message({ type: "success", message: "复制受众成功" ,offset:50});
|
||||
this.loadData(this.page,this.query);
|
||||
|
||||
Reference in New Issue
Block a user