diff --git a/.env b/.env index 97571e0..0c43f01 100644 --- a/.env +++ b/.env @@ -2,7 +2,7 @@ VITE_APP_TITLE=金融产品设计及数字化营销沙盘 VITE_PORT=9520 VITE_PROXY=http://192.168.31.125:8080 VITE_PUBLIC_PATH=./ -VITE_BASE_API=http://192.168.31.217:9000 +VITE_BASE_API=http://192.168.31.51:9000 # VITE_BASE_API=http://121.37.12.51 VITE_I18N_LOCALE=zh-cn VITE_I18N_FALLBACK_LOCALE=zh-cn diff --git a/src/api/model.ts b/src/api/model.ts index 6f1017c..7ba71a3 100644 --- a/src/api/model.ts +++ b/src/api/model.ts @@ -1,84 +1,81 @@ import axios from '@/utils/request'; +import { getIds } from '@/utils/common'; -export const accessStrategyGovernmentBlacklistFind = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/accessStrategyGovernmentBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +const host = `http://192.168.31.51:9000`; + +export const accessStrategyGovernmentBlacklistFind = async (): Promise => (await axios.post(`/product/accessStrategyGovernmentBlacklist/details`, getIds())).data; export const accessStrategyGovernmentBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyGovernmentBlacklist/saveOrUpdate`, data)).data; -export const accessStrategyEnterpriseBlacklistFind = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/accessStrategyEnterpriseBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const accessStrategyEnterpriseBlacklistFind = async (): Promise => (await axios.post(`/product/accessStrategyEnterpriseBlacklist/details`, getIds())).data; export const accessStrategyEnterpriseBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyEnterpriseBlacklist/saveOrUpdate`, data)).data; -export const accessStrategyAntiFraudStrategyFind = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/accessStrategyAntiFraudStrategy/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const accessStrategyAntiFraudStrategyFind = async (): Promise => (await axios.post(`/product/accessStrategyAntiFraudStrategy/details`, getIds())).data; export const accessStrategyAntiFraudStrategySave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyAntiFraudStrategy/saveOrUpdate`, data)).data; -export const accessStrategyBusinessBlacklistFind = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/accessStrategyBusinessBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const accessStrategyBusinessBlacklistFind = async (): Promise => (await axios.post(`/product/accessStrategyBusinessBlacklist/details`, getIds())).data; export const accessStrategyBusinessBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyBusinessBlacklist/saveOrUpdate`, data)).data; -export const accessStrategyCreditBlacklistFind = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/accessStrategyCreditBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const accessStrategyCreditBlacklistFind = async (): Promise => (await axios.post(`/product/accessStrategyCreditBlacklist/details`, getIds())).data; export const accessStrategyCreditBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyCreditBlacklist/saveOrUpdate`, data)).data; -export const accessStrategyInlineBlacklistFind = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/accessStrategyInlineBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const accessStrategyInlineBlacklistFind = async (): Promise => (await axios.post(`/product/accessStrategyInlineBlacklist/details`, getIds())).data; export const accessStrategyInlineBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyInlineBlacklist/saveOrUpdate`, data)).data; -export const accessStrategyNegativeIndustryStrategyFind = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/accessStrategyNegativeIndustryStrategy/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const accessStrategyNegativeIndustryStrategyFind = async (): Promise => (await axios.post(`/product/accessStrategyNegativeIndustryStrategy/details`, getIds())).data; export const accessStrategyNegativeIndustryStrategySave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyNegativeIndustryStrategy/saveOrUpdate`, data)).data; export const delCredit = async (id: number): Promise => (await axios.post(`/product/creditScoringStrategy/delete?strategyId=${id}`)).data; export const findCredit = async (id: number): Promise => (await axios.post(`/product/creditScoringStrategy/details?strategyId=${id}`)).data; export const listCredit = async (data: Record): Promise => - (await axios.post(`/product/creditScoringStrategy/list?checkpointId=${data.checkpointId}&projectId=${data.projectId}&pageNum=${data.pageNum}&pageSize=${data.pageSize}`)).data; + ( + await axios.post(`/product/creditScoringStrategy/list`, { + ...data, + ...getIds(), + }) + ).data; export const saveCredit = async (data: Record): Promise => (await axios.post(`/product/creditScoringStrategy/saveOrUpdate`, data)).data; -export const detailRick = async (data: Record): Promise => - (await axios.post(`/product/riskDegreeStrategy/details?checkpointId=${data.checkpointId}&projectId=${data.projectId}&type=${data.type}`)).data; +export const detailRick = async (type: number): Promise => + ( + await axios.post(`/product/riskDegreeStrategy/details`, { + ...getIds(), + type, + }) + ).data; export const saveRick = async (data: Record): Promise => (await axios.post(`/product/riskDegreeStrategy/saveOrUpdate`, data)).data; -export const businessInterestRateDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/interestRateModel/businessInterestRateDetails?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const businessInterestRateDetails = async (): Promise => (await axios.post(`/product/interestRateModel/businessInterestRateDetails`, getIds())).data; export const businessInterestRateSaveOrUpdate = async (data: Record): Promise => (await axios.post(`/product/interestRateModel/businessInterestRateSaveOrUpdate`, data)).data; -export const personalInterestRateDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/interestRateModel/personalInterestRateDetails?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const personalInterestRateDetails = async (): Promise => (await axios.post(`/product/interestRateModel/personalInterestRateDetails`, getIds())).data; export const personalInterestRateSaveOrUpdate = async (data: Record): Promise => (await axios.post(`/product/interestRateModel/personalInterestRateSaveOrUpdate`, data)).data; -export const businessQuotaModelDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/quotaModel/businessQuotaModelDetails?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const businessQuotaModelDetails = async (): Promise => (await axios.post(`/product/quotaModel/businessQuotaModelDetails`, getIds())).data; export const businessQuotaModelSaveOrUpdate = async (data: Record): Promise => (await axios.post(`/product/quotaModel/businessQuotaModelSaveOrUpdate`, data)).data; -export const personalCreditModelDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/quotaModel/personalCreditModelDetails?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const personalCreditModelDetails = async (): Promise => (await axios.post(`/product/quotaModel/personalCreditModelDetails`, getIds())).data; export const personalCreditModelSaveOrUpdate = async (data: Record): Promise => (await axios.post(`/product/quotaModel/personalCreditModelSaveOrUpdate`, data)).data; -export const fiveLevelClassificationDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/fiveLevelClassification/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const fiveLevelClassificationDetails = async (): Promise => (await axios.post(`/product/fiveLevelClassification/details`, getIds())).data; export const fiveLevelClassificationSave = async (data: Record): Promise => (await axios.post(`/product/fiveLevelClassification/saveOrUpdate`, data)).data; -export const postLoanInspectionDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/postLoanInspection/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const postLoanInspectionDetails = async (): Promise => (await axios.post(`/product/postLoanInspection/details`, getIds())).data; export const postLoanInspectionSave = async (data: Record): Promise => (await axios.post(`/product/postLoanInspection/saveOrUpdate`, data)).data; -export const postCreditScoreDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/postCreditScore/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const postCreditScoreDetails = async (): Promise => (await axios.post(`/product/postCreditScore/details`, getIds())).data; export const postCreditScoreSave = async (data: Record): Promise => (await axios.post(`/product/postCreditScore/saveOrUpdate`, data)).data; -export const postLoanWarningDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/postLoanWarning/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const postLoanWarningDetails = async (): Promise => (await axios.post(`/product/postLoanWarning/details`, getIds())).data; export const postLoanWarningSave = async (data: Record): Promise => (await axios.post(`/product/postLoanWarning/saveOrUpdate`, data)).data; -export const collectionAfterLoanDetails = async (checkpointId: number, projectId: number): Promise => - (await axios.post(`/product/collectionAfterLoan/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; +export const collectionAfterLoanDetails = async (): Promise => (await axios.post(`/product/collectionAfterLoan/details`, getIds())).data; export const collectionAfterLoanSave = async (data: Record): Promise => (await axios.post(`/product/collectionAfterLoan/saveOrUpdate`, data)).data; diff --git a/src/components/DialogForm.vue b/src/components/DialogForm.vue deleted file mode 100644 index 20137c8..0000000 --- a/src/components/DialogForm.vue +++ /dev/null @@ -1,258 +0,0 @@ - - - diff --git a/src/components/HelloI18n.vue b/src/components/HelloI18n.vue deleted file mode 100644 index f4af4e1..0000000 --- a/src/components/HelloI18n.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - - - -{ - "en": { - "hello": "Hello i18n in SFC!" - } -} - diff --git a/src/components/LabelTip.vue b/src/components/LabelTip.vue deleted file mode 100644 index d73f3f6..0000000 --- a/src/components/LabelTip.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/src/components/ListMove.vue b/src/components/ListMove.vue deleted file mode 100644 index ed1c283..0000000 --- a/src/components/ListMove.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/src/components/Panel/index.vue b/src/components/Panel/index.vue index 11fa25e..10b73fe 100644 --- a/src/components/Panel/index.vue +++ b/src/components/Panel/index.vue @@ -24,7 +24,7 @@ placeholder="请选择" class="select" :disabled="per != 0" - @change="selectProject"> + @change="getCache(1)"> (''); const getLevel = ref(); const container = ref(null); const handle = ref(null); +const isFirst = ref(true); // 实验面板拖拽 const { x, y, style } = useDraggable(container, { initialValue: { x: 0, y: 200 }, @@ -305,6 +306,7 @@ if (param.token) { Cookies.set('sand-account', param.account ?? ''); Cookies.set('sand-admin', param.admin ?? ''); // 从中台进来的标识 Cookies.remove('sand-submit'); + Cookies.remove('sand-loaded'); router.replace(route.path); } else { param.systemId = Cookies.get('sand-systemId'); @@ -387,24 +389,10 @@ const setSubmit = (val: boolean) => { }; // 获取考核列表来查询该考核是否已经考过 const getAssList = async () => { - // const { list } = await pageStuAssessment({ - // pageNum: 1, - // pageSize: 10000, - // }); - // let done = false; - // // 匹配到该考核,并且已经提交过(有reportId则说明有实验记录),并且classId跟当前用户的classId相同,就提示提交了考核然后返回上一页 - // if (list.find((e) => e.assessmentId == param.assessmentId && e.reportId && e.classId == param.classId)) { - // done = true; - // setSubmit(true); - // ElMessage.error('你已经提交过该考核!'); - // setTimeout((_) => { - // window.history.back(); // 直接返回上一页面 - // }, 1500); - // } - getProDetail(); - getAssStatus(); + await getAssStatus(); + await getProDetail(); }; -// 定时查询考核状态(查到考核如果结束后,直接提交考核) +// 查询考核状态(查到考核如果结束后,直接提交考核) const getAssStatus = async () => { // 未提交才需要查询状态 if (!isSubmit.value) { @@ -423,7 +411,7 @@ const getAssStatus = async () => { } }; -// 定时查询竞赛状态(查到竞赛如果结束后,直接提交竞赛) +// 查询竞赛状态(查到竞赛如果结束后,直接提交竞赛) const getCompetitionStatus = async () => { // 未提交才需要查询状态 if (!isSubmit.value) { @@ -470,11 +458,13 @@ const setNewProject = (reloadPage?: number) => { } }; // 项目选择回调 -const selectProject = async () => { +const getCache = async (reloadPage?: number) => { // 查询该项目是否有缓存记录 const res = await getSandTableLastCache({ cid: param.cid, projectId: param.projectId, + assessmentId: param.assessmentId, + competitionId: param.competitionId, }); // 如果有缓存 if (res.getLastCache) { @@ -484,7 +474,7 @@ const selectProject = async () => { type: 'success', }) .then(async () => { - setNewProject(1); + setNewProject(reloadPage); }) .catch(async () => { setNewProject(); @@ -495,10 +485,12 @@ const selectProject = async () => { competitionId: param.competitionId, }); // 在选择关卡的页面,直接刷新;否则调选择关卡页的获取关卡接口 - if (route.path === '/') { - location.reload(); - } else { - getLevel.value && getLevel.value(); + if (reloadPage) { + if (route.path === '/') { + location.reload(); + } else { + getLevel.value && getLevel.value(); + } } }); } else { @@ -685,24 +677,34 @@ const initSocket = () => { // 监听socket消息 socket.onmessage = getMessage; }; - -onMounted(() => { +const handleCache = () => { + 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) { - getAssList(); + // 考核 + await getAssList(); + handleCache(); + initSocket(); + } else if (param.competitionId) { + // 竞赛 + getCompetitionStatus(); + handleCache(); initSocket(); } else { + // 练习 param.cid && getList(); - if (param.competitionId) { - getCompetitionStatus(); - initSocket(); - } + handleCache(); } -}); + Cookies.set('sand-loaded', 1); +}; +onMounted(init);