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