1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-11 11:40:23 +08:00

finish regex

This commit is contained in:
源文雨
2023-04-22 15:14:24 +08:00
parent 282c9539ec
commit 9d9e04ebd2
6 changed files with 63 additions and 39 deletions

View File

@@ -7,6 +7,7 @@ enum Api {
DeleteMessage = '/delMessage',
GetAnnualVisits = '/getAnnualVisits',
GetUserRegex = '/getUserRegex',
SetUserRegex = '/setUserRegex',
}
export const getAnnualVisits = () => {
@@ -28,3 +29,7 @@ export const deleteMessage = (id: number) => {
export const getUserRegex = () => {
return defHttp.get<UserRegex>({ url: Api.GetUserRegex })
}
export const setUserRegex = (params: UserRegex) => {
return defHttp.post<string>({ url: Api.SetUserRegex, params })
}

View File

@@ -8,56 +8,56 @@ const userregex = await getUserRegex()
export const schemas: FormSchema[] = [
{
field: 'title',
field: 'Title',
component: 'Input',
colProps,
label: '试卷标题',
defaultValue: userregex.Title,
},
{
field: 'class',
field: 'Class',
component: 'Input',
colProps,
label: '课程名称',
defaultValue: userregex.Class,
},
{
field: 'opencl',
field: 'OpenCl',
component: 'Input',
colProps,
label: '开/闭卷',
defaultValue: userregex.OpenCl,
},
{
field: 'date',
field: 'Date',
component: 'Input',
colProps,
label: '考试日期',
defaultValue: userregex.Date,
},
{
field: 'time',
field: 'Time',
component: 'Input',
colProps,
label: '考试时长',
defaultValue: userregex.Time,
},
{
field: 'rate',
field: 'Rate',
component: 'Input',
colProps,
label: '成绩占比',
defaultValue: userregex.Rate,
},
{
field: 'major',
field: 'Major',
component: 'Input',
colProps,
label: '大题题号',
defaultValue: userregex.Major,
},
{
field: 'sub',
field: 'Sub',
component: 'Input',
colProps,
label: '小题题号',

View File

@@ -2,7 +2,7 @@
<PageWrapper
:title="t('routes.dashboard.regex')"
contentBackground
content=" 表单页用于向用户收集或验证信息,基础表单常见于数据项较少的表单场景。"
content="设置试卷解析/查重时使用的正则表达式"
contentClass="p-4"
>
<BasicForm @register="register" />
@@ -15,6 +15,7 @@
import { useMessage } from '/@/hooks/web/useMessage'
import { PageWrapper } from '/@/components/Page'
import { useI18n } from '/@/hooks/web/useI18n'
import { setUserRegex } from '/@/api/dashboard'
export default defineComponent({
name: 'FormBasicPage',
@@ -42,20 +43,20 @@
async function customSubmitFunc() {
try {
await validate()
const data = await validate()
if (!data) return
setProps({
submitButtonOptions: {
loading: true,
},
})
setTimeout(() => {
setProps({
submitButtonOptions: {
loading: false,
},
})
createMessage.success('提交成功!')
}, 2000)
const msg = await setUserRegex(data)
setProps({
submitButtonOptions: {
loading: false,
},
})
createMessage.success(msg)
} catch (error) {}
}