mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-23 12:00:35 +08:00
finish dashboard/account
This commit is contained in:
@@ -11,14 +11,14 @@ const menu: MenuModule = {
|
|||||||
path: 'analysis',
|
path: 'analysis',
|
||||||
name: t('routes.dashboard.analysis'),
|
name: t('routes.dashboard.analysis'),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'account',
|
|
||||||
name: t('routes.dashboard.account'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: 'workbench',
|
path: 'workbench',
|
||||||
name: t('routes.dashboard.workbench'),
|
name: t('routes.dashboard.workbench'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'account',
|
||||||
|
name: t('routes.dashboard.account'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ const dashboard: AppRouteModule = {
|
|||||||
roles: [RoleEnum.SUPER],
|
roles: [RoleEnum.SUPER],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'workbench',
|
||||||
|
name: 'Workbench',
|
||||||
|
component: () => import('/@/views/dashboard/workbench/index.vue'),
|
||||||
|
meta: {
|
||||||
|
title: t('routes.dashboard.workbench'),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'account',
|
path: 'account',
|
||||||
name: 'Account',
|
name: 'Account',
|
||||||
@@ -35,14 +43,6 @@ const dashboard: AppRouteModule = {
|
|||||||
roles: [RoleEnum.SUPER],
|
roles: [RoleEnum.SUPER],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'workbench',
|
|
||||||
name: 'Workbench',
|
|
||||||
component: () => import('/@/views/dashboard/workbench/index.vue'),
|
|
||||||
meta: {
|
|
||||||
title: t('routes.dashboard.workbench'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,20 @@
|
|||||||
emits: ['success', 'register'],
|
emits: ['success', 'register'],
|
||||||
setup(_, { emit }) {
|
setup(_, { emit }) {
|
||||||
const rowId = ref('')
|
const rowId = ref('')
|
||||||
|
const roles = [
|
||||||
|
{
|
||||||
|
roleName: '课程组长',
|
||||||
|
value: 'super',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
roleName: '归档代理',
|
||||||
|
value: 'filemgr',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
roleName: '课程组员',
|
||||||
|
value: 'user',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||||
labelWidth: 100,
|
labelWidth: 100,
|
||||||
@@ -27,20 +41,7 @@
|
|||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: () => {
|
api: () => {
|
||||||
return [
|
return roles
|
||||||
{
|
|
||||||
roleName: '课程组长',
|
|
||||||
value: 'super',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
roleName: '归档代理',
|
|
||||||
value: 'filemgr',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
roleName: '课程组员',
|
|
||||||
value: 'user',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
labelField: 'roleName',
|
labelField: 'roleName',
|
||||||
valueField: 'value',
|
valueField: 'value',
|
||||||
@@ -75,17 +76,19 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const nick2id = { 课程组长: 1, super: 1, 归档代理: 2, filemgr: 2, 课程组员: 3, user: 3 }
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
try {
|
try {
|
||||||
const values = await validate()
|
const values = await validate()
|
||||||
setModalProps({ confirmLoading: true })
|
setModalProps({ confirmLoading: true })
|
||||||
closeModal()
|
closeModal()
|
||||||
await setOthersInfoApi({ id: Number(rowId.value), nick: values.nick, desc: values.desc })
|
await setOthersInfoApi({ id: Number(rowId.value), nick: values.nick, desc: values.desc })
|
||||||
if (useUserStore().getUserInfo.userId != Number(rowId.value))
|
if (useUserStore().getUserInfo.userId != Number(rowId.value)) {
|
||||||
await setRole(
|
const rid = nick2id[values.role]
|
||||||
Number(rowId.value),
|
await setRole(Number(rowId.value), rid)
|
||||||
{ 课程组长: 1, 归档代理: 2, 课程组员: 3 }[values.role],
|
values.role = roles[rid - 1].roleName
|
||||||
)
|
}
|
||||||
emit('success', { values: { ...values, id: rowId.value } })
|
emit('success', { values: { ...values, id: rowId.value } })
|
||||||
} finally {
|
} finally {
|
||||||
setModalProps({ confirmLoading: false })
|
setModalProps({ confirmLoading: false })
|
||||||
|
|||||||
Reference in New Issue
Block a user