Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Starter Web Vue
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
product
kim3-web-vue
Starter Web Vue
Commits
07f6eb64
Commit
07f6eb64
authored
Jul 07, 2021
by
水落(YangLei)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加菜单管理中的中英文
parent
6e53962f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
6 deletions
+35
-6
src/api/menu.js
src/api/menu.js
+4
-0
src/pages/system/view/menu/form.vue
src/pages/system/view/menu/form.vue
+31
-6
No files found.
src/api/menu.js
View file @
07f6eb64
...
...
@@ -16,6 +16,10 @@ export async function getMenuDataApi(useCache) {
});
}
export
function
getMenuDetailApi
(
id
)
{
return
getReq
(
`/api/v1/menus/
${
id
}
`
);
}
export
function
addMenuApi
(
data
)
{
return
postReq
(
'
/api/v1/menus
'
,
data
);
}
...
...
src/pages/system/view/menu/form.vue
View file @
07f6eb64
...
...
@@ -10,10 +10,10 @@
</a-radio-group>
</a-form-model-item>
<a-form-model-item
label=
"中文名称"
>
<a-input
v-model=
"
form.menuName
"
/>
<a-input
v-model=
"
menuTypeNameZh
"
/>
</a-form-model-item>
<a-form-model-item
label=
"英文名称"
>
<a-input
/>
<a-input
v-model=
"menuTypeNameEn"
/>
</a-form-model-item>
<a-form-model-item
label=
"模块URL"
prop=
"menuUrl"
>
<a-input
v-model=
"form.menuUrl"
/>
...
...
@@ -31,7 +31,7 @@
</
template
>
<
script
>
import
{
addMenuApi
,
updateMenuApi
}
from
'
@/api
'
;
import
{
addMenuApi
,
updateMenuApi
,
getMenuDetailApi
}
from
'
@/api
'
;
import
MenuTree
from
'
@/components/menu_tree/select.vue
'
;
export
default
{
...
...
@@ -42,7 +42,15 @@ export default {
menuType
:
'
CATALOG
'
,
parentMenuId
:
null
,
menuName
:
''
,
menuNameI18nList
:
[
{
i18nLocale
:
'
zh_CN
'
,
i18nMessage
:
''
},
{
i18nLocale
:
'
en_US
'
,
i18nMessage
:
''
},
],
menuRemark
:
''
,
},
menuTypeNameZh
:
''
,
menuTypeNameEn
:
''
,
rules
:
{
menuUrl
:
[{
required
:
true
}],
},
...
...
@@ -58,12 +66,29 @@ export default {
methods
:
{
async
submit
()
{
await
this
.
$refs
[
'
form
'
].
validate
();
const
reqData
=
{
...
this
.
form
,
parentMenuId
:
this
.
form
.
parentMenuId
??
0
};
console
.
log
(
'
this.form.enuNameI18nList
'
,
this
.
form
.
enuNameI18nList
);
const
reqData
=
{
...
this
.
form
,
parentMenuId
:
this
.
form
.
parentMenuId
??
0
,
menuNameI18nList
:
this
.
form
.
menuNameI18nList
.
map
(
i18
=>
{
if
(
i18
.
i18nLocale
===
'
en_US
'
)
i18
.
i18nMessage
=
this
.
menuTypeNameEn
;
if
(
i18
.
i18nLocale
===
'
zh_CN
'
)
i18
.
i18nMessage
=
this
.
menuTypeNameZh
;
return
i18
;
}),
menuName
:
this
.
menuTypeNameZh
,
};
console
.
log
(
'
this.form.enuNameI18nList
'
,
this
.
form
.
enuNameI18nList
);
return
this
.
isEdit
?
updateMenuApi
(
reqData
)
:
addMenuApi
(
reqData
);
},
setEdit
(
data
)
{
async
setEdit
(
data
)
{
this
.
type
=
1
;
this
.
form
=
data
;
this
.
form
=
await
getMenuDetailApi
(
data
.
menuId
);
this
.
form
.
menuNameI18nList
?.
forEach
(
i18
=>
{
if
(
i18
.
i18nLocale
===
'
en_US
'
)
this
.
menuTypeNameEn
=
i18
.
i18nMessage
;
if
(
i18
.
i18nLocale
===
'
zh_CN
'
)
this
.
menuTypeNameZh
=
i18
.
i18nMessage
;
});
},
},
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment