fengxiang
2018-07-12 5c0d8040266554b67e852ccb7056c3d0cae4b4ef
菜单配置
1 files added
9 files modified
9044 ■■■■■ changed files
.angular-cli.json 2 ●●● patch | view | raw | blame | history
package.json 4 ●●●● patch | view | raw | blame | history
src/app/app.component.ts 15 ●●●● patch | view | raw | blame | history
src/app/app.module.ts 9 ●●●●● patch | view | raw | blame | history
src/app/core/net/default.interceptor.ts 6 ●●●● patch | view | raw | blame | history
src/app/routes/dashboard/workplace/workplace.component.ts 12 ●●●●● patch | view | raw | blame | history
src/app/routes/routes.module.ts 11 ●●●●● patch | view | raw | blame | history
src/assets/app-data.json 509 ●●●● patch | view | raw | blame | history
src/environments/environment.ts 2 ●●● patch | view | raw | blame | history
yarn.lock 8474 ●●●●● patch | view | raw | blame | history
.angular-cli.json
@@ -23,7 +23,7 @@
        "scripts": [
            "../node_modules/@antv/g2/dist/g2.min.js",
            "../node_modules/@antv/data-set/dist/data-set.min.js",
            "../node_modules/@antv/g2-plugin-slider/dist/g-2.0.0.min.js"
            "../node_modules/@antv/g2-plugin-slider/dist/g2-plugin-slider.min.js"
        ],
        "environmentSource": "environments/environment.ts",
        "environments": {
package.json
@@ -38,8 +38,8 @@
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@antv/data-set": "^0.7.0",
    "@antv/g2": "^3.0.1",
    "@antv/g2-plugin-slider": "^2.0.0",
    "@antv/g2": "^3.2.2",
    "@antv/g2-plugin-slider": "^2.0.3",
    "@delon/abc": "^0.3.0-rc.1",
    "@delon/acl": "^0.3.0-rc.1",
    "@delon/theme": "^0.3.0-rc.1",
src/app/app.component.ts
@@ -1,7 +1,8 @@
import { Component, HostBinding, OnInit } from '@angular/core';
import { Component, HostBinding, OnInit, Inject } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { ThemesService, SettingsService, TitleService } from '@delon/theme';
import { filter, map } from 'rxjs/operators';
import { TokenService, DA_SERVICE_TOKEN } from '@delon/auth';
@Component({
  selector: 'app-root',
@@ -17,10 +18,20 @@
    private theme: ThemesService,
    private settings: SettingsService,
    private router: Router,
    private titleSrv: TitleService) {
    private titleSrv: TitleService,
    @Inject(DA_SERVICE_TOKEN) private tokenService: TokenService,
  ) {
  }
  ngOnInit() {
    // 设置Token信息
    this.tokenService.set({
      token: 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsIm9pZCI6NSwibW9kZSI6IldlYiIsInNjb3BlcyI6WyJ0ZW1wIl0sImlzcyI6Imh0dHA6Ly9tb25pdG9yLjdkcmxiLmNvbSIsImlhdCI6MTUzMTMxNjU4MCwiZXhwIjoxNTM5MDkyNTgwfQ.tWE7AqGfLwwK-nO1FUveJ8xKqpxitqG1GdhKHp9JDyRPjNDYX7ocgkEw0W2G8hKL_tJIjjrQ1pc0zvCmLTJ-pg',
      name: 'admin',
      email: `admin@qq.com`,
      id: 10000,
      time: +new Date(),
    });
    this.router.events.pipe(
            filter(evt => evt instanceof NavigationEnd),
            map(() => this.router.url)
src/app/app.module.ts
@@ -12,7 +12,7 @@
import { LayoutModule } from './layout/layout.module';
import { StartupService } from './core/services/startup.service';
import { DefaultInterceptor } from '@core/net/default.interceptor';
import { AlainAuthModule, SimpleInterceptor } from '@delon/auth';
import { AlainAuthModule, SimpleInterceptor, JWTInterceptor } from '@delon/auth';
// i18n
import { I18NService } from './core/i18n/i18n.service';
@@ -44,7 +44,10 @@
        RoutesModule,
        // auth
        AlainAuthModule.forRoot({
            login_url: `/pro/user/login`
            login_url: `/pro/user/login`,
            token_send_key : 'X-Authorization',
            token_send_place : 'header',
            allow_anonymous_key: `_allow_anonymous`,
        }),
        // i18n
        TranslateModule.forRoot({
@@ -57,7 +60,7 @@
    ],
    providers: [
        { provide: LOCALE_ID, useValue: 'zh-Hans' },
        { provide: HTTP_INTERCEPTORS, useClass: SimpleInterceptor, multi: true},
        { provide: HTTP_INTERCEPTORS, useClass: JWTInterceptor, multi: true},
        { provide: HTTP_INTERCEPTORS, useClass: DefaultInterceptor, multi: true},
        { provide: ALAIN_I18N_TOKEN, useClass: I18NService, multi: false },
        StartupService,
src/app/core/net/default.interceptor.ts
@@ -27,11 +27,11 @@
        // TIPS:原TOKEN信息已交由 `@delon/auth` 处理
        // Document: http://ng-alain.com/docs/auth
         debugger;
        // 统一加上服务端前缀
        let url = req.url;
        if (!url.startsWith('https://') && !url.startsWith('http://')) {
            url = environment.SERVER_URL + url;
        if (!url.startsWith('https://') && !url.startsWith('http://') && !url.startsWith('assets')) {
        url = environment.SERVER_URL + url;
        }
        const newReq = req.clone({
src/app/routes/dashboard/workplace/workplace.component.ts
@@ -3,6 +3,7 @@
import { getTimeDistance, yuan, fixedZero } from '@delon/abc';
import { getNotice, getActivities } from '../../../../../_mock/api.service';
import { getFakeChartData } from '../../../../../_mock/chart.service';
import { _HttpClient } from '@delon/theme';
@Component({
    selector: 'app-dashboard-workplace',
@@ -76,9 +77,18 @@
      ];
    // endregion
    constructor(public msg: NzMessageService) {}
    constructor(
      public msg: NzMessageService,
      public http: _HttpClient,
    ) {  }
    ngOnInit() {
        debugger;
        this.http.get('user-context').subscribe(
          res => {
            console.log(res);
          }
        );
        setTimeout(() => {
            this.notice = getNotice();
            this.activities = getActivities().map((item: any) => {
src/app/routes/routes.module.ts
@@ -15,7 +15,16 @@
import { ProUserLoginComponent } from './pro/user/login/login.component';
import { ProUserRegisterComponent } from './pro/user/register/register.component';
import { ProUserRegisterResultComponent } from './pro/user/register-result/register-result.component';
// Operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/last';
import 'rxjs/add/operator/delay';
@NgModule({
    imports: [
        SharedModule,
src/assets/app-data.json
@@ -1,408 +1,125 @@
{
    "app": {
        "name": "Alain",
        "description": "Ng-zorro admin panel front-end framework"
        "name": "七星瓢虫环境监测",
        "description": "七星瓢虫环境监测"
    },
    "user": {
        "name": "Admin",
        "avatar": "./assets/img/zorro.svg",
        "email": "cipchk@qq.com"
        "email": "admin@qq.com"
    },
    "menu": [{
        "text": "主导航",
        "translate": "main_navigation",
        "group": true,
        "children": [{
            "text": "仪表盘",
            "translate": "dashboard",
            "link": "/dashboard",
            "icon": "icon-speedometer",
            "children": [{
                "text": "仪表盘V1",
                "link": "/dashboard/v1",
                "translate": "dashboard_v1"
            }, {
                "text": "分析页",
                "link": "/dashboard/analysis",
                "translate": "dashboard_analysis"
            }, {
                "text": "Monitor",
                "link": "/dashboard/monitor",
                "translate": "dashboard_monitor"
            }, {
                "text": "Workplace",
                "link": "/dashboard/workplace",
                "translate": "dashboard_workplace"
            }]
        }, {
            "text": "快捷菜单",
            "translate": "shortcut",
            "icon": "icon-rocket",
            "shortcut_root": true,
            "children": []
        }, {
            "text": "小部件",
            "translate": "widgets",
            "link": "/widgets",
            "icon": "icon-grid",
            "badge": 2
        }]
    }, {
        "text": "组件",
        "translate": "component",
        "group": true,
        "children": [{
            "text": "基础元素",
            "translate": "elements",
            "link": "/elements",
            "icon": "icon-chemistry",
            "acl": "role-a",
            "children": [{
                "text": "按钮",
                "link": "/elements/buttons",
                "translate": "buttons",
                "shortcut": true
            }, {
                "text": "Notification",
                "link": "/elements/notification",
                "translate": "notification",
                "shortcut": true
            }, {
                "text": "Modal",
                "link": "/elements/modal",
                "translate": "modal"
            }, {
                "text": "SweetAlert",
                "link": "/elements/sweetalert",
                "translate": "sweetalert"
            }, {
                "text": "Tree Antd",
                "link": "/elements/tree-antd",
                "translate": "tree-antd"
            }, {
                "text": "Sortable",
                "link": "/elements/sortable",
                "translate": "sortable"
            }, {
                "text": "Spin",
                "link": "/elements/spin",
                "translate": "spin"
            }, {
                "text": "Dropdown",
                "link": "/elements/dropdown",
                "translate": "dropdown"
            }, {
                "text": "Grid",
                "link": "/elements/grid",
                "translate": "grid"
            }, {
                "text": "Grid Masonry",
                "link": "/elements/gridmasonry",
                "translate": "gridmasonry"
            }, {
                "text": "Typography",
                "link": "/elements/typography",
                "translate": "typography"
            }, {
                "text": "Font Icons",
                "link": "/elements/iconsfont",
                "translate": "iconsfont"
            }, {
                "text": "Colors",
                "link": "/elements/colors",
                "translate": "colors"
            }]
        }, {
            "text": "表单",
            "translate": "forms",
            "link": "/forms",
            "icon": "icon-note",
            "acl": "role-a",
            "children": [{
                "text": "标准",
                "link": "/forms/standard",
                "translate": "standard"
            }, {
                "text": "扩展",
                "link": "/forms/extended",
                "translate": "extended"
            }, {
                "text": "校验",
                "link": "/forms/validation",
                "translate": "validation"
            }, {
                "text": "上传",
                "link": "/forms/upload",
                "translate": "upload",
                "shortcut": true
            }, {
                "text": "图片裁剪",
                "link": "/forms/cropper",
                "translate": "cropper"
            }]
        }, {
            "text": "Charts",
            "translate": "charts",
            "link": "/charts",
            "icon": "icon-graph",
            "acl": "role-a",
            "children": [{
                "text": "G2",
                "link": "/charts/g2"
            }]
        }, {
            "text": "表格",
            "translate": "tables",
            "link": "/tables",
            "icon": "icon-grid",
            "acl": "role-b",
            "children": [{
                "text": "标准",
                "link": "/tables/standard",
                "translate": "standard"
            }, {
                "text": "Full",
                "link": "/tables/full",
                "translate": "full"
            }]
        }, {
            "text": "地图",
            "translate": "maps",
            "link": "/maps",
            "icon": "icon-map",
            "acl": "role-b",
            "children": [{
                "text": "QQ",
                "link": "/maps/qq",
                "translate": "qq"
            }, {
                "text": "Baidu",
                "link": "/maps/baidu",
                "translate": "baidu"
            }]
        }]
    }, {
        "text": "Pro",
        "translate": "pro",
        "group": true,
        "children": [{
            "text": "Form Page",
            "translate": "form",
            "link": "/pro/form",
            "icon": "icon-note",
            "children": [{
                "text": "Step Form",
                "link": "/pro/form/step-form",
                "translate": "step-form"
            }, {
                "text": "Advanced Form",
                "link": "/pro/form/advanced-form",
                "translate": "advanced-form"
            }]
        }, {
            "text": "List",
            "translate": "pro-list",
            "link": "/pro/list",
            "icon": "icon-grid",
            "children": [{
                "text": "Table List",
                "link": "/pro/list/table-list",
                "translate": "pro-table-list"
            }, {
                "text": "Basic List",
                "link": "/pro/list/basic-list",
                "translate": "pro-basic-list"
            }, {
                "text": "Card List",
                "link": "/pro/list/card-list",
                "translate": "pro-card-list"
            }, {
                "text": "Cover Card List",
                "link": "/pro/list/cover-card-list",
                "translate": "pro-cover-card-list"
            }, {
                "text": "Filter Card List",
                "link": "/pro/list/filter-card-list",
                "translate": "pro-filter-card-list"
            }, {
                "text": "Search",
                "link": "/pro/list/search",
                "translate": "pro-search"
            }]
        }, {
            "text": "Profile",
            "translate": "pro-profile",
            "link": "/pro/profile",
            "icon": "icon-book-open",
            "children": [{
                "text": "Basic",
                "link": "/pro/profile/basic",
                "translate": "pro-profile-basic"
            }, {
                "text": "Advanced",
                "link": "/pro/profile/advanced",
                "translate": "pro-profile-advanced"
            }]
        }, {
            "text": "Result",
            "translate": "pro-result",
            "link": "/pro/result",
            "icon": "icon-check",
            "children": [{
                "text": "Success",
                "link": "/pro/result/success",
                "translate": "pro-result-success"
            }, {
                "text": "Fail",
                "link": "/pro/result/fail",
                "translate": "pro-result-fail"
            }]
        }, {
            "text": "Exception",
            "translate": "pro-exception",
            "link": "/pro/exception",
            "icon": "icon-fire",
            "children": [{
                "text": "403",
                "link": "/pro/exception/403"
            }, {
                "text": "404",
                "link": "/pro/exception/404"
            }, {
                "text": "500",
                "link": "/pro/exception/500"
            }]
        }, {
            "text": "User",
            "translate": "pro-user",
            "link": "/pro/user",
            "icon": "icon-user",
            "children": [{
                "text": "login",
                "link": "/pro/user/login",
                "translate": "pro-login"
            }, {
                "text": "register",
                "link": "/pro/user/register",
                "translate": "pro-register"
            }, {
                "text": "register result",
                "link": "/pro/user/register-result",
                "translate": "pro-register-result"
            }]
        }]
    }, {
        "text": "More",
        "translate": "more",
        "group": true,
        "children": [{
            "text": "Common Logics",
            "translate": "logics",
            "link": "/logics",
            "icon": "icon-compass",
            "children": [{
                "text": "ACL",
                "link": "/logics/acl",
                "translate": "acl"
    "menu": [
        {
          "text": "系统导航",
          "group": true,
          "hideInBreadcrumb": true,
          "children": [
            {
              "text": "首页概览",
              "icon": "icon-speedometer",
              "link": "/home-page"
            },
            {
                "text": "Route Guard",
                "link": "/logics/guard",
                "translate": "guard",
                "acl": "admin"
              "text": "预报预警",
              "icon": "icon-pie-chart",
              "children": [
                  {
                    "text": "预警",
                    "link": "/"
                  }
                  ,
                  {
                    "text": "预报",
                    "link": "/"
                  }
                  ,
                  {
                    "text": "因子数据",
                    "link": "/"
                  }
              ]
            },
            {
                "text": "Down File",
                "link": "/logics/downfile",
                "translate": "downfile",
                "shortcut": true
            }]
        }, {
            "text": "Report",
            "translate": "report",
            "icon": "anticon anticon-cloud-o",
            "children": [{
                "text": "Relation",
                "link": "/data-v/relation",
                "translate": "relation",
                "target": "_blank",
                "shortcut": true
            }]
        }, {
            "text": "Pages",
            "translate": "pages",
            "link": "/pages",
            "icon": "icon-doc",
            "acl": "admin",
            "children": [{
                "text": "Login",
                "link": "/login",
                "translate": "m-login"
            }, {
                "text": "Register",
                "link": "/register",
                "translate": "m-register"
            }, {
                "text": "Forget",
                "link": "/forget",
                "translate": "m-forget"
            }, {
                "text": "Lock",
                "link": "/lock",
                "translate": "m-lock"
            }, {
                "text": "404",
                "link": "/404"
            }, {
                "text": "500",
                "link": "/500"
            }, {
                "text": "Maintenance",
                "link": "/maintenance",
                "translate": "maintenance"
            }]
        }, {
            "text": "Extras",
            "translate": "extras",
            "link": "/extras",
            "icon": "icon-cup",
            "children": [{
                "text": "Blog",
                "link": "/extras/blog",
                "translate": "blog",
                "children": [{
                    "text": "List",
                    "link": "/extras/blog/list",
                    "translate": "list",
                    "badge": 1,
                    "badge_dot": true
                },{
                    "text": "Comment",
                    "link": "/extras/blog/comment",
                    "translate": "comment"
                },{
                    "text": "Post",
                    "link": "/extras/blog/post",
                    "translate": "post"
                },{
                    "text": "WebSite",
                    "externalLink": "//github.com/cipchk/ng-alain",
                    "target": "_blank",
                    "translate": "website"
                }]
            }, {
                "text": "Help Center",
                "link": "/extras/helpcenter",
                "translate": "helpcenter"
            }, {
                "text": "Settings",
                "link": "/extras/settings",
                "translate": "settings"
            }, {
                "text": "Poi",
                "link": "/extras/poi",
                "translate": "poi"
            }]
        }]
    }]
              "text": "环境管理",
              "icon": "icon-directions",
              "children": [
                {
                  "text": "考核指标",
                  "link": "/"
                }
                ,
                {
                  "text": "分析",
                  "link": "/"
                }
              ]
            },
            {
              "text": "污染管控",
              "icon": "icon-chemistry",
              "link": "/"
            },
            {
              "text": "企业污染管理",
              "icon": "icon-puzzle",
               "children": [
                {
                  "text": "gis显示",
                  "link": "/"
                }
                ,
                {
                  "text": "企业数据",
                  "link": "/"
                }
                ,
                {
                  "text": "超标报警",
                  "link": "/"
                }
               ]
            },
            {
              "text": "统计分析",
              "icon": "icon-note",
              "link": "/"
            },
            {
              "text": "网络溯源",
              "icon": "icon-support",
              "link": "/"
            },
            {
              "text": "运维运营",
              "icon": "icon-wrench",
              "children": [
            {
                  "text": "数据审核",
                  "link": "/"
                }
                ,
                {
                  "text": "设备状态",
                  "link": "/"
                }
                ,
                {
                  "text": "设备维护",
                  "link": "/"
                }
          ]
            },
            {
              "text": "扬尘监控",
              "icon": "icon-flag",
              "link": "/"
            },
            {
              "text": "会商沙盘",
              "icon": "icon-people",
              "link": "/"
            }
          ]
        }
      ]
}
src/environments/environment.ts
@@ -4,7 +4,7 @@
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
    SERVER_URL: `./`,
    SERVER_URL: `http://127.0.0.1:8080/`,
    production: false,
    hmr: false,
    useHash: true
yarn.lock
New file
Diff too large