This commit is contained in:
NiSen
2023-06-20 21:31:24 +08:00
parent a15ec430c6
commit d94afe2958
5 changed files with 1001 additions and 141 deletions

26
.env
View File

@@ -2,25 +2,29 @@
VUE_APP_BASE=/manage VUE_APP_BASE=/manage
# api项目基础url # api项目基础url
VUE_APP_BASE_API=/manageApi VUE_APP_BASE_API=/manageApi
# systemApi
VUE_APP_NEW_API=/systemapi
#文件路径 #文件路径
VUE_APP_FILE_PATH=/upload/ VUE_APP_FILE_PATH=/upload/
# 代理url 本地调试,不可以用在其他地方 # 代理url 本地调试,不可以用在其他地方
VUE_APP_PROXY_URL=//43.143.139.204/manageApi VUE_APP_PROXY_URL=//43.143.139.204/manageApi
# 登录url # 登录url
VUE_APP_LOGIN_URL=//u-pre.boe.com/web?returnUrl= VUE_APP_LOGIN_URL=//pretest.zcwytd.com/web?returnUrl=
# boe域名 # boe域名
VUE_APP_BOE_API_URL=//u-pre.boe.com VUE_APP_BOE_API_URL=//pretest.zcwytd.com
#打包路径 #打包路径
VUE_APP_OUTPUT_DIR=./dist VUE_APP_OUTPUT_DIR=./dist
# iframe嵌套url # iframe嵌套url
VUE_APP_IFRAME_URL=//u-pre.boe.com/pc/iframe VUE_APP_IFRAME_URL=//pretest.zcwytd.com/pc/iframe
# 本地
# VUE_APP_IFRAME_URL=//localhost:1024/pc/iframe
# 学员端路由 # 学员端路由
VUE_APP_IFRAME_STUDENT_URL=//u-pre.boe.com/pc/loading VUE_APP_IFRAME_STUDENT_URL=//pretest.zcwytd.com/pc/loading
VUE_APP_IFRAME_TEACHER_URL=//u-pre.boe.com/pc/need/waitaudit VUE_APP_IFRAME_TEACHER_URL=//pretest.zcwytd.com/pc/need/waitaudit
# 课程二维码 # 课程二维码
VUE_APP_COURSE_STUDY=//u-pre.boe.com/pc/course/studyindex?id= VUE_APP_COURSE_STUDY=//pretest.zcwytd.com/pc/course/studyindex?id=
# 导入学员模板 # 导入学员模板
VUE_APP_UP_LOAD_STUDENT_TEMPLATE=导入学员模版-1673963663229.xlsx VUE_APP_UP_LOAD_STUDENT_TEMPLATE=导入学员模版-1673963663229.xlsx
@@ -28,16 +32,16 @@ VUE_APP_UP_LOAD_STUDENT_TEMPLATE=导入学员模版-1673963663229.xlsx
VUE_APP_UP_LOAD_STUDENT_SCORE_TEMPLATE=外部考试学员成绩导入模板-1676551319283.xlsx VUE_APP_UP_LOAD_STUDENT_SCORE_TEMPLATE=外部考试学员成绩导入模板-1676551319283.xlsx
#在线 #在线
VUE_APP_ONLINE_CLASS_URL=//u-pre.boe.com/mobile/pages/study/courseStudy?id= VUE_APP_ONLINE_CLASS_URL=//pretest.zcwytd.com/mobile/pages/study/courseStudy?id=
#案例 #案例
VITE_BOE_CASS_DETAIL_URL=//u-pre.boe.com/pc/case/detail?id= VITE_BOE_CASS_DETAIL_URL=//pretest.zcwytd.com/pc/case/detail?id=
#考试 #考试
VUE_APP_EXAM_DETAIL_URL=//u-pre.boe.com/mobile/pages/exam/exam?id= VUE_APP_EXAM_DETAIL_URL=//pretest.zcwytd.com/mobile/pages/exam/exam?id=
#h5的基本url #h5的基本url
VUE_APP_H5=//u-pre.boe.com/student-h5 VUE_APP_H5=//pretest.zcwytd.com/student-h5
#用户头像 #用户头像
VUE_APP_AVATAR_PATH=/upload/ VUE_APP_AVATAR_PATH=/upload/
# 旧版管理员界面 # 旧版管理员界面
VUE_APP_OLD_MANAGE=//u-pre.boe.com/resource/index.html VUE_APP_OLD_MANAGE=//pretest.zcwytd.com/resource/index.html
# 批量面授报名模板 # 批量面授报名模板
VUE_APP_FACE_STUDENT_TEMPLATE=批量面授报名模版-1673963663229.xlsx VUE_APP_FACE_STUDENT_TEMPLATE=批量面授报名模版-1673963663229.xlsx

