feat:修改项目封面图

This commit is contained in:
lixg
2023-02-23 11:41:18 +08:00
parent 255400dce2
commit a79efcec01

View File

@@ -3,15 +3,14 @@
<div class="projectAdd">
<div class="header">
<span class="title"
>{{
projectInfo.id ? "编辑" : "创建"
>{{ projectInfo.id ? "编辑" : "创建"
}}{{ ptojectType == "3" ? "班级" : "项目" }}</span
>
<div
@click="backPage"
style="cursor: pointer"
to="/projectmanage"
class="goback"
@click="backPage"
style="cursor: pointer"
to="/projectmanage"
class="goback"
>
<span class="return"></span><span class="returntext">返回</span>
</div>
@@ -21,8 +20,8 @@
<div class="name" v-if="projectInfo.parentName">
<div class="namebox">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">项目归属</div>
</div>
@@ -35,8 +34,8 @@
<div class="name">
<div class="namebox">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">
{{ ptojectType == 3 ? "班级名称" : "项目名称" }}
@@ -44,27 +43,27 @@
</div>
<div class="in">
<NameInput
placeholder="请输入项目名称"
v-model:value="projectInfo.name"
v-model:validate="projectInfo.validate"
:maxlength="30"
show-count
:id="projectInfo.id"
placeholder="请输入项目名称"
v-model:value="projectInfo.name"
v-model:validate="projectInfo.validate"
:maxlength="30"
show-count
:id="projectInfo.id"
></NameInput>
</div>
</div>
<div class="name flex-top">
<div class="namebox" style="margin-top: 10px">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">封面图2</div>
<div class="inname">封面图</div>
</div>
<div class="in select" style="flex: 1; display: flex">
<div
:class="`box ${projectInfo.picUrl === src.value ? 'active' : ''}`"
style="
:class="`box ${projectInfo.picUrl === src.value ? 'active' : ''}`"
style="
width: 100px;
height: 100px;
border-radius: 5px;
@@ -72,114 +71,115 @@
position: relative;
overflow: hidden;
"
v-for="(src, index) in projectPic"
:style="{
display: index >= 3 ? 'none' : 'flex',
}"
:key="index"
@click="() => (projectInfo.picUrl = src.value)"
v-for="(src, index) in projectPic"
:style="{
display: index >= 3 ? 'none' : 'flex',
}"
:key="index"
@click="() => (projectInfo.picUrl = src.value)"
>
<img
style="
style="
width: 100px;
height: 100px;
margin-bottom: 4px;
margin-right: 4px;
"
:src="src.value"
alt="avatar"
:src="src.value"
alt="avatar"
/>
</div>
<div
@click="showLearnBgMore"
v-if="projectPic.length > 3"
style="
width: 100px;
height: 100px;
padding-left: 15px;
border-radius: 5px;
cursor: pointer;
position: relative;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #c7cbd2;
font-size: 14px;
font-weight: 400;
color: #4ea6ff;
line-height: 36px;
"
@click="showLearnBgMore"
v-if="projectPic.length > 3"
style="
width: 100px;
height: 100px;
padding-left: 15px;
border-radius: 5px;
cursor: pointer;
position: relative;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #c7cbd2;
font-size: 14px;
font-weight: 400;
color: #4ea6ff;
line-height: 36px;
"
>
查看更多 <img src="../../assets/images/projectadd/go.png" alt=""/>
查看更多
<img src="../../assets/images/projectadd/go.png" alt="" />
</div>
</div>
</div>
<div class="name">
<div class="namebox">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">项目时间</div>
</div>
<div class="in">
<a-range-picker
separator="至"
:show-time="{ format: 'HH:mm' }"
:placeholder="[' 开始时间', ' 结束时间']"
:disabledDate="disabledDate"
v-model:value="timeRange"
@calendarChange="calendarChange"
style="width: 100%; height: 40px; border-radius: 5px"
:allowClear="false"
format="YYYY-MM-DD HH:mm"
valueFormat="YYYY-MM-DD HH:mm"
@change="timeChange"
:disabled="!!viewDetail"
separator="至"
:show-time="{ format: 'HH:mm' }"
:placeholder="[' 开始时间', ' 结束时间']"
:disabledDate="disabledDate"
v-model:value="timeRange"
@calendarChange="calendarChange"
style="width: 100%; height: 40px; border-radius: 5px"
:allowClear="false"
format="YYYY-MM-DD HH:mm"
valueFormat="YYYY-MM-DD HH:mm"
@change="timeChange"
:disabled="!!viewDetail"
/>
</div>
</div>
<div class="name">
<div class="namebox">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">项目经理</div>
</div>
<div class="in">
<ProjectManager
v-model:value="projectInfo.managerId"
v-model:name="projectInfo.manager"
@onChange="managerChange"
mode="multiple"
v-model:value="projectInfo.managerId"
v-model:name="projectInfo.manager"
@onChange="managerChange"
mode="multiple"
></ProjectManager>
</div>
</div>
<div class="name">
<div class="namebox">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">资源归属</div>
</div>
<div class="in select">
<OrgClass
v-model:value="projectInfo.sourceBelongId"
v-model:name="projectInfo.sourceBelongName"
v-model:fullName="projectInfo.sourceBelongFullName"
v-model:value="projectInfo.sourceBelongId"
v-model:name="projectInfo.sourceBelongName"
v-model:fullName="projectInfo.sourceBelongFullName"
></OrgClass>
</div>
</div>
<div class="name">
<div class="namebox">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">项目级别</div>
</div>
@@ -190,8 +190,8 @@
<div class="name">
<div class="namebox">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">培训分类</div>
</div>
@@ -202,15 +202,15 @@
<div class="name">
<div class="namebox">
<img
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
class="nameimg"
src="../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">是否BOEU实施</div>
</div>
<div class="in">
<a-radio-group
v-model:value="projectInfo.boeFlag"
:disabled="viewDetail ? true : false"
v-model:value="projectInfo.boeFlag"
:disabled="viewDetail ? true : false"
>
<a-radio :style="radioStyle" :value="1"></a-radio>
<a-radio :style="radioStyle" :value="0"></a-radio>
@@ -225,7 +225,7 @@
<!-- :disabled="viewDetail ? true : false" -->
<a-checkbox v-model:checked="courseSyncFlag" disabled>
<span
style="
style="
width: 100%;
color: rgba(109, 117, 132, 1);
font-size: 14px;
@@ -239,7 +239,7 @@
<!-- :disabled="viewDetail ? true : false" -->
<a-checkbox v-model:checked="courseSyncFlag" disabled>
<span
style="
style="
width: 100%;
color: rgba(109, 117, 132, 1);
font-size: 14px;
@@ -256,12 +256,12 @@
</div>
<div class="in">
<a-textarea
v-model:value="projectInfo.remark"
style="height: 80px"
placeholder="请输入说明"
show-count
:maxlength="200"
:disabled="viewDetail ? true : false"
v-model:value="projectInfo.remark"
style="height: 80px"
placeholder="请输入说明"
show-count
:maxlength="200"
:disabled="viewDetail ? true : false"
/>
</div>
</div>
@@ -280,13 +280,15 @@
<div class="inname" style="width: 50px">模版</div>
<div class="in select" style="margin-left: 2px">
<a-select
:getPopupContainer="triggerNode => (triggerNode.parentNode || document.body)"
placeholder="请选择模版"
style="width: 100%"
:options="classifyList5"
@change="classificationChange5"
@popupScroll="templateScroll"
:fieldNames="{
:getPopupContainer="
(triggerNode) => triggerNode.parentNode || document.body
"
placeholder="请选择模版"
style="width: 100%"
:options="classifyList5"
@change="classificationChange5"
@popupScroll="templateScroll"
:fieldNames="{
label: 'name',
value: 'id',
}"
@@ -300,24 +302,24 @@
<div class="btn">
<a-button @click="backPage" class="btn2">取消</a-button>
<a-button
:loading="loading"
v-on:click="createProject"
type="primary"
class="btn1"
style="margin-left: 20px"
>确定
:loading="loading"
v-on:click="createProject"
type="primary"
class="btn1"
style="margin-left: 20px"
>确定
</a-button>
</div>
</div>
<!-- 更多背景图 v-model:visible="learnBgMore" -->
<a-modal
:closable="sh"
centered="true"
v-model:visible="learnBgMore"
:footer="null"
:width="650"
wrapClassName="learnBgMoreModal"
:z-index="9999"
:closable="sh"
centered="true"
v-model:visible="learnBgMore"
:footer="null"
:width="650"
wrapClassName="learnBgMoreModal"
:z-index="9999"
>
<div class="main">
<div class="top">
@@ -331,18 +333,18 @@
class="learnBgItem"
> -->
<div
@click="chooseImg2(item)"
v-for="item in projectPic"
:key="item.code"
class="learnBgItem"
:style="{
border:
pathBgId === item.code
? '2px solid rgba(78, 166, 255, 1)'
: '1px solid #ccc',
'background-image': 'url(' + item.value.split(',')[0] + ')',
}"
>
@click="chooseImg2(item)"
v-for="item in projectPic"
:key="item.code"
class="learnBgItem"
:style="{
border:
projectInfo.picUrl === item.value
? '3px solid rgba(78, 166, 255, 1)'
: '1px solid #ccc',
'background-image': 'url(' + item.value.split(',')[0] + ')',
}"
>
<!-- <img class="im" :src="item.source" /> -->
</div>
</div>
@@ -355,20 +357,20 @@
</div>
</template>
<script>
import {onMounted, reactive, toRefs, watch} from "vue";
import {message} from "ant-design-vue";
import {useRoute, useRouter} from "vue-router";
import { onMounted, reactive, toRefs, watch } from "vue";
import { message } from "ant-design-vue";
import { useRoute, useRouter } from "vue-router";
import * as api from "../../api/index";
import {useStore} from "vuex";
import { useStore } from "vuex";
import TrainClass from "@/components/project/TrainClass";
import OrgClass from "@/components/project/OrgClass";
import ProjectManager from "@/components/project/ProjectManagerNew";
import NameInput from "@/components/project/NameInput";
import ProjectLevel from "@/components/project/ProjectLevel";
import * as api2 from "../../api/indexAudit";
import {validateName} from "@/api/index1";
import { validateName } from "@/api/index1";
import dayjs from "dayjs";
import {scrollLoad} from "@/api/method";
import { scrollLoad } from "@/api/method";
export default {
name: "projectAdd",
@@ -385,14 +387,14 @@ export default {
const routers = useRoute();
const router = useRouter();
const state = reactive({
datePartial: 'start',
datePartial: "start",
loading: false,
currentPage: 1, //当前页
tableDataTotal: -1, //模版列表总数
pageSize: 10, //每页10条数据
totalPages: 0, //总页数
viewDetail: null,
projectInfo: {id: ''},
projectInfo: { id: "" },
projectPic: [],
memberParam: {
pageNo: 1,
@@ -406,7 +408,8 @@ export default {
changeCondition: false,
clickNum: 0,
timeRange: [],
learnBgMore: false
learnBgMore: false,
pathBgId: null,
});
// 封面图选择
@@ -416,6 +419,7 @@ export default {
};
onMounted(() => {
state.projectPic = store.state.project_pic.map((e) => ({
code: e.id,
value: e.value,
label: e.name,
}));
@@ -423,7 +427,7 @@ export default {
getProjectInfo();
getTemplate();
state.ptojectType = routers.query.ptojectType;
// console.log("routers.query.ptojectType", routers.query.ptojectType);
console.log("获取封面图", state.projectPic);
});
watch(routers.query, () => {
@@ -437,10 +441,9 @@ export default {
state.projectInfo.parentId = routers.query.parentId;
state.projectInfo.id = routers.query.projectId;
(state.projectInfo.id || state.projectInfo.parentId) &&
api
api
.getProjectDetail({
projectId:
state.projectInfo.id || state.projectInfo.parentId,
projectId: state.projectInfo.id || state.projectInfo.parentId,
})
.then((res) => {
state.projectInfo = {
@@ -448,9 +451,12 @@ export default {
...state.projectInfo,
};
!routers.query.projectId &&
!!routers.query.parentId &&
(state.projectInfo.name = "");
state.timeRange = [state.projectInfo.beginTime, state.projectInfo.endTime];
!!routers.query.parentId &&
(state.projectInfo.name = "");
state.timeRange = [
state.projectInfo.beginTime,
state.projectInfo.endTime,
];
state.courseSyncFlag = !!state.projectInfo.courseSyncFlag;
if (Number(state.projectInfo.status) === -5) {
let obj = {
@@ -465,8 +471,8 @@ export default {
if (res.rows && res.rows.length > 0) {
let i = res.rows.length;
state.auditDescription = res.rows[i - 1].description
? res.rows[i - 1].description
: "-";
? res.rows[i - 1].description
: "-";
}
}
});
@@ -485,8 +491,8 @@ export default {
const classificationChange5 = (key, option) => {
state.projectInfo = option;
state.projectInfo.projectTemplateId = option.id
state.projectInfo.id = ''
state.projectInfo.projectTemplateId = option.id;
state.projectInfo.id = "";
state.projectInfo.type = 3;
state.timeRange = [option.beginTime, option.endTime];
state.projectInfo.parentName = routers.query.parentName;
@@ -581,7 +587,7 @@ export default {
message.success(state.projectInfo.id ? "编辑成功" : "创建成功");
router.push({
path: "/taskpage",
query: {projectId: res.data.data},
query: { projectId: res.data.data },
});
});
};
@@ -593,14 +599,16 @@ export default {
state.projectInfo.sourceBelongFullName = orgName;
}
const disabledDate = (current) => {
//编辑的时候 开始实际只能选当前时间之前的时间
if (state.projectInfo.id && state.datePartial === 'start') {
return current && current > dayjs(state.timeRange[0]).endOf("YYYY-MM-DD HH:mm");
if (state.projectInfo.id && state.datePartial === "start") {
return (
current &&
current > dayjs(state.timeRange[0]).endOf("YYYY-MM-DD HH:mm")
);
}
// return current && current < dayjs().endOf('day');
return current && current < dayjs().subtract(1, 'days').endOf('day')
return current && current < dayjs().subtract(1, "days").endOf("day");
};
//显示更多路径背景弹窗
@@ -612,13 +620,14 @@ export default {
state.learnBgMore = false;
};
function calendarChange(date, dateStr, partial) {
state.datePartial = partial
state.datePartial = partial;
}
const chooseImg2 = (item) => {
// console.log(item);
state.projectInfo.picUrl = item.value;
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];
};
return {
@@ -635,7 +644,7 @@ export default {
handleChangeSelect,
showLearnBgMore,
closeLearnBgMore,
chooseImg2
chooseImg2,
};
},
};
@@ -706,7 +715,7 @@ export default {
}
.active {
border: 2px solid rgba(78, 166, 255, 1);
border: 3px solid rgba(78, 166, 255, 1);
}
.content {