修改开屏设置时间问题

This commit is contained in:
liaozetao
2024-02-18 15:50:08 +08:00
parent a962dbc669
commit ec30e516a0

View File

@@ -25,6 +25,12 @@
<span>{{ scope.row.skipContent }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="生效时间">
<template v-slot="scope">
<span>{{ scope.row.startTime == null && scope.row.endTime ? "不限" : (scope.row.startTime + "~" +
(scope.row.endTime == null ? "不限" : scope.row.endTime)) }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="USER_LEVEL" label="可见等级" :formatter="ruleJsonFormatter" />
<el-table-column align="center" prop="PLATFORM" label="生效平台" :formatter="ruleJsonFormatter" />
<el-table-column align="center" prop="IOS" label="iOS版本号" :formatter="ruleJsonFormatter" />
@@ -285,10 +291,23 @@ export default {
let startTime = this.resource.startTime;
if (startTime) {
this.resource.startTime = new Date(startTime).format("yyyy-MM-dd hh:mm:ss");
} else {
$("#tipMsg").text('生效时间不能为空');
$("#tipModal").modal('show');
return;
}
let endTime = this.resource.endTime;
if (endTime) {
this.resource.endTime = new Date(endTime).format("yyyy-MM-dd hh:mm:ss");
} else {
$("#tipMsg").text('失效时间不能为空');
$("#tipModal").modal('show');
return;
}
let isEnabled = 0;
let now = new Date();
if (now >= new Date(startTime) && now <= new Date(endTime)) {
isEnabled = 1;
}
saveResource({
id: this.resource.id,
@@ -301,7 +320,7 @@ export default {
startTime: this.resource.startTime,
endTime: this.resource.endTime,
seqNo: this.resource.seqNo,
isEnabled: 1,
isEnabled: isEnabled,
ruleValue: JSON.stringify(this.resource.ruleValue)
}).then(res => {
this.getData();