fix:项目创建时间去除限制

This commit is contained in:
wuyx
2023-02-23 14:29:50 +08:00

View File

@@ -2,8 +2,7 @@
<template xmlns:display="http://www.w3.org/1999/xhtml"> <template xmlns:display="http://www.w3.org/1999/xhtml">
<div class="projectAdd"> <div class="projectAdd">
<div class="header"> <div class="header">
<span class="title">{{ <span class="title">{{ projectInfo.id ? "编辑" : "创建"
projectInfo.id ? "编辑" : "创建"
}}{{ ptojectType == "3" ? "班级" : "项目" }}</span> }}{{ ptojectType == "3" ? "班级" : "项目" }}</span>
<div @click="backPage" style="cursor: pointer" to="/projectmanage" class="goback"> <div @click="backPage" style="cursor: pointer" to="/projectmanage" class="goback">
<span class="return"></span><span class="returntext">返回</span> <span class="return"></span><span class="returntext">返回</span>
@@ -37,44 +36,45 @@
<div class="name flex-top"> <div class="name flex-top">
<div class="namebox" style="margin-top: 10px"> <div class="namebox" style="margin-top: 10px">
<img class="nameimg" src="../../assets/images/basicinfo/asterisk.png" /> <img class="nameimg" src="../../assets/images/basicinfo/asterisk.png" />
<div class="inname">封面图2</div> <div class="inname">封面图</div>
</div> </div>
<div class="in select" style="flex: 1; display: flex"> <div class="in select" style="flex: 1; display: flex">
<div :class="`box ${projectInfo.picUrl === src.value ? 'active' : ''}`" style=" <div :class="`box ${projectInfo.picUrl === src.value ? 'active' : ''}`" style="
width: 100px; width: 100px;
height: 100px; height: 100px;
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
" v-for="(src, index) in projectPic" :style="{ " v-for="(src, index) in projectPic" :style="{
display: index >= 3 ? 'none' : 'flex', display: index >= 3 ? 'none' : 'flex',
}" :key="index" @click="() => (projectInfo.picUrl = src.value)"> }" :key="index" @click="() => (projectInfo.picUrl = src.value)">
<img style=" <img style="
width: 100px; width: 100px;
height: 100px; height: 100px;
margin-bottom: 4px; margin-bottom: 4px;
margin-right: 4px; margin-right: 4px;
" :src="src.value" alt="avatar" /> " :src="src.value" alt="avatar" />
</div> </div>
<div @click="showLearnBgMore" v-if="projectPic.length > 3" style=" <div @click="showLearnBgMore" v-if="projectPic.length > 3" style="
width: 100px; width: 100px;
height: 100px; height: 100px;
padding-left: 15px; padding-left: 15px;
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border: 1px solid #c7cbd2; border: 1px solid #c7cbd2;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
color: #4ea6ff; color: #4ea6ff;
line-height: 36px; line-height: 36px;
"> ">
查看更多 <img src="../../assets/images/projectadd/go.png" alt="" /> 查看更多
<img src="../../assets/images/projectadd/go.png" alt="" />
</div> </div>
</div> </div>
</div> </div>
@@ -150,10 +150,10 @@
<!-- :disabled="viewDetail ? true : false" --> <!-- :disabled="viewDetail ? true : false" -->
<a-checkbox v-model:checked="courseSyncFlag" disabled> <a-checkbox v-model:checked="courseSyncFlag" disabled>
<span style=" <span style="
width: 100%; width: 100%;
color: rgba(109, 117, 132, 1); color: rgba(109, 117, 132, 1);
font-size: 14px; font-size: 14px;
"> ">
同步课程学习记录如学员在课程库中拥有课程的学习记录自动免修该课程 同步课程学习记录如学员在课程库中拥有课程的学习记录自动免修该课程
</span> </span>
</a-checkbox> </a-checkbox>
@@ -162,10 +162,10 @@
<!-- :disabled="viewDetail ? true : false" --> <!-- :disabled="viewDetail ? true : false" -->
<a-checkbox v-model:checked="courseSyncFlag" disabled> <a-checkbox v-model:checked="courseSyncFlag" disabled>
<span style=" <span style="
width: 100%; width: 100%;
color: rgba(109, 117, 132, 1); color: rgba(109, 117, 132, 1);
font-size: 14px; font-size: 14px;
"> ">
同步课程学习记录如学员在课程库中拥有课程的学习记录自动免修该课程 同步课程学习记录如学员在课程库中拥有课程的学习记录自动免修该课程
</span> </span>
</a-checkbox> </a-checkbox>
@@ -194,9 +194,10 @@
<div class="name"> <div class="name">
<div class="inname" style="width: 50px">模版</div> <div class="inname" style="width: 50px">模版</div>
<div class="in select" style="margin-left: 2px"> <div class="in select" style="margin-left: 2px">
<a-select :getPopupContainer="triggerNode => (triggerNode.parentNode || document.body)" placeholder="请选择模版" <a-select :getPopupContainer="
style="width: 100%" :options="classifyList5" @change="classificationChange5" @popupScroll="templateScroll" (triggerNode) => triggerNode.parentNode || document.body
:fieldNames="{ " placeholder="请选择模版" style="width: 100%" :options="classifyList5" @change="classificationChange5"
@popupScroll="templateScroll" :fieldNames="{
label: 'name', label: 'name',
value: 'id', value: 'id',
}"> }">
@@ -225,11 +226,11 @@
v-for="item in projectPic" v-for="item in projectPic"
:key="item.code" :key="item.code"
class="learnBgItem" class="learnBgItem"
> --> > -->
<div @click="chooseImg2(item)" v-for="item in projectPic" :key="item.code" class="learnBgItem" :style="{ <div @click="chooseImg2(item)" v-for="item in projectPic" :key="item.code" class="learnBgItem" :style="{
border: border:
pathBgId === item.code projectInfo.picUrl === item.value
? '2px solid rgba(78, 166, 255, 1)' ? '3px solid rgba(78, 166, 255, 1)'
: '1px solid #ccc', : '1px solid #ccc',
'background-image': 'url(' + item.value.split(',')[0] + ')', 'background-image': 'url(' + item.value.split(',')[0] + ')',
}"> }">
@@ -275,14 +276,14 @@ export default {
const routers = useRoute(); const routers = useRoute();
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
datePartial: 'start', datePartial: "start",
loading: false, loading: false,
currentPage: 1, //当前页 currentPage: 1, //当前页
tableDataTotal: -1, //模版列表总数 tableDataTotal: -1, //模版列表总数
pageSize: 10, //每页10条数据 pageSize: 10, //每页10条数据
totalPages: 0, //总页数 totalPages: 0, //总页数
viewDetail: null, viewDetail: null,
projectInfo: { id: '' }, projectInfo: { id: "" },
projectPic: [], projectPic: [],
memberParam: { memberParam: {
pageNo: 1, pageNo: 1,
@@ -296,7 +297,8 @@ export default {
changeCondition: false, changeCondition: false,
clickNum: 0, clickNum: 0,
timeRange: [], timeRange: [],
learnBgMore: false learnBgMore: false,
pathBgId: null,
}); });
// 封面图选择 // 封面图选择
@@ -306,6 +308,7 @@ export default {
}; };
onMounted(() => { onMounted(() => {
state.projectPic = store.state.project_pic.map((e) => ({ state.projectPic = store.state.project_pic.map((e) => ({
code: e.id,
value: e.value, value: e.value,
label: e.name, label: e.name,
})); }));
@@ -313,7 +316,7 @@ export default {
getProjectInfo(); getProjectInfo();
getTemplate(); getTemplate();
state.ptojectType = routers.query.ptojectType; state.ptojectType = routers.query.ptojectType;
// console.log("routers.query.ptojectType", routers.query.ptojectType); console.log("获取封面图", state.projectPic);
}); });
watch(routers.query, () => { watch(routers.query, () => {
@@ -329,8 +332,7 @@ export default {
(state.projectInfo.id || state.projectInfo.parentId) && (state.projectInfo.id || state.projectInfo.parentId) &&
api api
.getProjectDetail({ .getProjectDetail({
projectId: projectId: state.projectInfo.id || state.projectInfo.parentId,
state.projectInfo.id || state.projectInfo.parentId,
}) })
.then((res) => { .then((res) => {
state.projectInfo = { state.projectInfo = {
@@ -340,7 +342,10 @@ export default {
!routers.query.projectId && !routers.query.projectId &&
!!routers.query.parentId && !!routers.query.parentId &&
(state.projectInfo.name = ""); (state.projectInfo.name = "");
state.timeRange = [state.projectInfo.beginTime, state.projectInfo.endTime]; state.timeRange = [
state.projectInfo.beginTime,
state.projectInfo.endTime,
];
state.courseSyncFlag = !!state.projectInfo.courseSyncFlag; state.courseSyncFlag = !!state.projectInfo.courseSyncFlag;
if (Number(state.projectInfo.status) === -5) { if (Number(state.projectInfo.status) === -5) {
let obj = { let obj = {
@@ -375,8 +380,8 @@ export default {
const classificationChange5 = (key, option) => { const classificationChange5 = (key, option) => {
state.projectInfo = option; state.projectInfo = option;
state.projectInfo.projectTemplateId = option.id state.projectInfo.projectTemplateId = option.id;
state.projectInfo.id = '' state.projectInfo.id = "";
state.projectInfo.type = 3; state.projectInfo.type = 3;
state.timeRange = [option.beginTime, option.endTime]; state.timeRange = [option.beginTime, option.endTime];
state.projectInfo.parentName = routers.query.parentName; state.projectInfo.parentName = routers.query.parentName;
@@ -483,11 +488,13 @@ export default {
state.projectInfo.sourceBelongFullName = orgName; state.projectInfo.sourceBelongFullName = orgName;
} }
const disabledDate = (current) => { const disabledDate = (current) => {
//编辑的时候 开始实际只能选当前时间之前的时间 //编辑的时候 开始实际只能选当前时间之前的时间
if (state.projectInfo.id && state.datePartial === 'start') { if (state.projectInfo.id && state.datePartial === "start") {
return current && current > dayjs(state.timeRange[0]).endOf("YYYY-MM-DD HH:mm"); return (
current &&
current > dayjs(state.timeRange[0]).endOf("YYYY-MM-DD HH:mm")
);
} }
// 去除创建项目时间限制 可以选择创建时间之前的时间 // 去除创建项目时间限制 可以选择创建时间之前的时间
// return current && current < dayjs().subtract(1, 'days').endOf('day') // return current && current < dayjs().subtract(1, 'days').endOf('day')
@@ -502,13 +509,14 @@ export default {
state.learnBgMore = false; state.learnBgMore = false;
}; };
function calendarChange(date, dateStr, partial) { function calendarChange(date, dateStr, partial) {
state.datePartial = partial state.datePartial = partial;
} }
const chooseImg2 = (item) => { const chooseImg2 = (item) => {
// console.log(item); // console.log(item);
state.projectInfo.picUrl = item.value;
state.pathBgId = item.code; state.pathBgId = item.code;
state.pathBg = item.value.split(',')[0]; state.pathBg = item.value.split(",")[0];
state.mobilePicUrl = item.value.split(',')[1]; state.mobilePicUrl = item.value.split(",")[1];
}; };
return { return {
@@ -525,7 +533,7 @@ export default {
handleChangeSelect, handleChangeSelect,
showLearnBgMore, showLearnBgMore,
closeLearnBgMore, closeLearnBgMore,
chooseImg2 chooseImg2,
}; };
}, },
}; };
@@ -596,7 +604,7 @@ export default {
} }
.active { .active {
border: 2px solid rgba(78, 166, 255, 1); border: 3px solid rgba(78, 166, 255, 1);
} }
.content { .content {