12
src/api/case.js Normal file
View File

@@ -0,0 +1,12 @@
import http from "./configSys";
// 案例列表
const RECOMMEND_PAGE = "/systemapi/xboe/m/boe/cases/recommend/page post";
//下载失败数据
const downloadErrorData = (params = {}) => http.post("/xboe/m/boe/cases/recommend/launch", params);
export {
RECOMMEND_PAGE,
downloadErrorData
}

70
src/api/configSys.js Normal file
View File

@@ -0,0 +1,70 @@
import {message} from "ant-design-vue";
import axios from "axios";
import router from "@/router";
import Cookies from 'vue-cookies'
// import { getCookie } from '../api/method'
// const Qs = require("qs");
// axios.defaults.headers.post["Content-Type"] =
// "application/x-www-form-urlencoded";
// export const FILE_UPLOAD_URL = process.env.VUE_APP_BASE_API + '/file/upload'
// export const BATCH_IMPORT_SCORE = process.env.VUE_APP_BASE_API + '/admin/offcourse/batchImportScore'
axios.defaults.withCredentials = true;
const http = axios.create({
baseURL: process.env.VUE_APP_NEW_API,
timeout: 1000 * 15,
headers: {"Content-Type": "application/json",},
});
http.interceptors.request.use(
(config) => {
const token = Cookies.get("token")
if (token) {
config.headers.token = token; //测试1111
} else{
message.error('未获取到登录信息,请先登录')
}
return config;
},
(err) => {
console.log("登陆前拦截", err);
return Promise.reject(err);
}
);
http.interceptors.response.use(
(response) => {
// console.log('response', response)
const {
data: {code},
} = response;
if (code === 0 || code === 200) {
return response.data?response.data:response;
}
if(code==500){
return message.error('请求失败');
}
if(code==601){
message.error('token过期请重新登陆');
}
if (code === 1000) {
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: 'login'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL)
return Promise.reject(response);
}
// show && message.error(msg);
// console.log("api %o", msg);
// return Promise.reject(response);
return response
},
function (error) {
if (error.message == "timeout of 1ms exceeded") {
message.destroy();
message.error("请求超时");
}
console.log("api error %o", error);
return message.error(error.message);
}
);
export default http;

View File

