fix:投放设置有效期起止时间设置
This commit is contained in:
2
components.d.ts
vendored
2
components.d.ts
vendored
@@ -2,7 +2,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// Generated by unplugin-vue-components
|
// Generated by unplugin-vue-components
|
||||||
// Read more: https://github.com/vuejs/core/pull/3399
|
// Read more: https://github.com/vuejs/core/pull/3399
|
||||||
export {};
|
export {}
|
||||||
|
|
||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
|
|||||||
@@ -158,3 +158,26 @@ export function debounce(fn, wait) {
|
|||||||
timer = setTimeout(() => fn.apply(context, args), wait);
|
timer = setTimeout(() => fn.apply(context, args), wait);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化时间
|
||||||
|
* @param type now:当前时间 endOfDay:当前时间的 23:59:59
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function getFormattedTime(type = 'now') {
|
||||||
|
const date = new Date();
|
||||||
|
|
||||||
|
if (type === 'endOfDay') {
|
||||||
|
date.setHours(23, 59, 59, 999); // 设置为当天的 23:59:59.999
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化时间为 yyyy-MM-dd hh:mm:ss
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要 +1
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
|||||||
@@ -352,6 +352,7 @@ import {
|
|||||||
getSurveysDetail,
|
getSurveysDetail,
|
||||||
changeStatus
|
changeStatus
|
||||||
} from '@/api/design/index';
|
} from '@/api/design/index';
|
||||||
|
import { getFormattedTime } from '@/utils/utils';
|
||||||
import Design from '@/views/Design/Index.vue';
|
import Design from '@/views/Design/Index.vue';
|
||||||
import { useCounterStore } from '@/stores/counter';
|
import { useCounterStore } from '@/stores/counter';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
@@ -500,6 +501,14 @@ const saveQuestionItem = (questionJson) => {
|
|||||||
// 保存设置
|
// 保存设置
|
||||||
const saveSetting = (parentKey, childKeys, type) => {
|
const saveSetting = (parentKey, childKeys, type) => {
|
||||||
const query = {};
|
const query = {};
|
||||||
|
// 当有效期开关打开时设置默认时间
|
||||||
|
if (parentKey === 'is_time' && questionInfo.value.survey.is_time === 1) {
|
||||||
|
// 设置起始时间为当前时间
|
||||||
|
questionInfo.value.survey.start_time = getFormattedTime('now');
|
||||||
|
// 设置截止时间为今天23:59:59
|
||||||
|
questionInfo.value.survey.end_time = getFormattedTime('endOfDay');
|
||||||
|
}
|
||||||
|
|
||||||
function changeValueType(type, value) {
|
function changeValueType(type, value) {
|
||||||
if (type) {
|
if (type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -736,6 +745,7 @@ onMounted(async () => {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 230px;
|
width: 230px;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
|
|
||||||
& div {
|
& div {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
@@ -745,7 +755,8 @@ onMounted(async () => {
|
|||||||
& .title-right {
|
& .title-right {
|
||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
width: 65px; /* 根据实际图片大小调整 */
|
width: 65px;
|
||||||
|
/* 根据实际图片大小调整 */
|
||||||
height: 50px;
|
height: 50px;
|
||||||
margin-right: 40px;
|
margin-right: 40px;
|
||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
@@ -755,8 +766,10 @@ onMounted(async () => {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: -70px;
|
bottom: -70px;
|
||||||
left: -10px;
|
left: -10px;
|
||||||
width: 65px; /* 根据实际图片大小调整 */
|
width: 65px;
|
||||||
height: 140px; /* 根据实际图片大小调整 */
|
/* 根据实际图片大小调整 */
|
||||||
|
height: 140px;
|
||||||
|
/* 根据实际图片大小调整 */
|
||||||
background: url('@/assets/img/create-right-back.png') no-repeat center center;
|
background: url('@/assets/img/create-right-back.png') no-repeat center center;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user