From 47e180b9f4090677864f266b8ef33656189a683d Mon Sep 17 00:00:00 2001 From: zhangsir Date: Tue, 10 Oct 2023 18:03:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8E=A8=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/indexCourse.js | 6 + src/views/courselibrary/CourseRecommended.vue | 198 ++++++------------ 2 files changed, 72 insertions(+), 132 deletions(-) diff --git a/src/api/indexCourse.js b/src/api/indexCourse.js index f2200d74..2cd8870e 100644 --- a/src/api/indexCourse.js +++ b/src/api/indexCourse.js @@ -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) \ No newline at end of file diff --git a/src/views/courselibrary/CourseRecommended.vue b/src/views/courselibrary/CourseRecommended.vue index 896f38ec..88dae806 100644 --- a/src/views/courselibrary/CourseRecommended.vue +++ b/src/views/courselibrary/CourseRecommended.vue @@ -8,7 +8,7 @@
@@ -20,17 +20,7 @@ placeholder="请输入名称" />
- +
- - - {{ status[record.publishStatus] }} + + + @@ -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"; @@ -144,24 +119,42 @@ import { codeUrl, toDate } from "@/api/method"; import { useStore } from "vuex"; import { checkPer, checkOwner } from "@/utils/utils"; - const status = { - 1: "推荐", - 2: "取消推荐", - 3: "重新推送", - } +const status = { + 1: "推荐", + 2: "取消推荐", + 3: "重新推送", + } 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 {text ? text : "-"} + 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, - pageSize: state.pageSize1, - auditStatus: state.auditStatus, + let res = await page({ + + pageNum:state.currentPage1, + pageSize:state.pageSize1, + sysCreateBy:state.sysCreateBy, sysTypeId: state.sysTypeId, - projectName: state.projectName, - name: state.name, - createName: state.createName, - endTime: endTime, - beginTime: startTime, + name:state.name, }); - 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({ +