mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-09 10:21:00 +08:00
finish getUserRegex
This commit is contained in:
@@ -79,9 +79,9 @@ func (u *UserDatabase) GetUserRegex(id int) (*Regex, error) {
|
||||
reg, _ := sql.Find[Regex](&u.db, UserTableRegex, "WHERE ID="+strconv.Itoa(id))
|
||||
u.mu.RUnlock()
|
||||
reg.ID = *user.ID
|
||||
rf := reflect.ValueOf(reg)
|
||||
rf := reflect.ValueOf(®).Elem()
|
||||
defaultrf := reflect.ValueOf(GetDefaultRegex())
|
||||
for i := 0; i < rf.NumField(); i++ {
|
||||
for i := 1; i < rf.NumField(); i++ {
|
||||
if rf.Field(i).IsZero() {
|
||||
rf.Field(i).Set(defaultrf.Field(i))
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { defHttp } from '/@/utils/http/axios'
|
||||
import { MessageItem } from './model/workbenchModel'
|
||||
import { MessageItem, UserRegex } from './model/model'
|
||||
|
||||
enum Api {
|
||||
GetMessageList = '/getMessageList',
|
||||
AcceptMessage = '/acceptMessage',
|
||||
DeleteMessage = '/delMessage',
|
||||
GetAnnualVisits = '/getAnnualVisits',
|
||||
GetUserRegex = '/getUserRegex',
|
||||
}
|
||||
|
||||
export const getAnnualVisits = () => {
|
||||
@@ -23,3 +24,7 @@ export const acceptMessage = (id: number) => {
|
||||
export const deleteMessage = (id: number) => {
|
||||
return defHttp.get<string>({ url: Api.DeleteMessage, params: { id } })
|
||||
}
|
||||
|
||||
export const getUserRegex = () => {
|
||||
return defHttp.get<UserRegex>({ url: Api.GetUserRegex })
|
||||
}
|
||||
|
||||
@@ -15,3 +15,15 @@ export interface MessageItem {
|
||||
text: string
|
||||
type: MessageTypeEnum
|
||||
}
|
||||
|
||||
export interface UserRegex {
|
||||
ID: number
|
||||
Title: string
|
||||
Class: string
|
||||
OpenCl: string
|
||||
Date: string
|
||||
Time: string
|
||||
Rate: string
|
||||
Major: string
|
||||
Sub: string
|
||||
}
|
||||
@@ -1,63 +1,66 @@
|
||||
import { FormSchema } from '/@/components/Form'
|
||||
import { getUserRegex } from '/@/api/dashboard'
|
||||
const colProps = {
|
||||
span: 24,
|
||||
}
|
||||
|
||||
const userregex = await getUserRegex()
|
||||
|
||||
export const schemas: FormSchema[] = [
|
||||
{
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
colProps,
|
||||
label: '试卷标题',
|
||||
defaultValue: 'more 吗',
|
||||
defaultValue: userregex.Title,
|
||||
},
|
||||
{
|
||||
field: 'class',
|
||||
component: 'Input',
|
||||
colProps,
|
||||
label: '课程名称',
|
||||
defaultValue: 'more 吗',
|
||||
defaultValue: userregex.Class,
|
||||
},
|
||||
{
|
||||
field: 'opencl',
|
||||
component: 'Input',
|
||||
colProps,
|
||||
label: '开/闭卷',
|
||||
defaultValue: 'more 吗',
|
||||
defaultValue: userregex.OpenCl,
|
||||
},
|
||||
{
|
||||
field: 'date',
|
||||
component: 'Input',
|
||||
colProps,
|
||||
label: '考试日期',
|
||||
defaultValue: 'more 吗',
|
||||
defaultValue: userregex.Date,
|
||||
},
|
||||
{
|
||||
field: 'time',
|
||||
component: 'Input',
|
||||
colProps,
|
||||
label: '考试时长',
|
||||
defaultValue: 'more 吗',
|
||||
defaultValue: userregex.Time,
|
||||
},
|
||||
{
|
||||
field: 'rate',
|
||||
component: 'Input',
|
||||
colProps,
|
||||
label: '成绩占比',
|
||||
defaultValue: 'more 吗',
|
||||
defaultValue: userregex.Rate,
|
||||
},
|
||||
{
|
||||
field: 'major',
|
||||
component: 'Input',
|
||||
colProps,
|
||||
label: '大题题号',
|
||||
defaultValue: 'more 吗',
|
||||
defaultValue: userregex.Major,
|
||||
},
|
||||
{
|
||||
field: 'sub',
|
||||
component: 'Input',
|
||||
colProps,
|
||||
label: '小题题号',
|
||||
defaultValue: 'more 吗',
|
||||
defaultValue: userregex.Sub,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
import { Card, List } from 'ant-design-vue'
|
||||
import { getMessageList, acceptMessage, deleteMessage } from '/@/api/dashboard/index'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
import { MessageTypeEnum, MessageItem } from '/@/api/dashboard/model/workbenchModel'
|
||||
import { MessageTypeEnum, MessageItem } from '../../../../api/dashboard/model/model.js'
|
||||
import { Avatar } from 'ant-design-vue'
|
||||
import headerImg from '/@/assets/images/header.jpg'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user