课程推荐

This commit is contained in:
zhangsir
2023-10-10 18:03:29 +08:00
parent 422b262c7f
commit 47e180b9f4
2 changed files with 72 additions and 132 deletions

View File

@@ -60,3 +60,9 @@ export const studyRecordList = (obj) =>
// 获取员工信息
export const getMemberInfoApi = (obj) =>
http.post("/admin/orgStruct/getMemberInfo", obj);
//课程推荐列表
export const page = (params) => http.get("/recommend/page",{params})
//课程推荐或撤回推荐
export const recommend = (obj) =>
http.post("/recommend/recommend",obj)

View File

@@ -8,7 +8,7 @@
<div class="filterItems">
<div class="pathnameInp">
<a-input
v-model:value="createName"
v-model:value="sysCreateBy"
style="width: 200px; height: 40px; border-radius: 8px"
placeholder="请输入创建人"
/>
@@ -20,17 +20,7 @@
placeholder="请输入名称"
/>
</div>
<!-- <div class="select">
<a-select
v-model:value="auditStatus"
dropdownClassName="dropdown-style"
style="width: 200px"
placeholder="请选择状态"
:options="options1"
allowClear
>
</a-select>
</div> -->
<div class="select">
<a-tree-select
:getPopupContainer="
@@ -80,25 +70,9 @@
>
<template #action="{ text, record, index }">
<a-space :key="record.id">
<!-- <a-button
v-if="(record.auditStatus === 2 || record.auditStatus === 3) && !record.publishStatus && checkPer(record.permissions,createId)"
@click="() => handlePush(text, index)"
type="link"
>发布
</a-button>
<a-button
v-if="
(record.auditStatus === 1 || record.auditStatus === 2 || record.publishStatus) &&
record.status &&
checkPer(record.permissions,createId)
"
@click="() => handleRejectExit(text, index, record)"
type="link"
block
>撤回</a-button
> -->
<a-button @click="() => handleOper(record, record.publishStatus)" type="link">
{{ status[record.publishStatus] }}
<a-button @click="() => handleOper(record,'withdraw',record.recommendStatus)" type="link">
<!-- {{ status[record.recommendStatus] }} -->
</a-button>
</a-space>
</template>
@@ -134,7 +108,8 @@ import { useRouter, useRoute } from "vue-router";
import dialog from "@/utils/dialog";
import {
list,
handle,
page,
recommend
} from "@/api/indexCourse";
import {
} from "../../utils/utils";
@@ -153,15 +128,33 @@ export default defineComponent({
components: {},
setup() {
// function handleOper(record, type, status = '') {
// dialog({ content: handleMsg[status ? type + status : type], ok: handle(record)[type] });
const handleMsg = {
withdraw1: "你确认要撤回此次推送吗?",
withdraw2: "您确定要重新推送此案例吗?",
};
function handleOper(record, type, status = '') {
dialog({content: handleMsg[status ? type + status : type], ok: handle(record)[type] });
}
// const handle = (record) => ({
// withdraw: async () => {
// try {
// // editReleaseStatus({ assessmentId: record.id, releaseStatus: 1 });
// await recommend({ casesRecommendId: record.id });
// getTableDate();
// } catch (error) {
// message.info("推送失败!");
// }
// },
// });
const store = useStore();
const sysTypeOptions = computed(() => store.state.content_type);
const state = reactive({
permissions:null,
createId:null,
total:0,
tableLoading: false,
columns1: [
{
@@ -185,27 +178,27 @@ export default defineComponent({
{
title: "内容分类",
width: 130,
dataIndex: "contentTxt",
dataIndex: "keywords",
ellipsis: true,
key: "contentTxt",
key: "keywords",
align: "center",
customRender: ({ record }) =>
findClassFullName(sysTypeOptions.value, record.sysTypeId) || "-",
},
{
title: "关键字",
dataIndex: "tips",
key: "tips",
dataIndex: "value",
key: "value",
align: "left",
customCell :() => {return {style: {maxWidth: '200px',overflow: 'hidden',whiteSpace: 'nowrap',textOverflow:'ellipsis',cursor:'pointer'}}},
customRender: ({ text }) => {
return <a-tooltip placement="topLeft" title = {text} >{text ? text : "-"}</a-tooltip>
return text ? text : "-"
},
},
{
title: "创建人",
width: 100,
dataIndex: "createName",
dataIndex: "sysCreateBy",
key: "8",
ellipsis: true,
align: "center",
@@ -216,7 +209,7 @@ export default defineComponent({
{
title: "创建时间",
width: 100,
dataIndex: "createTime",
dataIndex: "sysCreateTime",
key: "9",
ellipsis: true,
align: "center",
@@ -228,48 +221,18 @@ export default defineComponent({
title: "推荐时间",
width: 100,
ellipsis: true,
dataIndex: "publishTime",
dataIndex: "recommendTime",
key: "10",
align: "center",
customRender: ({ text, publishStatus }) => {
return publishStatus? text || "-" : "-";
customRender: ({ text, recommendStatus }) => {
return recommendStatus? text || "-" : "-";
},
},
{
title: "状态",
width: 130,
dataIndex: "auditStatus",
key: "6",
align: "center",
customRender: ({ record }) => {
switch (String(record.auditStatus)) {
case "0":
return "未提交";
case "1":
return "待审核";
case "2":
return "已审核";
case "3":
return "已审核";
case "-1":
return "审核未通过";
}
},
},
// {
// title: "是否推荐",
// width: 100,
// dataIndex: "publishStatus",
// key: "7",
// align: "center",
// customRender: ({ record }) =>
// record.publishStatus? "已发布" : "未发布",
// },
{
title: "推送进度",
dataIndex: "publishStatus",
key: "publishStatus",
title: "是否推荐",
width: 100,
dataIndex: "recommendStatus",
key: "7",
align: "center",
customRender: ({ text }) => {
switch (text) {
@@ -288,6 +251,7 @@ export default defineComponent({
}
},
},
{
title: "操作",
width: 100,
@@ -304,10 +268,9 @@ export default defineComponent({
tableDataTotal1: -1,
pageSize1: 10,
pageSize: 10,
projectName: "",
name: "",
createName: "",
auditStatus: null,
sysCreateBy:"",
sysTypeId: undefined,
codeUrl: codeUrl,
selectedRowKeys:[], //标题ID
@@ -346,8 +309,7 @@ export default defineComponent({
const getTableDate = async () => {
state.tableLoading = true;
console.log("我是点击搜索的数据", state.sysTypeId);
let startTime = "";
let endTime = "";
if (state.projectTime) {
startTime = toDate(
new Date(state.projectTime[0].$d).getTime() / 1000,
@@ -358,32 +320,26 @@ export default defineComponent({
"Y-M-D"
);
}
let res = await list({
pageNo: state.currentPage1,
let res = await page({
pageNum:state.currentPage1,
pageSize:state.pageSize1,
auditStatus: state.auditStatus,
sysCreateBy:state.sysCreateBy,
sysTypeId: state.sysTypeId,
projectName: state.projectName,
name:state.name,
createName: state.createName,
endTime: endTime,
beginTime: startTime,
});
const { rows, total } = res.data.data;
state.tableData1 = rows;
const { records, total } = res.data.data;
state.tableData1 = records;
state.tableDataTotal1 = total;
state.tableLoading = false;
console.log("state.tableData1", state.tableData1);
};
getTableDate();
// 计算全选
const rowSelection = computed(() => {
return {
selectedRowKeys: state.selectedRowKeys,
onChange: onSelectChange,
// preserveSelectedRowKeys: true,
}
});
//计算出来已选中状态
@@ -408,10 +364,9 @@ export default defineComponent({
};
//重置
const handleRest1 = () => {
state.projectName = "";
state.name = "";
state.createName = "";
state.auditStatus = null;
state.sysCreateBy = '';
state.sysTypeId = null;
state.projectTime = "";
getTableDate();
@@ -445,37 +400,14 @@ export default defineComponent({
label: "已完成",
},
]);
//撤回
const handleRejectExit = (id, index, record) => {
dialog({
content: "确定撤回吗?",
ok: () => {
message.success("撤回成功");
record.publishStatus ? (state.tableData1[index].publishStatus = 0) : (state.tableData1[index].auditStatus = 0);
handle({ offcourseId: id, type: 0 });
},
});
};
//发布
const handlePush = (id, index) => {
dialog({
content: "确定发布该课程吗?",
ok: () => {
message.success("发布成功");
state.tableData1[index].publishStatus = 1;
handle({ offcourseId: id, type: 3 });
},
});
};
return {
...toRefs(state),
sysTypeOptions,
// sysTypeOptions,
findClassFullName,
moment,
handlePush,
options1,
options11,
handleRejectExit,
mode: "simple",
handelChangePage1,
handleSearch1,
@@ -485,7 +417,8 @@ export default defineComponent({
rowSelection,
onSelectChange,
status,
// handleOper
handleOper,
// handle,
};
},
});
@@ -647,3 +580,4 @@ export default defineComponent({
</style>