Unverified Commit ffd694b8 authored by liuzheng712's avatar liuzheng712

Merge branch 'dev' into test

parents e689e27d 6615fc52
...@@ -39,5 +39,6 @@ ...@@ -39,5 +39,6 @@
"labels": "标签管理", "labels": "标签管理",
"user": "用户", "user": "用户",
"user group": "用户组", "user group": "用户组",
"login logs": "登陆日志" "login logs": "登陆日志",
"language": "语言选择"
} }
...@@ -5390,6 +5390,10 @@ ...@@ -5390,6 +5390,10 @@
"is-glob": "2.0.1" "is-glob": "2.0.1"
} }
}, },
"global": {
"version": "https://github.com/component/global/archive/v2.0.1.tar.gz",
"integrity": "sha512-O91OcV/NbdmQJPHaRu2ekSP7bqFRLWgqSwaJvqHPZHUwmHBagQYTOra29+LnzzG3lZkXH1ANzHzfCxtAPM9HMA=="
},
"globals": { "globals": {
"version": "9.18.0", "version": "9.18.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
...@@ -8070,10 +8074,6 @@ ...@@ -8070,10 +8074,6 @@
"requires": { "requires": {
"better-assert": "1.0.2" "better-assert": "1.0.2"
} }
},
"xmlhttprequest": {
"version": "https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz",
"integrity": "sha512-GO6pmHif8rvZ9YddEoem4hQo0OvcTZJnPGyKxBNsFwgEwNYxbpfewye2ulTDAanWXTcfl2+XKE6/DK7SAoKqMw=="
} }
} }
}, },
...@@ -8104,12 +8104,6 @@ ...@@ -8104,12 +8104,6 @@
"integrity": "sha1-UCrLmzEE2sM90mMOry+IiwuvTLM=", "integrity": "sha1-UCrLmzEE2sM90mMOry+IiwuvTLM=",
"requires": { "requires": {
"global": "https://github.com/component/global/archive/v2.0.1.tar.gz" "global": "https://github.com/component/global/archive/v2.0.1.tar.gz"
},
"dependencies": {
"global": {
"version": "https://github.com/component/global/archive/v2.0.1.tar.gz",
"integrity": "sha512-O91OcV/NbdmQJPHaRu2ekSP7bqFRLWgqSwaJvqHPZHUwmHBagQYTOra29+LnzzG3lZkXH1ANzHzfCxtAPM9HMA=="
}
} }
}, },
"json3": { "json3": {
...@@ -15188,6 +15182,10 @@ ...@@ -15188,6 +15182,10 @@
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz",
"integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk="
}, },
"xmlhttprequest": {
"version": "https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz",
"integrity": "sha512-GO6pmHif8rvZ9YddEoem4hQo0OvcTZJnPGyKxBNsFwgEwNYxbpfewye2ulTDAanWXTcfl2+XKE6/DK7SAoKqMw=="
},
"xregexp": { "xregexp": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz",
......
<div id="sidebar"> <div id="sidebar">
<div class="search"> <div class="search">
<input class="left-search" placeholder=" Search ..." maxlength="2048" name="q" autocomplete="off" <input class="left-search" placeholder=" {{'Search'| trans }} ..." maxlength="2048" name="q" autocomplete="off"
title="Search" title="Search"
type="text" tabindex="1" spellcheck="false" autofocus [(ngModel)]="q" (keyup.enter)="Search(q)"> type="text" tabindex="1" spellcheck="false" autofocus [(ngModel)]="q" (keyup.enter)="Search(q)">
</div> </div>
......
...@@ -150,6 +150,10 @@ export class LocalStorageService { ...@@ -150,6 +150,10 @@ export class LocalStorageService {
set(key: string, value: any) { set(key: string, value: any) {
return localStorage.setItem(key, value); return localStorage.setItem(key, value);
} }
delete(key: string) {
return localStorage.removeItem(key);
}
} }
@Injectable() @Injectable()
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
* @author liuzheng <liuzheng712@gmail.com> * @author liuzheng <liuzheng712@gmail.com>
*/ */
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {AppService, HttpService, LogService} from '../../app.service'; import {AppService, HttpService, LocalStorageService, LogService} from '../../app.service';
import {CleftbarComponent} from '../../ControlPage/cleftbar/cleftbar.component'; import {CleftbarComponent} from '../../ControlPage/cleftbar/cleftbar.component';
import {ControlComponent, NavList} from '../../ControlPage/control/control.component'; import {ControlComponent, NavList} from '../../ControlPage/control/control.component';
import {DataStore} from '../../globals'; import {DataStore, i18n} from '../../globals';
import * as jQuery from 'jquery/dist/jquery.min.js'; import * as jQuery from 'jquery/dist/jquery.min.js';
// import * as layer from 'layui-layer/src/layer.js'; // import * as layer from 'layui-layer/src/layer.js';
declare let layer: any; declare let layer: any;
...@@ -28,7 +28,8 @@ export class ElementNavComponent implements OnInit { ...@@ -28,7 +28,8 @@ export class ElementNavComponent implements OnInit {
constructor(private _appService: AppService, constructor(private _appService: AppService,
private _http: HttpService, private _http: HttpService,
private _logger: LogService) { private _logger: LogService,
private _localStorage: LocalStorageService) {
this._logger.log('nav.ts:NavComponent'); this._logger.log('nav.ts:NavComponent');
this.getnav(); this.getnav();
} }
...@@ -89,6 +90,14 @@ export class ElementNavComponent implements OnInit { ...@@ -89,6 +90,14 @@ export class ElementNavComponent implements OnInit {
this.EnterLicense(); this.EnterLicense();
break; break;
} }
case 'English': {
this.English();
break;
}
case 'Chinese': {
this.Language('cn');
break;
}
default: { default: {
break; break;
} }
...@@ -228,10 +237,25 @@ export class ElementNavComponent implements OnInit { ...@@ -228,10 +237,25 @@ export class ElementNavComponent implements OnInit {
'click': 'BBS', 'click': 'BBS',
'name': 'BBS' 'name': 'BBS'
}] }]
}]; }, {
'id': 'Language',
'name': 'Language',
'children': [
{
'id': 'English',
'click': 'English',
'name': 'English'
},
{
'id': 'Chinese',
'click': 'Chinese',
'name': '中文'
}
]
}
];
} }
Connect() { Connect() {
layer.prompt({ layer.prompt({
formType: 2, formType: 2,
...@@ -248,4 +272,26 @@ export class ElementNavComponent implements OnInit { ...@@ -248,4 +272,26 @@ export class ElementNavComponent implements OnInit {
}); });
} }
English() {
this._localStorage.delete('lang');
i18n.clear();
location.reload();
}
Language(lan: string) {
this._http.get('/i18n/' + lan).subscribe(
data => {
this._localStorage.set('lang', JSON.stringify(data));
}
);
const l = this._localStorage.get('lang');
if (l) {
const data = JSON.parse(l);
Object.keys(data).forEach((k, _) => {
i18n.set(k, data[k]);
});
}
location.reload();
}
} }
...@@ -24,3 +24,44 @@ $asset-path: '../static/imgs/inspinia'; ...@@ -24,3 +24,44 @@ $asset-path: '../static/imgs/inspinia';
@import '~@swimlane/ngx-datatable/release/index.css'; @import '~@swimlane/ngx-datatable/release/index.css';
@import '~@swimlane/ngx-datatable/release/themes/material.css'; @import '~@swimlane/ngx-datatable/release/themes/material.css';
@import '~@swimlane/ngx-datatable/release/assets/icons.css'; @import '~@swimlane/ngx-datatable/release/assets/icons.css';
$material-design-icons-font-path: '~/material-design-icons/iconfont/';
//@import "~material-design-icons/iconfont/material-icons";
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url('#{$material-design-icons-font-path}/MaterialIcons-Regular.eot'); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url('#{$material-design-icons-font-path}/MaterialIcons-Regular.woff2') format('woff2'),
url('#{$material-design-icons-font-path}/MaterialIcons-Regular.woff') format('woff'),
url('#{$material-design-icons-font-path}/MaterialIcons-Regular.ttf') format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment