fix: 修复字段difTime->diffTime
This commit is contained in:
parent
9dbe7cfa2b
commit
e58be83214
@ -14,7 +14,7 @@ export class SurveyResponse extends BaseEntity {
|
|||||||
data: Record<string, any>;
|
data: Record<string, any>;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
difTime: number;
|
diffTime: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
clientTime: number;
|
clientTime: number;
|
||||||
|
@ -90,7 +90,7 @@ export class DataStatisticService {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...data,
|
...data,
|
||||||
difTime: (submitedData.difTime / 1000).toFixed(2),
|
diffTime: (submitedData.diffTime / 1000).toFixed(2),
|
||||||
createDate: moment(submitedData.createDate).format(
|
createDate: moment(submitedData.createDate).format(
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
),
|
),
|
||||||
|
@ -58,7 +58,7 @@ export function getListHeadByDataList(dataList) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
listHead.push({
|
listHead.push({
|
||||||
field: 'difTime',
|
field: 'diffTime',
|
||||||
title: '答题耗时(秒)',
|
title: '答题耗时(秒)',
|
||||||
type: QUESTION_TYPE.TEXT,
|
type: QUESTION_TYPE.TEXT,
|
||||||
});
|
});
|
||||||
|
@ -47,7 +47,7 @@ export class SurveyResponseController {
|
|||||||
encryptType: Joi.string(),
|
encryptType: Joi.string(),
|
||||||
sessionId: Joi.string(),
|
sessionId: Joi.string(),
|
||||||
clientTime: Joi.number().required(),
|
clientTime: Joi.number().required(),
|
||||||
difTime: Joi.number(),
|
diffTime: Joi.number(),
|
||||||
password: Joi.string().allow(null, ''),
|
password: Joi.string().allow(null, ''),
|
||||||
whitelist: Joi.string().allow(null, ''),
|
whitelist: Joi.string().allow(null, ''),
|
||||||
}).validate(reqBody, { allowUnknown: true });
|
}).validate(reqBody, { allowUnknown: true });
|
||||||
@ -65,7 +65,7 @@ export class SurveyResponseController {
|
|||||||
data,
|
data,
|
||||||
sessionId,
|
sessionId,
|
||||||
clientTime,
|
clientTime,
|
||||||
difTime,
|
diffTime,
|
||||||
password,
|
password,
|
||||||
whitelist: whitelistValue,
|
whitelist: whitelistValue,
|
||||||
} = value;
|
} = value;
|
||||||
@ -254,7 +254,7 @@ export class SurveyResponseController {
|
|||||||
surveyPath: value.surveyPath,
|
surveyPath: value.surveyPath,
|
||||||
data: decryptedData,
|
data: decryptedData,
|
||||||
clientTime,
|
clientTime,
|
||||||
difTime,
|
diffTime,
|
||||||
surveyId: responseSchema.pageId,
|
surveyId: responseSchema.pageId,
|
||||||
optionTextAndId,
|
optionTextAndId,
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,7 @@ export class SurveyResponseService {
|
|||||||
async createSurveyResponse({
|
async createSurveyResponse({
|
||||||
data,
|
data,
|
||||||
clientTime,
|
clientTime,
|
||||||
difTime,
|
diffTime,
|
||||||
surveyId,
|
surveyId,
|
||||||
surveyPath,
|
surveyPath,
|
||||||
optionTextAndId,
|
optionTextAndId,
|
||||||
@ -22,7 +22,7 @@ export class SurveyResponseService {
|
|||||||
data,
|
data,
|
||||||
secretKeys: [],
|
secretKeys: [],
|
||||||
clientTime,
|
clientTime,
|
||||||
difTime,
|
diffTime,
|
||||||
pageId: surveyId,
|
pageId: surveyId,
|
||||||
optionTextAndId,
|
optionTextAndId,
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,7 @@ describe('getPushingData', () => {
|
|||||||
status: RECORD_STATUS.NEW,
|
status: RECORD_STATUS.NEW,
|
||||||
date: 1711025113146,
|
date: 1711025113146,
|
||||||
},
|
},
|
||||||
difTime: 30518,
|
diffTime: 30518,
|
||||||
data: {
|
data: {
|
||||||
data458: '15000000000',
|
data458: '15000000000',
|
||||||
data515: '115019',
|
data515: '115019',
|
||||||
|
@ -19,128 +19,133 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from "vue";
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from "pinia";
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from "vue-router";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import communalLoader from '@materials/communals/communalLoader.js'
|
import communalLoader from "@materials/communals/communalLoader.js";
|
||||||
import MainRenderer from '../components/MainRenderer.vue'
|
import MainRenderer from "../components/MainRenderer.vue";
|
||||||
import AlertDialog from '../components/AlertDialog.vue'
|
import AlertDialog from "../components/AlertDialog.vue";
|
||||||
import ConfirmDialog from '../components/ConfirmDialog.vue'
|
import ConfirmDialog from "../components/ConfirmDialog.vue";
|
||||||
import ProgressBar from '../components/ProgressBar.vue'
|
import ProgressBar from "../components/ProgressBar.vue";
|
||||||
|
|
||||||
import { useSurveyStore } from '../stores/survey'
|
import { useSurveyStore } from "../stores/survey";
|
||||||
import { useQuestionStore } from '../stores/question'
|
import { useQuestionStore } from "../stores/question";
|
||||||
import { submitForm } from '../api/survey'
|
import { submitForm } from "../api/survey";
|
||||||
import encrypt from '../utils/encrypt'
|
import encrypt from "../utils/encrypt";
|
||||||
|
|
||||||
import useCommandComponent from '../hooks/useCommandComponent'
|
import useCommandComponent from "../hooks/useCommandComponent";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
questionInfo?: any
|
questionInfo?: any;
|
||||||
isMobile?: boolean
|
isMobile?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
questionInfo: {},
|
questionInfo: {},
|
||||||
isMobile: false
|
isMobile: false,
|
||||||
})
|
});
|
||||||
|
|
||||||
const HeaderContent = communalLoader.loadComponent('HeaderContent')
|
const HeaderContent = communalLoader.loadComponent("HeaderContent");
|
||||||
const MainTitle = communalLoader.loadComponent('MainTitle')
|
const MainTitle = communalLoader.loadComponent("MainTitle");
|
||||||
const SubmitButton = communalLoader.loadComponent('SubmitButton')
|
const SubmitButton = communalLoader.loadComponent("SubmitButton");
|
||||||
const LogoIcon = communalLoader.loadComponent('LogoIcon')
|
const LogoIcon = communalLoader.loadComponent("LogoIcon");
|
||||||
|
|
||||||
const mainRef = ref<any>()
|
const mainRef = ref<any>();
|
||||||
const boxRef = ref<HTMLElement>()
|
const boxRef = ref<HTMLElement>();
|
||||||
|
|
||||||
const alert = useCommandComponent(AlertDialog)
|
const alert = useCommandComponent(AlertDialog);
|
||||||
const confirm = useCommandComponent(ConfirmDialog)
|
const confirm = useCommandComponent(ConfirmDialog);
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter();
|
||||||
const surveyStore = useSurveyStore()
|
const surveyStore = useSurveyStore();
|
||||||
const questionStore = useQuestionStore()
|
const questionStore = useQuestionStore();
|
||||||
|
|
||||||
const renderData = computed(() => questionStore.renderData)
|
const renderData = computed(() => questionStore.renderData);
|
||||||
const { bannerConf, submitConf, bottomConf: logoConf, whiteData } = storeToRefs(surveyStore)
|
const {
|
||||||
const surveyPath = computed(() => surveyStore.surveyPath || '')
|
bannerConf,
|
||||||
|
submitConf,
|
||||||
|
bottomConf: logoConf,
|
||||||
|
whiteData,
|
||||||
|
} = storeToRefs(surveyStore);
|
||||||
|
const surveyPath = computed(() => surveyStore.surveyPath || "");
|
||||||
|
|
||||||
const validate = (cbk: (v: boolean) => void) => {
|
const validate = (cbk: (v: boolean) => void) => {
|
||||||
const index = 0
|
const index = 0;
|
||||||
mainRef.value.$refs.formGroup[index].validate(cbk)
|
mainRef.value.$refs.formGroup[index].validate(cbk);
|
||||||
}
|
};
|
||||||
|
|
||||||
const normalizationRequestBody = () => {
|
const normalizationRequestBody = () => {
|
||||||
const enterTime = surveyStore.enterTime
|
const enterTime = surveyStore.enterTime;
|
||||||
const encryptInfo = surveyStore.encryptInfo as any
|
const encryptInfo = surveyStore.encryptInfo as any;
|
||||||
const formValues = surveyStore.formValues
|
const formValues = surveyStore.formValues;
|
||||||
|
|
||||||
const result: any = {
|
const result: any = {
|
||||||
surveyPath: surveyPath.value,
|
surveyPath: surveyPath.value,
|
||||||
data: JSON.stringify(formValues),
|
data: JSON.stringify(formValues),
|
||||||
difTime: Date.now() - enterTime,
|
diffTime: Date.now() - enterTime,
|
||||||
clientTime: Date.now(),
|
clientTime: Date.now(),
|
||||||
...whiteData.value
|
...whiteData.value,
|
||||||
}
|
};
|
||||||
|
|
||||||
if (encryptInfo?.encryptType) {
|
if (encryptInfo?.encryptType) {
|
||||||
result.encryptType = encryptInfo.encryptType
|
result.encryptType = encryptInfo.encryptType;
|
||||||
result.data = encrypt[result.encryptType as 'rsa']({
|
result.data = encrypt[result.encryptType as "rsa"]({
|
||||||
data: result.data,
|
data: result.data,
|
||||||
secretKey: encryptInfo?.data?.secretKey
|
secretKey: encryptInfo?.data?.secretKey,
|
||||||
})
|
});
|
||||||
if (encryptInfo?.data?.sessionId) {
|
if (encryptInfo?.data?.sessionId) {
|
||||||
result.sessionId = encryptInfo.data.sessionId
|
result.sessionId = encryptInfo.data.sessionId;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.data = JSON.stringify(result.data)
|
result.data = JSON.stringify(result.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
const submitSurver = async () => {
|
const submitSurver = async () => {
|
||||||
if (surveyPath.value.length > 8) {
|
if (surveyPath.value.length > 8) {
|
||||||
router.push({ name: 'successPage' })
|
router.push({ name: "successPage" });
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const params = normalizationRequestBody()
|
const params = normalizationRequestBody();
|
||||||
console.log(params)
|
console.log(params);
|
||||||
const res: any = await submitForm(params)
|
const res: any = await submitForm(params);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
router.push({ name: 'successPage' })
|
router.push({ name: "successPage" });
|
||||||
} else {
|
} else {
|
||||||
alert({
|
alert({
|
||||||
title: res.errmsg || '提交失败'
|
title: res.errmsg || "提交失败",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
const confirmAgain = (surveyStore.submitConf as any).confirmAgain
|
const confirmAgain = (surveyStore.submitConf as any).confirmAgain;
|
||||||
const { again_text, is_again } = confirmAgain
|
const { again_text, is_again } = confirmAgain;
|
||||||
|
|
||||||
if (is_again) {
|
if (is_again) {
|
||||||
confirm({
|
confirm({
|
||||||
title: again_text,
|
title: again_text,
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
try {
|
try {
|
||||||
submitSurver()
|
submitSurver();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
confirm.close()
|
confirm.close();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
submitSurver()
|
submitSurver();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.index {
|
.index {
|
||||||
|
Loading…
Reference in New Issue
Block a user