Commit b6c383d4 by 陈羽

update: 修复弹窗时间范围与上传图片提示文案

parent e9da80d9
......@@ -16,7 +16,7 @@
</el-checkbox-group>
</el-form-item>
<el-form-item label="计划时间:" prop="dateTime">
<el-date-picker v-model="group.dateTime" :disabled="!!group.id" :picker-options="pickerOptions" class="w400" type="datetimerange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
<el-date-picker v-model="group.dateTime" :disabled="!!group.id" :picker-options="pickerOptions" :default-time="['00:00:00', '23:59:59']" class="w400" type="datetimerange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<p class="line"></p>
<h2 style="font-size: 16px;font-weight: 600;color: #303133;line-height: 62px;margin:7px 0 0 10px;">弹窗</h2>
......@@ -82,7 +82,7 @@
<el-button type="text" :disabled="pop.activeStatus == 2" @click="showPutonPage(pop, elIndex)">设置</el-button>
</el-form-item>
<el-form-item label="投放时间:" :prop="`dateTime_${elIndex}`">
<el-date-picker v-model="pop.dateTime" :picker-options="pickerOptions" :default-time="['00:00:00', '23:59:59']" :disabled="pop.activeStatus == 2" class="w400" type="datetimerange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
<el-date-picker v-model="pop.dateTime" :picker-options="pickerOptions2" @focus="checkGroupDate" @blur="dateDelay = 1" :default-time="['00:00:00', '23:59:59']" :disabled="pop.activeStatus == 2" class="w400" type="datetimerange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item label="弹出频次:" :prop="`popupType_${elIndex}`">
<el-radio-group v-model="pop.popupType" :disabled="pop.activeStatus == 2" class="block_radio">
......@@ -288,6 +288,7 @@ export default {
sortOptions: ['', '最高', '较高', '普通', '较低', '最低'],
showCardDialog: false,
putonPageDialog: false,
dateDelay: 1,
putonForm: {
// // 弹窗链接id
id: '',
......@@ -312,6 +313,18 @@ export default {
const startTime = new Date(this.minDate).getTime();
return time < new Date(startTime - 24 * 3600 * 1000) || time > new Date(startTime + 183 * 24 * 3600 * 1000);
}
},
pickerOptions2: {
// 时间范围6个月
disabledDate: time => {
if (this.group.dateTime[0] && this.group.dateTime[1]) {
const startTime = new Date(new Date(this.group.dateTime[0]) > new Date() ? new Date(this.group.dateTime[0]) : new Date()).getTime();
const endTime = new Date(this.group.dateTime[1]);
return time < new Date(startTime) || time > endTime;
} else {
return true;
}
}
}
};
},
......@@ -343,6 +356,7 @@ export default {
const res = await getPopupPlan({ popupPlanId: this.$route.query.id });
if (res.errorCode === 0 && res.result) {
let groupPlan = { ...res.result };
this.minDate = new Date(groupPlan.beginTime) > new Date() ? new Date(groupPlan.beginTime) : new Date();
groupPlan.dateTime = [new Date(groupPlan.beginTime), new Date(groupPlan.endTime)];
groupPlan.scene = typeof groupPlan.scene == 'string' ? groupPlan.scene.split(',') : [];
if (Array.isArray(groupPlan.popupList)) {
......@@ -573,10 +587,10 @@ export default {
},
// 投放内容-图片 上传之前校验
beforeAvatarUpload(file, elIndex) {
const isJPG = file.type === ('image/jpeg' || 'image/png' || 'image/gif');
const isJPG = ['image/jpeg', 'image/png', 'image/gif'].includes(file.type);
const isLt500kb = file.size / 1024 < 500;
if (!isJPG) {
this.$message.warning('只能上传JPG格式文件!');
this.$message.warning('只能上传JPG/PNG/GIF格式文件!');
return false;
}
if (!isLt500kb) {
......@@ -670,6 +684,17 @@ export default {
pop.putonPageList = pop.putonPageList.filter(item => item.id != pageId);
}
},
checkGroupDate() {
if (this.dateDelay === 1) {
this.dateDelay = 0;
if (!this.group.dateTime[0]) {
this.$message.error('请先选择计划时间!');
setTimeout(function() {
this.dateDelay = 1;
}, 500);
}
}
},
// 级别更改
sortChange() {
this.popSort = { 1: false, 2: false, 3: false, 4: false, 5: false };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment