提交 da6b7cfb 编写于 作者: guangjun.yang's avatar guangjun.yang

自定义项目--选择课程个数限制(-1表示不限制)

上级 af80fcec
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<ul class="course-header"> <ul class="course-header">
<li class="title"> <li class="title">
<span class="main">全部课程</span> <span class="main">全部课程</span>
<span class="sub">单个项目最多只能选择30个课程</span> <span v-show="courseLimitCount != -1" class="sub">单个项目最多只能选择{{courseLimitCount}}个课程</span>
</li> </li>
<li class="order"> <li class="order">
<div class="num" @click="toggleOrder"> <div class="num" @click="toggleOrder">
...@@ -86,14 +86,14 @@ export default { ...@@ -86,14 +86,14 @@ export default {
dialogObj: { dialogObj: {
title: "课程数量已达上限", title: "课程数量已达上限",
visible: false, visible: false,
message: "单个项目最多只能选择30个课程", message: '单个项目最多只能选择3个课程',
tip: "", tip: "",
hideMsg: "我知道了" hideMsg: "我知道了"
} }
}; };
}, },
computed: { computed: {
...mapGetters(["cartList", "courseList", "searchParam"]) ...mapGetters(["cartList", "courseList", "searchParam", "courseLimitCount"])
}, },
components: { components: {
ShoppingCart, ShoppingCart,
...@@ -127,8 +127,9 @@ export default { ...@@ -127,8 +127,9 @@ export default {
toggleChecked(item) { toggleChecked(item) {
item.checked = !item.checked; item.checked = !item.checked;
if (item.checked) { if (item.checked) {
if (this.cartList.length >= 30) { if (this.courseLimitCount != -1 && this.cartList.length >= this.courseLimitCount) {
item.checked = !item.checked; item.checked = !item.checked;
this.dialogObj.message = '单个项目最多只能选择' + this.courseLimitCount + '个课程';
this.dialogObj.visible = true; this.dialogObj.visible = true;
return; return;
} }
......
<!--基础信息--> <!--基础信息-->
<template> <template>
<div class="base-message-wrap"> <div class="base-message-wrap">
<el-form <el-form ref="formData" :model="formData" :rules="rules" label-width="150px" class="basic-form">
ref="formData"
:model="formData"
:rules="rules"
label-width="150px"
class="basic-form"
>
<el-form-item label="项目名称:" prop="projectName"> <el-form-item label="项目名称:" prop="projectName">
<el-col :span="13"> <el-col :span="13">
<el-input <el-input
...@@ -24,7 +18,7 @@ ...@@ -24,7 +18,7 @@
<el-col :span="10" class="curt-position-wrapper"> <el-col :span="10" class="curt-position-wrapper">
<div class="curt-position"> <div class="curt-position">
<SortedCart :isPreview="isPreview"></SortedCart> <SortedCart :isPreview="isPreview"></SortedCart>
</div> </div>
</el-col> </el-col>
</el-form-item> </el-form-item>
...@@ -35,24 +29,38 @@ ...@@ -35,24 +29,38 @@
v-model="formData.organizationNameList[index]" v-model="formData.organizationNameList[index]"
placeholder="请输入发起机构名称" placeholder="请输入发起机构名称"
style="width:70%;" style="width:70%;"
maxlength=16 maxlength="16"
@input="changeOrganizationName" @input="changeOrganizationName"
@blur = "blurName" @blur="blurName"
@focus = "focusName(index)" @focus="focusName(index)"
:disabled="isPreview==1" :disabled="isPreview==1"
></el-input> ></el-input>
<span class="word-num">{{(formData.organizationNameList[index]).replace(/\s+/g,"").length}}/16</span> <span
<img @click="plusOrg(index)" class="edit-img" src="../../../assets/image/plus.png" v-if="isPreview!=1"/> class="word-num"
<img @click="deleteOrg(index)" v-if="index >= 1 && isPreview!=1" class="edit-img" src="../../../assets/image/trash.png" /> >{{(formData.organizationNameList[index]).replace(/\s+/g,"").length}}/16</span>
<img
@click="plusOrg(index)"
class="edit-img"
src="../../../assets/image/plus.png"
v-if="isPreview!=1"
/>
<img
@click="deleteOrg(index)"
v-if="index >= 1 && isPreview!=1"
class="edit-img"
src="../../../assets/image/trash.png"
/>
</el-col> </el-col>
<el-popover <el-popover
v-if="formData.creatorOrganizationName" v-if="formData.creatorOrganizationName"
class="popover-content" :style="{'top': orgListIndex * 41 + 'px'}" class="popover-content"
:style="{'top': orgListIndex * 41 + 'px'}"
placement="bottom" placement="bottom"
:content="organizationContent" :content="organizationContent"
v-model="visibleName" v-model="visibleName"
@click="checkDefault"> @click="checkDefault"
<p @click="checkDefault"> 我的机构: {{ formData.creatorOrganizationName }} </p> >
<p @click="checkDefault">我的机构: {{ formData.creatorOrganizationName }}</p>
</el-popover> </el-popover>
</el-form-item> </el-form-item>
...@@ -91,13 +99,16 @@ ...@@ -91,13 +99,16 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form-item> </el-form-item>
<p class="time-message"><i class="el-icon-warning-outline"></i>项目有效期为{{attachInfo.limitValue}}天,选择项目起止时间须在有效期内</p> <p class="time-message">
<i class="el-icon-warning-outline"></i>
项目有效期为{{attachInfo.limitValue}}天,选择项目起止时间须在有效期内
</p>
</div> </div>
<el-form-item label="列表图片:" style="margin-bottom: 10px"> <el-form-item label="列表图片:" style="margin-bottom: 10px">
<el-col :span="13" style="height:95px"> <el-col :span="13" style="height:95px">
<div class="url1-selected"> <div class="url1-selected">
<img :src="formData.attachmentUrl1" alt=""> <img :src="formData.attachmentUrl1" alt />
</div> </div>
</el-col> </el-col>
<el-col :span="13" style="height:95px"> <el-col :span="13" style="height:95px">
...@@ -107,22 +118,28 @@ ...@@ -107,22 +118,28 @@
class="img-wrapper" class="img-wrapper"
v-for="(item, index) in attachInfo.attachMap[1]" v-for="(item, index) in attachInfo.attachMap[1]"
:key="index" :key="index"
@click="selectedAttachUrl(item, 1)" @click="selectedAttachUrl(item.attachmentUrl, 1)"
> >
<img class="selected-icon" :src="item.attachmentUrl" alt=""> <img class="selected-icon" :src="item.attachmentUrl" alt />
<img class="status-icon" v-show="item.checked" src="../../../assets/custom/icon/icon-select.png" alt /> <img
<img class="status-icon" v-show="!item.checked" src="../../../assets/custom/icon/icon-select-no.png" alt /> class="status-icon"
v-show="item.checked"
src="../../../assets/custom/icon/icon-select.png"
alt
/>
<img
class="status-icon"
v-show="!item.checked"
src="../../../assets/custom/icon/icon-select-no.png"
alt
/>
</li> </li>
</ul> </ul>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="封面类型:"> <el-form-item label="封面类型:">
<el-radio-group <el-radio-group size="small" v-model="formData.type" disabled>
size="small"
v-model="formData.type"
disabled
>
<el-radio :label="1">图片</el-radio> <el-radio :label="1">图片</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
...@@ -130,7 +147,7 @@ ...@@ -130,7 +147,7 @@
<el-form-item label="封面文件:" style="margin-bottom: 10px"> <el-form-item label="封面文件:" style="margin-bottom: 10px">
<el-col :span="13" style="height: 95px"> <el-col :span="13" style="height: 95px">
<div class="url2-selected"> <div class="url2-selected">
<img :src="formData.attachmentUrl2" alt=""> <img :src="formData.attachmentUrl2" alt />
</div> </div>
</el-col> </el-col>
<el-col :span="13" style="height:95px"> <el-col :span="13" style="height:95px">
...@@ -140,11 +157,21 @@ ...@@ -140,11 +157,21 @@
class="img-wrapper" class="img-wrapper"
v-for="(item, index) in attachInfo.attachMap[2]" v-for="(item, index) in attachInfo.attachMap[2]"
:key="index" :key="index"
@click="selectedAttachUrl(item, 2)" @click="selectedAttachUrl(item.attachmentUrl, 2)"
> >
<img class="selected-icon" :src="item.attachmentUrl" alt=""> <img class="selected-icon" :src="item.attachmentUrl" alt />
<img class="status-icon" v-show="item.checked" src="../../../assets/custom/icon/icon-select.png" alt /> <img
<img class="status-icon" v-show="!item.checked" src="../../../assets/custom/icon/icon-select-no.png" alt /> class="status-icon"
v-show="item.checked"
src="../../../assets/custom/icon/icon-select.png"
alt
/>
<img
class="status-icon"
v-show="!item.checked"
src="../../../assets/custom/icon/icon-select-no.png"
alt
/>
</li> </li>
</ul> </ul>
</el-col> </el-col>
...@@ -173,20 +200,20 @@ ...@@ -173,20 +200,20 @@
<script> <script>
import { doUpload, getFilePath } from "../../../utils/qiniu-util"; import { doUpload, getFilePath } from "../../../utils/qiniu-util";
import { openLoading, closeLoading } from "../../../utils/utils"; import { openLoading, closeLoading } from "../../../utils/utils";
import SortedCart from '@/components/education/custom/sorted-cart' import SortedCart from "@/components/education/custom/sorted-cart";
import { convertTime } from "../../../utils"; import { convertTime } from "../../../utils";
import dialog from "./dialog"; import dialog from "./dialog";
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from "vuex";
let vm = null; let vm = null;
export default { export default {
props: { props: {
openTemplateId: { openTemplateId: {
type: String | Number, type: String | Number,
default: '' default: ""
}, },
projectId: { projectId: {
type: String | Number, type: String | Number,
default: '' default: ""
}, },
editor: { editor: {
type: Boolean, type: Boolean,
...@@ -204,8 +231,8 @@ export default { ...@@ -204,8 +231,8 @@ export default {
callback(); callback();
} }
}; };
let checkUserTime= (rule, value, callback) => { let checkUserTime = (rule, value, callback) => {
if (value> 1000 || value < 1) { if (value > 1000 || value < 1) {
callback(new Error("输入长度为1-1000的有效期")); callback(new Error("输入长度为1-1000的有效期"));
} else { } else {
callback(); callback();
...@@ -214,15 +241,15 @@ export default { ...@@ -214,15 +241,15 @@ export default {
return { return {
visibleName: false, //是否显示机构提示 visibleName: false, //是否显示机构提示
orgListIndex: 1, orgListIndex: 1,
organizationContent: '',//机构名称 organizationContent: "", //机构名称
formData: { formData: {
id: "", //项目 id 26 id: "", //项目 id 26
projectName: "", //开放模板名称 projectName: "", //开放模板名称
projectBegintime: "", //模板开始时间 projectBegintime: "", //模板开始时间
projectEndtime: "", //模板结束时间 projectEndtime: "", //模板结束时间
projectIntro: "", //开放模板简介 projectIntro: "", //开放模板简介
projectType: 4, //类型 projectType: 4, //类型
type: 1, //封面类型 1图片2视频 type: 1, //封面类型 1图片2视频
projectStatus: 1, //1.草稿 2.未上架 3.审核中/待审核 4.已上架 5.已下架 6.已拒绝/未上架 projectStatus: 1, //1.草稿 2.未上架 3.审核中/待审核 4.已上架 5.已下架 6.已拒绝/未上架
expireDay: 90, //模板有效期(天) expireDay: 90, //模板有效期(天)
status4Flag: 0, //0表示没有上过架,1表示上过架 status4Flag: 0, //0表示没有上过架,1表示上过架
...@@ -238,29 +265,30 @@ export default { ...@@ -238,29 +265,30 @@ export default {
attachmentName: "", attachmentName: "",
attachmentSize: 0 attachmentSize: 0
}, },
organizationName: "", // 发起机构名称(多个机构拼接 organizationName: "", // 发起机构名称(多个机构拼接
organizationNameList: [''] //发起机构列表 organizationNameList: [""] //发起机构列表
}, },
attachmentModel:[ //基础信息的图片视频 attachmentModel: [
//基础信息的图片视频
{ {
attachmentExt: '',// 附件格式 attachmentExt: "", // 附件格式
attachmentName: '',//附件名称 attachmentName: "", //附件名称
attachmentSize:'',//附件大小, attachmentSize: "", //附件大小,
attachmentType: 1,//1:图片 2:视频 3:pdf attachmentType: 1, //1:图片 2:视频 3:pdf
attachmentUrl: '',//附件链接 attachmentUrl: "", //附件链接
id: '', //关联唯一ID id: "", //关联唯一ID
kind: 1, //1:列表图片 2:封面配置 3:附件配置 kind: 1, //1:列表图片 2:封面配置 3:附件配置
openTemplateId: ''//开放模板id openTemplateId: "" //开放模板id
}, },
{ {
attachmentExt: '',// 附件格式 attachmentExt: "", // 附件格式
attachmentName: '',//附件名称 attachmentName: "", //附件名称
attachmentSize:'',//附件大小, attachmentSize: "", //附件大小,
attachmentType: 1,//1:图片 2:视频 3:pdf attachmentType: 1, //1:图片 2:视频 3:pdf
attachmentUrl: '',//附件链接 attachmentUrl: "", //附件链接
id: '', //关联唯一ID id: "", //关联唯一ID
kind: 1, //1:列表图片 2:封面配置 3:附件配置 kind: 1, //1:列表图片 2:封面配置 3:附件配置
openTemplateId: ''//开放模板id openTemplateId: "" //开放模板id
} }
], ],
pickerOptions0: { pickerOptions0: {
...@@ -279,7 +307,10 @@ export default { ...@@ -279,7 +307,10 @@ export default {
disabledDate: time => { disabledDate: time => {
return ( return (
// time.getTime() < new Date((vm.formData.projectBegintime).replace(/\-/g, '/')).getTime() || time.getTime() > new Date((vm.formData.projectBegintime).replace(/\-/g, '/')).getTime() + 1000 * 60 * 60 * 24 * vm.attachInfo.limitValue // time.getTime() < new Date((vm.formData.projectBegintime).replace(/\-/g, '/')).getTime() || time.getTime() > new Date((vm.formData.projectBegintime).replace(/\-/g, '/')).getTime() + 1000 * 60 * 60 * 24 * vm.attachInfo.limitValue
time.getTime() < new Date(vm.formData.projectBegintime).getTime() || time.getTime() > new Date(vm.formData.projectBegintime).getTime() + 1000 * 60 * 60 * 24 * vm.attachInfo.limitValue time.getTime() < new Date(vm.formData.projectBegintime).getTime() ||
time.getTime() >
new Date(vm.formData.projectBegintime).getTime() +
1000 * 60 * 60 * 24 * vm.attachInfo.limitValue
); //减去一天的时间代表可以选择同一天; ); //减去一天的时间代表可以选择同一天;
} }
}, },
...@@ -320,11 +351,11 @@ export default { ...@@ -320,11 +351,11 @@ export default {
disabled: true, disabled: true,
dialogObj: { dialogObj: {
visible: false, visible: false,
title: '该项目模版已下架', title: "该项目模版已下架",
tip: '', tip: "",
message: '模版已下架,请重新选择其他项目模版', message: "模版已下架,请重新选择其他项目模版",
confirmMsg: '取消', confirmMsg: "取消",
hideMsg: '重新选择' hideMsg: "重新选择"
}, },
isPreview: 0, isPreview: 0,
attachInfo: { attachInfo: {
...@@ -334,49 +365,49 @@ export default { ...@@ -334,49 +365,49 @@ export default {
}, },
creatorOrganizationName: "云鹊医", creatorOrganizationName: "云鹊医",
limitKind: 1, limitKind: 1,
limitValue: 90, limitValue: 90
}, },
attachMap: { attachMap: {
1: [], 1: [],
2: [] 2: []
}, }
} };
}, },
computed: { computed: {
...mapGetters(['cartList']), ...mapGetters(["cartList"])
}, },
components: { components: {
dialogComponet:dialog, dialogComponet: dialog,
SortedCart SortedCart
}, },
created() { created() {
vm = this; vm = this;
vm.isPreview = vm.$route.query.isPreview ? vm.$route.query.isPreview : 0; vm.isPreview = vm.$route.query.isPreview ? vm.$route.query.isPreview : 0;
vm.getMessage();
// 编辑时 // 编辑时
if (vm.editor) { if (vm.editor) {
vm.disabled = false; vm.disabled = false;
vm.getEditorMessage() vm.getMessage(vm.editor);
// 创建时 // vm.getEditorMessage();
} else{ // 创建时
} else {
vm.disabled = true; vm.disabled = true;
// vm.getMessage(); vm.getMessage(false);
} }
}, },
methods: { methods: {
...mapActions(['setCartList']), ...mapActions(["setCartList"]),
// 选择列表或封面图片 // 选择列表或封面图片
selectedAttachUrl(item, index) { selectedAttachUrl(attachmentUrl, index, isClick = true) {
// 查看状态,不可重新选择 // 查看状态,不可重新选择
if( vm.isPreview == 1) return; if (isClick && vm.isPreview == 1) return;
this.attachInfo.attachMap[index].forEach( attach => { this.attachInfo.attachMap[index].forEach(attach => {
if(item.attachmentUrl == attach.attachmentUrl) { if (attachmentUrl == attach.attachmentUrl) {
attach.checked = true; attach.checked = true;
} else { } else {
attach.checked = false; attach.checked = false;
} }
}) });
vm.formData['attachmentUrl' + index] = item.attachmentUrl; vm.formData["attachmentUrl" + index] = attachmentUrl;
vm.$forceUpdate(); vm.$forceUpdate();
}, },
...@@ -387,77 +418,56 @@ export default { ...@@ -387,77 +418,56 @@ export default {
vm.formData = Object.assign(vm.formData, data.projectData); vm.formData = Object.assign(vm.formData, data.projectData);
vm.formData.attachmentUrl1 = data.attachmentData[0].attachmentUrl; vm.formData.attachmentUrl1 = data.attachmentData[0].attachmentUrl;
vm.formData.attachmentMore1 = Object.assign(vm.formData.attachmentMore1, data.attachmentData[0]); vm.selectedAttachUrl(data.attachmentData[0].attachmentUrl, 1, false);
vm.formData.attachmentMore1 = Object.assign( vm.formData.attachmentMore1, data.attachmentData[0]);
// 暂存为1 下一步为3 // 暂存为1 下一步为3
vm.formData.projectType = vm.formData.projectType == 0 ? 4 : vm.formData.projectType; vm.formData.projectType = vm.formData.projectType == 0 ? 4 : vm.formData.projectType;
vm.formData.projectBegintime = vm.formData.projectBegintime ? new Date(vm.formData.projectBegintime) : ''; vm.formData.projectBegintime = vm.formData.projectBegintime ? new Date(vm.formData.projectBegintime) : "";
vm.formData.projectEndtime = vm.formData.projectBegintime ? new Date(vm.formData.projectEndtime) : ''; vm.formData.projectEndtime = vm.formData.projectBegintime ? new Date(vm.formData.projectEndtime) : "";
if (data.attachmentData[1]) { if (data.attachmentData[1]) {
vm.formData.attachmentUrl2 = data.attachmentData[1].attachmentUrl; let attachmentUrl2 = data.attachmentData[1].attachmentUrl;
vm.selectedAttachUrl(attachmentUrl2, 2, false);
vm.formData.attachmentUrl2 = attachmentUrl2;
vm.formData.type = data.attachmentData[1].attachmentType; vm.formData.type = data.attachmentData[1].attachmentType;
vm.formData.attachmentMore2 = Object.assign(vm.formData.attachmentMore2, data.attachmentData[1]); vm.formData.attachmentMore2 = Object.assign(vm.formData.attachmentMore2, data.attachmentData[1]);
} }
// 将所有课程设置到购物车中 // 将所有课程设置到购物车中
console.log(data.hotCourseForPortalModelList.slice())
vm.setCartList(data.hotCourseForPortalModelList.slice()); vm.setCartList(data.hotCourseForPortalModelList.slice());
// 不知道是否要使用 // 不知道是否要使用
// vm.$emit('setStatus4Flag',data.projectData.status4Flag) // vm.$emit('setStatus4Flag',data.projectData.status4Flag)
}, },
// // 设置已有的基本信息
// setBaseMessage(data) {
// data.projectData.projectBegintime = convertTime(data.projectData.projectBegintime);
// data.projectData.projectEndtime = convertTime(data.projectData.projectEndtime);
// vm.formData = Object.assign(vm.formData, data.projectData);
// vm.formData.attachmentUrl1 = data.attachmentData[0].attachmentUrl;
// vm.formData.attachmentMore1 = Object.assign(vm.formData.attachmentMore1, data.attachmentData[0]);
// // 暂存为1 下一步为3
// vm.formData.projectType = vm.formData.projectType == 0 ? 3 : vm.formData.projectType;
// vm.formData.projectBegintime = vm.formData.projectBegintime ? new Date(vm.formData.projectBegintime) : '';
// vm.formData.projectEndtime = vm.formData.projectBegintime ? new Date(vm.formData.projectEndtime) : '';
// if (data.attachmentData[1]) {
// vm.formData.attachmentUrl2 = data.attachmentData[1].attachmentUrl;
// vm.formData.type = data.attachmentData[1].attachmentType;
// vm.formData.attachmentMore2 = Object.assign(vm.formData.attachmentMore2, data.attachmentData[1]);
// }
// vm.$emit('setStatus4Flag',data.projectData.status4Flag)
// },
// 创建时,获取机构信息、列表图片等 // 创建时,获取机构信息、列表图片等
getMessage() { getMessage(isEdit = false) {
openLoading(vm); openLoading(vm);
vm.GET(`portal/portalInfo/sass/attach`, {typeList: [1,2]}) vm.GET(`portal/portalInfo/sass/attach`, { typeList: [1, 2] })
.then(res => { .then(res => {
closeLoading(vm); closeLoading(vm);
if (res.code == "000000") { if (res.code == "000000") {
this.attachInfo = res.data; this.attachInfo = res.data;
this.attachInfo.attachMap[1].forEach(item => { this.attachInfo.attachMap[1].forEach(item => {
item.checked = false; item.checked = false;
}); });
this.attachInfo.attachMap[2].forEach(item => { this.attachInfo.attachMap[2].forEach(item => {
item.checked = false; item.checked = false;
}); });
this.formData.attachmentUrl1 = this.attachInfo.attachMap[1][0].attachmentUrl; this.formData.attachmentUrl1 = this.attachInfo.attachMap[1][0].attachmentUrl;
this.formData.attachmentUrl2 = this.attachInfo.attachMap[2][0].attachmentUrl; this.formData.attachmentUrl2 = this.attachInfo.attachMap[2][0].attachmentUrl;
this.formData.creatorOrganizationName = this.attachInfo.creatorOrganizationName || ''; this.formData.creatorOrganizationName = this.attachInfo.creatorOrganizationName || "";
this.attachInfo.attachMap[1][0].checked = true; this.attachInfo.attachMap[1][0].checked = true;
this.attachInfo.attachMap[2][0].checked = true; this.attachInfo.attachMap[2][0].checked = true;
console.log('this.attachInfo', this.attachInfo); if(isEdit) {
// let data = res.data; vm.getEditorMessage();
// data.projectData.organizationNameList = [data.projectData.creatorOrganizationName] }
// this.$emit('hideSave',res.data.projectData.projectStatus)
// vm.setBaseMessage(res.data);
} else { } else {
vm.$message.info(res.message); vm.$message.info(res.message);
} }
}) })
.catch((err) => { .catch(err => {
closeLoading(vm); closeLoading(vm);
vm.$message.warning('请稍后重试'); vm.$message.warning("请稍后重试");
}); });
}, },
// 获取选择模板后的基本信息 // 获取选择模板后的基本信息
// getMessage() { // getMessage() {
...@@ -483,26 +493,25 @@ export default { ...@@ -483,26 +493,25 @@ export default {
// 获取编辑时的信息 // 获取编辑时的信息
getEditorMessage() { getEditorMessage() {
openLoading(vm); openLoading(vm);
// vm.GET(`portal/portalInfo/getProjectInfo/${vm.projectId}`)
vm.GET(`portal/portalCustom/getInfo/${vm.projectId}`) vm.GET(`portal/portalCustom/getInfo/${vm.projectId}`)
.then(res => { .then(res => {
closeLoading(vm); closeLoading(vm);
if (res.code == "000000") { if (res.code == "000000") {
// this.$emit('hideSave',res.data.projectData.projectStatus) // this.$emit('hideSave',res.data.projectData.projectStatus)
vm.setBaseMessage(res.data) vm.setBaseMessage(res.data);
} else { } else {
vm.$message.info(res.message); vm.$message.info(res.message);
} }
}) })
.catch((err) => { .catch(err => {
closeLoading(vm); closeLoading(vm);
vm.$message.warning('请稍后重试'); vm.$message.warning("请稍后重试");
}); });
}, },
// 增加发起机构 // 增加发起机构
plusOrg(index) { plusOrg(index) {
vm.formData.organizationNameList.splice(index + 1, 0, ''); vm.formData.organizationNameList.splice(index + 1, 0, "");
}, },
// 删除发起机构 // 删除发起机构
...@@ -517,7 +526,7 @@ export default { ...@@ -517,7 +526,7 @@ export default {
vm.visibleName = textLength == 0; vm.visibleName = textLength == 0;
}, },
// 离开机构名称焦点 // 离开机构名称焦点
blurName() { blurName() {
vm.visibleName = false; vm.visibleName = false;
setTimeout(() => { setTimeout(() => {
...@@ -539,12 +548,14 @@ export default { ...@@ -539,12 +548,14 @@ export default {
// 机构选择默认值 // 机构选择默认值
checkDefault() { checkDefault() {
vm.organizationContent = vm.formData.creatorOrganizationName; vm.organizationContent = vm.formData.creatorOrganizationName;
vm.formData.organizationNameList.splice(vm.orgListIndex-1, 1, vm.organizationContent); vm.formData.organizationNameList.splice(
vm.orgListIndex - 1,
1,
vm.organizationContent
);
vm.visibleName = false; vm.visibleName = false;
}, },
// getFilePath(file, null), // getFilePath(file, null),
// "preview4", // "preview4",
// "progress1", // "progress1",
...@@ -639,8 +650,8 @@ export default { ...@@ -639,8 +650,8 @@ export default {
nextStep() { nextStep() {
let flag = true; let flag = true;
if (!vm.formData.attachmentUrl1) { if (!vm.formData.attachmentUrl1) {
vm.uploadImgMessage = true; vm.uploadImgMessage = true;
flag = false; flag = false;
} else { } else {
vm.uploadImgMessage = false; vm.uploadImgMessage = false;
} }
...@@ -650,35 +661,46 @@ export default { ...@@ -650,35 +661,46 @@ export default {
} else { } else {
vm.uploadImgMessage2 = false; vm.uploadImgMessage2 = false;
} }
if (vm.submitForm('formData') && flag) { if (vm.submitForm("formData") && flag) {
vm.insertOrupdate(); vm.insertOrupdate();
} }
}, },
// 暂存 // 暂存
save() { save() {
if (vm.$refs['formData'].projectName == '') { if (vm.$refs["formData"].projectName == "") {
vm.$refs['formData'].validateField('projectName') vm.$refs["formData"].validateField("projectName");
} else { } else {
vm.insertOrupdate(1); vm.insertOrupdate(1);
}; }
}, },
// 新增或者更新基本信息 // 新增或者更新基本信息
insertOrupdate(status) { insertOrupdate(status) {
if (
if(new Date(vm.formData.projectEndtime).getTime() > new Date(vm.formData.projectBegintime).getTime() + 1000 * 60 * 60 * 24 * vm.attachInfo.limitValue) { new Date(vm.formData.projectEndtime).getTime() >
vm.$message.warning('项目结束时间应在有效期内'); new Date(vm.formData.projectBegintime).getTime() +
1000 * 60 * 60 * 24 * vm.attachInfo.limitValue
) {
vm.$message.warning("项目结束时间应在有效期内");
return; return;
} }
if(new Date(vm.formData.projectEndtime).getTime() <= new Date(vm.formData.projectBegintime).getTime()) { if (
vm.$message.warning('项目结束时间应大于开始时间'); new Date(vm.formData.projectEndtime).getTime() <=
new Date(vm.formData.projectBegintime).getTime()
) {
vm.$message.warning("项目结束时间应大于开始时间");
return; return;
} }
vm.formData.projectBegintime = convertTime(
vm.formData.projectBegintime = convertTime(vm.formData.projectBegintime, false); vm.formData.projectBegintime,
vm.formData.projectEndtime = convertTime(vm.formData.projectEndtime, false); false
);
vm.formData.projectEndtime = convertTime(
vm.formData.projectEndtime,
false
);
if (status) { if (status) {
vm.formData.projectStatus = status; vm.formData.projectStatus = status;
} }
...@@ -687,15 +709,21 @@ export default { ...@@ -687,15 +709,21 @@ export default {
vm.formData.attachmentMore2.attachmentUrl = vm.formData.attachmentUrl2; vm.formData.attachmentMore2.attachmentUrl = vm.formData.attachmentUrl2;
// 封面类型 // 封面类型
vm.formData.attachmentMore2.attachmentType = vm.formData.type; vm.formData.attachmentMore2.attachmentType = vm.formData.type;
vm.formData.attachmentMore2.kind = 2; vm.formData.attachmentMore2.kind = 2;
//整合图片视频 //整合图片视频
vm.attachmentModel[0] = Object.assign(vm.attachmentModel[0],vm.formData.attachmentMore1); vm.attachmentModel[0] = Object.assign(
vm.attachmentModel[1] = Object.assign(vm.attachmentModel[1],vm.formData.attachmentMore2); vm.attachmentModel[0],
vm.formData.attachmentMore1
);
vm.attachmentModel[1] = Object.assign(
vm.attachmentModel[1],
vm.formData.attachmentMore2
);
let baseobj = {}; let baseobj = {};
baseobj.projectModel = JSON.stringify(vm.formData); baseobj.projectModel = JSON.stringify(vm.formData);
baseobj.attachmentModel = JSON.stringify(vm.attachmentModel); baseobj.attachmentModel = JSON.stringify(vm.attachmentModel);
baseobj.attachmentPDFModel= null; baseobj.attachmentPDFModel = null;
baseobj.notifyData= null; baseobj.notifyData = null;
baseobj.hotCourseForPortalModelList = vm.cartList; baseobj.hotCourseForPortalModelList = vm.cartList;
console.log(baseobj); console.log(baseobj);
openLoading(vm); openLoading(vm);
...@@ -705,25 +733,25 @@ export default { ...@@ -705,25 +733,25 @@ export default {
if (res.code == "000000") { if (res.code == "000000") {
// 暂存不会跳到下一页 // 暂存不会跳到下一页
if (status == 1) { if (status == 1) {
vm.$message.info('成功'); vm.$message.info("成功");
return; return;
} }
// 下一步,并将项目id传递给父组件 // 下一步,并将项目id传递给父组件
vm.$emit('next',res.data.id); vm.$emit("next", res.data.id);
} else if (res.code == "213061") { } else if (res.code == "213061") {
vm.dialogObj.visible = true; vm.dialogObj.visible = true;
} else { } else {
vm.$message.warning(res.message); vm.$message.warning(res.message);
} }
}) })
.catch((err) => { .catch(err => {
vm.$message({ vm.$message({
type: "warning", type: "warning",
message: res.message message: res.message
}); });
}) });
}, },
//表单校验 //表单校验
submitForm(formName) { submitForm(formName) {
let flag = null; let flag = null;
vm.$refs[formName].validate(valid => { vm.$refs[formName].validate(valid => {
...@@ -742,219 +770,216 @@ export default { ...@@ -742,219 +770,216 @@ export default {
// 确定 // 确定
hide() { hide() {
vm.dialogObj.visible = false; vm.dialogObj.visible = false;
vm.$emit('backSelectVue') vm.$emit("backSelectVue");
} }
} }
} };
</script> </script>
<style > <style >
.subject-slelct .el-input__inner { .subject-slelct .el-input__inner {
height: 32px;
line-height: 32px;
}
</style>
<style lang="scss" scoped>
.base-message-wrap {
padding-top: 80px;
.p_label {
margin-left: 56px;
font-size: 12px;
color: #606266;
}
.edit-img {
width: 20px;
height: 20px;
vertical-align: middle;
margin-left: 10px;
}
.day-btn {
display: inline-block;
width: 50px;
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
background: #838683;
text-align: center;
margin-left: -3px;
border-radius: 0 4px 4px 0;
z-index: 100;
} }
</style> .basic-item-icon {
<style lang="scss" scoped> position: relative;
.require {
.base-message-wrap { position: absolute;
padding-top: 80px; left: 67px;
.p_label { top: 11px;
margin-left: 56px; color: #f56c6c;
font-size: 12px;
color: #606266;
}
.edit-img {
width: 20px;
height: 20px;
vertical-align: middle;
margin-left: 10px;
}
.day-btn {
display: inline-block;
width: 50px;
height: 32px;
line-height: 32px;
background: #838683;
text-align: center;
margin-left: -3px;
border-radius: 0 4px 4px 0;
z-index: 100;
}
.basic-item-icon {
position: relative;
.require {
position: absolute;
left: 67px;
top: 11px;
color: #f56c6c;
}
.upload-message {
position: absolute;
left: 160px;
top: 105px;
font-size: 12px;
color: #f56c6c;
}
.img-delete {
position: absolute;
left: 0px;
top: 0px;
width: 84px;
height: 100px;
background: #000;
opacity: 0.7;
z-index: 999;
i {
color: #fff;
margin-top: 39px;
margin-left: 0px;
}
}
} }
.word-num { .upload-message {
position: absolute;
left: 160px;
top: 105px;
font-size: 12px; font-size: 12px;
color: #999; color: #f56c6c;
padding-top: 5px;
} }
.line { .img-delete {
margin-left: 10px; position: absolute;
width: 20px; left: 0px;
} top: 0px;
.bg-uploader { width: 84px;
img { height: 100px;
float: left; background: #000;
} opacity: 0.7;
.bg-img { z-index: 999;
width: 84px; i {
height: 100px; color: #fff;
} margin-top: 39px;
.bg-video { margin-left: 0px;
float: left;
width: 84px;
height: 100px;
}
.limit-text {
float: left;
margin-left: 10px;
margin-top: -10px;
p {
font-size: 12px;
color: #999;
}
} }
} }
.el-upload__tip { }
position: absolute; .word-num {
top: -6px; font-size: 12px;
left: 130px; color: #999;
padding-top: 5px;
}
.line {
margin-left: 10px;
width: 20px;
}
.bg-uploader {
img {
float: left;
} }
.choose-button { .bg-img {
background: #fff; width: 84px;
color: #409eff; height: 100px;
border: 1px solid #409eff;
} }
.el-popover--plain { .bg-video {
padding: 18px 20px; float: left;
top: 40px; width: 84px;
height: 100px;
} }
.ueitem { .limit-text {
position: relative; float: left;
margin-left: 10px;
margin-top: -10px;
p {
font-size: 12px;
color: #999;
}
} }
.ue-warp {
position: absolute;
width: 80%;
height: 100%;
background: #F5F7FA;
opacity: 0.5;
top: 0;
z-index: 1000;
}
} }
.el-form-item__content { .el-upload__tip {
width: 100%; position: absolute;
top: -6px;
left: 130px;
}
.choose-button {
background: #fff;
color: #409eff;
border: 1px solid #409eff;
}
.el-popover--plain {
padding: 18px 20px;
top: 40px;
}
.ueitem {
position: relative;
}
.ue-warp {
position: absolute;
width: 80%;
height: 100%; height: 100%;
background: red; background: #f5f7fa;
opacity: 0.5;
top: 0;
z-index: 1000;
} }
.popover-content { }
position: relative; .el-form-item__content {
top: 0; width: 100%;
left: 0; height: 100%;
} background: red;
.time-message { }
margin: -6px 0 20px 150px; .popover-content {
font-size: 14px; position: relative;
top: 0;
left: 0;
}
.time-message {
margin: -6px 0 20px 150px;
font-size: 14px;
}
.url1-selected {
img {
widows: 120px;
height: 90px;
} }
.url1-selected { }
img {
widows: 120px;
height: 90px;
}
}
.url1-list { .url1-list {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
.img-wrapper { .img-wrapper {
position: relative; position: relative;
top: 0; top: 0;
left: 0; left: 0;
z-index: 1; z-index: 1;
.selected-icon { .selected-icon {
width: 60px; width: 60px;
height: 45px; height: 45px;
margin-right: 10px; margin-right: 10px;
}
.status-icon {
position: absolute;
top: 5px;
right: 15px;
z-index: 2;
widows: 14px;
height: 14px;
}
} }
} .status-icon {
position: absolute;
.url2-selected { top: 5px;
img { right: 15px;
width: 160px; z-index: 2;
height: 90px; widows: 14px;
} height: 14px;
}
.url2-list {
display: flex;
flex-direction: row;
.img-wrapper {
position: relative;
top: 0;
left: 0;
z-index: 1;
.selected-icon {
width: 80px;
height: 45px;
margin-right: 10px;
}
.status-icon {
position: absolute;
top: 5px;
right: 15px;
z-index: 2;
widows: 14px;
height: 14px;
}
} }
} }
.curt-position-wrapper { }
.url2-selected {
img {
width: 160px;
height: 90px;
}
}
.url2-list {
display: flex;
flex-direction: row;
.img-wrapper {
position: relative; position: relative;
top: 0; top: 0;
left: 0; left: 0;
z-index: 100; z-index: 1;
.curt-position { .selected-icon {
width: 80px;
height: 45px;
margin-right: 10px;
}
.status-icon {
position: absolute; position: absolute;
top: 0; top: 5px;
left: 0; right: 15px;
z-index: 101; z-index: 2;
widows: 14px;
height: 14px;
} }
} }
}
.curt-position-wrapper {
position: relative;
top: 0;
left: 0;
z-index: 100;
.curt-position {
position: absolute;
top: 0;
left: 0;
z-index: 101;
}
}
</style> </style>
\ No newline at end of file
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
return {}; return {};
}, },
props: { props: {
isPreview: String isPreview: String | Number
}, },
computed: { computed: {
cartList: { cartList: {
......
...@@ -13,6 +13,7 @@ const customStore = { ...@@ -13,6 +13,7 @@ const customStore = {
courseList: [], courseList: [],
allLabelList: [], allLabelList: [],
subLabelList: [], subLabelList: [],
courseLimitCount: -1 // -1: 不限制; 其它值: 限制的个数
}, },
mutations: { mutations: {
SET_SEARCH_PARAM: (state, searchParam) => { SET_SEARCH_PARAM: (state, searchParam) => {
...@@ -29,6 +30,9 @@ const customStore = { ...@@ -29,6 +30,9 @@ const customStore = {
}, },
SET_SUB_LABEL_LIST: (state, subLabelList) => { SET_SUB_LABEL_LIST: (state, subLabelList) => {
state.subLabelList = subLabelList; state.subLabelList = subLabelList;
},
SET_COURSE_LIMIT_COUNT: (state, courseLimitCount) => {
state.courseLimitCount = courseLimitCount;
}, },
}, },
actions: { actions: {
...@@ -46,6 +50,9 @@ const customStore = { ...@@ -46,6 +50,9 @@ const customStore = {
}, },
setSubLabelList({ commit }, subLabelList) { setSubLabelList({ commit }, subLabelList) {
commit('SET_SUB_LABEL_LIST', subLabelList); commit('SET_SUB_LABEL_LIST', subLabelList);
},
setCourseLimitCount({ commit }, courseLimitCount) {
commit('SET_COURSE_LIMIT_COUNT', courseLimitCount);
}, },
} }
} }
......
...@@ -5,6 +5,7 @@ const getters = { ...@@ -5,6 +5,7 @@ const getters = {
courseList: state => state.customStore.courseList, courseList: state => state.customStore.courseList,
allLabelList: state => state.customStore.allLabelList, allLabelList: state => state.customStore.allLabelList,
subLabelList: state => state.customStore.subLabelList, subLabelList: state => state.customStore.subLabelList,
courseLimitCount: state => state.customStore.courseLimitCount,
} }
export default getters export default getters
...@@ -199,7 +199,8 @@ export default { ...@@ -199,7 +199,8 @@ export default {
"setCartList", "setCartList",
"setCourseList", "setCourseList",
"setAllLabelList", "setAllLabelList",
"setSubLabelList" "setSubLabelList",
"setCourseLimitCount",
]), ]),
initPageParams() { initPageParams() {
...@@ -217,10 +218,20 @@ export default { ...@@ -217,10 +218,20 @@ export default {
this.setAllLabelList([]); this.setAllLabelList([]);
this.setSubLabelList([]); this.setSubLabelList([]);
this.courseLimitCount();
this.getLabelList(); this.getLabelList();
this.getCourseList(searchParam); this.getCourseList(searchParam);
}, },
// 自定义项目--选择课程个数限制(-1表示不限制)
courseLimitCount() {
vm.GET("portal/portalCustom/courseLimitCount", {}).then(res => {
if (res.code == "000000") {
this.setCourseLimitCount(res.data);
}
});
},
getLabelList() { getLabelList() {
vm.GET("contents/diseases/labelList", {}).then(res => { vm.GET("contents/diseases/labelList", {}).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
...@@ -260,9 +271,16 @@ export default { ...@@ -260,9 +271,16 @@ export default {
getCourseList(searchParam) { getCourseList(searchParam) {
vm.GET("contents/diseases/courseListForPortal", searchParam).then(res => { vm.GET("contents/diseases/courseListForPortal", searchParam).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
let courseList = res.data; let courseList = res.data, cartIndex = -1;
courseList.list.forEach(item => { courseList.list.forEach(item => {
item.checked = false; cartIndex = vm.cartList.findIndex( current => {
return current.courseId == item.courseId;
})
if(cartIndex >= 0) {
item.checked = true;
} else {
item.checked = false;
}
}); });
this.setCourseList(courseList); this.setCourseList(courseList);
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册