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

解决验证问题

上级 da6b7cfb
<!--基础信息-->
<template>
<div class="base-message-wrap">
<el-form ref="formData" :model="formData" :rules="rules" label-width="150px" class="basic-form">
<el-form-item label="项目名称:" prop="projectName">
<el-col :span="13">
<el-input
size="small"
v-model="formData.projectName"
placeholder="请输入项目名称"
style="width:70%;"
ref="projectName"
maxlength="24"
:disabled="isPreview==1"
></el-input>
<span class="word-num">{{(formData.projectName).replace(/\s+/g,"").length}}/24</span>
</el-col>
<el-col :span="10" class="curt-position-wrapper">
<div class="curt-position">
<SortedCart :isPreview="isPreview"></SortedCart>
</div>
</el-col>
</el-form-item>
<el-form-item label="发起机构名称:">
<el-col :span="13" v-for="(item, index) in formData.organizationNameList" :key="index">
<el-input
size="small"
v-model="formData.organizationNameList[index]"
placeholder="请输入发起机构名称"
style="width:70%;"
maxlength="16"
@input="changeOrganizationName"
@blur="blurName"
@focus="focusName(index)"
:disabled="isPreview==1"
></el-input>
<span
class="word-num"
>{{(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-popover
v-if="formData.creatorOrganizationName"
class="popover-content"
:style="{'top': orgListIndex * 41 + 'px'}"
placement="bottom"
:content="organizationContent"
v-model="visibleName"
@click="checkDefault"
>
<p @click="checkDefault">我的机构: {{ formData.creatorOrganizationName }}</p>
</el-popover>
</el-form-item>
<div>
<el-form-item label="项目时间:" required>
<el-col :span="5">
<el-form-item prop="projectBegintime">
<el-date-picker
v-model="formData.projectBegintime"
size="small"
type="datetime"
placeholder="请选择开始时间"
value-format="yyyy/MM/dd HH:mm:ss"
format="yyyy/MM/dd HH:mm:ss"
:picker-options="pickerOptions0"
style="width: 100%;"
:disabled="formData.status4Flag == 1 || isPreview==1"
></el-date-picker>
</el-form-item>
</el-col>
<el-col class="line" :span="1">~</el-col>
<el-col :span="5">
<el-form-item label prop="projectEndtime">
<el-date-picker
v-model="formData.projectEndtime"
size="small"
type="datetime"
placeholder="请选择结束时间"
value-format="yyyy/MM/dd HH:mm:ss"
format="yyyy/MM/dd HH:mm:ss"
:picker-options="pickerOptions1"
default-time="00:00:00"
style="width: 100%;"
:disabled="isPreview==1"
></el-date-picker>
</el-form-item>
</el-col>
</el-form-item>
<p class="time-message">
<i class="el-icon-warning-outline"></i>
项目有效期为{{attachInfo.limitValue}}天,选择项目起止时间须在有效期内
</p>
</div>
<el-form-item label="列表图片:" style="margin-bottom: 10px">
<el-col :span="13" style="height:95px">
<div class="url1-selected">
<img :src="formData.attachmentUrl1" alt />
</div>
</el-col>
<el-col :span="13" style="height:95px">
<div style="color:#666666;font-size:14px;">从模版中选择其他列表图片</div>
<ul class="url1-list">
<li
class="img-wrapper"
v-for="(item, index) in attachInfo.attachMap[1]"
:key="index"
@click="selectedAttachUrl(item.attachmentUrl, 1)"
>
<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
class="status-icon"
v-show="!item.checked"
src="../../../assets/custom/icon/icon-select-no.png"
alt
/>
</li>
</ul>
</el-col>
</el-form-item>
<el-form-item label="封面类型:">
<el-radio-group size="small" v-model="formData.type" disabled>
<el-radio :label="1">图片</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="封面文件:" style="margin-bottom: 10px">
<el-col :span="13" style="height: 95px">
<div class="url2-selected">
<img :src="formData.attachmentUrl2" alt />
</div>
</el-col>
<el-col :span="13" style="height:95px">
<div style="color:#666666;font-size:14px;">从模版中选择其他封面图片</div>
<ul class="url2-list">
<li
class="img-wrapper"
v-for="(item, index) in attachInfo.attachMap[2]"
:key="index"
@click="selectedAttachUrl(item.attachmentUrl, 2)"
>
<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
class="status-icon"
v-show="!item.checked"
src="../../../assets/custom/icon/icon-select-no.png"
alt
/>
</li>
</ul>
</el-col>
</el-form-item>
<el-form-item label="项目简介:" prop="projectIntro">
<el-col :span="13">
<el-input
size="small"
type="textarea"
:autosize="{ minRows: 5}"
placeholder="请输入项目简介"
v-model="formData.projectIntro"
style="width:83%;"
:disabled="isPreview==1"
></el-input>
<span class="word-num">{{(formData.projectIntro).replace(/\s+/g,"").length}}/200</span>
</el-col>
</el-form-item>
</el-form>
<dialog-componet :dialogObj="dialogObj" @confirm="confirm" @hide="hide"></dialog-componet>
</div>
</template>
<script>
import { doUpload, getFilePath } from "../../../utils/qiniu-util";
import { openLoading, closeLoading } from "../../../utils/utils";
import SortedCart from "@/components/education/custom/sorted-cart";
import { convertTime } from "../../../utils";
import dialog from "./dialog";
import { mapGetters, mapActions } from "vuex";
let vm = null;
export default {
props: {
openTemplateId: {
type: String | Number,
default: ""
},
projectId: {
type: String | Number,
default: ""
},
editor: {
type: Boolean,
default: false
}
},
data() {
let checkProjectStr = (rule, value, callback) => {
if (value.indexOf("\\") != -1) {
//存在
callback(new Error("请勿输入字符“ \\ "));
} else if (value.indexOf(".") != -1) {
callback(new Error("请勿输入字符“ . "));
} else {
callback();
}
};
let checkUserTime = (rule, value, callback) => {
if (value > 1000 || value < 1) {
callback(new Error("输入长度为1-1000的有效期"));
} else {
callback();
}
};
return {
visibleName: false, //是否显示机构提示
orgListIndex: 1,
organizationContent: "", //机构名称
formData: {
id: "", //项目 id 26
projectName: "", //开放模板名称
projectBegintime: "", //模板开始时间
projectEndtime: "", //模板结束时间
projectIntro: "", //开放模板简介
projectType: 4, //类型
type: 1, //封面类型 1图片2视频
projectStatus: 1, //1.草稿 2.未上架 3.审核中/待审核 4.已上架 5.已下架 6.已拒绝/未上架
expireDay: 90, //模板有效期(天)
status4Flag: 0, //0表示没有上过架,1表示上过架
attachmentUrl1: "",
attachmentUrl2: "",
attachmentMore1: {
attachmentExt: "",
attachmentName: "",
attachmentSize: 0
},
attachmentMore2: {
attachmentExt: "",
attachmentName: "",
attachmentSize: 0
},
organizationName: "", // 发起机构名称(多个机构拼接
organizationNameList: [""] //发起机构列表
},
attachmentModel: [
//基础信息的图片视频
{
attachmentExt: "", // 附件格式
attachmentName: "", //附件名称
attachmentSize: "", //附件大小,
attachmentType: 1, //1:图片 2:视频 3:pdf
attachmentUrl: "", //附件链接
id: "", //关联唯一ID
kind: 1, //1:列表图片 2:封面配置 3:附件配置
openTemplateId: "" //开放模板id
},
{
attachmentExt: "", // 附件格式
attachmentName: "", //附件名称
attachmentSize: "", //附件大小,
attachmentType: 1, //1:图片 2:视频 3:pdf
attachmentUrl: "", //附件链接
id: "", //关联唯一ID
kind: 1, //1:列表图片 2:封面配置 3:附件配置
openTemplateId: "" //开放模板id
}
],
pickerOptions0: {
disabledDate: time => {
if (
vm.formData.projectEndtime != "" &&
vm.formData.projectEndtime != null
) {
return (
time.getTime() > new Date(vm.formData.projectEndtime).getTime()
);
}
}
},
pickerOptions1: {
disabledDate: time => {
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).getTime() ||
time.getTime() >
new Date(vm.formData.projectBegintime).getTime() +
1000 * 60 * 60 * 24 * vm.attachInfo.limitValue
); //减去一天的时间代表可以选择同一天;
}
},
imgMouseOver: false,
imgMouseOver2: false,
uploadImgMessage: false,
uploadImgMessage2: false,
rules: {
projectName: [
{ required: true, message: "请输入项目名称" },
{
min: 2,
max: 24,
message: "输入长度为2-24的内容,可包含中英文、数字及特殊符号",
trigger: "blur"
},
{ validator: checkProjectStr, trigger: "blur" }
],
projectBegintime: [
{
required: true,
message: "请选择时间",
trigger: "change"
}
],
projectEndtime: [
{
required: true,
message: "请选择时间",
trigger: "change"
}
],
projectIntro: [
{ required: true, message: "请填写项目简介", trigger: "blur" },
{ min: 1, max: 200, message: "超出可输入的最大长度", trigger: "blur" }
]
},
disabled: true,
dialogObj: {
visible: false,
title: "该项目模版已下架",
tip: "",
message: "模版已下架,请重新选择其他项目模版",
confirmMsg: "取消",
hideMsg: "重新选择"
},
isPreview: 0,
attachInfo: {
attachMap: {
1: [],
2: []
},
creatorOrganizationName: "云鹊医",
limitKind: 1,
limitValue: 90
},
attachMap: {
1: [],
2: []
}
};
},
computed: {
...mapGetters(["cartList"])
},
components: {
dialogComponet: dialog,
SortedCart
},
created() {
vm = this;
vm.isPreview = vm.$route.query.isPreview ? vm.$route.query.isPreview : 0;
// 编辑时
if (vm.editor) {
vm.disabled = false;
vm.getMessage(vm.editor);
// vm.getEditorMessage();
// 创建时
} else {
vm.disabled = true;
vm.getMessage(false);
}
},
methods: {
...mapActions(["setCartList"]),
// 选择列表或封面图片
selectedAttachUrl(attachmentUrl, index, isClick = true) {
// 查看状态,不可重新选择
if (isClick && vm.isPreview == 1) return;
this.attachInfo.attachMap[index].forEach(attach => {
if (attachmentUrl == attach.attachmentUrl) {
attach.checked = true;
} else {
attach.checked = false;
}
});
vm.formData["attachmentUrl" + index] = attachmentUrl;
vm.$forceUpdate();
},
// 设置已有的基本信息
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.selectedAttachUrl(data.attachmentData[0].attachmentUrl, 1, false);
vm.formData.attachmentMore1 = Object.assign( vm.formData.attachmentMore1, data.attachmentData[0]);
// 暂存为1 下一步为3
vm.formData.projectType = vm.formData.projectType == 0 ? 4 : 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]) {
let attachmentUrl2 = data.attachmentData[1].attachmentUrl;
vm.selectedAttachUrl(attachmentUrl2, 2, false);
vm.formData.attachmentUrl2 = attachmentUrl2;
vm.formData.type = data.attachmentData[1].attachmentType;
vm.formData.attachmentMore2 = Object.assign(vm.formData.attachmentMore2, data.attachmentData[1]);
}
// 将所有课程设置到购物车中
vm.setCartList(data.hotCourseForPortalModelList.slice());
// 不知道是否要使用
// vm.$emit('setStatus4Flag',data.projectData.status4Flag)
},
// 创建时,获取机构信息、列表图片等
getMessage(isEdit = false) {
openLoading(vm);
vm.GET(`portal/portalInfo/sass/attach`, { typeList: [1, 2] })
.then(res => {
closeLoading(vm);
if (res.code == "000000") {
this.attachInfo = res.data;
this.attachInfo.attachMap[1].forEach(item => {
item.checked = false;
});
this.attachInfo.attachMap[2].forEach(item => {
item.checked = false;
});
this.formData.attachmentUrl1 = this.attachInfo.attachMap[1][0].attachmentUrl;
this.formData.attachmentUrl2 = this.attachInfo.attachMap[2][0].attachmentUrl;
this.formData.creatorOrganizationName = this.attachInfo.creatorOrganizationName || "";
this.attachInfo.attachMap[1][0].checked = true;
this.attachInfo.attachMap[2][0].checked = true;
if(isEdit) {
vm.getEditorMessage();
}
} else {
vm.$message.info(res.message);
}
})
.catch(err => {
closeLoading(vm);
vm.$message.warning("请稍后重试");
});
},
// 获取选择模板后的基本信息
// getMessage() {
// openLoading(vm);
// vm.GET(`portal/openTemplateProject/getOpenTemplateInfoForCreate/${vm.openTemplateId}`)
// .then(res => {
// closeLoading(vm);
// if (res.code == "000000") {
// let data = res.data;
// data.projectData.organizationNameList = [data.projectData.creatorOrganizationName]
// this.$emit('hideSave',res.data.projectData.projectStatus)
// vm.setBaseMessage(res.data);
// } else {
// vm.$message.info(res.message);
// }
// })
// .catch((err) => {
// closeLoading(vm);
// vm.$message.warning('请稍后重试');
// });
// },
// 获取编辑时的信息
getEditorMessage() {
openLoading(vm);
vm.GET(`portal/portalCustom/getInfo/${vm.projectId}`)
.then(res => {
closeLoading(vm);
if (res.code == "000000") {
// this.$emit('hideSave',res.data.projectData.projectStatus)
vm.setBaseMessage(res.data);
} else {
vm.$message.info(res.message);
}
})
.catch(err => {
closeLoading(vm);
vm.$message.warning("请稍后重试");
});
},
// 增加发起机构
plusOrg(index) {
vm.formData.organizationNameList.splice(index + 1, 0, "");
},
// 删除发起机构
deleteOrg(index) {
vm.formData.organizationNameList.splice(index, 1);
},
// 机构名称输入
changeOrganizationName() {
let textLength = vm.formData.organizationName.length;
// 机构输入提示显示与否
vm.visibleName = textLength == 0;
},
// 离开机构名称焦点
blurName() {
vm.visibleName = false;
setTimeout(() => {
vm.submitForm("formData");
}, 200);
},
// 机构名称聚焦
focusName(index) {
let textLength = vm.formData.organizationNameList[index].length;
if (textLength == 0) {
vm.orgListIndex = index + 1;
vm.visibleName = true;
} else {
vm.visibleName = false;
}
},
// 机构选择默认值
checkDefault() {
vm.organizationContent = vm.formData.creatorOrganizationName;
vm.formData.organizationNameList.splice(
vm.orgListIndex - 1,
1,
vm.organizationContent
);
vm.visibleName = false;
},
// getFilePath(file, null),
// "preview4",
// "progress1",
// 1
// ).then(function(path) {
// closeLoading(vm);
// console.log(path);
// if (fileLimit.show == "uploadImgMessage") {
// vm.uploadImgMessage = false;
// } else if (fileLimit.show == "uploadImgMessage2") {
// vm.uploadImgMessage2 = false;
// }
// vm.formData[fileLimit.key] = path.fullPath;
// vm.formData[fileLimit.more] = {
// attachmentName: path.name,
// attachmentExt: path.ext,
// attachmentSize: path.size
// };
// vm.$message.success("上传成功");
// });
// }
// };
// };
// return isJPG && isLt2M;
// },
// // 删除图片
// deleteImg(type) {
// if (type == 1) {
// vm.formData.attachmentUrl1 = "";
// vm.imgMouseOver = false;
// } else {
// vm.formData.attachmentUrl2 = "";
// vm.imgMouseOver2 = false;
// }
// },
// //改变封面类型
// changeCover(radio) {
// vm.formData.attachmentUrl2 = "";
// },
// //上传封面图片
// beforeUploadCoverPic(file) {
// let fileLimit = {
// width: 750,
// height: 420,
// size: 2,
// sizeText: "2.0M",
// key: "attachmentUrl2",
// more: "attachmentMore2",
// show: "uploadImgMessage2"
// };
// if (vm.formData.type == 1) {
// vm.beforeAvatarUpload(file, fileLimit);
// } else {
// vm.beforeUploadMp4(file);
// }
// },
// //上传mp4
// beforeUploadMp4(file) {
// console.log(file);
// const isMP4 = file.type === "video/mp4";
// const isLt = file.size / 1024 / 1024 < 500;
// if (!isLt) {
// vm.$message.error("视频不符合规范,请根据规范上传视频");
// return;
// }
// if (!isMP4) {
// vm.$message.error("视频不符合规范,请根据规范上传视频");
// } else {
// openLoading(vm);
// doUpload(
// vm,
// file,
// getFilePath(file, null),
// "preview4",
// "progress1",
// ""
// ).then(function(path) {
// closeLoading(vm);
// console.log(path);
// vm.uploadImgMessage2 = false;
// vm.formData.attachmentUrl2 = path.fullPath;
// vm.$message.success("上传成功");
// });
// }
// },
// 点击下一步
nextStep() {
let flag = true;
if (!vm.formData.attachmentUrl1) {
vm.uploadImgMessage = true;
flag = false;
} else {
vm.uploadImgMessage = false;
}
if (!vm.formData.attachmentUrl2) {
vm.uploadImgMessage2 = true;
flag = false;
} else {
vm.uploadImgMessage2 = false;
}
if (vm.submitForm("formData") && flag) {
vm.insertOrupdate();
}
},
// 暂存
save() {
if (vm.$refs["formData"].projectName == "") {
vm.$refs["formData"].validateField("projectName");
} else {
vm.insertOrupdate(1);
}
},
// 新增或者更新基本信息
insertOrupdate(status) {
if (
new Date(vm.formData.projectEndtime).getTime() >
new Date(vm.formData.projectBegintime).getTime() +
1000 * 60 * 60 * 24 * vm.attachInfo.limitValue
) {
vm.$message.warning("项目结束时间应在有效期内");
return;
}
if (
new Date(vm.formData.projectEndtime).getTime() <=
new Date(vm.formData.projectBegintime).getTime()
) {
vm.$message.warning("项目结束时间应大于开始时间");
return;
}
vm.formData.projectBegintime = convertTime(
vm.formData.projectBegintime,
false
);
vm.formData.projectEndtime = convertTime(
vm.formData.projectEndtime,
false
);
if (status) {
vm.formData.projectStatus = status;
}
// 图片或者视频地址
vm.formData.attachmentMore1.attachmentUrl = vm.formData.attachmentUrl1;
vm.formData.attachmentMore2.attachmentUrl = vm.formData.attachmentUrl2;
// 封面类型
vm.formData.attachmentMore2.attachmentType = vm.formData.type;
vm.formData.attachmentMore2.kind = 2;
//整合图片视频
vm.attachmentModel[0] = Object.assign(
vm.attachmentModel[0],
vm.formData.attachmentMore1
);
vm.attachmentModel[1] = Object.assign(
vm.attachmentModel[1],
vm.formData.attachmentMore2
);
let baseobj = {};
baseobj.projectModel = JSON.stringify(vm.formData);
baseobj.attachmentModel = JSON.stringify(vm.attachmentModel);
baseobj.attachmentPDFModel = null;
baseobj.notifyData = null;
baseobj.hotCourseForPortalModelList = vm.cartList;
console.log(baseobj);
openLoading(vm);
vm.POST("portal/portalCustom/insertOrUpdate", baseobj)
.then(res => {
closeLoading(vm);
if (res.code == "000000") {
// 暂存不会跳到下一页
if (status == 1) {
vm.$message.info("成功");
return;
}
// 下一步,并将项目id传递给父组件
vm.$emit("next", res.data.id);
} else if (res.code == "213061") {
vm.dialogObj.visible = true;
} else {
vm.$message.warning(res.message);
}
})
.catch(err => {
vm.$message({
type: "warning",
message: res.message
});
});
},
//表单校验
submitForm(formName) {
let flag = null;
vm.$refs[formName].validate(valid => {
if (valid) {
flag = true;
} else {
flag = false;
}
});
return flag;
},
// 取消
confirm() {
vm.dialogObj.visible = false;
},
// 确定
hide() {
vm.dialogObj.visible = false;
vm.$emit("backSelectVue");
}
}
};
</script>
<style >
.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;
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 {
font-size: 12px;
color: #999;
padding-top: 5px;
}
.line {
margin-left: 10px;
width: 20px;
}
.bg-uploader {
img {
float: left;
}
.bg-img {
width: 84px;
height: 100px;
}
.bg-video {
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;
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%;
background: #f5f7fa;
opacity: 0.5;
top: 0;
z-index: 1000;
}
}
.el-form-item__content {
width: 100%;
height: 100%;
background: red;
}
.popover-content {
position: relative;
top: 0;
left: 0;
}
.time-message {
margin: -6px 0 20px 150px;
font-size: 14px;
}
.url1-selected {
img {
widows: 120px;
height: 90px;
}
}
.url1-list {
display: flex;
flex-direction: row;
.img-wrapper {
position: relative;
top: 0;
left: 0;
z-index: 1;
.selected-icon {
width: 60px;
height: 45px;
margin-right: 10px;
}
.status-icon {
position: absolute;
top: 5px;
right: 15px;
z-index: 2;
widows: 14px;
height: 14px;
}
}
}
.url2-selected {
img {
width: 160px;
height: 90px;
}
}
.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 {
position: relative;
top: 0;
left: 0;
z-index: 100;
.curt-position {
position: absolute;
top: 0;
left: 0;
z-index: 101;
}
}
</style>
\ No newline at end of file
......@@ -556,96 +556,6 @@ export default {
vm.visibleName = false;
},
// getFilePath(file, null),
// "preview4",
// "progress1",
// 1
// ).then(function(path) {
// closeLoading(vm);
// console.log(path);
// if (fileLimit.show == "uploadImgMessage") {
// vm.uploadImgMessage = false;
// } else if (fileLimit.show == "uploadImgMessage2") {
// vm.uploadImgMessage2 = false;
// }
// vm.formData[fileLimit.key] = path.fullPath;
// vm.formData[fileLimit.more] = {
// attachmentName: path.name,
// attachmentExt: path.ext,
// attachmentSize: path.size
// };
// vm.$message.success("上传成功");
// });
// }
// };
// };
// return isJPG && isLt2M;
// },
// // 删除图片
// deleteImg(type) {
// if (type == 1) {
// vm.formData.attachmentUrl1 = "";
// vm.imgMouseOver = false;
// } else {
// vm.formData.attachmentUrl2 = "";
// vm.imgMouseOver2 = false;
// }
// },
// //改变封面类型
// changeCover(radio) {
// vm.formData.attachmentUrl2 = "";
// },
// //上传封面图片
// beforeUploadCoverPic(file) {
// let fileLimit = {
// width: 750,
// height: 420,
// size: 2,
// sizeText: "2.0M",
// key: "attachmentUrl2",
// more: "attachmentMore2",
// show: "uploadImgMessage2"
// };
// if (vm.formData.type == 1) {
// vm.beforeAvatarUpload(file, fileLimit);
// } else {
// vm.beforeUploadMp4(file);
// }
// },
// //上传mp4
// beforeUploadMp4(file) {
// console.log(file);
// const isMP4 = file.type === "video/mp4";
// const isLt = file.size / 1024 / 1024 < 500;
// if (!isLt) {
// vm.$message.error("视频不符合规范,请根据规范上传视频");
// return;
// }
// if (!isMP4) {
// vm.$message.error("视频不符合规范,请根据规范上传视频");
// } else {
// openLoading(vm);
// doUpload(
// vm,
// file,
// getFilePath(file, null),
// "preview4",
// "progress1",
// ""
// ).then(function(path) {
// closeLoading(vm);
// console.log(path);
// vm.uploadImgMessage2 = false;
// vm.formData.attachmentUrl2 = path.fullPath;
// vm.$message.success("上传成功");
// });
// }
// },
// 点击下一步
nextStep() {
let flag = true;
......@@ -667,30 +577,33 @@ export default {
},
// 暂存
save() {
if (vm.$refs["formData"].projectName == "") {
save(needCheckTime = true) {
if (!vm.formData.projectName) {
vm.$refs["formData"].validateField("projectName");
} else {
vm.insertOrupdate(1);
vm.insertOrupdate(1, needCheckTime);
}
},
// 新增或者更新基本信息
insertOrupdate(status) {
if (
new Date(vm.formData.projectEndtime).getTime() >
new Date(vm.formData.projectBegintime).getTime() +
1000 * 60 * 60 * 24 * vm.attachInfo.limitValue
) {
vm.$message.warning("项目结束时间应在有效期内");
return;
}
if (
new Date(vm.formData.projectEndtime).getTime() <=
new Date(vm.formData.projectBegintime).getTime()
) {
vm.$message.warning("项目结束时间应大于开始时间");
return;
insertOrupdate(status, needCheckTime) {
console.log('insertOrupdate', vm.formData.projectEndtime);
if(needCheckTime) {
if (
new Date(vm.formData.projectEndtime).getTime() >
new Date(vm.formData.projectBegintime).getTime() +
1000 * 60 * 60 * 24 * vm.attachInfo.limitValue
) {
vm.$message.warning("项目结束时间应在有效期内");
return;
}
if (
new Date(vm.formData.projectEndtime).getTime() <=
new Date(vm.formData.projectBegintime).getTime()
) {
vm.$message.warning("项目结束时间应大于开始时间");
return;
}
}
vm.formData.projectBegintime = convertTime(
......
......@@ -54,7 +54,7 @@ service.interceptors.request.use(config => {
}
if( process.env.BUILD_ENV == "development" ){ // 本地开发环境
// console.log('环境变量>>>> ', process.env.BUILD_ENV);
config.headers['token'] = '19CD6690D41D44148F53BECB7CA86B6F';
config.headers['token'] = '08C051899378462280EF479538CE43CA';
// config.headers['token'] = localStorage.getItem('storageToken')
}else{
config.headers['token'] = localStorage.getItem('storageToken')
......
......@@ -232,6 +232,7 @@ export default {
});
},
//
getLabelList() {
vm.GET("contents/diseases/labelList", {}).then(res => {
if (res.code == "000000") {
......@@ -296,6 +297,8 @@ export default {
vm.canNext = true;
}
},
// 判断是否为预览状态
isPreviewFn() {
if (vm.$route.query.isPreview == 1 && vm.$route.query.projectId) {
vm.projectId = vm.$route.query.projectId;
......@@ -304,6 +307,7 @@ export default {
vm.canNext = true;
}
},
// 按钮点击下一步
nextStep() {
if (vm.active == 0) {
......@@ -330,7 +334,7 @@ export default {
// 暂存
save() {
if (vm.active == 1) {
vm.$refs.CustomBaseinfo.save();
vm.$refs.CustomBaseinfo.save(false);
} else if (vm.active == 2) {
vm.regionComplete();
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册