feat:修改面授课

This commit is contained in:
lixg
2023-02-23 21:31:17 +08:00
parent d79acf9633
commit 2913789eae
7 changed files with 3166 additions and 2102 deletions

View File

@@ -87,39 +87,77 @@
</div>
<!-- 无数据 -->
<!-- 表格 -->
<div v-if="tableDataTotal" style="padding:10px 35px">
<div v-if="tableDataTotal" style="padding: 10px 35px">
<a-table
:header-cell-style="{'text-align':'center'}"
style="border: 1px solid #f2f6fe;"
:header-cell-style="{ 'text-align': 'center' }"
style="border: 1px solid #f2f6fe"
:columns="tableDataFunc()"
:data-source="tableData"
:loading="tableLoading"
@expand="expandTable"
:scroll="{x:'max-content'}"
:scroll="{ x: 'max-content' }"
:pagination="false"
>
<template #bodyCell="{ record, column }">
<template v-if="column.key === 'operation'">
<a-space>
<a-button v-if="record.state==='草稿' && checkPer(record.permissions)" @click="showPub(record)" type="link">发布</a-button>
<a-button v-if="record.state==='草稿' && checkPer(record.permissions)" @click="getLearnPathInfo(record.id)" type="link">编辑</a-button>
<a-button v-if="record.state==='已发布' && checkPer(record.permissions)" @click="getLearnPathInfo(record.id)" type="link">编辑</a-button>
<a-button @click="manage(record.id)" type="link">管理</a-button>
<DropDown v-if="checkPer(record.permissions)" value="授权">
<OwnerTableModelStudent :types="[7,8,9]" :id="record.id" :type="9">权限名单</OwnerTableModelStudent>
<CommonStudent :type="7" :id="record.id" title="查看权">查看权</CommonStudent>
<CommonStudent :type="8" :id="record.id" title="管理权">管理权</CommonStudent>
</DropDown>
<DropDown v-if="checkPer(record.permissions)" value="更多">
<a-button @click="showCopyModal(record.id)" type="link">复制</a-button>
<a-button @click="showDeleteModal(record.id)" type="link" danger>删除</a-button>
<a-button v-if="record.state==='已发布'" @click="showBackModal(record.id)" type="link">撤回</a-button>
<a-button v-if="record.state==='已发布'" @click="showStopModal(record.id)" type="link">结束</a-button>
</DropDown>
<!-- <a-button v-if="record.state==='已结束'" @click="showStartModal(record.id)" type="link">启用</a-button> -->
</a-space>
<template #bodyCell="{ record, column }">
<template v-if="column.key === 'operation'">
<a-space>
<a-button
v-if="record.state === '草稿' && checkPer(record.permissions)"
@click="showPub(record)"
type="link"
>发布</a-button
>
<a-button
v-if="record.state === '草稿' && checkPer(record.permissions)"
@click="getLearnPathInfo(record.id)"
type="link"
>编辑</a-button
>
<a-button
v-if="record.state === '已发布' && checkPer(record.permissions)"
@click="getLearnPathInfo(record.id)"
type="link"
>编辑</a-button
>
<a-button @click="manage(record.id)" type="link">管理</a-button>
<DropDown v-if="checkPer(record.permissions)" value="授权">
<OwnerTableModelStudent
:types="[7, 8, 9]"
:id="record.id"
:type="9"
>权限名单</OwnerTableModelStudent
>
<CommonStudent :type="7" :id="record.id" title="查看权"
>查看权</CommonStudent
>
<CommonStudent :type="8" :id="record.id" title="管理权"
>管理权</CommonStudent
>
</DropDown>
<DropDown v-if="checkPer(record.permissions)" value="更多">
<a-button @click="showCopyModal(record.id)" type="link"
>复制</a-button
>
<a-button @click="showDeleteModal(record.id)" type="link" danger
>删除</a-button
>
<a-button
v-if="record.state === '已发布'"
@click="showBackModal(record.id)"
type="link"
>撤回</a-button
>
<a-button
v-if="record.state === '已发布'"
@click="showStopModal(record.id)"
type="link"
>结束</a-button
>
</DropDown>
<!-- <a-button v-if="record.state==='已结束'" @click="showStartModal(record.id)" type="link">启用</a-button> -->
</a-space>
</template>
</template>
</template>
</a-table>
</div>
<div class="tableBox">
@@ -244,7 +282,12 @@
</div>
<div class="btn">
<button class="samtn btn1" @click="handleOut">取消</button>
<a-button class="samtn btn2" @click="createLearnPath" :loading="confirmLoading">确定</a-button>
<a-button
class="samtn btn2"
@click="createLearnPath"
:loading="confirmLoading"
>确定</a-button
>
</div>
<div
@@ -344,7 +387,7 @@
? '2px solid rgba(78, 166, 255, 1)'
: '1px solid #ccc',
'background-image': 'url(' + item.value.split(',')[0] + ')',
display: index >= 5 ? 'none' : 'flex',
display: index >= 3 ? 'none' : 'flex',
}"
style="background-size: 100% 100%"
>
@@ -368,7 +411,12 @@
</div>
<div class="btn">
<button class="samtn btn1" @click="handleOut1">取消</button>
<a-button class="samtn btn2" @click="editLearnPath" :loading="confirmLoading">确定</a-button>
<a-button
class="samtn btn2"
@click="editLearnPath"
:loading="confirmLoading"
>确定</a-button
>
</div>
</div>
</div>
@@ -390,7 +438,9 @@
height: 68px;
display: flex;
align-items: center;
justify-content: space-between;">
justify-content: space-between;
"
>
<div class="headerLeft" style="margin-left: 32px">
<span style="width: 15px; height: 15px"
><img src="../../assets/images/taskpage/pub.png"
@@ -702,7 +752,7 @@ import OrgClass from "@/components/project/OrgClass";
import NameInput from "@/components/project/NameInput";
import { validateName } from "@/api/index1";
import DropDown from "@/components/common/DropDown";
import {checkPer} from "@/utils/utils";
import { checkPer } from "@/utils/utils";
export default {
name: "learningPath",
@@ -720,9 +770,9 @@ export default {
setup() {
const store = useStore();
const router = useRouter();
const userInfo = computed(()=>store.state.userInfo)
const userInfo = computed(() => store.state.userInfo);
const state = reactive({
confirmLoading:false,
confirmLoading: false,
tableLoading: false,
out: false,
out1: false,
@@ -857,7 +907,7 @@ export default {
state.pathIntro = "";
state.out = !state.out;
if (userInfo.value.departId && userInfo.value.departName) {
state.organizationSelectName =userInfo.value.departName;
state.organizationSelectName = userInfo.value.departName;
state.organizationSelectId = userInfo.value.departId;
}
};
@@ -874,14 +924,14 @@ export default {
const chooseImg = (item) => {
console.log(item);
state.pathBgId = item.code;
state.pathBg = item.value.split(',')[0];
state.mobilePicUrl = item.value.split(',')[1];
state.pathBg = item.value.split(",")[0];
state.mobilePicUrl = item.value.split(",")[1];
};
const chooseImg2 = (item) => {
// console.log(item);
state.pathBgId = item.code;
state.pathBg = item.value.split(',')[0];
state.mobilePicUrl = item.value.split(',')[1];
state.pathBg = item.value.split(",")[0];
state.mobilePicUrl = item.value.split(",")[1];
};
//发布弹窗
const showPub = (router) => {
@@ -961,10 +1011,14 @@ export default {
const copyLearnPath = () => {
state.copyModal = false;
state.tableLoading = true;
api.handleLearnPath({
routerId: state.copyPathId,
type: 2,
}).then(() => {getLearnPath();})
api
.handleLearnPath({
routerId: state.copyPathId,
type: 2,
})
.then(() => {
getLearnPath();
});
message.success("复制成功");
};
@@ -1158,30 +1212,30 @@ export default {
};
//创建学习路径图
const createLearnPath = async () => {
state.confirmLoading = true
state.confirmLoading = true;
if (!state.pathName) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("请输入路径图名称");
}
if (!state.organizationSelectName) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("请选择归属组织");
}
if (!state.pathBg) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("请选择背景图");
}
if (!state.mobilePicUrl) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("未配置H5背景图请联系管理员");
}
if (!state.validate) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
message.warning("路径图名称重复");
return;
}
@@ -1194,23 +1248,25 @@ export default {
});
if (offName) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("项目名称重复,请重新填写");
}
api.createLearnPath({
name: state.pathName,
remark: state.pathIntro,
status: 0,
organizationId: state.organizationSelectId,
organizationName: state.organizationSelectName,
picUrl: state.pathBg,
mobilePicUrl: state.mobilePicUrl,
}).then(id => {
message.destroy();
state.confirmLoading = false
message.success("创建成功");
router.push( {path: "/leveladd",query:{routerId: id.data.data }})
api
.createLearnPath({
name: state.pathName,
remark: state.pathIntro,
status: 0,
organizationId: state.organizationSelectId,
organizationName: state.organizationSelectName,
picUrl: state.pathBg,
mobilePicUrl: state.mobilePicUrl,
})
.then((id) => {
message.destroy();
state.confirmLoading = false;
message.success("创建成功");
router.push({ path: "/leveladd", query: { routerId: id.data.data } });
});
};
//获取学习路径列表
@@ -1260,35 +1316,39 @@ export default {
state.deleteModal = false;
state.tableLoading = true;
message.success("删除成功");
api.handleLearnPath({routerId: state.deletePathId, type: -2}).then(() => {getLearnPath()})
api
.handleLearnPath({ routerId: state.deletePathId, type: -2 })
.then(() => {
getLearnPath();
});
};
//编辑学习路径图
const editLearnPath = async () => {
state.confirmLoading = true
state.confirmLoading = true;
if (!state.pathName) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("请输入路径图名称");
}
if (!state.organizationSelectName) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("请选择归属组织");
}
if (!state.pathBgId) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("请选择背景图");
}
if (!state.mobilePicUrl) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("未配置H5背景图请联系管理员");
}
if (!state.validate) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("路径图名称重复");
}
// state.pathName = detail.name;
@@ -1308,11 +1368,11 @@ export default {
});
if (offName) {
message.destroy();
state.confirmLoading = false
state.confirmLoading = false;
return message.warning("项目名称重复,请重新填写");
}
state.out1 = false;
state.confirmLoading = false
state.confirmLoading = false;
message.success("修改成功");
state.tableLoading = true;
let obj = {
@@ -1325,7 +1385,9 @@ export default {
organizationId: state.organizationSelectId,
status: 0,
};
api.createLearnPath(obj).then(() => {getLearnPath()})
api.createLearnPath(obj).then(() => {
getLearnPath();
});
};
//选择状态
const selectStatusClassify = (e, v) => {
@@ -1452,10 +1514,10 @@ export default {
);
function manage(id) {
// TODO 为了点击顶部面包屑导航返回而存储
localStorage.setItem('routerId',id)
localStorage.setItem("routerId", id);
router.push({
path: "/leveladd",
query:{routerId:id}
query: { routerId: id },
});
}
@@ -1463,38 +1525,40 @@ export default {
// console.log("编辑学习路径图id", id);
//获取学习路径详情
api
.getRouterDetail(id,"draft")
.then((res) => {
if (res.data.code === 200) {
console.log("获取学习路径详情成功", res.data.data);
let detail = res.data.data.routerInfo;
state.pathName = detail.name;
state.pathBg = detail.picUrl;
state.mobilePicUrl = detail.mobilePicUrl;
state.pathBgId = "";
state.organizationSelectName = detail.organizationName;
state.organizationSelectId = detail.organizationId;
state.pathIntro = detail.remark;
state.editPathId = id;
const imgDict = imgData.value.find((img)=>img.value.split(',')[0] === state.pathBg)
if(imgDict){
state.pathBgId = imgDict.code;
state.pathBg = imgDict.value.split(',')[0];
state.mobilePicUrl = imgDict.value.split(',')[1];
}
//for (let i = 0; i < arr.length; i++) {
// console.log("arr[i].dictValue", arr[i].dictValue, state.pathBg);
// if (arr[i].dictValue === state.pathBg) {
// state.pathBgId = arr[i].dictCode;
// }
// }
.getRouterDetail(id, "draft")
.then((res) => {
if (res.data.code === 200) {
console.log("获取学习路径详情成功", res.data.data);
let detail = res.data.data.routerInfo;
state.pathName = detail.name;
state.pathBg = detail.picUrl;
state.mobilePicUrl = detail.mobilePicUrl;
state.pathBgId = "";
state.organizationSelectName = detail.organizationName;
state.organizationSelectId = detail.organizationId;
state.pathIntro = detail.remark;
state.editPathId = id;
const imgDict = imgData.value.find(
(img) => img.value.split(",")[0] === state.pathBg
);
if (imgDict) {
state.pathBgId = imgDict.code;
state.pathBg = imgDict.value.split(",")[0];
state.mobilePicUrl = imgDict.value.split(",")[1];
}
})
.catch((err) => {
console.log("获取详情失败", err);
});
//for (let i = 0; i < arr.length; i++) {
// console.log("arr[i].dictValue", arr[i].dictValue, state.pathBg);
// if (arr[i].dictValue === state.pathBg) {
// state.pathBgId = arr[i].dictCode;
// }
// }
}
})
.catch((err) => {
console.log("获取详情失败", err);
});
state.out1 = true;
};
@@ -1541,7 +1605,7 @@ export default {
showLearnBgMore,
closeLearnBgMore,
checkPer,
getLearnPathInfo
getLearnPathInfo,
};
},
};