diff --git a/.env b/.env index 0c43f01..1afc474 100644 --- a/.env +++ b/.env @@ -2,7 +2,8 @@ VITE_APP_TITLE=金融产品设计及数字化营销沙盘 VITE_PORT=9520 VITE_PROXY=http://192.168.31.125:8080 VITE_PUBLIC_PATH=./ -VITE_BASE_API=http://192.168.31.51:9000 +# VITE_BASE_API=http://192.168.31.217:9000 # VITE_BASE_API=http://121.37.12.51 +VITE_BASE_API=https://www.occupationlab.com VITE_I18N_LOCALE=zh-cn VITE_I18N_FALLBACK_LOCALE=zh-cn diff --git a/src/api/judgment.ts b/src/api/judgment.ts index 1c3b1fb..9963bff 100644 --- a/src/api/judgment.ts +++ b/src/api/judgment.ts @@ -15,5 +15,9 @@ export const deleteCache = async (data: Record): Promise => ).data; export const getOperation = async (params?: Record): Promise => (await axios.get('/product/product/bank/operation/getOperation', { params })).data; export const getSandTableLastCache = async (data: Record): Promise => - (await axios.post(`/product/product/bank/operation/getSandTableLastCache?cid=${data.cid}&projectId=${data.projectId}`)).data; + ( + await axios.post( + `/product/product/bank/operation/getSandTableLastCache?cid=${data.cid}&projectId=${data.projectId}&assessmentId=${data.assessmentId}&competitionId=${data.competitionId}`, + ) + ).data; export const deleteOperationData = async (data: Record): Promise => (await axios.post('/product/product/bank/operation/deleteOperationData', data)).data; diff --git a/src/components/Panel/index.vue b/src/components/Panel/index.vue index 10b73fe..613557d 100644 --- a/src/components/Panel/index.vue +++ b/src/components/Panel/index.vue @@ -47,7 +47,7 @@ @click="toReport" v-if="isSubmit">查看实验报告 重新开始 import { ref, reactive, onMounted, inject, computed, watch } from 'vue'; import { submitOpe } from '@/api/bank'; -import { deleteCache, getSandTableLastCache, deleteOperationData } from '@/api/judgment'; -import { pageStuAssessment, getProjectBySystemId, getProjectDetail, getDetailById, getCompetition, getStartTime } from '@/api/system'; +import { getSandTableLastCache, deleteOperationData } from '@/api/judgment'; +import { getProjectBySystemId, getProjectDetail, getDetailById, getCompetition, getStartTime } from '@/api/system'; import Settings from '@/settings'; import { useRouter, useRoute } from 'vue-router'; import type { Action } from 'element-plus'; @@ -342,15 +342,22 @@ watch( ); // 获取上次实验的时间 -const getSumTime = (): Promise => { +const getSumTime = (reset?: number): Promise => { return new Promise(async (resolve, reject) => { const res = await getStartTime({ permissions: per.value, projectId: param.projectId, + reset, }); resolve(res.startTime ? new Date(res.startTime) : ''); }); }; +// 获取进入时间 +const getEntryTime = async (resetTime?: number) => { + let now = await getSumTime(resetTime); // 获取上次进入实验的时间,如果没有,说明是第一次进入,然后直接从服务器获取当前时间 + if (!now) now = await getNow(); + entryTime.value = now; +}; // 倒计时 const timeFormat = (num: number): string | number => { return num < 10 ? `0${num}` : num; @@ -438,6 +445,15 @@ const getCompetitionStatus = async () => { } } }; +// 删除缓存 +const delCache = async () => { + await deleteOperationData({ + cid: param.cid, + projectId: param.projectId, + assessmentId: param.assessmentId, + competitionId: param.competitionId, + }); +}; // 项目切换完后的操作 const setNewProject = (reloadPage?: number) => { Cookies.set('sand-projectId', param.projectId); @@ -447,6 +463,7 @@ const setNewProject = (reloadPage?: number) => { grade.value = '00'; pannelTab.value = 'first'; reload(); + getEntryTime(); if (reloadPage) { // 在选择关卡的页面,直接刷新;否则调选择关卡页的获取关卡接口 @@ -463,8 +480,8 @@ const getCache = async (reloadPage?: number) => { const res = await getSandTableLastCache({ cid: param.cid, projectId: param.projectId, - assessmentId: param.assessmentId, - competitionId: param.competitionId, + assessmentId: param.assessmentId || '', + competitionId: param.competitionId || '', }); // 如果有缓存 if (res.getLastCache) { @@ -472,18 +489,20 @@ const getCache = async (reloadPage?: number) => { confirmButtonText: '是', cancelButtonText: '否', type: 'success', + closeOnClickModal: false, }) .then(async () => { + // 如果返回了关卡id,则存起来 + if (res.checkpointId) { + Cookies.set('sand-level', res.checkpointId); + } + setNewProject(reloadPage); }) .catch(async () => { + Cookies.remove('sand-level'); setNewProject(); - await deleteOperationData({ - cid: param.cid, - projectId: param.projectId, - assessmentId: param.assessmentId, - competitionId: param.competitionId, - }); + delCache(); // 在选择关卡的页面,直接刷新;否则调选择关卡页的获取关卡接口 if (reloadPage) { if (route.path === '/') { @@ -494,6 +513,7 @@ const getCache = async (reloadPage?: number) => { } }); } else { + Cookies.remove('sand-level'); setNewProject(); } }; @@ -502,8 +522,12 @@ const toReport = () => { router.push('/report'); }; // 重新开始 -const reload = async () => { - // await deleteCache(getIds()); +const reload = async (fromReload?: number) => { + if (fromReload) { + getEntryTime(1); + await delCache(); // 点了重新开始才需要删除缓存,切换了项目不需要删除缓存 + Cookies.remove('sand-level'); + } reloadCount(); grade.value = '00'; setSubmit(false); @@ -513,10 +537,13 @@ const reload = async () => { // 提交 const submit = async () => { if (isSubmit.value) return false; + const checkpointId = Cookies.get('sand-level') ?? ''; + if (!checkpointId) return ElMessage.error('请选择关卡'); ElMessageBox.confirm('此操作将视为结束考试,是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', + closeOnClickModal: false, }) .then(async () => { submiting.value = true; @@ -532,7 +559,7 @@ const submit = async () => { endTime: per.value ? param.stopTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间) submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式) timeSum, - checkpointId: Cookies.get('sand-level') ?? '', + checkpointId, projectId: param.projectId, projectName: projectList.value.find((e) => e.projectId == param.projectId)?.projectName, lcId: curReq.value, @@ -564,7 +591,7 @@ const submit = async () => { reportId.value = retMap.reportId; Cookies.set('sand-reportId', retMap.reportId); localStorage.setItem('sand-taskList', JSON.stringify(taskList.value)); - // await deleteCache(getIds()); + delCache(); submiting.value = false; // 非练习 @@ -632,12 +659,6 @@ const getList = async () => { if (!per.value && !param.projectId) param.projectId = projects[0]?.projectId ?? 0; // 默认取第一个项目 getProDetail(); }; -// 获取进入时间 -const getEntryTime = async () => { - let now = await getSumTime(); // 获取上次进入实验的时间,如果没有,说明是第一次进入,然后直接从服务器获取当前时间 - if (!now) now = await getNow(); - entryTime.value = now; -}; // websocket获取考核及竞赛信息,用于自动提交 // socket连接成功 @@ -678,15 +699,17 @@ const initSocket = () => { socket.onmessage = getMessage; }; const handleCache = () => { - visible.value && !Cookies.get('sand-loaded') && getCache(0); // 选择关卡页面才需要弹出是否恢复缓存的弹框 + // 没提交的情况下才需要查 + if (!isSubmit.value) { + param.cid && getEntryTime(); + visible.value && !Cookies.get('sand-loaded') && getCache(0); // 选择关卡页面才需要弹出是否恢复缓存的弹框 + } }; // 初始化 const init = async () => { getLevel.value = inject('getLevel'); // 关卡页面获取关卡方法 per.value = param.assessmentId ? 1 : param.competitionId ? 2 : 0; - param.cid && getEntryTime(); - if (param.assessmentId) { // 考核 await getAssList(); diff --git a/src/utils/common.ts b/src/utils/common.ts index 46cee58..ded001c 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -257,10 +257,10 @@ export const getNow = (): Promise => { export const whethers = [ { id: 795, - name: '是', + name: '启用', }, { id: 796, - name: '否', + name: '不启用', }, ]; diff --git a/src/views/product/bank/Add.vue b/src/views/product/bank/Add.vue index c5a6933..afd2447 100644 --- a/src/views/product/bank/Add.vue +++ b/src/views/product/bank/Add.vue @@ -171,12 +171,12 @@ :label="item.itemId">{{ item.options }} - - {{ child.options }} @@ -243,7 +243,7 @@ - {{ child.options }} @@ -356,7 +356,7 @@ interface RuleForm { edu: number | string; educationalRequirements?: any; loanCeiling: any; - loanPurpose: any; + loanPurpose?: number; maximumAge: any; maximumAnnualInterestRate: any; maximumTermOfLoan: any; @@ -588,19 +588,17 @@ const addRecord = async (data: Record) => { data.curWL === 795 && lcRule.push(handleId(1242, 43, data.currentWorkingLife, preIds + ',51,1240,1242', 1)); data.providentFundAndSocialSecurity && lcRule.push(handleId(1244, 324, data.providentFundAndSocialSecurity, preIds + ',51,1243,1244', 1)); // 公积金社保 - - lcRule.push( - data.loanPurpose === 107 ? handleId(107, 11, data.otherPurposesOfLoan, preIds + ',52,107', 3) : handleId(data.loanPurpose, '', '', preIds + ',52,' + data.loanPurpose, ''), - ); + lcRule.push(handleId(1316, 328, data.loanPurpose, preIds + ',52,1316', 1)); + data.loanPurpose === 822 && lcRule.push(handleId(1317, 11, data.otherPurposesOfLoan, preIds + ',52,1317', 3)); } // 担保方式 - data.bankGuarantee1 && lcRule.push(handleId(100, 324, data.bankGuarantee1, preIds + ',53,108,100', 1)); - data.bankGuarantee2 && lcRule.push(handleId(101, 324, data.bankGuarantee2, preIds + ',53,109,101', 1)); - data.bankGuarantee3 && lcRule.push(handleId(102, 324, data.bankGuarantee3, preIds + ',53,110,102', 1)); - data.bankGuarantee4 && lcRule.push(handleId(103, 324, data.bankGuarantee4, preIds + ',53,111,103', 1)); - data.bankGuarantee3 === 795 && lcRule.push(handleId(110, 13, data.bankGuaranteeTypeIds.filter((e: number) => e > 22 && e < 33).join(), preIds + ',53,110', 1)); - data.bankGuarantee4 === 795 && lcRule.push(handleId(111, 14, data.bankGuaranteeTypeIds.filter((e: number) => e > 32 && e < 38).join(), preIds + ',53,111', 1)); + data.bankGuarantee1 && lcRule.push(handleId(108, 324, data.bankGuarantee1, preIds + ',53,108', 1)); + data.bankGuarantee2 && lcRule.push(handleId(109, 324, data.bankGuarantee2, preIds + ',53,109', 1)); + data.bankGuarantee3 && lcRule.push(handleId(1277, 324, data.bankGuarantee3, preIds + ',53,110,1277', 1)); + data.bankGuarantee4 && lcRule.push(handleId(1277, 324, data.bankGuarantee4, preIds + ',53,111,1277', 1)); + data.bankGuarantee3 === 795 && lcRule.push(handleId(1275, 13, data.bankGuaranteeTypeIds.filter((e: number) => e > 22 && e < 33).join(), preIds + ',53,110,1275', 1)); + data.bankGuarantee4 === 795 && lcRule.push(handleId(1276, 14, data.bankGuaranteeTypeIds.filter((e: number) => e > 32 && e < 38).join(), preIds + ',53,111,1276', 1)); lcRule.push( handleId(54, 15, data.minimumLoan + '~' + data.loanCeiling, preIds + ',54', 5), diff --git a/src/views/product/bank/CardList.vue b/src/views/product/bank/CardList.vue index ee744fe..6ee78d1 100644 --- a/src/views/product/bank/CardList.vue +++ b/src/views/product/bank/CardList.vue @@ -33,7 +33,7 @@
{{ item.productName }}
-

{{ item.productNumber + ' ' + item.guarantyStyle }}

+

{{ item.productNumber + ' ' + (item.guarantyStyle || '') }}

{{ getStatus(item.status) }}

创建日期:{{ item.operationTime }}

diff --git a/src/views/product/bank/Config.vue b/src/views/product/bank/Config.vue index 4b60a58..bd95865 100644 --- a/src/views/product/bank/Config.vue +++ b/src/views/product/bank/Config.vue @@ -26,7 +26,7 @@

选择需要提供的申请人材料(至少选一样)

- {{ item.options }} @@ -39,14 +39,14 @@
- {{ item.options }}