23 changed files with 710 additions and 780 deletions
@ -1,54 +1,107 @@
|
||||
/* |
||||
* @Descripttion:
|
||||
* @version:
|
||||
* @Descripttion: |
||||
* @version: |
||||
* @Author: sueRimn |
||||
* @Date: 2021-01-11 14:48:03 |
||||
* @LastEditors: sueRimn |
||||
* @LastEditTime: 2021-07-29 10:26:58 |
||||
*/ |
||||
import { NgModule } from '@angular/core'; |
||||
import { Routes, RouterModule } from '@angular/router'; |
||||
import { LoginComponent } from './pages/login/login.component'; |
||||
import { NavigationComponent } from './navigation/navigation.component'; |
||||
import {HomeComponent} from './home/home.component' |
||||
import { PlanPassComponent } from '../app/plan-audit/plan-pass/plan-pass.component'; |
||||
import { NgModule } from "@angular/core"; |
||||
import { Routes, RouterModule } from "@angular/router"; |
||||
import { LoginComponent } from "./pages/login/login.component"; |
||||
import { NavigationComponent } from "./navigation/navigation.component"; |
||||
import { HomeComponent } from "./home/home.component"; |
||||
import { PlanPassComponent } from "../app/plan-audit/plan-pass/plan-pass.component"; |
||||
|
||||
//路由守卫
|
||||
import {AuthGuard} from './auth.guard' |
||||
import {MTokenK1Component} from './m-token-k1/m-token-k1.component' //K1秘钥
|
||||
import {ViewUnitDetailsPlanComponent} from './key-unit/view-unit-details-plan/view-unit-details-plan.component' |
||||
import { TestComponent } from './test/test.component'; |
||||
import { ExternalLinksPlanComponent } from './external-links-plan/external-links-plan.component'; |
||||
import { CreatePlanOnlineFiveComponent } from './plan-management/create-plan-online-five/create-plan-online-five.component' |
||||
import { ExportExcelComponent } from './export-excel/export-excel.component' |
||||
import { AuthGuard } from "./auth.guard"; |
||||
import { MTokenK1Component } from "./m-token-k1/m-token-k1.component"; //K1秘钥
|
||||
import { ViewUnitDetailsPlanComponent } from "./key-unit/view-unit-details-plan/view-unit-details-plan.component"; |
||||
import { ExternalLinksPlanComponent } from "./external-links-plan/external-links-plan.component"; |
||||
import { CreatePlanOnlineFiveComponent } from "./plan-management/create-plan-online-five/create-plan-online-five.component"; |
||||
import { ExportExcelComponent } from "./export-excel/export-excel.component"; |
||||
|
||||
const routes: Routes = [ |
||||
{path:'',redirectTo:'login',pathMatch:'full'}, |
||||
{ path: "", redirectTo: "login", pathMatch: "full" }, |
||||
{ |
||||
path:'',component:NavigationComponent,canActivate: [AuthGuard],//守卫验证
|
||||
children:[ |
||||
{path:'ui',loadChildren:() => import('./ui/ui.module').then(m => m.UiModule)}, |
||||
{path:'keyUnit',loadChildren:() => import('./key-unit/key-unit.module').then(m => m.KeyUnitModule)}, |
||||
{path:'planManagement',loadChildren:() => import('./plan-management/plan-management.module').then(m => m.PlanManagementModule)}, |
||||
{path:'planAudit',loadChildren:() => import('./plan-audit/plan-audit.module').then(m => m.PlanAuditModule)}, |
||||
{path:'visualization',component: HomeComponent}, |
||||
{path:'gis',loadChildren:() => import('./gis-management/gis-management.module').then(m => m.GISManagementModule)}, |
||||
{path:'statisticanalysis',loadChildren:() => import('./statistic-analysis/statistic-analysis.module').then(m => m.StatisticAnalysisModule)}, |
||||
{path:'dataCollection',loadChildren:() => import('./data-collection/data-collection.module').then(m => m.DataCollectionModule)}, |
||||
] |
||||
path: "", |
||||
component: NavigationComponent, |
||||
canActivate: [AuthGuard], //守卫验证
|
||||
children: [ |
||||
{ |
||||
path: "ui", |
||||
loadChildren: () => import("./ui/ui.module").then((m) => m.UiModule), |
||||
}, |
||||
{ |
||||
path: "keyUnit", |
||||
loadChildren: () => |
||||
import("./key-unit/key-unit.module").then((m) => m.KeyUnitModule), |
||||
}, |
||||
{ |
||||
path: "planManagement", |
||||
loadChildren: () => |
||||
import("./plan-management/plan-management.module").then( |
||||
(m) => m.PlanManagementModule |
||||
), |
||||
}, |
||||
{ |
||||
path: "planAudit", |
||||
loadChildren: () => |
||||
import("./plan-audit/plan-audit.module").then( |
||||
(m) => m.PlanAuditModule |
||||
), |
||||
}, |
||||
{ path: "visualization", component: HomeComponent }, |
||||
{ |
||||
path: "gis", |
||||
loadChildren: () => |
||||
import("./gis-management/gis-management.module").then( |
||||
(m) => m.GISManagementModule |
||||
), |
||||
}, |
||||
{ |
||||
path: "statisticanalysis", |
||||
loadChildren: () => |
||||
import("./statistic-analysis/statistic-analysis.module").then( |
||||
(m) => m.StatisticAnalysisModule |
||||
), |
||||
}, |
||||
{ |
||||
path: "dataCollection", |
||||
loadChildren: () => |
||||
import("./data-collection/data-collection.module").then( |
||||
(m) => m.DataCollectionModule |
||||
), |
||||
}, |
||||
], |
||||
}, |
||||
{ path: "login", component: LoginComponent }, |
||||
{ |
||||
path: "keyUnit/viewunitinfoplans", |
||||
component: ViewUnitDetailsPlanComponent, |
||||
canActivate: [AuthGuard], |
||||
}, |
||||
{ |
||||
path: "getNoMToken", |
||||
component: MTokenK1Component, |
||||
canActivate: [AuthGuard], |
||||
}, //K1秘钥验证失败是跳转页面
|
||||
{ |
||||
path: "planAudit/planpass", |
||||
component: PlanPassComponent, |
||||
canActivate: [AuthGuard], |
||||
}, |
||||
{ path: "linksPlan", component: ExternalLinksPlanComponent }, |
||||
{ path: "CreatePlanOnlineFive", component: CreatePlanOnlineFiveComponent }, |
||||
{ |
||||
path: "exportExcel", |
||||
component: ExportExcelComponent, |
||||
canActivate: [AuthGuard], |
||||
}, |
||||
{path:'login',component:LoginComponent}, |
||||
{path:'keyUnit/viewunitinfoplans', component:ViewUnitDetailsPlanComponent,canActivate: [AuthGuard],}, |
||||
{path:'getNoMToken',component:MTokenK1Component, canActivate: [AuthGuard],}, //K1秘钥验证失败是跳转页面
|
||||
{path:'planAudit/planpass', component: PlanPassComponent , canActivate: [AuthGuard]}, |
||||
{path:'test', component: TestComponent }, |
||||
{path:'linksPlan', component: ExternalLinksPlanComponent }, |
||||
{path:'CreatePlanOnlineFive',component:CreatePlanOnlineFiveComponent}, |
||||
{path:'exportExcel',component:ExportExcelComponent, canActivate: [AuthGuard]}, |
||||
]; |
||||
|
||||
@NgModule({ |
||||
imports: [RouterModule.forRoot(routes)], |
||||
exports: [RouterModule] |
||||
exports: [RouterModule], |
||||
}) |
||||
export class AppRoutingModule { } |
||||
export class AppRoutingModule {} |
||||
|
@ -1,8 +0,0 @@
|
||||
<div class="box"> |
||||
<button mat-button style="position: absolute;left: 50%;top: 0;z-index: 999;" (click)="createimg()">生成图片</button> |
||||
<div id="mapxxx"></div> |
||||
<div class="img"> |
||||
<img [src]="canvasImg" alt=""> |
||||
</div> |
||||
</div> |
||||
|
@ -1,17 +0,0 @@
|
||||
.box{ |
||||
width: 100%; |
||||
height: 100%; |
||||
display: flex; |
||||
#mapxxx{ |
||||
width: 500px; |
||||
height: 500px; |
||||
} |
||||
.img{ |
||||
width: 500px; |
||||
height: 500px; |
||||
img{ |
||||
width: 500px; |
||||
height: 500px; |
||||
} |
||||
} |
||||
} |
@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { TestComponent } from './test.component'; |
||||
|
||||
describe('TestComponent', () => { |
||||
let component: TestComponent; |
||||
let fixture: ComponentFixture<TestComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ TestComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(TestComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -1,56 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core'; |
||||
declare var html2canvas: any; |
||||
declare var AMap: any; |
||||
@Component({ |
||||
selector: 'app-test', |
||||
templateUrl: './test.component.html', |
||||
styleUrls: ['./test.component.scss'] |
||||
}) |
||||
export class TestComponent implements OnInit { |
||||
|
||||
constructor() { } |
||||
map: any |
||||
ngOnInit(): void { |
||||
setTimeout(() => { |
||||
this.map = new AMap.Map('mapxxx', { |
||||
WebGLParams: { |
||||
preserveDrawingBuffer: true |
||||
} |
||||
}); |
||||
|
||||
this.map.setCity('上海市'); |
||||
}, 0); |
||||
} |
||||
//生成图片
|
||||
canvasImg |
||||
createimg() { |
||||
|
||||
// 使用html2canvas插件,将数据源中的数据转换成画布。
|
||||
html2canvas(document.querySelector("#mapxxx"), { |
||||
useCORS: true, |
||||
onrendered: function (canvas) { |
||||
var dataUrl = canvas.toDataURL("image/png"); |
||||
} |
||||
}).then(canvas => { |
||||
// 修改生成的宽度
|
||||
// canvas.style.width = "1000px";
|
||||
console.log(canvas, "生成的画布文件"); |
||||
this.canvasImg = canvas.toDataURL("image/png"); |
||||
// console.log(this.canvasImg)
|
||||
}).then(() => { |
||||
this.downloadFile("导出图片", this.canvasImg); |
||||
|
||||
}) |
||||
|
||||
} |
||||
downloadFile(filename, content) { |
||||
var base64Img = content; |
||||
var oA = document.createElement('a'); |
||||
oA.href = base64Img; |
||||
oA.download = filename; |
||||
var event = document.createEvent('MouseEvents'); |
||||
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); |
||||
oA.dispatchEvent(event); |
||||
} |
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue