diff --git a/src/api/person.ts b/src/api/person.ts index 9abd9e8..8379273 100644 --- a/src/api/person.ts +++ b/src/api/person.ts @@ -12,6 +12,7 @@ enum api { PAGE_XSFXBG = '/annualcompetitionprojectregistration/annualCompetitionProjectRegistration/xsfxbg', // 个人能力报告 competition = '/AnnualCompPoint/annualCompPoint/findcompp', // 比赛项目列表 competitionOne = '/AnnualCompPoint/annualCompPoint/findcomppxq', // 比赛项目单个 + signUp = '/annualcompetitionprojectregistration/annualCompetitionProjectRegistration/edit', // 年度比赛项目报名 POST } export const getlEvaluateApi = (params: Record<'pageNo' | 'pageSize', number>) => request.get(api.liststu, { params }); export const getlIntegralApi = (params: Record<'pageNo' | 'pageSize', number>) => request.get(api.integral, { params }); @@ -23,4 +24,13 @@ export const getXsfxbgApi = (params = {}) => { }; export const getCompetitionApi = (id: string) => request.get(api.competition, { params: { id } }); -export const getCompetitionOneApi = (id: string) => request.get(api.competitionOne, { params: { id } }); \ No newline at end of file +export const getCompetitionOneApi = (id: string) => request.get(api.competitionOne, { params: { id } }); + +interface SignUpData { + annualCompid: string, + entryFormat: '团队' | '个人', + id: string, + instructorSheetList?: any[], + teamManagementList?: any[], +} +export const getSignUpApi = (data: SignUpData) => request.post(api.signUp, data); \ No newline at end of file diff --git a/src/permissions.ts b/src/permissions.ts index 6ae7270..be9ab25 100644 --- a/src/permissions.ts +++ b/src/permissions.ts @@ -9,7 +9,7 @@ router.beforeEach(async (to, form, next) => { if (useuserStore.token) { if (to.path === '/login') { next({ path: '/' }) - } else { + } else { if (!Object.keys(useuserStore.userInfo).length) { useuserStore.getUserInfo() next() diff --git a/src/utils/asyncHint.ts b/src/utils/asyncHint.ts new file mode 100644 index 0000000..2ef0fbe --- /dev/null +++ b/src/utils/asyncHint.ts @@ -0,0 +1,65 @@ +import { ElMessage, MessageOptions } from "element-plus"; + +enum indexs { + fulfilled, + Rejected +} + +interface Options { + onFulfilled?: Function; + onRejected?: Function; + onFinish?: Function; + // 是否需要提示:[ 成功时的 , 失败时的]。 + // 默认:[true, true] + isNeedPrompts?: boolean[]; + // 提示配置:[成功时的 , 失败时的] + msgObjs?: MessageOptions[]; + // 提示配置的快捷message配置:[ 成功时的 , 失败时的]。 + // 默认:['成功', '失败'] + msgs?: string[]; + [key: string]: any; +} + + +export function getHint(pro: Promise, options: Options = {}) { + const ful = indexs.fulfilled; + const rej = indexs.Rejected; + const { isNeedPrompts, msgs } = options; + + const opt: Options = { + ...options, + isNeedPrompts: Object.assign([true, true], isNeedPrompts), + msgs: Object.assign(['成功', '失败'], msgs), + } + + const onFulfilled = (res: any) => { + if (opt.isNeedPrompts?.[ful]) { + ElMessage({ + message: opt.msgs?.[ful], + type: 'success', + ...opt.msgObjs?.[ful] + }); + } + if (opt.onFulfilled) opt.onFulfilled(res); + } + const onRejected = (err: Error) => { + if (opt.isNeedPrompts?.[rej]) { + ElMessage({ + message: opt.msgs?.[rej], + type: 'error', + ...opt.msgObjs?.[rej] + }); + } + + if (opt.onRejected) opt.onRejected(err); + } + const onFinish = () => { + console.log(opt, opt.onFinish); + + if (opt.onFinish) opt.onFinish(); + } + + pro.then(onFulfilled).catch(onRejected).finally(onFinish); + + return pro; +} \ No newline at end of file diff --git a/src/views/projectName/index.vue b/src/views/projectName/index.vue index 3453585..f93d2c4 100644 --- a/src/views/projectName/index.vue +++ b/src/views/projectName/index.vue @@ -80,7 +80,11 @@ function handleSub() { }) return } - router.push({ path: '/registrationPersonage', query: { id: route.query.id } }) + // Y:团队赛 N:个人赛 + let path; + if (data.value.entryForm === 'Y') path = '/registrationGroup'; + else path = '/registrationPersonage'; + router.push({ path, query: { id: route.query.id } }) } getData(); diff --git a/src/views/registrationGroup/index.vue b/src/views/registrationGroup/index.vue index 8bb593f..2ee996b 100644 --- a/src/views/registrationGroup/index.vue +++ b/src/views/registrationGroup/index.vue @@ -84,25 +84,29 @@
姓名
-
王不留行
+
{{ info.realname }}
姓别
-
+
{{ pasSex(info.sex) }}
学号
-
2023010236
+
{{ info.workNo }}
手机号
-
17725633652
+
{{ info.phone }}
+
邮箱
+
{{ info.email }}
+
+ @@ -164,17 +168,22 @@