@@ -0,0 +1,719 @@
<template>
<a-drawer class="recommend" :visible="visible" width="80%" :title="title" @close="closeDrawer" :maskClosable="false">
<!-- 搜索框及按钮 -->
<div class="filter">
<div class="filterItems">
<div class="select">
<a-input v-model:value="searchDataInfo.keyWord" style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入案例标题" />
</div>
<div class="select">
<a-input v-model:value="searchDataInfo.authorName" style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入作者名字" />
</div>
<div style="display: flex; margin-bottom: 20px">
<div class="btn btn1" @click="handleSearch(1)">
<div class="search"></div>
<div class="btnText">搜索</div>
</div>
<div class="btn btn1" @click="handleRest" style="width: 105px">
<div class="search"></div>
<div class="btnText">重置</div>
</div>
<div class="btn btn1" @click="handleImportInfo" style="width: 105px">
<div class=""></div>
<div class="btnText">导入</div>
</div>
</div>
</div>
<div class="btns">
<div class="btnText">已选择 <span style="color:#4ea6ff ;">{{ state.selectedRowKeys.length }}</span> 条案例</div>
</div>
</div>
<div style="display: flex; overflow-x: auto; overflow-y: auto;justify-content: space-between;">
<div class="tableBox" style="margin-top: 30px;min-height: 800px;overflow: hidden;">
<a-table style="border: 1px solid #f2f6fe;" :columns="state.columns" :data-source="state.dataSource"
:loading="!loading" :pagination="false" :row-selection="rowSelection">
</a-table>
</div>
<div class="right1" style="min-width: 200px">
<div class="onerow">
<div class="onleft">
<div class="already">已选</div>
</div>
</div>
<!-- <div :style="{ 'max-height': state.screenHeight - 235 + 'px' }" style="overflow-y: auto"> -->
<div style="overflow-y: auto">
<div class="selecteds">
<div v-for="(item, i) in state.projectSelectRows" :key="i">
<div v-if="i < 11">
<div class="chose">
{{ item.studentName }}
<div class="ch" @click="auditTableRef.remove(i)"></div>
</div>
</div>
<div v-else>
<div v-if="state.person">
<div class="chose">
{{ item.studentName }}
<div class="ch" @click="auditTableRef.remove(i)"></div>
</div>
</div>
</div>
</div>
<div v-if="!state.member && state.projectSelectRows?.length > 10" class="ifsw">
<div @click="state.member = !state.member" class="“sw”">查看更多></div>
</div>
<div v-if="state.member && state.projectSelectRows?.length > 10" class="ifsw">
<div @click="state.member = !state.member" class="sw">收起&lt;</div>
</div>
</div>
</div>
</div>
</div>
<div class="btnn">
<button class="btn2" @click="closeDrawer">取消</button>
<button class="btn2" @click="nextPage">下一步</button>
</div>
</a-drawer>
<!-- 导入的提示框 -->
<a-modal class="modal" v-model:visible="state.AMvisible" :closable="false" :maskClosable="false" ok-text="确定"
cancel-text="取消" @ok="hideModal" @cancel="closeModal">
<div class="importInfo" style="padding: 24px;">
<div class="imptHeader">
<span>导入</span>
<div class="defeat">
<div class="detext" @click="downloadEeeorData(1)">
下载导入模版
</div>
</div>
<div class="defeat">
<div class="detext" @click="downloadEeeorData(2)">
下载最新案例模版
</div>
</div>
</div>
<div class="upload">
<a-upload :file-list="state.fileList" :action="state.uploadAction" name="file" @change="handleChange"
:showUploadList="false" :multiple="false" :data="{
result: '123456'
}">
<a-button style="width: 150px;">
上传文件
</a-button>
</a-upload>
<span class="ant-upload-hint">支持文件格式.xls/.xlsx</span>
</div>
<div class="progress">
<div class="nameAndProgress" style="display: flex;justify-content: space-between;padding-right: 36px;">
<span>{{ state.fileName }}</span>
<span>上传完成</span>
</div>
<a-progress :percent="state.uploadpercent" status="active" />
</div>
<div class="importDetail" style="display: flex;flex-direction: column;">
<span>导入 1039 成功 1007 失败 <span style="color: red;">32</span> </span>
<div class="defeat">
<div class="detext" @click="downloadErrorInfo">
下载失败数据
</div>
</div>
</div>
</div>
</a-modal>
<!-- 下一步添加学员 -->
</template>
<script setup>
import { reactive, onMounted, ref, watch } from 'vue';
import { Form, message } from "ant-design-vue";
import axios from "axios";
import Cookies from "vue-cookies";
import { downloadErrorData } from '@/api/case'
defineProps({
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: '添加案例'
}
})
const emit = defineEmits(['update:visible'])
const state = reactive({
importId: '',//导入id
selectedRowKeys: [],
dataSource: [],
AMvisible: false,
imptProgress: false,
uploadpercent: -1,//导入进度
uploadErr: false, //上传失败
fileName: '',//下载的名字
uploadAction: process.env.VUE_APP_NEW_API + '/xboe/m/boe/cases/recommend/import',//下载地址
addLoading: false,
fileList: [],
nextPageShow: false,//下一步
person: false,
member: false,
projectSelectRows: [{
studentName: 'heihei',
title: '案例标题',
AuthorName: '作者名称'
}],
projectParams: {
pid: '', type: '', studentName: ""
},
screenHeight: document.body.clientHeight,
columns: [
{
title: "案例标题",
dataIndex: "title",
key: "title",
align: "left",
className: "h",
width: '80%',
ellipsis: true,
},
{
title: "作者名称",
dataIndex: "authorName",
key: "authorName",
width: '20%',
align: "center",
className: "h",
ellipsis: true,
}
]
})
const loading = ref(false)
// 查询数据
const searchDataInfo = reactive({
pageIndex: 1,
pageSize: 10,
keyWord: "",
authorName: ''
});
watch(() => state.dataSource, (newVal) => {
console.log(newVal);
}, {
deep: true,
})
// 请求列表数据是formdata类型的
const getTopList = () => {
loading.value = true;
axios({
method: "post",
url: "/systemapi/xboe/m/boe/cases/isTopList",
data: { ...searchDataInfo },
headers: {
token: Cookies.get("token"),
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then((res) => {
console.log(res);
state.dataSource = res?.data?.result?.list || []
}),
(err) => {
message.error(err);
loading.value = false;
};
}
// 获取列表数据
getTopList()
onMounted(() => {
// console.log(window.location.protocol);
})
// 全选
const rowSelection = {
onChange: (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
},
getCheckboxProps: record => ({
disabled: record.name === 'Disabled User',
// Column configuration not to be checked
name: record.name,
}),
};
// 搜索
const handleSearch = () => {
console.log(searchDataInfo);
getTopList()
}
//下载模版
const downloadErrorInfo = () => {
downloadErrorData({ importId: state.importId })
// apiCase.exportCasesInfo(type).then(res => {
// const link = document.createElement('a');// 创建a标签
// let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }); // 设置文件类型
// link.style.display = "none";
// link.href = URL.createObjectURL(blob); // 创建URL
// link.setAttribute("download", "案例.xls");
// document.body.appendChild(link);
// link.click();
// document.body.removeChild(link);
// })
}
// 下一步
const nextPage = () => {
state.nextPageShow = true
}
const { resetFields } = Form.useForm(searchDataInfo, {});
//重置
const handleRest = () => {
resetFields()
getTopList()
}
// 取消抽屉
const closeDrawer = () => {
emit('update:visible', false)
}
//导入按钮
const handleImportInfo = () => {
state.AMvisible = true
}
//model确定按钮
const hideModal = () => {
console.log('确定');
state.AMvisible = false
}
//改变
//上传文件
const handleChange = (info) => {
console.log("info", info);
state.imptProgress = true
if (info) {
var FileExt = info.file.name.replace(/.+\./, "");
if (["xls", "xlsx"].indexOf(FileExt.toLowerCase()) === -1) {
state.fileList = [];
state.uploadpercent = -1;
message.destroy();
message.error("请上传正确的文件格式");
return;
}
}
state.addLoading = true;
state.uploadErr = false;
state.uploadpercent = parseInt(info.file.percent);
console.log("我是文件上传的进度---------->", info.file.percent);
const status = info.file.status;
if (status !== "uploading") {
console.log(info.file, info.fileList);
}
if (status === "done") {
state.fileName = info.file.name;
let i = 0;
state.timers = setInterval(() => {
// let uid = info.file.response.data;
// caseImport(uid)
// .then((res) => {
// console.log("查询导入状态", res);
// if (res.data.code === 200) {
// if (res.data.data.status !== "START") {
// i++;
// if (i === 1) {
// message.destroy();
// message.success(`${info.file.name}上传成功`);
// state.showBottomBar = true;
// state.addLoading = false;
// state.isAddStudent = true;
// }
// state.succNum = res.data.data.successNum;
// state.errNum = res.data.data.failedNum;
// state.downloadErrUrl = res.data.data.url;
// clearInterval(state.timers);
// }
// }
// })
// .catch((err) => {
// clearInterval(state.timers);
// state.showBottomBar = true;
// state.addLoading = false;
// console.log("查询导入状态失败", err);
// });
}, 500);
} else if (status === "error") {
state.addLoading = false;
state.uploadErr = true;
message.error(`${info.file.name}上传失败`);
}
};
// 关闭modal弹窗
const closeModal = () => {
}
</script>
<style lang="scss" scoped>
//上传
.modal {
:global(.ant-modal-header) {
border: 0;
}
:global(.ant-modal-footer) {
border: 0;
}
.importInfo {
.imptHeader {
display: flex;
margin-bottom: 40px;
.defeat {
margin-left: 40px;
color: #0982ff;
text-decoration: underline;
cursor: pointer;
}
}
.upload {
display: flex;
align-items: center;
margin-bottom: 40px;
.ant-upload-hint {
margin-left: 20px;
}
}
.importDetail {
margin-top: 40px;
.defeat {
color: #0982ff;
text-decoration: underline;
cursor: pointer;
}
}
}
}
.recommend {
:global(.ant-drawer-header-title) {
flex-direction: row-reverse !important;
}
:global(.ant-drawer-close) {
margin-right: 0;
}
.btnn {
height: 72px;
width: 100%;
position: absolute;
background-color: #fff;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
.btn1 {
width: 100px;
height: 40px;
border: 1px solid #4ea6ff;
border-radius: 8px;
color: #4ea6ff;
background-color: #fff;
cursor: pointer;
}
.btn2 {
cursor: pointer;
width: 100px;
height: 40px;
background: #4ea6ff;
border-radius: 8px;
border: 0;
margin-left: 15px;
color: #fff;
}
}
// 头部
.filter {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.filterItems {
display: flex;
flex-wrap: wrap;
.select {
margin-right: 20px;
margin-bottom: 20px;
}
.btn {
padding: 0 26px 0 26px;
height: 38px;
background: #4ea6ff;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 14px;
flex-shrink: 0;
cursor: pointer;
.search {
background-size: 100%;
}
.btnText {
font-size: 14px;
font-weight: 400;
color: #ffffff;
line-height: 36px;
margin-left: 5px;
}
}
.btnn {
padding: 0 26px 0 26px;
height: 38px;
background: #4ea6ff;
border-radius: 8px;
border: 1px solid rgba(64, 158, 255, 1);
display: flex;
align-items: center;
justify-content: center;
margin-right: 14px;
flex-shrink: 0;
cursor: pointer;
.search {
background-size: 100%;
}
.btnText {
font-size: 14px;
font-weight: 400;
color: #fff;
line-height: 36px;
margin-left: 5px;
}
}
.btn1 {
.search {
width: 15px;
height: 17px;
background-image: url("../../assets/images/courseManage/search0.png");
}
}
.btn2 {
.search {
width: 16px;
height: 18px;
background-image: url("../../assets/images/courseManage/reset0.png");
}
}
.btn1:active {
background: #0982ff;
}
.btn2:active {
background: rgba(64, 158, 255, 0.2);
}
}
.btns {
display: flex;
.btn {
padding: 0 26px;
height: 38px;
background: #4ea6ff;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 14px;
flex-shrink: 0;
cursor: pointer;
.search {
background-size: 100%;
}
.btnText {
font-size: 14px;
font-weight: 400;
color: #ffffff;
line-height: 36px;
margin-left: 5px;
}
}
.btn3 {
margin-right: 0;
.search {
width: 17px;
height: 18px;
background-image: url("../../assets/images/courseManage/add0.png");
}
}
.btn3:active {
background: #0982ff;
}
}
}
//底部
.right1 {
border-left: 1px solid #f2f6fe;
margin-left: 20px;
.onerow {
display: flex;
justify-content: space-between;
align-items: center;
margin-right: 40px;
flex-wrap: wrap;
width: 100%;
.onleft {
display: flex;
text-align: center;
.already {
color: rgba(51, 51, 51, 1);
font-size: 16px;
font-weight: 500;
margin-left: 32px;
white-space: nowrap;
// margin-bottom: 20px;
}
.count {
color: #4ea6ff;
font-size: 16px;
margin: 0 6px;
}
.peo {
color: rgba(51, 51, 51, 1);
font-size: 16px;
font-weight: 500;
}
}
.clbox {
margin-right: 50px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
width: 104px;
height: 32px;
border-radius: 4px;
background: #4ea6ff;
.colose {
width: 16px;
height: 16px;
background-image: url(../../assets/images/basicinfo/ch.png);
background-size: 100%;
margin-right: 4px;
}
.allclear {
color: rgba(255, 255, 255, 1);
font-size: 14px;
}
}
}
.selecteds {
display: flex;
flex-wrap: wrap;
margin-left: 32px;
.person {
width: 100%;
margin-top: 20px;
border-top: 1px solid #f2f6fe;
}
.chose {
width: 64px;
height: 24px;
margin-top: 25px;
margin-right: 25px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 2px;
border: 1px solid rgba(56, 139, 225, 1);
color: rgba(56, 139, 225, 1);
font-size: 12px;
position: relative;
.ch {
position: absolute;
width: 18px;
height: 18px;
background-image: url(../../assets/images/basicinfo/ch.png);
right: -8px;
top: -8px;
}
}
.ifsw {
display: flex;
align-items: end;
justify-content: center;
color: #4ea6ff;
}
.sw {
display: flex;
align-items: center;
justify-content: center;
text-align: justify;
color: #4ea6ff;
margin-top: 23px;
margin-left: 10px;
}
.dept {
width: 100%;
margin-top: 30px;
border-top: 1px solid #f2f6fe;
}
}
}
}
</style>

View File

@@ -1,22 +1,22 @@
<!-- 案例推荐页面 --> <!-- 评估管理页面 -->
<template> <template>
<div class="researchmanage"> <div class="researchmanage">
<!-- 搜索框及按钮 --> <!-- 搜索框及按钮 -->
<div class="filter"> <div class="filter">
<div class="filterItems"> <div class="filterItems">
<div class="select"> <div class="select">
<a-input v-model:value="searchData.assessmentName" style="width: 270px; height: 40px; border-radius: 8px" <a-input v-model:value="searchData.recommendName" style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入姓名" /> placeholder="请输入姓名" />
</div> </div>
<div class="select"> <div class="select">
<div class="select addTimeBox"> <div class="select addTimeBox">
<div class="addTime">创建时间</div> <!-- <div class="addTime">创建时间</div> -->
<a-range-picker v-model:value="dateTime" style="width: 420px" @change="timeChange" format="YYYY-MM-DD" <a-range-picker v-model:value="recommendTimeList" style="width: 420px" @change="timeChange"
valueFormat="YYYY-MM-DD" separator="至" :placeholder="[' 开始时间', ' 结束时间']" /> format="YYYY-MM-DD" valueFormat="YYYY-MM-DD" separator="至" :placeholder="[' 开始时间', ' 结束时间']" />
</div> </div>
</div> </div>
<div style="display: flex; margin-bottom: 20px"> <div style="display: flex; margin-bottom: 20px">
<div class="btn btn1" @click="handleSearch"> <div class="btn btn1" @click="getList(1)">
<div class="search"></div> <div class="search"></div>
<div class="btnText">搜索</div> <div class="btnText">搜索</div>
</div> </div>
@@ -36,40 +36,169 @@
<!-- 搜索框及按钮 --> <!-- 搜索框及按钮 -->
<!-- 表格 --> <!-- 表格 -->
<div class="tableBox"> <div class="tableBox">
就哈哈哈哈 <a-table style="border: 1px solid #f2f6fe" :columns="column" :data-source="state.data" :loading="!loading"
:scroll="{ x: 1500 }" :pagination="false">
<template #operation="{ record }">
<a-space style="padding-right: 10px">
<a-button @click="handleOper(record, 'download')" type="link">信息下载
</a-button>
<a-button @click="() => handleOper(record, 'withdraw')" type="link">撤回
</a-button>
<a-button @click="handleOper(record, 'del')" type="link">删除
</a-button>
</a-space>
</template>
</a-table>
</div> </div>
<div class="pa">
<a-pagination :pageSize="searchData.pageSize" :current="searchData.pageIndex"
:total="state.total" class="pagination" @change="handelChangePage" show-size-changer/>
</div>
<InitiateRecommend v-model:visible="newNext" :title="添加案例"></InitiateRecommend>
</div> </div>
</template> </template>
<script setup lang="jsx"> <script setup lang="jsx">
import { ref, onMounted } from "vue"; import { ref, onMounted, reactive } from "vue";
import { import {
createResearch,
deleteResearch, deleteResearch,
editReleaseStatus, editReleaseStatus,
} from "@/api/indexResearch"; } from "@/api/indexResearch";
import { Form, message } from "ant-design-vue"; import { Form, message } from "ant-design-vue";
import { useRowsPage } from "@/api/request"; import { boeRequest } from "@/api/request";
import { ASSESSMENT_PAGE } from "@/api/apis"; import { RECOMMEND_PAGE } from "@/api/case";
import { useRouter } from "vue-router";
import dialog from "@/utils/dialog"; import dialog from "@/utils/dialog";
import InitiateRecommend from '@/components/drawers/InitiateRecommend.vue'
const router = useRouter(); const column = [
{
title: "推荐人",
dataIndex: "recommendBy",
key: "recommendBy",
width: "20%",
align: "center",
ellipsis: true,
className: "h",
customRender: ({ text }) => {
return text ? text : "-";
},
},
{
title: "推荐时间",
dataIndex: "recommendTime",
key: "recommendTime",
width: "10%",
align: "center",
className: "h",
customRender: ({ text }) => {
return text ? text : "-";
},
},
{
title: "案例数",
dataIndex: "caseCount",
key: "caseCount",
width: "10%",
align: "center",
className: "h",
customRender: ({ text }) => {
return text ? text : "-";
},
},
{
title: "用户数",
dataIndex: "userCount",
key: "userCount",
width: "10%",
align: "center",
className: "h",
customRender: ({ text }) => {
return text ? text : "-";
},
},
{
title: "推送进度",
dataIndex: "pushProgress",
key: "pushProgress",
width: "10%",
align: "center",
className: "h",
customRender: ({ text }) => {
switch (text) {
case 1: return (
<span>未推送</span>
)
case 2: return (
<span>推送中</span>
)
case 3: return (
<span>已推送</span>
)
case 4: return (
<span style={{ color: 'red' }}>推送失败</span>
)
case 5: return (
<span>已撤回</span>
)
default: return (
<span>-</span>
)
}
},
},
{
title: "查看率",
dataIndex: "viewRate",
key: "viewRate",
width: "10%",
align: "center",
className: "h",
customRender: ({ text }) => {
return text ? text : "-";
},
},
{
title: "操作",
width: "20%",
className: "h",
dataIndex: "id",
key: "id",
fixed: "right",
align: "center",
slots: { customRender: "operation" },
},
];
const state = reactive({
data: [],
total: 0
})
// 查询数据
const searchData = ref({ const searchData = ref({
pageNo: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
releaseStatus: null, recommendName: "",
assessmentName: "", recommendTimeList: []
searchEndTime: "",
searchStartTime: "",
});
const formData = ref({
assessmentName: "",
id: "",
validated: 0,
}); });
const newNext = ref(false);
const recommendTimeList = ref([]);
const loading = ref(false)
const getList = (num) => {
if (num === 1) searchData.value.pageIndex = 1;
boeRequest(
RECOMMEND_PAGE,
searchData.value
).then((res) => {
loading.value = true;
state.data = res?.result?.list || []
state.total = res?.result?.totalPages || 0;
}).catch(() => {
loading.value = false
})
}
// 获取列表数据
getList()
onMounted(() => { onMounted(() => {
// 是否需要触发新建弹框 // 是否需要触发新建弹框
@@ -80,134 +209,62 @@ onMounted(() => {
} }
}); });
const newNext = ref(false);
const dateTime = ref([]);
const nameRef = ref();
const rulesRef = ref({
assessmentName: [
{
required: true,
message: "请输入评估名称",
},
],
});
const { resetFields } = Form.useForm(searchData, {}); const { resetFields } = Form.useForm(searchData, {});
const { resetFields: resetFormFields, validate } = Form.useForm(
formData,
rulesRef
);
const { data, total, loading, fetch } = useRowsPage(
ASSESSMENT_PAGE,
searchData.value
);
const handle = (record) => ({ const handle = (record) => ({
push: () => { push: () => {
message.info("发布成功!"); message.info("发布成功!");
record.releaseStatus = "2"; record.releaseStatus = "2";
try {
editReleaseStatus({ assessmentId: record.id, releaseStatus: 2 }); editReleaseStatus({ assessmentId: record.id, releaseStatus: 2 });
} catch (error) {
message.info("发布失败!");
}
}, },
withdraw: () => { withdraw: () => {
message.info("撤回成功!"); message.info("撤回成功!");
record.releaseStatus = "1"; record.releaseStatus = "1";
try {
editReleaseStatus({ assessmentId: record.id, releaseStatus: 1 }); editReleaseStatus({ assessmentId: record.id, releaseStatus: 1 });
}, } catch (error) {
end: () => { message.info("推送失败!");
message.info("结束成功!"); }
record.releaseStatus = "3";
editReleaseStatus({ assessmentId: record.id, releaseStatus: 3 });
}, },
del: async () => { del: async () => {
loading.value = true; loading.value = true;
await deleteResearch({ assessmentId: record.id }).then(() => { await deleteResearch({ assessmentId: record.id }).then(() => {
message.info("删除成功!"); message.info("删除成功!");
fetch(); getList();
}).catch(() => loading.value = false) }).catch(() => loading.value = false)
}, },
copy: async () => {
loading.value = true;
message.info("复制成功!");
record.id = null;
if (record.essayQuestionVoList) {
record.essayQuestionVoList.forEach((item) => {
item.id = null;
});
}
//多选题
let assessmentMultipleChoiceDtoList = [];
if (record.multipleStemVoList) {
record.multipleStemVoList.forEach((item) => {
item.multipleChoiceVoList.forEach((a) => {
a.id = null;
assessmentMultipleChoiceDtoList.push(a);
});
});
}
if (record.scoringQuestionVoList) {
record.scoringQuestionVoList.forEach((item) => {
item.id = null;
});
}
//单选题
let assessmentSingleChoiceDtoList = [];
if (record.singleStemVoList) {
record.singleStemVoList.forEach((item) => {
item.assessmentSingleChoiceVoList.forEach((a) => {
a.id = null;
assessmentSingleChoiceDtoList.push(a);
});
});
}
console.log("record", record);
console.log("复制传参", {
...record,
assessmentName: record.assessmentName + "(1)",
});
let newObj = {
assessmentEssayQuestionDtoList: record.essayQuestionVoList,
assessmentMultipleChoiceDtoList: assessmentMultipleChoiceDtoList,
assessmentScoringQuestionDtoList: record.scoringQuestionVoList,
assessmentSingleChoiceDtoList: assessmentSingleChoiceDtoList,
assessmentMark: record.assessmentMark,
};
console.log("newObj", newObj);
await createResearch({
...newObj,
assessmentName: record.assessmentName + "(1)",
});
fetch();
},
}); });
const handleMsg = { const handleMsg = {
push: "确定要发布此评估吗", download: "确定呀哦下载吗",
withdraw: "您确定要撤回此评估吗", withdraw: "你确认要撤回此次推送吗?",
end: "确定要结束此评估吗", del: "确定要删除这条案例吗?",
del: "您确定要删除此评估吗",
copy: "您确定要复制此评估吗",
}; };
function handleOper(record, type) {
dialog({ content: handleMsg[type], ok: handle(record)[type] });
function timeChange(time, timeStr) {
searchData.value.searchStartTime = timeStr[0];
searchData.value.searchEndTime = timeStr[1];
} }
const handleSearch = () => {
fetch(); const handelChangePage = (page, pageSize) => {
}; searchData.value.pageSize = pageSize
const handleRest = () => { searchData.value.pageIndex = page;
dateTime.value = []; getList();
resetFields();
fetch();
}; };
function timeChange(time, timeStr) {
searchData.value.recommendTimeList = timeStr
}
const handleRest = () => {
recommendTimeList.value = [];
resetFields();
getList();
};
const handleNew = () => { const handleNew = () => {
@@ -215,8 +272,6 @@ const handleNew = () => {
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.clearfix:before, .clearfix:before,