|
|
@@ -38,6 +38,12 @@
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
}
|
|
|
+ .amis-scope .cxd-Layout--headerFixed .cxd-Layout-header .cxd-Page {
|
|
|
+ background: none;
|
|
|
+ }
|
|
|
+ .amis-scope .cxd-Page-body .cxd-DropDown--alignRight .cxd-DropDown-menu {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
@@ -69,22 +75,138 @@
|
|
|
langReplaceTextIgnoreKeys: zhCNLocale.langReplaceTextIgnoreKeys
|
|
|
}
|
|
|
}
|
|
|
+ // 缓存中设置的语言
|
|
|
+ let lang = localStorage.getItem('language')
|
|
|
+ //内置组件的翻译信息
|
|
|
+ let langRegister = {}
|
|
|
+ //json配置的全文翻译信息
|
|
|
+ let langReplaceText = {}
|
|
|
+ //需要忽略json配置的全文替换key
|
|
|
+ let langReplaceTextIgnoreKeys = {}
|
|
|
+ if (undefined !== languageMap[lang]) {
|
|
|
+ langRegister = languageMap[lang].register
|
|
|
+ langReplaceText = languageMap[lang].replaceText
|
|
|
+ langReplaceTextIgnoreKeys = languageMap[lang].langReplaceTextIgnoreKeys
|
|
|
+ } else {
|
|
|
+ lang = 'zh-CN'
|
|
|
+ }
|
|
|
+ if (undefined !== langReplaceText && Object.keys(langReplaceText).length !== 0) {
|
|
|
+ } else {
|
|
|
+ langReplaceText = {}
|
|
|
+ }
|
|
|
+
|
|
|
+ if (undefined !== langReplaceTextIgnoreKeys && Object.keys(langReplaceTextIgnoreKeys).length !== 0) {
|
|
|
+ } else {
|
|
|
+ langReplaceTextIgnoreKeys = {}
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
// 如果想用 browserHistory 请切换下这处代码, 其他不用变
|
|
|
// const history = History.createBrowserHistory();
|
|
|
const history = History.createHashHistory();
|
|
|
-
|
|
|
+ const header = {
|
|
|
+ "type": "page",
|
|
|
+ "initApi": "/api/sys_user_info",
|
|
|
+ "body": [
|
|
|
+ {
|
|
|
+ "type": "flex",
|
|
|
+ "justify": "flex-end",
|
|
|
+ "items": [
|
|
|
+ {
|
|
|
+ "type": "dropdown-button",
|
|
|
+ "label": "切换语言",
|
|
|
+ "className": "header-menu",
|
|
|
+ "buttons": [
|
|
|
+ {
|
|
|
+ "type": "button",
|
|
|
+ "label": "中文",
|
|
|
+ "id": "u:6911502c8fcc",
|
|
|
+ "onEvent": {
|
|
|
+ "click": {
|
|
|
+ "actions": [
|
|
|
+ {
|
|
|
+ "script": "localStorage.setItem('language', 'zh-CN')\nlocation.reload()",
|
|
|
+ "actionType": "custom",
|
|
|
+ "args": {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "weight": 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "type": "button",
|
|
|
+ "label": "English",
|
|
|
+ "id": "u:e702685a7a45",
|
|
|
+ "onEvent": {
|
|
|
+ "click": {
|
|
|
+ "actions": [
|
|
|
+ {
|
|
|
+ "script": "localStorage.setItem('language', 'en-US')\r\nlocation.reload()",
|
|
|
+ "actionType": "custom"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "weight": 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "actionType": "",
|
|
|
+ "link": "/view/user_info"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "id": "u:4fedf7a987bf",
|
|
|
+ "size": "md",
|
|
|
+ "level": "default",
|
|
|
+ "align": "right",
|
|
|
+ "block": true,
|
|
|
+ "hideCaret": false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "type": "dropdown-button",
|
|
|
+ "label": "名字e",
|
|
|
+ "className": "header-menu",
|
|
|
+ "buttons": [
|
|
|
+ {
|
|
|
+ "type": "button",
|
|
|
+ "label": "个人信息",
|
|
|
+ "actionType": "link",
|
|
|
+ "link": "/view/user_info",
|
|
|
+ "id": "u:57cf3ed9c568"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "type": "button",
|
|
|
+ "actionType": "url",
|
|
|
+ "url": "/login/out",
|
|
|
+ "blank": false,
|
|
|
+ "confirmText": "确定要退出吗",
|
|
|
+ "label": "退出登录",
|
|
|
+ "id": "u:88d8afc464b5"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "id": "u:d324269526b9",
|
|
|
+ "size": "md",
|
|
|
+ "level": "default",
|
|
|
+ "align": "right",
|
|
|
+ "block": true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "id": "u:e7752d0c1dbe"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "id": "u:d16525b6aae6"
|
|
|
+}
|
|
|
const app = {
|
|
|
type: 'app',
|
|
|
- // brandName: 'ROMA',
|
|
|
- logo: './public/static/images/logo.jpg',
|
|
|
+ brandName: 'ROMA',
|
|
|
+ // logo: './public/static/images/logo.jpg',
|
|
|
|
|
|
// footer: '<div class="p-2 text-center bg-light">底部区域</div>',
|
|
|
// asideBefore: '<div class="p-2 text-center">菜单前面区域</div>',
|
|
|
// asideAfter: '<div class="p-2 text-center">菜单后面区域</div>',
|
|
|
// // api: '/pages/site.json'
|
|
|
- api: 'http://192.168.115.39:8051/demomenu'
|
|
|
+ header,
|
|
|
+ api: 'http://172.20.118.83:8051/demomenu'
|
|
|
};
|
|
|
|
|
|
function normalizeLink(to, location = history.location) {
|
|
|
@@ -151,9 +273,13 @@
|
|
|
'#root',
|
|
|
app,
|
|
|
{
|
|
|
- location: history.location
|
|
|
+ location: history.location,
|
|
|
+ locale: lang
|
|
|
},
|
|
|
{
|
|
|
+ replaceText: langReplaceText,
|
|
|
+ langReplaceTextIgnoreKeys: langReplaceTextIgnoreKeys,
|
|
|
+
|
|
|
// watchRouteChange: fn => {
|
|
|
// return history.listen(fn);
|
|
|
// },
|