mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 10:56:46 +08:00
课程推荐
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import http from "./config";
|
||||
import Http from './configPublic'
|
||||
|
||||
/**
|
||||
* 1
|
||||
@@ -62,7 +63,7 @@ export const getMemberInfoApi = (obj) =>
|
||||
http.post("/admin/orgStruct/getMemberInfo", obj);
|
||||
|
||||
//课程推荐列表
|
||||
export const page = (params) => http.get("/recommend/page",{params})
|
||||
export const page = (obj) => http.post("/recommend/page",obj)
|
||||
//课程推荐或撤回推荐
|
||||
export const recommend = (obj) =>
|
||||
http.post("/recommend/recommend",obj)
|
||||
Http.post("/manageApi/recommend/recommend",obj)
|
||||
@@ -6,21 +6,6 @@
|
||||
<!-- 搜索框及按钮 -->
|
||||
<div class="filter">
|
||||
<div class="filterItems">
|
||||
<div class="pathnameInp">
|
||||
<a-input
|
||||
v-model:value="sysCreateBy"
|
||||
style="width: 200px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入创建人"
|
||||
/>
|
||||
</div>
|
||||
<div class="pathnameInp">
|
||||
<a-input
|
||||
v-model:value="name"
|
||||
style="width: 200px; height: 40px; border-radius: 8px"
|
||||
placeholder="请输入名称"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="select">
|
||||
<a-tree-select
|
||||
|
||||
@@ -31,11 +16,30 @@
|
||||
placeholder="请选择内容分类"
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
|
||||
:fieldNames="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'code',
|
||||
}"
|
||||
:tree-data="sysTypeOptions"
|
||||
>
|
||||
</a-tree-select>
|
||||
</div>
|
||||
<div class="pathnameInp">
|
||||
<a-input
|
||||
v-model:value="sysCreateBy"
|
||||
style="width: 200px; height: 40px; border-radius: 8px"
|
||||
placeholder="授课教师"
|
||||
/>
|
||||
</div>
|
||||
<div class="pathnameInp">
|
||||
<a-input
|
||||
v-model:value="name"
|
||||
style="width: 200px; height: 40px; border-radius: 8px"
|
||||
placeholder="名称"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; margin-bottom: 20px" class="courseBtn">
|
||||
<div class="btn btn1" @click="handleSearch1">
|
||||
<div class="search"></div>
|
||||
@@ -56,22 +60,23 @@
|
||||
:header-cell-style="{ 'text-align': 'center' }"
|
||||
style="border: 1px solid #f2f6fe"
|
||||
:columns="columns1"
|
||||
:data-source="data"
|
||||
:data-source="tableData1"
|
||||
:loading="tableLoading"
|
||||
:pagination="false"
|
||||
:row-selection="rowSelection"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
row-key="id"
|
||||
>
|
||||
<template #action="{ text, record, index }">
|
||||
<template #actions="{ text, record, index }">
|
||||
<a-space :key="record.id">
|
||||
|
||||
<!-- <a-button @click="() => handleOper(record,'withdraw',record.recommendStatus)" type="link">
|
||||
<a-button @click="() => handleOper(record,'withdraw',record.recommendStatus)" type="link">
|
||||
{{ status[record.recommendStatus] }}
|
||||
</a-button> -->
|
||||
<a-button @click="() => handleOper(record, 'withdraw', record.pushProgress)" type="link">
|
||||
{{ status[record.pushProgress] }}
|
||||
</a-button>
|
||||
<!-- <a-button @click="() => handleOper(record, 'withdraw', record.pushProgress)" type="link">
|
||||
{{ status[record.pushProgress] }}
|
||||
</a-button> -->
|
||||
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table>
|
||||
@@ -127,93 +132,94 @@ const searchData = ref({
|
||||
recommendTimeList: [],
|
||||
});
|
||||
|
||||
const sysTypeOptions = [
|
||||
{
|
||||
title: '专业类',
|
||||
value: '0',
|
||||
key: '0',
|
||||
},
|
||||
{
|
||||
title: '领导力',
|
||||
value: '1',
|
||||
key: '1',
|
||||
},
|
||||
];
|
||||
const status = {
|
||||
1: "撤回",
|
||||
2: "撤回",
|
||||
3: "撤回",
|
||||
4: "重新推送",
|
||||
5: "重新推送",
|
||||
}
|
||||
// const sysTypeOptions = [
|
||||
// {
|
||||
// title: '专业类',
|
||||
// value: '0',
|
||||
// key: '0',
|
||||
// },
|
||||
// {
|
||||
// title: '领导力',
|
||||
// value: '1',
|
||||
// key: '1',
|
||||
// },
|
||||
// ];
|
||||
const status = reactive({
|
||||
0:'推荐',
|
||||
1:'取消推荐',
|
||||
2:'重新推荐'
|
||||
})
|
||||
const data = []
|
||||
|
||||
export default defineComponent({
|
||||
components: {},
|
||||
|
||||
setup() {
|
||||
|
||||
|
||||
const handleMsg = {
|
||||
withdraw1: "你确认要撤回此次推送吗?",
|
||||
withdraw2: "你确认要撤回此次推送吗?",
|
||||
withdraw3: "你确认要撤回此次推送吗?",
|
||||
withdraw4: "您确定要重新推送此案例吗?",
|
||||
withdraw5: "您确定要重新推送此案例吗?",
|
||||
withdraw1: "课程已被推荐,点击可以取消推荐",
|
||||
withdraw: "课程未被推荐,点击可以设为推荐",
|
||||
};
|
||||
function handleOper(record, type, status = '') {
|
||||
dialog({content: handleMsg[status ? type + status : type], ok: handle(record)[type] });
|
||||
dialog({content: handleMsg[status ? type + status : type], ok: recommends(record)[type] });
|
||||
}
|
||||
const getList = (num) => {
|
||||
if (num === 1) searchData.value.pageIndex = 1;
|
||||
boeRequest(RECOMMEND_PAGE, searchData.value)
|
||||
.then((res) => {
|
||||
state.tableLoading = false;
|
||||
state.data = res?.result?.list || [];
|
||||
state.total = res?.result?.count || 0;
|
||||
console.log('推送数据',state.data)
|
||||
})
|
||||
.catch(() => {
|
||||
state.tableLoading = true;
|
||||
});
|
||||
};
|
||||
|
||||
// 获取列表数据
|
||||
getList();
|
||||
const handle = (record) => ({
|
||||
|
||||
const recommends = (record) => ({
|
||||
withdraw: async () => {
|
||||
try {
|
||||
await rePushOrWithdraw({ casesRecommendId: record.id });
|
||||
getList();
|
||||
await recommend({ courseId: record.id });
|
||||
console.log('recommendStatus',state.tableData1[0].recommendStatus)
|
||||
getTableDate();
|
||||
} catch (error) {
|
||||
message.info("推送失败!");
|
||||
console.log('record.id',record.id)
|
||||
console.log('recommend',record)
|
||||
}
|
||||
},
|
||||
});
|
||||
// const handle = (record) => ({
|
||||
// withdraw: async () => {
|
||||
// try {
|
||||
// await recommend({ casesRecommendId: record.id });
|
||||
// getTableDate();
|
||||
// } catch (error) {
|
||||
// message.info("推送失败!");
|
||||
// }
|
||||
// },
|
||||
|
||||
// });
|
||||
});
|
||||
//内容分类
|
||||
function findClassFullName(list, classify, name = "") {
|
||||
return (
|
||||
(list &&
|
||||
list.length > 0 &&
|
||||
list
|
||||
.map((e) =>
|
||||
classify == e.code
|
||||
? name
|
||||
? name + "-" + e.name
|
||||
: e.name
|
||||
: findClassFullName(
|
||||
e.children,
|
||||
classify,
|
||||
name ? name + "-" + e.name : e.name
|
||||
)
|
||||
)
|
||||
.filter((name) => name)
|
||||
.join("")) ||
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
const store = useStore();
|
||||
// const sysTypeOptions = computed(() => store.state.content_type);
|
||||
const sysTypeOptions = computed(() => {console.log('sysTypeOptions',sysTypeOptions);return store.state.content_type;});
|
||||
console.log(sysTypeOptions,'闽侯阿加佳偶');
|
||||
const state = reactive({
|
||||
//测试
|
||||
data:[],
|
||||
// data:[],
|
||||
|
||||
total:0,
|
||||
tableLoading: false,
|
||||
columns1: [
|
||||
{
|
||||
title: "序号",
|
||||
width: 130,
|
||||
dataIndex: "offcourseNumber",
|
||||
key: "offcourseNumber",
|
||||
width: 50,
|
||||
dataIndex: "xuhaoid",
|
||||
key: "xuhaoid",
|
||||
align: "center",
|
||||
customRender: ({ text,record,index }) => {
|
||||
return index+1
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
@@ -223,32 +229,35 @@ export default defineComponent({
|
||||
ellipsis: true,
|
||||
align: "left",
|
||||
customRender: ({ text }) => {
|
||||
return text ? text : "-";
|
||||
return `${text.length>12?text.slice(0,12)+'...':text}`
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
title: "内容分类",
|
||||
width: 130,
|
||||
width: 200,
|
||||
dataIndex: "keywords",
|
||||
ellipsis: true,
|
||||
key: "keywords",
|
||||
align: "center",
|
||||
customRender: ({ record }) =>
|
||||
findClassFullName( record.sysTypeId) || "-",
|
||||
// findClassFullName(sysTypeOptions.value, record.sysTypeId) || "-",
|
||||
|
||||
findClassFullName(sysTypeOptions.value, record.sysTypeId) || "-",
|
||||
// customRender: ({ text }) => {
|
||||
// return text ? text : "-";
|
||||
// },
|
||||
},
|
||||
{
|
||||
title: "关键字",
|
||||
dataIndex: "value",
|
||||
key: "value",
|
||||
dataIndex: "keywords",
|
||||
key: "keywords",
|
||||
align: "left",
|
||||
customRender: ({ text }) => {
|
||||
return text ? text : "-"
|
||||
return text.length>12?text.slice(0,12)+'...':text
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "创建人",
|
||||
title: "授课教师",
|
||||
width: 100,
|
||||
dataIndex: "sysCreateBy",
|
||||
key: "8",
|
||||
@@ -276,58 +285,28 @@ export default defineComponent({
|
||||
dataIndex: "recommendTime",
|
||||
key: "10",
|
||||
align: "center",
|
||||
customRender: ({ text, recommendStatus }) => {
|
||||
return recommendStatus? text || "-" : "-";
|
||||
customRender: ({ text, record }) => {
|
||||
return record.recommendStatus? text || "-" : "-";
|
||||
// return text ? text : "-";
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: "是否推荐",
|
||||
// width: 100,
|
||||
// dataIndex: "recommendStatus",
|
||||
// key: "7",
|
||||
// align: "center",
|
||||
// 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: "pushProgress",
|
||||
key: "pushProgress",
|
||||
width: "10%",
|
||||
title: "是否推荐",
|
||||
width: 100,
|
||||
dataIndex: "recommendStatus",
|
||||
key: "recommendStatus",
|
||||
align: "center",
|
||||
className: "h",
|
||||
customRender: ({ text }) => {
|
||||
switch (text) {
|
||||
case 0:
|
||||
return <span>未推荐</span>;
|
||||
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>;
|
||||
return <span>已推荐</span>;
|
||||
default:
|
||||
return <span>-</span>;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
title: "操作",
|
||||
width: 100,
|
||||
@@ -335,7 +314,7 @@ export default defineComponent({
|
||||
key: "id",
|
||||
fixed: "right",
|
||||
align: "center",
|
||||
slots: { customRender: "action" },
|
||||
slots: { customRender: "actions" },
|
||||
},
|
||||
],
|
||||
//列表表格
|
||||
@@ -347,34 +326,15 @@ export default defineComponent({
|
||||
name: "",
|
||||
createName: "",
|
||||
sysCreateBy:"",
|
||||
sysType1:"", //内容分类
|
||||
sysType2:"",
|
||||
sysType3:"",
|
||||
sysTypeId: undefined,
|
||||
codeUrl: codeUrl,
|
||||
selectedRowKeys:[], //标题ID
|
||||
caseTitleList:[],
|
||||
selectedRow:[], //选组的每一行数据
|
||||
});
|
||||
//内容分类
|
||||
function findClassFullName(list, classify, name = "") {
|
||||
return (
|
||||
(list &&
|
||||
list.length > 0 &&
|
||||
list
|
||||
.map((e) =>
|
||||
classify == e.code
|
||||
? name
|
||||
? name + "-" + e.name
|
||||
: e.name
|
||||
: findClassFullName(
|
||||
e.children,
|
||||
classify,
|
||||
name ? name + "-" + e.name : e.name
|
||||
)
|
||||
)
|
||||
.filter((name) => name)
|
||||
.join("")) ||
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
const route = useRoute();
|
||||
console.log(route);
|
||||
@@ -403,6 +363,9 @@ export default defineComponent({
|
||||
sysCreateBy:state.sysCreateBy,
|
||||
sysTypeId: state.sysTypeId,
|
||||
name:state.name,
|
||||
sysType1:state.sysType1,
|
||||
sysType2:state.sysType2,
|
||||
sysType3:state.sysType3,
|
||||
});
|
||||
const { records, total } = res.data.data;
|
||||
state.tableData1 = records;
|
||||
@@ -494,13 +457,17 @@ export default defineComponent({
|
||||
onSelectChange,
|
||||
status,
|
||||
handleOper,
|
||||
handle,
|
||||
searchData
|
||||
searchData,
|
||||
recommends,
|
||||
data,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
:deep(.ant-table-cell-fix-right){
|
||||
width: 100px !important;
|
||||
}
|
||||
.courseManage {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
Reference in New Issue
Block a user