Browse Source

[新增]框架搭建

dev
邵佳豪 3 years ago
commit
8b660d4dff
  1. 13
      .editorconfig
  2. 46
      .gitignore
  3. 15
      .vscode/launch.json
  4. 2
      README.md
  5. 139
      angular.json
  6. 12
      browserslist
  7. 7
      debug.log
  8. 32
      e2e/protractor.conf.js
  9. 23
      e2e/src/app.e2e-spec.ts
  10. 11
      e2e/src/app.po.ts
  11. 13
      e2e/tsconfig.json
  12. 32
      karma.conf.js
  13. 17798
      package-lock.json
  14. 64
      package.json
  15. 7
      proxy.config.json
  16. 5098
      src/app/_theming.scss
  17. 31
      src/app/app-routing.module.ts
  18. 1
      src/app/app.component.html
  19. 0
      src/app/app.component.scss
  20. 35
      src/app/app.component.spec.ts
  21. 34
      src/app/app.component.ts
  22. 41
      src/app/app.module.ts
  23. 33
      src/app/auth.guard.ts
  24. 85
      src/app/http-interceptors/base-interceptor.ts
  25. 9
      src/app/http-interceptors/index.ts
  26. 20
      src/app/interface.ts
  27. 27
      src/app/navigation/navigation.component.html
  28. 152
      src/app/navigation/navigation.component.scss
  29. 25
      src/app/navigation/navigation.component.spec.ts
  30. 17
      src/app/navigation/navigation.component.ts
  31. 109
      src/app/navigation/navigation.module.ts
  32. 1
      src/app/pages/home/home.component.html
  33. 0
      src/app/pages/home/home.component.scss
  34. 25
      src/app/pages/home/home.component.spec.ts
  35. 15
      src/app/pages/home/home.component.ts
  36. 49
      src/app/pages/login/login.component.html
  37. 89
      src/app/pages/login/login.component.scss
  38. 25
      src/app/pages/login/login.component.spec.ts
  39. 54
      src/app/pages/login/login.component.ts
  40. 101
      src/app/pages/pages.module.ts
  41. 102
      src/app/pages/register/register.component.html
  42. 91
      src/app/pages/register/register.component.scss
  43. 25
      src/app/pages/register/register.component.spec.ts
  44. 43
      src/app/pages/register/register.component.ts
  45. 13
      src/app/pipes/boolean.pipe.ts
  46. 9
      src/app/pipes/time.pipe.ts
  47. 44
      src/app/service/cache-token.service.ts
  48. 85
      src/app/service/objects.service.ts
  49. 38
      src/app/service/tree.service.ts
  50. 25
      src/app/tabbar/tabbar.component.html
  51. 45
      src/app/tabbar/tabbar.component.scss
  52. 25
      src/app/tabbar/tabbar.component.spec.ts
  53. 66
      src/app/tabbar/tabbar.component.ts
  54. 18
      src/app/theme.scss
  55. 48
      src/app/ui/changepassword/changepassword.component.html
  56. 15
      src/app/ui/changepassword/changepassword.component.scss
  57. 44
      src/app/ui/changepassword/changepassword.component.ts
  58. 30
      src/app/ui/changepassword/equal-validator.directive.ts
  59. 29
      src/app/ui/paginator/my-paginator.ts
  60. 13
      src/app/ui/paginator/paginator.module.ts
  61. 14
      src/app/ui/ui-routing.module.ts
  62. 106
      src/app/ui/ui.module.ts
  63. 42
      src/app/ui/userdata/edituserdata.component.html
  64. 27
      src/app/ui/userdata/userdata.component.html
  65. 15
      src/app/ui/userdata/userdata.component.scss
  66. 83
      src/app/ui/userdata/userdata.component.ts
  67. 0
      src/assets/.gitkeep
  68. BIN
      src/assets/icon/MaterialIcons-Regular.eot
  69. 1
      src/assets/icon/MaterialIcons-Regular.ijmap
  70. 2373
      src/assets/icon/MaterialIcons-Regular.svg
  71. BIN
      src/assets/icon/MaterialIcons-Regular.ttf
  72. BIN
      src/assets/icon/MaterialIcons-Regular.woff
  73. BIN
      src/assets/icon/MaterialIcons-Regular.woff2
  74. 37
      src/assets/icon/material-icons.css
  75. BIN
      src/assets/images/AnXinQQ.jpg
  76. BIN
      src/assets/images/AnXinWX.jpg
  77. BIN
      src/assets/images/caiji.jpg
  78. BIN
      src/assets/images/noImg.png
  79. BIN
      src/assets/images/upload.jpg
  80. BIN
      src/assets/images/upload.png
  81. BIN
      src/assets/images/upload2.png
  82. 646
      src/assets/mTokenK1/mToken_K1.js
  83. 3
      src/environments/environment.prod.ts
  84. 16
      src/environments/environment.ts
  85. BIN
      src/favicon.ico
  86. 15
      src/index.html
  87. 13
      src/main.ts
  88. 63
      src/polyfills.ts
  89. 122
      src/styles.scss
  90. 20
      src/test.ts
  91. 18
      tsconfig.app.json
  92. 27
      tsconfig.json
  93. 18
      tsconfig.spec.json
  94. 91
      tslint.json
  95. 7996
      yarn.lock

13
.editorconfig

@ -0,0 +1,13 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

46
.gitignore vendored

@ -0,0 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db

15
.vscode/launch.json vendored

@ -0,0 +1,15 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4000",
"webRoot": "${workspaceFolder}"
}
]
}

2
README.md

@ -0,0 +1,2 @@
# 中国石化加油站项目

139
angular.json

@ -0,0 +1,139 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"anxin119": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss",
"spec": false
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/anxin119",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss",
"./node_modules/swiper/css/swiper.min.css",
"./node_modules/viewerjs/dist/viewer.css"
],
"scripts": [
"node_modules/echarts/dist/echarts.js",
"./node_modules/swiper/js/swiper.min.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "8mb",
"maximumError": "8mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "anxin119:build",
"proxyConfig": "proxy.config.json"
},
"configurations": {
"production": {
"browserTarget": "anxin119:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "anxin119:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "anxin119:serve"
},
"configurations": {
"production": {
"devServerTarget": "anxin119:serve:production"
}
}
}
}
}
},
"defaultProject": "anxin119",
"cli": {
"analytics": false
}
}

12
browserslist

@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

7
debug.log

@ -0,0 +1,7 @@
[1214/094922.722:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[1215/082617.914:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[1215/093432.367:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[1217/083219.853:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[1217/102235.409:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[1217/162245.895:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[1217/165122.912:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)

32
e2e/protractor.conf.js

@ -0,0 +1,32 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

23
e2e/src/app.e2e-spec.ts

@ -0,0 +1,23 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('anxin119 app is running!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

11
e2e/src/app.po.ts

@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
}
getTitleText() {
return element(by.css('app-root .content span')).getText() as Promise<string>;
}
}

13
e2e/tsconfig.json

@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

32
karma.conf.js

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/anxin119'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

17798
package-lock.json generated

File diff suppressed because it is too large Load Diff

64
package.json

@ -0,0 +1,64 @@
{
"name": "anxin119",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.config.json --open --port 4000 ",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^9.0.0",
"@angular/cdk": "^9.0.0",
"@angular/common": "~9.0.0",
"@angular/compiler": "~9.0.0",
"@angular/core": "~9.0.0",
"@angular/fire": "^5.3.0",
"@angular/forms": "~9.0.0",
"@angular/material": "^9.0.0",
"@angular/platform-browser": "~9.0.0",
"@angular/platform-browser-dynamic": "~9.0.0",
"@angular/router": "~9.0.0",
"@types/cesium": "^1.59.5",
"@types/swiper": "^5.2.1",
"angular-calendar": "^0.28.2",
"bson-objectid": "^1.3.1",
"cesium": "^1.64.0",
"e-ngx-cesium": "^6.3.2",
"echarts": "^4.6.0",
"firebase": "^7.6.2",
"ngx-cookie-service": "^3.0.2",
"ngx-countdown": "^11.0.0",
"ngx-echarts": "^4.2.2",
"ngx-perfect-scrollbar": "^8.0.0",
"rxjs": "~6.5.4",
"swiper": "^5.3.6",
"tslib": "^1.10.0",
"viewerjs": "^1.6.2",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.1",
"@angular/cli": "~9.0.1",
"@angular/compiler-cli": "~9.0.0",
"@angular/language-service": "~9.0.0",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.7.5"
}
}

7
proxy.config.json

@ -0,0 +1,7 @@
{
"/api": {
"target": "http://39.106.78.171:9008",
"secure": false,
"changeOrigin": true
}
}

5098
src/app/_theming.scss

File diff suppressed because it is too large Load Diff

31
src/app/app-routing.module.ts

@ -0,0 +1,31 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './pages/login/login.component';
import { RegisterComponent } from './pages/register/register.component';
import { NavigationComponent } from './navigation/navigation.component';
//路由守卫
import { AuthGuard } from './auth.guard'
import { HomeComponent } from './pages/home/home.component';
const routes: Routes = [
{ path: '', redirectTo: 'login', pathMatch: 'full' },
{
path: '', component: NavigationComponent, canActivate: [AuthGuard],//守卫验证
children: [
{ path: 'datacollection', loadChildren: () => import('./ui/ui.module').then(m => m.UiModule) }
]
},
{ path: 'login', component: LoginComponent }, //登录页
{ path: 'register', component: RegisterComponent }, //注册页
{ path: 'home', component: HomeComponent } //首页
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }

1
src/app/app.component.html

@ -0,0 +1 @@
<router-outlet></router-outlet>

0
src/app/app.component.scss

35
src/app/app.component.spec.ts

@ -0,0 +1,35 @@
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'anxin119'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('anxin119');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('anxin119 app is running!');
});
});

34
src/app/app.component.ts

@ -0,0 +1,34 @@
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { Data } from './interface'
import { Router,ActivatedRoute } from '@angular/router'
import {CacheTokenService} from './service/cache-token.service'//引入服务
import { CookieService } from 'ngx-cookie-service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor(private http:HttpClient,private router:Router,public token:CacheTokenService,private cookieService: CookieService) { }
ngOnInit(): void {
var token = this.cookieService.get("token")
var refreshToken = this.cookieService.get("refreshToken");
if(token && refreshToken) {
this.http.post('/api/CompanyAccount/RefreshToken',{token: token,refreshToken: refreshToken}).subscribe((data: Data) => {
sessionStorage.setItem("token",data.token);
this.cookieService.set("token",data.token,null,'/');
this.cookieService.set("refreshToken",data.refreshToken,null,'/');
this.token.startUp()
})
}
}
}

41
src/app/app.module.ts

@ -0,0 +1,41 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatIconModule } from '@angular/material/icon';
import { MatSidenavModule } from '@angular/material/sidenav';
import { NavigationModule } from './navigation/navigation.module';
import { PagesModule } from './pages/pages.module';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { httpInterceptorProviders } from './http-interceptors/index'
import { CacheTokenService } from './service/cache-token.service'
import { TreeService } from './service/tree.service'
import { CookieService } from 'ngx-cookie-service';//cookie插件
import { CountdownModule } from 'ngx-countdown'; //倒计时插件
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
MatButtonModule,
MatCheckboxModule,
MatSidenavModule,
NavigationModule,
MatIconModule,
PagesModule,
FormsModule,
HttpClientModule,
CountdownModule
],
providers: [httpInterceptorProviders, CacheTokenService, TreeService, CookieService],
bootstrap: [AppComponent]
})
export class AppModule { }

33
src/app/auth.guard.ts

@ -0,0 +1,33 @@
import { Component, OnInit, Inject } from '@angular/core';
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
import { CookieService } from 'ngx-cookie-service';
@Injectable({
providedIn: 'root'
})
export class AuthGuard implements CanActivate {
constructor(private router: Router,private cookieService: CookieService) {
}
// 路由守卫
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
return this.checkLogin();
}
checkLogin(): boolean {
// 判断本地有没有token
const token = this.cookieService.get("token");
// 如果有token,允许访问
if (token) { return true; }
//如果没有token,跳转登录页
this.router.navigate(['/login']);
return false;
}
}

85
src/app/http-interceptors/base-interceptor.ts

@ -0,0 +1,85 @@
import { Injectable } from '@angular/core';
import {
HttpClient, HttpEvent, HttpInterceptor, HttpHandler, HttpRequest,
HttpErrorResponse
} from '@angular/common/http';
import { throwError } from 'rxjs'
import { catchError, retry } from 'rxjs/operators';
import { Router,ActivatedRoute } from '@angular/router'
import {CacheTokenService} from '../service/cache-token.service'
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { CookieService } from 'ngx-cookie-service';
//baseurl
// const baseurl = 'http://39.106.78.171:8008';
@Injectable()
export class BaseInterceptor implements HttpInterceptor {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,
public snackBar: MatSnackBar,private cookieService: CookieService) {}
intercept(req, next: HttpHandler) {
let newReq = req.clone({
url: req.hadBaseurl ? `${req.url}` : `${req.url}`,
});
if(!req.cancelToken) {
/*获取token*/
let token = this.cookieService.get("token")
/*此处设置额外请求头,token令牌*/
newReq.headers =
newReq.headers.set('Authorization', `Bearer ${token}`)
}
// 携带请求头发送下一次请求
return next.handle(newReq)
.pipe(
//箭头函数,注意this指向
catchError((err) => this.handleError(err))
)
}
// 捕获错误
//401 token过期 403没权限!!! 400参数错误 404未找到 614刷新令牌过期!!!
private handleError(error: HttpErrorResponse) {
// 用户认证失败返回登录页
if (error.status === 401||error.status === 614) {
this.token.delete()
sessionStorage.clear()
window.localStorage.clear()
this.cookieService.set("token",'',new Date(new Date().getTime() + 1),'/')
this.cookieService.set("refreshToken",'',new Date(new Date().getTime() + 1),'/')
this.snackBar.open('用户认证信息过期,请重新登录', '确定', {
duration: 3000
});
this.router.navigate(['/login'])
}
if (error.status === 403) {
this.snackBar.open('对不起,您无此权限!', '确定', {
duration: 3000
});
}
if (error.status === 400) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请核对您的输入格式是否正确','确定',config);
}
if (error.error instanceof ErrorEvent) {
// 发生客户端或网络错误。相应处理。
console.error('An error occurred:', error.error.message);
} else {
// 服务端返回http状态码
// 服务端返回错误信息
console.error(
`Backend returned code ${error.status}, ` +
`body was: ${error.error}`);
}
// 返回带有面向用户的错误信息
return throwError(
error.error);
};
}

9
src/app/http-interceptors/index.ts

@ -0,0 +1,9 @@
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { BaseInterceptor } from './base-interceptor';
/** Http interceptor providers in outside-in order */
export const httpInterceptorProviders = [
{ provide: HTTP_INTERCEPTORS, useClass: BaseInterceptor, multi: true },
];

20
src/app/interface.ts

@ -0,0 +1,20 @@
export interface Data {
token:string,
refreshToken:string,
expires: number,
realName:string,
isDefaultPassword:any
}
export interface windows {
token:string
}
export enum isno {
"是",
"否"
}
export interface House {
name:string,
type:string,
space:string
}

27
src/app/navigation/navigation.component.html

@ -0,0 +1,27 @@
<mat-sidenav-container class="example-container" autosize>
<mat-sidenav #drawer class="example-sidenav" mode="side" opened="true" color="primary" style="overflow-x: hidden;">
<div class="biglogobox">
<img src="../../assets/images/logo2.png" alt="">
</div>
<div class="navbox">
<ul>
<!-- basicinfo -->
<!-- <li [routerLink]="['/datacollection/basicinfo']" routerLinkActive="router-link-active">基本信息</li> -->
<li>基本信息</li>
</ul>
</div>
</mat-sidenav>
<button type="button" mat-button (click)="drawer.toggle()" class="shownav">
<mat-icon>menu</mat-icon>
</button>
<div class="example-sidenav-content">
<div style="height: 64px;">
<app-tabbar></app-tabbar>
</div>
<div style="flex: 1; overflow: hidden;">
<router-outlet></router-outlet>
</div>
</div>
</mat-sidenav-container>

152
src/app/navigation/navigation.component.scss

@ -0,0 +1,152 @@
.example-container {
width: 100%;
height:100%;
border: 1px solid rgba(0, 0, 0, 0.5);
overflow: hidden;
}
mat-accordion{
height: 100%;
}
mat-sidenav{
box-shadow: 2px 0px 5px #888888;
color: white;
background-color: #3c4252;
width: 240px;
overflow-x: hidden;
p{
height: 48px;
cursor: pointer;
font-size: 16px;
line-height: 48px;
}
ul{
width: 100%;
li{
list-style: none;
height: 48px;
line-height: 48px;
cursor: pointer;
background: white;
padding-left: 55px;
background-color: #3c4252;
color: white;
border: none;
outline: none;
}
.superli{
padding-left: 66px;
}
}
}
.logobox{
border-radius: 50%;
width: 64px;
height: 64px;
background:url("https://img5.tianyancha.com/logo/lll/cce72488294fb8f4bc670a5bb7f0cc4d.png@!f_200x200") no-repeat;
background-size: 100%;
margin: 0px auto;
img{
width: 100%;
height: 100%;
}
}
.shownav{
position: absolute;
top: 13px;
z-index: 200;
}
.mat-accordion .mat-expansion-panel:first-of-type {
border-top-right-radius:0px;
border-top-left-radius:0px;
}
.mat-accordion .mat-expansion-panel:last-of-type {
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
}
.mat-expansion-panel{
border-radius: 0px;
}
.mat-expansion-panel-spacing {
margin: 0px;
}
.superdiv{
padding-left: 31px;
}
mat-icon{
color: white;
}
.navbox{
position: absolute;
left: 0px;
top: 153px;
right: -18px;
bottom: 0px;
overflow-y: scroll;
}
mat-sidenav-container.myapp-dark-theme{
background-color: #fafafa;
color: black;
mat-panel-title{
color: black;
}
ul li{
background-color: white;
color: black;
}
.biglogobox{
background-color: #d50000;
}
color: black;
}
.biglogobox{
width: 250px;
background-color: #42a5f5;
padding-top: 15px;
display: block;
text-align: center;
line-height:40px;
position: relative;
color: #FFF;
font-size: 2em;
margin: 0 auto;
margin-bottom: 100px;
img{
margin-right: 11px;
}
}
mat-panel-title mat-icon{
color: #afb2bb;
font-size: 16px;
line-height: 24px;
margin-right: 6px;
}
mat-expansion-panel{
background-color: #3c4252;
mat-panel-title{
color: white;
}
}
.mat-expansion-indicator::after {
color: white;
}
.example-container .navbox .router-link-active {
background-color: rgba(225,225,225,.5);
border:0
}
.example-sidenav-content{
height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
}

25
src/app/navigation/navigation.component.spec.ts

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NavigationComponent } from './navigation.component';
describe('NavigationComponent', () => {
let component: NavigationComponent;
let fixture: ComponentFixture<NavigationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NavigationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NavigationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

17
src/app/navigation/navigation.component.ts

@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
import {CacheTokenService} from '../service/cache-token.service'//引入服务
@Component({
selector: 'app-navigation',
templateUrl: './navigation.component.html',
styleUrls: ['./navigation.component.scss']
})
export class NavigationComponent implements OnInit {
constructor(public navmenus:CacheTokenService) { }
ngOnInit() {
}
}

109
src/app/navigation/navigation.module.ts

@ -0,0 +1,109 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NavigationComponent } from './navigation.component';
import { MatIconModule } from '@angular/material/icon';
import { MatSidenavModule } from '@angular/material/sidenav';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { TabbarComponent } from '../tabbar/tabbar.component';
import { UiModule } from '../ui/ui.module';
import {A11yModule} from '@angular/cdk/a11y';
import {DragDropModule} from '@angular/cdk/drag-drop';
import {PortalModule} from '@angular/cdk/portal';
import {ScrollingModule} from '@angular/cdk/scrolling';
import {CdkStepperModule} from '@angular/cdk/stepper';
import {CdkTableModule} from '@angular/cdk/table';
import {CdkTreeModule} from '@angular/cdk/tree';
import {MatAutocompleteModule} from '@angular/material/autocomplete';
import {MatBadgeModule} from '@angular/material/badge';
import {MatBottomSheetModule} from '@angular/material/bottom-sheet';
import {MatButtonModule} from '@angular/material/button';
import {MatButtonToggleModule} from '@angular/material/button-toggle';
import {MatCardModule} from '@angular/material/card';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatChipsModule} from '@angular/material/chips';
import {MatStepperModule} from '@angular/material/stepper';
import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatDialogModule} from '@angular/material/dialog';
import {MatDividerModule} from '@angular/material/divider';
import {MatExpansionModule} from '@angular/material/expansion';
import {MatGridListModule} from '@angular/material/grid-list';
import {MatInputModule} from '@angular/material/input';
import {MatListModule} from '@angular/material/list';
import {MatMenuModule} from '@angular/material/menu';
import {MatNativeDateModule, MatRippleModule} from '@angular/material/core';
import {MatPaginatorModule} from '@angular/material/paginator';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatRadioModule} from '@angular/material/radio';
import {MatSelectModule} from '@angular/material/select';
import {MatSliderModule} from '@angular/material/slider';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {MatTabsModule} from '@angular/material/tabs';
import {MatToolbarModule} from '@angular/material/toolbar';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatTreeModule} from '@angular/material/tree';
@NgModule({
declarations: [
NavigationComponent,
TabbarComponent
],
imports: [
CommonModule,
MatSidenavModule,
RouterModule,
MatIconModule,
FormsModule,
UiModule,
A11yModule,
CdkStepperModule,
CdkTableModule,
CdkTreeModule,
DragDropModule,
MatAutocompleteModule,
MatBadgeModule,
MatBottomSheetModule,
MatButtonModule,
MatButtonToggleModule,
MatCardModule,
MatCheckboxModule,
MatChipsModule,
MatStepperModule,
MatDatepickerModule,
MatDialogModule,
MatDividerModule,
MatExpansionModule,
MatGridListModule,
MatIconModule,
MatInputModule,
MatListModule,
MatMenuModule,
MatNativeDateModule,
MatPaginatorModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatRadioModule,
MatRippleModule,
MatSelectModule,
MatSidenavModule,
MatSliderModule,
MatSlideToggleModule,
MatSnackBarModule,
MatSortModule,
MatTableModule,
MatTabsModule,
MatToolbarModule,
MatTooltipModule,
MatTreeModule,
PortalModule,
ScrollingModule,
],
exports: [
NavigationComponent
]
})
export class NavigationModule { }

1
src/app/pages/home/home.component.html

@ -0,0 +1 @@
<p>我是首页</p>

0
src/app/pages/home/home.component.scss

25
src/app/pages/home/home.component.spec.ts

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

15
src/app/pages/home/home.component.ts

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

49
src/app/pages/login/login.component.html

@ -0,0 +1,49 @@
<div class="login">
<div class="loginBox">
<div>
<div class="card">
<span class="cardheader">XXXXXXXXXX</span>
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container">
<div class="input">
<label class="position"><mat-icon>account_box</mat-icon></label>
<mat-form-field>
<input matInput id="name" name="name"
required type="text"
ngModel #name="ngModel" placeholder="请输入账号">
</mat-form-field>
</div>
<div class="input">
<label class="position"><mat-icon>lock</mat-icon></label>
<mat-form-field>
<input matInput id="password" name="password" type='password'
required
ngModel #password="ngModel" placeholder="请输入密码">
</mat-form-field>
</div>
<div *ngIf="errmsg" class="alert-danger input">
{{errmsg}}
</div>
<div class="register">
<a href="javascript:void(0);" style="margin-left: 100px;" class="forget">
忘记密码?
<div class="contactUs">
<label style="font-size: 14px; text-align: center; width: 100%; display: block; color: #fff;">安信科创QQ号</label>
<img src="../../../assets/images/AnXinQQ.jpg">
</div>
</a>
<a href="javascript:void(0);" (click)='toRegister()' style="margin-left: 180px;">快速注册</a>
</div>
<button type="submit" [disabled]="!form.form.valid" class="loginbtn" mat-button>登录</button>
</form>
</div>
</div>
</div>
</div>

89
src/app/pages/login/login.component.scss

@ -0,0 +1,89 @@
.login {
width: 100%;
height: 100%;
background: url('../../../assets/images/caiji.jpg');
background-size:100% 100%;
}
.loginBox {
width: 100%;
height: 100%;
background-color: #000;
background: rgba(0,0,0,0.5);/*盒子背景透明*/
display: flex;
/*!*flex-direction: column;*!可写可不写*/
justify-content: center;
align-items: center;
}
.card {
width: 500px;
height: 355px;
border-radius: 10px;
padding-top: 25px;
background-color: hsla(0,0%,100%,.8);
text-align: center;
box-shadow:0px 0px 10px 5px #333;
}
.cardheader{
margin-bottom: 10px;
font-size: 26px;
font-weight: 500;
}
.input {
margin: 15px auto;
position: relative;
}
.mat-form-field {
width: 300px;
}
.position {
margin-top: 5px;
position: absolute;
top: 15px;
left: 75px;
}
.alert-danger {
text-align-last: left;
margin-left: 100px;
font-size: 14px;
color: red;
}
.register {
text-align: left;
a {
font-size: 14px;
color: #0066FF;
}
}
.loginbtn {
margin-top: 25px;
height: 30px;
line-height: 30px;
width: 280px;
background-color:#039be5;
border-radius: 15px;
color: #fff;
}
//二维码
.forget:hover {
.contactUs {
opacity: 1;
z-index: 1;
transition: opacity 1.5s;
}
}
.contactUs {
opacity: 0;
z-index: -999;
position: fixed;
top: 55%;
left: 28%;
width: 150px;
border-radius: 5px;;
img {
width: 150px;
height: 150px;}
}

25
src/app/pages/login/login.component.spec.ts

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginComponent } from './login.component';
describe('LoginComponent', () => {
let component: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoginComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

54
src/app/pages/login/login.component.ts

@ -0,0 +1,54 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { Data } from '../../interface'
import { Router,ActivatedRoute } from '@angular/router'
import {CacheTokenService} from '../../service/cache-token.service'//引入服务
import { CookieService } from 'ngx-cookie-service';//cookie插件
import { MatSnackBar } from '@angular/material/snack-bar';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss'],
})
export class LoginComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,
public snackBar: MatSnackBar,private cookieService: CookieService) { }
ngOnInit() {}
errmsg :string = ''; //错误信息
//提交登录表单
onSubmit(e){
this.http.post('/api/CompanyAccount/SignIn',{
name: e.name,
password: e.password}).subscribe(
(data: Data) =>
{
sessionStorage.setItem("isDefaultPassword",data.isDefaultPassword);
sessionStorage.setItem("token",data.token);
this.cookieService.set("token",data.token,null,'/');
this.cookieService.set("refreshToken",data.refreshToken,null,'/');
this.router.navigate(['/home'])
//调用服务中的function刷新token
this.token.startUp()
},
(err) =>
{this.errmsg = err}
)
}
//跳转注册页面
toRegister () {
this.router.navigate(['/register'])
}
}

101
src/app/pages/pages.module.ts

@ -0,0 +1,101 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LoginComponent } from './login/login.component';
import { RegisterComponent } from './register/register.component';
import {A11yModule} from '@angular/cdk/a11y';
import {DragDropModule} from '@angular/cdk/drag-drop';
import {PortalModule} from '@angular/cdk/portal';
import {ScrollingModule} from '@angular/cdk/scrolling';
import {CdkStepperModule} from '@angular/cdk/stepper';
import {CdkTableModule} from '@angular/cdk/table';
import {CdkTreeModule} from '@angular/cdk/tree';
import {MatAutocompleteModule} from '@angular/material/autocomplete';
import {MatBadgeModule} from '@angular/material/badge';
import {MatBottomSheetModule} from '@angular/material/bottom-sheet';
import {MatButtonModule} from '@angular/material/button';
import {MatButtonToggleModule} from '@angular/material/button-toggle';
import {MatCardModule, MatCardTitle} from '@angular/material/card';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatChipsModule} from '@angular/material/chips';
import {MatStepperModule} from '@angular/material/stepper';
import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatDialogModule} from '@angular/material/dialog';
import {MatDividerModule} from '@angular/material/divider';
import {MatExpansionModule} from '@angular/material/expansion';
import {MatGridListModule} from '@angular/material/grid-list';
import {MatIconModule} from '@angular/material/icon';
import {MatInputModule} from '@angular/material/input';
import {MatListModule} from '@angular/material/list';
import {MatMenuModule} from '@angular/material/menu';
import {MatNativeDateModule, MatRippleModule} from '@angular/material/core';
import {MatPaginatorModule} from '@angular/material/paginator';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatRadioModule} from '@angular/material/radio';
import {MatSelectModule} from '@angular/material/select';
import {MatSidenavModule} from '@angular/material/sidenav';
import {MatSliderModule} from '@angular/material/slider';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {MatTabsModule} from '@angular/material/tabs';
import {MatToolbarModule} from '@angular/material/toolbar';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatTreeModule} from '@angular/material/tree';
import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
@NgModule({
declarations: [LoginComponent, RegisterComponent, HomeComponent,],
imports: [
CommonModule,
A11yModule,
CdkStepperModule,
CdkTableModule,
CdkTreeModule,
DragDropModule,
MatAutocompleteModule,
MatBadgeModule,
MatBottomSheetModule,
MatButtonModule,
MatButtonToggleModule,
MatCardModule,
MatCheckboxModule,
MatChipsModule,
MatStepperModule,
MatDatepickerModule,
MatDialogModule,
MatDividerModule,
MatExpansionModule,
MatGridListModule,
MatIconModule,
MatInputModule,
MatListModule,
MatMenuModule,
MatNativeDateModule,
MatPaginatorModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatRadioModule,
MatRippleModule,
MatSelectModule,
MatSidenavModule,
MatSliderModule,
MatSlideToggleModule,
MatSnackBarModule,
MatSortModule,
MatTableModule,
MatTabsModule,
MatToolbarModule,
MatTooltipModule,
MatTreeModule,
PortalModule,
ScrollingModule,
FormsModule,
ReactiveFormsModule,
RouterModule
]
})
export class PagesModule { }

102
src/app/pages/register/register.component.html

@ -0,0 +1,102 @@
<div class="login">
<div class="loginBox">
<div>
<div class="card">
<span class="cardheader">数据采集平台</span>
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container">
<div class="input">
<label class="position">
<mat-icon>group</mat-icon>
</label>
<mat-form-field>
<input matInput id="companyName" name="companyName" required ngModel placeholder="请输入单位名称">
</mat-form-field>
</div>
<div class="input">
<label class="position">
<mat-icon>dns</mat-icon>
</label>
<mat-form-field>
<input matInput id="usci" name="usci" #usci="ngModel"
pattern="^[0-9A-HJ-NP-RTUW-Y]{2}\d{6}[0-9A-HJ-NP-RTUW-Y]{10}$" ngModel placeholder="请输入统一社会信用代码">
</mat-form-field>
</div>
<div *ngIf="usci.invalid && (usci.dirty || usci.touched)" class="alert-danger">
<div *ngIf="usci.errors.pattern">
统一社会信用代码格式为18位字母/数字
</div>
</div>
<div class="input">
<label class="position">
<mat-icon>phone</mat-icon>
</label>
<mat-form-field>
<input matInput type="number" id="phone" name="phone" #tel="ngModel" required ngModel
placeholder="请输入联系电话">
</mat-form-field>
</div>
<!-- <div *ngIf="tel.invalid && (tel.dirty || tel.touched)" class="alert-danger">
<div *ngIf="tel.errors.pattern">
电话号码格式为11位数字
</div>
</div> -->
<div class="input">
<label class="position">
<mat-icon>account_box</mat-icon>
</label>
<mat-form-field>
<input matInput id="name" name="name" #name="ngModel" pattern="^[a-zA-Z][a-zA-Z0-9_]{4,19}$" required
ngModel placeholder="请输入账号">
</mat-form-field>
</div>
<div *ngIf="name.invalid && (name.dirty || name.touched)" class="alert-danger">
<div *ngIf="name.errors.pattern">
登录账号格式为5-19位字母+数字
</div>
</div>
<div class="input">
<label class="position">
<mat-icon>lock</mat-icon>
</label>
<mat-form-field>
<input matInput id="password" name="password" type='password' #password="ngModel" required
pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.+[\!\@\#\$\%\^\&\*\(\)\-\=\\\`\_\+\|\~\[\]\{\}\;\'\:\,\.\/\<\>\?])[A-Za-z0-9\!\@\#\$\%\^\&\*\(\)\-\=\\\`\_\+\|\~\[\]\{\}\;\'\:\,\.\/\<\>\?]{8,32}$"
ngModel placeholder="请输入密码">
</mat-form-field>
</div>
<div *ngIf="password.invalid && (password.dirty || password.touched)" class="alert-danger">
<div *ngIf="password.errors.pattern">
登录密码格式为8-20位,大小写字母+数字+特殊字符
</div>
</div>
<div *ngIf="errmsg" class="alert-danger">
{{errmsg}}
</div>
<div class="register">
<a href="javascript:void(0);" (click)='toLogin()'>登录账号</a>
<a href="javascript:void(0);" style="margin-left: 135px;" class="forget">
注册失败?
<div class="contactUs">
<label
style="font-size: 14px; text-align: center; width: 100%; display: block; color: #fff;">安信科创QQ号</label>
<img src="../../../assets/images/AnXinQQ.jpg">
</div>
</a>
</div>
<button type="submit" [disabled]="!form.form.valid" class="loginbtn" mat-button>注册</button>
</form>
</div>
</div>
</div>
</div>

91
src/app/pages/register/register.component.scss

@ -0,0 +1,91 @@
.login {
width: 100%;
height: 100%;
background: url('../../../assets/images/caiji.jpg');
background-size:100% 100%;
}
.loginBox {
width: 100%;
height: 100%;
background-color: #000;
background: rgba(0,0,0,0.5);/*盒子背景透明*/
display: flex;
/*!*flex-direction: column;*!可写可不写*/
justify-content: center;
align-items: center;
}
.card {
width: 500px;
border-radius: 10px;
padding-top: 25px;
background-color: hsla(0,0%,100%,.8);
text-align: center;
box-shadow:0px 0px 10px 5px #333;
}
.cardheader{
margin-bottom: 10px;
font-size: 26px;
font-weight: 500;
}
.input {
margin: 0 auto;
position: relative;
}
.mat-form-field {
width: 300px;
}
.position {
margin-top: 5px;
position: absolute;
top: 15px;
left: 75px;
}
.alert-danger {
margin-bottom: 5px;
text-align: left;
padding-left: 100px;
font-size: 12px;
color: red;
}
.register {
padding-left: 100px;
text-align: left;
a {
font-size: 14px;
color: #0066FF;
}
}
.loginbtn {
margin-top: 25px;
margin-bottom: 25px;
height: 30px;
line-height: 30px;
width: 280px;
background-color:#039be5;
border-radius: 15px;
color: #fff;
}
//二维码
.forget:hover {
.contactUs {
opacity: 1;
z-index: 1;
transition: opacity 1.5s;
}
}
.contactUs {
opacity: 0;
z-index: -999;
position: fixed;
top: 55%;
left: 64%;
width: 150px;
border-radius: 5px;;
img {
width: 150px;
height: 150px;}
}

25
src/app/pages/register/register.component.spec.ts

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RegisterComponent } from './register.component';
describe('RegisterComponent', () => {
let component: RegisterComponent;
let fixture: ComponentFixture<RegisterComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RegisterComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RegisterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

43
src/app/pages/register/register.component.ts

@ -0,0 +1,43 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router, ActivatedRoute } from '@angular/router';
import { MatSnackBar } from '@angular/material/snack-bar';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.scss']
})
export class RegisterComponent implements OnInit {
constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public snackBar: MatSnackBar) { }
ngOnInit() { }
errmsg: any; //错误信息
//提交注册表单
onSubmit(e) {
this.http.post('/api/CompanyAccount/SignUp', {
companyName: e.companyName,
name: e.name,
password: e.password,
phone: String(e.phone),
usci: e.usci
}).subscribe(data => {
this.snackBar.open('注册成功,请登录!', '确定', {
duration: 3000
});
this.router.navigate(['/login'])
}, (err) => {
this.errmsg = err
})
}
//跳转登陆页面
toLogin() {
this.router.navigate(['/login'])
}
}

13
src/app/pipes/boolean.pipe.ts

@ -0,0 +1,13 @@
import { Pipe, PipeTransform } from '@angular/core';
import { isno } from '../interface'
@Pipe({name: 'isno'})
export class IsnoPipe implements PipeTransform {
transform(value: boolean): string {
if(value){
var x = 0
}else{
x=1
}
return isno[x]
}
}

9
src/app/pipes/time.pipe.ts

@ -0,0 +1,9 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'time'})
export class TimePipe implements PipeTransform {
transform(value: string): string {
var newtime = value.substr(0,4) + '-' + value.substr(5,2) + '-' + value.substr(8,2)
return newtime
}
}

44
src/app/service/cache-token.service.ts

@ -0,0 +1,44 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { CookieService } from 'ngx-cookie-service';
@Injectable({
providedIn: 'root'
})
export class CacheTokenService {
constructor(private http:HttpClient,private cookieService: CookieService) { }
public timer;
//刷新token令牌定时器
startUp = ():void=>{
window.clearInterval(this.timer)
this.timer = window.setInterval( ()=>{
var token = this.cookieService.get("token");
var refreshToken = this.cookieService.get("refreshToken");
this.http.post('/api/CompanyAccount/RefreshToken', {
token: token,
refreshToken: refreshToken
}).subscribe( (data:any) => {
sessionStorage.setItem("token",data.token);
this.cookieService.set("token",data.token,null,'/');
this.cookieService.set("refreshToken",data.refreshToken,null,'/');
})
} ,18*60*1000)
}
//删除定时器
delete = ():void=> {
window.clearInterval(this.timer)
}
createTime = (time:string)=>{
var newtime = time.substr(0,4) + '年' + time.substr(5,2) + '月' + time.substr(8,2) + '日' + time.substr(11,8)
}
}

85
src/app/service/objects.service.ts

@ -0,0 +1,85 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class ObjectsService {
static readonly c_apiRoot = "/api/";//普通上传的API根路径
static readonly c_apiRoot_Multipart = "/api/";//分块上传的API根路径
// static testPath = "f1/f2";//测试路径
constructor(private http: HttpClient) { }
//普通上传,单个文件上限5M
static baseUrl = ObjectsService.c_apiRoot + 'Objects/PlanPlatform/';
postFile(extensionPath: string, file: File): Observable<Object> {
let formData = new FormData()
formData.append("file", file, file.name)
let data = { keepOriginalName: 'true' }
return this.http.post(ObjectsService.baseUrl + extensionPath, formData, { params: data });
}
//分块上传
static baseUrl_MultipartUpload = ObjectsService.c_apiRoot_Multipart + 'NewMultipartUpload/PlanPlatform/';
// {
// "objectName": "string",
// "uploadId": "string"
// }
postFile_MultipartUpload(extensionPath: string, file: File): Promise<Object> {
// let formData = new FormData()
// formData.append("file", file, file.name)
// return this.http.post(ObjectsService.baseUrl + extensionPath, formData);
let data = { keepOriginalName: 'true', filename: file.name }
return new Promise((resolve, reject) => {
this.http.post(ObjectsService.baseUrl_MultipartUpload + extensionPath, {}, { params: data }).subscribe(async (data: any) => { //初始化分段上传
let objectName = data.objectName
let uploadId = data.uploadId
let PartNumberETag = []; //每次返回需要保存的信息
//分块 处理
let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段
for (let i = 0; i < allSlice; i++) { //循环分段上传
let start = i * shardSize //切割文件开始位置
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
let formData = new FormData()
formData.append("file", file.slice(start, end))
//同步写法实现异步调用
let result = await new Promise((resolve, reject) => {
// await 需要后面返回一个 promise 对象
this.http.post(ObjectsService.c_apiRoot_Multipart + `MultipartUpload/PlanPlatform/${objectName}?uploadId=${uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => {
let msg = { "partNumber": data.partNumber || null, "eTag": data.eTag || null }
resolve(msg) // 调用 promise 内置方法处理成功
})
});
PartNumberETag.push(result)
if (PartNumberETag.length === allSlice) { //分块上传完成
let data = PartNumberETag
let paramsData = { uploadId: uploadId };
let path = ObjectsService.c_apiRoot_Multipart + 'CompleteMultipartUpload/PlanPlatform/' + objectName;
this.http.post(path, data, { params: paramsData }).subscribe(data => {
let objData: any = new Object();
objData.fileName = file.name;
objData.filePath = (ObjectsService.baseUrl + objectName).replace(file.name, "");
resolve(objData)
})
}
}//for循环
//分块 处理
})
})
}
}

38
src/app/service/tree.service.ts

@ -0,0 +1,38 @@
import { Injectable } from '@angular/core';
@Injectable()
export class TreeService {
toTree(olddata){
let newdata = []
function getparentNode(parentId){
return olddata.find((item)=>{
return item.id == parentId
})
}
olddata.forEach(item => {
var parentNode = getparentNode(item.parentId);
if(parentNode){
if(!parentNode.children){
parentNode.children = []
}
if (parentNode.children.length == 0) {
item.isTop = true;
} else {
item.isTop = false;
parentNode.children[parentNode.children.length -1].isBottom = false;
}
item.isBottom = true;
parentNode.children.push(item)
}else{
if(!item.parentId){//如果parentId为null
newdata.push(item)
}
}
});
return newdata;
}
}

25
src/app/tabbar/tabbar.component.html

@ -0,0 +1,25 @@
<mat-toolbar [color]="'primary'">
<!-- <mat-toolbar> -->
<h1 *ngIf="companyName">{{companyName}}</h1>
<!-- 登录信息按钮 -->
<button mat-icon-button [matMenuTriggerFor]="appMenu" class="login">
<mat-icon>account_circle</mat-icon>
</button>
<mat-menu #appMenu="matMenu">
<button mat-menu-item [routerLink]="['/datacollection/userdata']" >
<mat-icon>perm_identity</mat-icon>
<span>个人资料</span>
</button>
<button mat-menu-item (click)='changpsw()'>
<mat-icon>verified_user</mat-icon>
<span>修改密码</span>
</button>
<button mat-menu-item (click)='signOut()'>
<mat-icon>power_settings_new</mat-icon>
<span>退出系统</span>
</button>
</mat-menu>
</mat-toolbar>

45
src/app/tabbar/tabbar.component.scss

@ -0,0 +1,45 @@
mat-toolbar{
position: relative;
padding-left: 65px;
}
.logo{
height: 64px;
widows: 64px;
}
h1{
line-height: 64px;
color: white;
}
mat-icon{
color: white;
}
.login{
position: absolute;
right:30px;
}
.fullscreen{
position: absolute;
right:60px;
}
.help {
position: absolute;
right:90px;
}
.setting{
position: absolute;
right:120px;
}
.lockscreen{
position: absolute;
right:160px;
}
.darktheme{
position: absolute;
right:140px;
display: none;
}
.boxed{
width: 1200px;
}

25
src/app/tabbar/tabbar.component.spec.ts

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TabbarComponent } from './tabbar.component';
describe('TabbarComponent', () => {
let component: TabbarComponent;
let fixture: ComponentFixture<TabbarComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TabbarComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TabbarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

66
src/app/tabbar/tabbar.component.ts

@ -0,0 +1,66 @@
import { Component, OnInit,Output,EventEmitter } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { Router,ActivatedRoute } from '@angular/router'
import {CacheTokenService} from '../service/cache-token.service' //引入服务
import { MatDialog } from '@angular/material/dialog';
import {ChangepasswordComponent} from '../ui/changepassword/changepassword.component'
import { MatSnackBar } from '@angular/material/snack-bar';
import { CookieService } from 'ngx-cookie-service';
@Component({
selector: 'app-tabbar',
templateUrl: './tabbar.component.html',
styleUrls: ['./tabbar.component.scss']
})
export class TabbarComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,public dialog: MatDialog,public snackBar: MatSnackBar,
private cookieService: CookieService) { }
ngOnInit() {
this.getUserInfo()
}
companyName:any; //企业name
//获取用户信息
getUserInfo () {
this.http.get('/api/CompanyAccount/Profiles').subscribe((data:any)=>{
sessionStorage.setItem('companyId',data.companyId)
this.companyName = data.companyName
})
}
//退出系统
signOut = () => {
let out = confirm("您确定要退出吗")
if(out) {
this.http.post('/api/CompanyAccount/SignOut',{}).subscribe(
data=> {
this.token.delete()
sessionStorage.clear()
window.localStorage.clear()
this.cookieService.set("token",'',new Date(new Date().getTime() + 1),'/');
this.cookieService.set("refreshToken",'',new Date(new Date().getTime() + 1),'/');
this.snackBar.open('成功退出', '确定', {
duration: 3000
});
this.router.navigate(['/login'])
}
)
}
}
//修改密码
changpsw() {
let dialogRef = this.dialog.open(ChangepasswordComponent,
{width:'348px'});
dialogRef.afterClosed().subscribe();
}
}

18
src/app/theme.scss

@ -0,0 +1,18 @@
@import "./theming";
@include mat-core();
$my-app-primary:mat-palette($mat-blue,500);
$my-app-accent :mat-palette($mat-pink,A200,A100,A400);
$my-app-warn :mat-palette($mat-red);
$my-app-theme :mat-light-theme($my-app-primary,$my-app-accent,$my-app-warn);
@include angular-material-theme($my-app-theme);
$my-dark-primary:mat-palette($mat-red,A700);
$my-dark-accent :mat-palette($mat-amber,A200,A100,A400);
$my-dark-warn :mat-palette($mat-deep-orange);
$my-dark-theme :mat-dark-theme($my-dark-primary,$my-dark-accent,$my-dark-warn);
.myapp-dark-theme{
@include angular-material-theme($my-dark-theme);
}

48
src/app/ui/changepassword/changepassword.component.html

@ -0,0 +1,48 @@
<div mat-dialog-title>
修改密码
</div>
<div class="passwordCard" mat-dialog-content>
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container">
<span class="cardLeft">原密码</span>
<mat-form-field>
<input matInput id="password" name="password"
required type="password"
ngModel #password="ngModel" placeholder="请输入原密码">
</mat-form-field>
<span class="cardLeft">新密码</span>
<mat-form-field>
<input matInput id="newPassword" name="newPassword" type="password"
required pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.+[\!\@\#\$\%\^\&\*\(\)\-\=\\\`\_\+\|\~\[\]\{\}\;\'\:\,\.\/\<\>\?])[A-Za-z0-9\!\@\#\$\%\^\&\*\(\)\-\=\\\`\_\+\|\~\[\]\{\}\;\'\:\,\.\/\<\>\?]{8,32}$"
ngModel #newPassword="ngModel" placeholder="请输入新密码">
</mat-form-field>
<div *ngIf="newPassword.invalid && (newPassword.dirty || newPassword.touched)">
<div class="group-error-content">密码格式8-20位,大小写字母+数字+特殊字符</div>
</div>
<span class="cardLeft">确认新密码</span>
<mat-form-field>
<input matInput id="newsPassword" name="newsPassword" type="password"
required
ngModel #newsPassword="ngModel" placeholder="请确认新密码"
[appConfirmpsw] = "newPassword.value">
</mat-form-field>
<div *ngIf="newsPassword.touched&&newsPassword.invalid">
<div class="group-error-content">密码输入不一致!</div>
</div>
<div *ngIf="errmsg" class="group-error-content">
{{errmsg}}
</div>
<div mat-dialog-actions class="btnbox">
<button mat-raised-button color="primary" type="submit"
[disabled]="!form.form.valid">
确定
</button>
<button mat-raised-button color="primary" mat-dialog-close>取消</button>
</div>
</form>
</div>

15
src/app/ui/changepassword/changepassword.component.scss

@ -0,0 +1,15 @@
.passwordCard {
width: 300px;
height: 100%;
}
.mat-form-field {
display: block;
width: 300px;
}
.group-error-content {
font-size: 12px;
color: red;
}
.mat-dialog-content {
overflow: visible
}

44
src/app/ui/changepassword/changepassword.component.ts

@ -0,0 +1,44 @@
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { MatDialogRef } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@Component({
selector: 'app-changepassword',
templateUrl: './changepassword.component.html',
styleUrls: ['./changepassword.component.scss']
})
export class ChangepasswordComponent implements OnInit {
constructor(private http:HttpClient,public snackBar: MatSnackBar,
public dialogRef: MatDialogRef<ChangepasswordComponent>) { }
ngOnInit() {
}
errmsg :string = ''
onSubmit(e){
this.http.put(
'/api/CompanyAccount/Password',
{
newPassword: e.newPassword,
password: e.password
}
).subscribe(data=> {
this.dialogRef.close(data);
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('密码修改成功','确定',config);
},(err) =>
{this.errmsg = err}
)
}
}

30
src/app/ui/changepassword/equal-validator.directive.ts

@ -0,0 +1,30 @@
import { Directive, Input } from '@angular/core';
import { NG_VALIDATORS, Validator, AbstractControl, ValidatorFn} from '@angular/forms';
@Directive({
selector: '[appConfirmpsw]',
providers: [{
provide : NG_VALIDATORS,
useExisting : ConfirmpswDirective,
multi: true
}]
})
export class ConfirmpswDirective implements Validator {
@Input('appConfirmpsw') confirmpsw: string;
constructor() {
}
validate(control: AbstractControl): {[key: string]: any} {
return this.confirmpsw ? comfirmPswValidator(this.confirmpsw)(control) : null;
}
}
export function comfirmPswValidator(_confirmpsw: string): ValidatorFn {
return (control: AbstractControl): {[key: string]: any} => {
if ( !control.value ) {
return { 'required' : true };
}
return control.value !== _confirmpsw ? {'confirmpsw' : {value: true}} : null;
};
}

29
src/app/ui/paginator/my-paginator.ts

@ -0,0 +1,29 @@
import { MatPaginatorIntl } from '@angular/material/paginator';
const dutchRangeLabel = (page: number, pageSize: number, length: number) => {
if (length === 0 || pageSize === 0) { return `0 到 ${length}`; }
length = Math.max(length, 0);
const startIndex = page * pageSize;
const endIndex = startIndex < length ?
Math.min(startIndex + pageSize, length) :
startIndex + pageSize;
return `${startIndex + 1} - ${endIndex} / ${length}`;
}
export function myPaginator() {
const paginatorIntl = new MatPaginatorIntl();
paginatorIntl.itemsPerPageLabel = '每页条数:';
paginatorIntl.nextPageLabel = '下一页:';
paginatorIntl.previousPageLabel = '上一页:';
paginatorIntl.getRangeLabel = dutchRangeLabel;
return paginatorIntl;
}

13
src/app/ui/paginator/paginator.module.ts

@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatPaginatorIntl, MatPaginatorModule } from '@angular/material/paginator';
import { myPaginator } from './my-paginator'
@NgModule({
imports: [
CommonModule,
MatPaginatorModule
],
providers: [ { provide: MatPaginatorIntl, useValue: myPaginator() } ]
})
export class PaginatorModule { }

14
src/app/ui/ui-routing.module.ts

@ -0,0 +1,14 @@
import { Routes, RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { UserdataComponent } from './userdata/userdata.component';
const routes: Routes = [
{ path: 'userdata', component: UserdataComponent }
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class UiRoutingModule { }

106
src/app/ui/ui.module.ts

@ -0,0 +1,106 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { UiRoutingModule } from './ui-routing.module';
import { A11yModule } from '@angular/cdk/a11y';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { PortalModule } from '@angular/cdk/portal';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { CdkStepperModule } from '@angular/cdk/stepper';
import { CdkTableModule } from '@angular/cdk/table';
import { CdkTreeModule } from '@angular/cdk/tree';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatBadgeModule } from '@angular/material/badge';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatButtonModule } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatChipsModule } from '@angular/material/chips';
import { MatStepperModule } from '@angular/material/stepper';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog';
import { MatDividerModule } from '@angular/material/divider';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatNativeDateModule, MatRippleModule, MatOption } from '@angular/material/core';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatSliderModule } from '@angular/material/slider';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTreeModule } from '@angular/material/tree';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { UserdataComponent, EditUser } from './userdata/userdata.component';
import { ChangepasswordComponent } from './changepassword/changepassword.component';
import { IsnoPipe } from '../pipes/boolean.pipe';
import { ConfirmpswDirective } from './changepassword/equal-validator.directive';
import { TimePipe } from '../pipes/time.pipe';
import { PaginatorModule } from './paginator/paginator.module';
@NgModule({
declarations: [UserdataComponent, ChangepasswordComponent, IsnoPipe, ConfirmpswDirective, TimePipe, EditUser],
imports: [
CommonModule,
UiRoutingModule,
A11yModule,
CdkStepperModule,
CdkTableModule,
CdkTreeModule,
DragDropModule,
MatAutocompleteModule,
MatBadgeModule,
MatBottomSheetModule,
MatButtonModule,
MatButtonToggleModule,
MatCardModule,
MatCheckboxModule,
MatChipsModule,
MatStepperModule,
MatDatepickerModule,
MatDialogModule,
MatDividerModule,
MatExpansionModule,
MatGridListModule,
MatIconModule,
MatInputModule,
MatListModule,
MatMenuModule,
MatNativeDateModule,
MatPaginatorModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatRadioModule,
MatRippleModule,
MatSelectModule,
MatSidenavModule,
MatSliderModule,
MatSlideToggleModule,
MatSnackBarModule,
MatSortModule,
MatTableModule,
MatTabsModule,
MatToolbarModule,
MatTooltipModule,
MatTreeModule,
PortalModule,
ScrollingModule,
ReactiveFormsModule,
FormsModule,
PaginatorModule
]
})
export class UiModule { }

42
src/app/ui/userdata/edituserdata.component.html

@ -0,0 +1,42 @@
<h1 mat-dialog-title>修改资料</h1>
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm">
<div>
<mat-form-field>
<input type="text" matInput disabled
[(ngModel)]="data.name" name="name" placeholder="登录账号">
</mat-form-field>
</div>
<div>
<mat-form-field>
<input type="text" matInput pattern="^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[35-8]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0135-9]\d{2}|66\d{2})\d{6}$" required
[(ngModel)]="tel" name="tel" placeholder="联系电话">
</mat-form-field>
</div>
<div>
<mat-form-field>
<input type="text" matInput required
[(ngModel)]="companyName" name="companyName" placeholder="单位名称">
</mat-form-field>
</div>
<div>
<mat-form-field>
<input type="text" matInput required pattern="^[0-9A-HJ-NP-RTUW-Y]{2}\d{6}[0-9A-HJ-NP-RTUW-Y]{10}$"
[(ngModel)]="usci" name="usci" placeholder="统一社会信用代码">
</mat-form-field>
</div>
<div *ngIf="errMsg" class="err"><p>{{errMsg}}</p></div>
<div mat-dialog-actions>
<button mat-raised-button color="primary" type="submit"
[disabled]="!form.form.valid">
确定
</button>
<button mat-raised-button mat-dialog-close>取消</button>
</div>
</form>

27
src/app/ui/userdata/userdata.component.html

@ -0,0 +1,27 @@
<mat-card>
<mat-list role="list" class="userList">
<mat-list-item role="listitem">
<label>登录账号:</label> {{userInfo.name}}
</mat-list-item>
<mat-list-item role="listitem">
<label>联系电话:</label> {{userInfo.phone}}
</mat-list-item>
<mat-list-item role="listitem">
<label>单位名称:</label> {{userInfo.companyName}}
</mat-list-item>
<mat-list-item role="listitem">
<label>账号状态:</label>
<span *ngIf="userInfo.enabled">正常</span>
<span *ngIf="!userInfo.enabled">禁用</span>
</mat-list-item>
<mat-list-item role="listitem">
<label>注册时间:</label> {{userInfo.creationTime|date:'yyyy-MM-dd'}}
</mat-list-item>
<mat-list-item role="listitem">
<label>统一社会信用代码:</label> {{userInfo.usci}}
</mat-list-item>
<mat-list-item role="listitem">
<button mat-raised-button color="primary" (click)='edit()'>修改资料</button>
</mat-list-item>
</mat-list>
</mat-card>

15
src/app/ui/userdata/userdata.component.scss

@ -0,0 +1,15 @@
.userList {
padding-left: 35%;
label {
font-weight: 500;
margin-right: 10px;
}
}
.mat-form-field {
width: 200px;
}
.err {
width: 350px;
font-size: 14px;
color: red;
}

83
src/app/ui/userdata/userdata.component.ts

@ -0,0 +1,83 @@
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
import { HttpClient,HttpHeaders } from '@angular/common/http';
@Component({
selector: 'app-userdata',
templateUrl: './userdata.component.html',
styleUrls: ['./userdata.component.scss']
})
export class UserdataComponent implements OnInit {
constructor(private http: HttpClient,public dialog: MatDialog) { }
userInfo:any={}; // 用户信息
ngOnInit() {
this.getUserInfo()
}
//获取用户信息
getUserInfo () {
this.http.get('/api/CompanyAccount/Profiles').subscribe(data=>{
this.userInfo = data
})
}
//修改资料弹窗
edit () {
let data = this.userInfo
let dialogRef = this.dialog.open(EditUser,{data});
dialogRef.afterClosed().subscribe(
(data)=>{
if (data) {this.getUserInfo()}
}
);
}
}
@Component({
selector: 'edituserdata',
templateUrl: './edituserdata.component.html',
styleUrls: ['./userdata.component.scss']
})
export class EditUser {
constructor(private http: HttpClient,public dialogRef: MatDialogRef<EditUser>,@Inject(MAT_DIALOG_DATA) public data) {}
ngOnInit() {
this.tel = this.data.phone
this.companyName = this.data.companyName
this.usci = this.data.usci
}
tel:any; //联系电话
companyName:any; //单位名称
usci:any; //统一社会信用代码
errMsg:any; //错误信息
//提交表单修改信息
onSubmit (e) {
this.http.put('/api/CompanyAccount/Profiles',{
name:this.data.name,
phone:e.tel,
enabled:this.data.enabled,
creationTime:this.data.creationTime,
usci:e.usci,
companyId:this.data.companyId,
companyName:e.companyName
}).subscribe(data=>{
this.dialogRef.close('success')
},(err) =>
{this.errMsg = err})
}
}

0
src/assets/.gitkeep

BIN
src/assets/icon/MaterialIcons-Regular.eot

Binary file not shown.

1
src/assets/icon/MaterialIcons-Regular.ijmap

File diff suppressed because one or more lines are too long

2373
src/assets/icon/MaterialIcons-Regular.svg

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 275 KiB

BIN
src/assets/icon/MaterialIcons-Regular.ttf

Binary file not shown.

BIN
src/assets/icon/MaterialIcons-Regular.woff

Binary file not shown.

BIN
src/assets/icon/MaterialIcons-Regular.woff2

Binary file not shown.

37
src/assets/icon/material-icons.css

@ -0,0 +1,37 @@
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(./MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(./MaterialIcons-Regular.woff2) format('woff2'),
url(./MaterialIcons-Regular.woff) format('woff'),
url(./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';
}

BIN
src/assets/images/AnXinQQ.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
src/assets/images/AnXinWX.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
src/assets/images/caiji.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
src/assets/images/noImg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
src/assets/images/upload.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
src/assets/images/upload.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
src/assets/images/upload2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

646
src/assets/mTokenK1/mToken_K1.js

@ -0,0 +1,646 @@

function isIe()
{
return ("ActiveXObject" in window);
}
function mToken(obj){
this.obj = obj;
var g_mTokenPlugin = null;
this.LoadLibrary = function()
{
g_mTokenPlugin = new K1ClientPlugin();//新
if(g_mTokenPlugin == null)
{
return -1;
}
return 0;
};
this.K1_mTokenGetVersion = function()
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGetVersion();
};
this.K1_mTokenFindDevice = function()
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenFindDevice();
};
this.K1_mTokenGetLastError = function()
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenGetLastError();
};
this.K1_mTokenGetUID = function(keyIndex)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGetUID(keyIndex);
};
this.K1_mTokenOpen = function(keyUID, keyPassword)
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenOpen(keyUID, keyPassword, 1);
};
this.K1_mTokenClose = function()
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenClose();
};
this.K1_mTokenChangePwd = function(keyUID,oldPassword, newPassword)
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenChangePwd(keyUID, 1, oldPassword, newPassword);
};
this.K1_mTokenSHA1WithSeed = function(keyUID, randomStr)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenSHA1WithSeed(keyUID, randomStr);
};
this.K1_mTokenSHA1WithSeedMac = function(keyUID, randomStr)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenSHA1WithSeedMac(keyUID, randomStr);
};
this.K1_mTokenGenResetPwdRequest = function(keyUID, userInfo)
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenGenResetPwdRequest(keyUID, userInfo);
};
this.K1_mTokenResetPassword = function(keyUID, serverResponse)
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenResetPassword(keyUID, serverResponse);
};
this.K1_mTokenGenRandom = function(keyUID, randomLength)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGenRandom(keyUID, randomLength);
};
this.K1_mTokenReadSecureStorage = function(keyUID, offset, dataLength)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenReadSecureStorage(keyUID, offset, dataLength);
};
this.K1_mTokenWriteSecureStorag = function(keyUID, offset, writeData)
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenWriteSecureStorage(keyUID, offset, writeData);
};
this.K1_mTokenReadUserStorage = function(keyUID, offset, dataLength)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenReadUserStorage(keyUID, offset, dataLength);
};
this.K1_mTokenWriteUserStorage = function(keyUID, offset, writeData)
{
if(g_mTokenPlugin == null)
{
return -1;
}
return g_mTokenPlugin.mTokenWriteUserStorage(keyUID, offset, writeData);
};
this.K1_mTokenGetURL = function(keyUID)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGetURL(keyUID);
};
this.K1_mTokenGetLabel = function(keyUID)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGetLabel(keyUID);
};
this.K1_mTokenGetCompanyName = function(keyUID)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGetCompanyName(keyUID);
};
this.K1_mTokenGetRemark = function(keyUID)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGetRemarks(keyUID);
};
this.K1_mTokenGetOpenType = function(keyUID)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGetOpenType(keyUID);
};
this.K1_mTokenPwdRetryCount = function(keyUID)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenPwdRetryCount(keyUID, 1);
};
this.K1_mTokenEncrypt = function(keyUID, method, data)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenEncrypt(keyUID, method, 1, data);
};
this.K1_mTokenDecrypt = function(keyUID, method, data)
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenDecrypt(keyUID, method, 1, data);
};
this.K1_GetMacAddr = function()
{
if(g_mTokenPlugin == null)
{
return null;
}
return g_mTokenPlugin.mTokenGetMacAddr();
};
var _TimerErrorMessage;
var _ExpireUrl;
/*******************************************************
*
* 函数名称K1_CheckExist()
* 检查USB Key是否存在
* 此方法结合K1_StartCheckTimer方法可用来定时
* 检测USB Key是否存在,不存在即返回到指定页面(
* _ExpireUrl)
*
**********************************************************/
function K1_CheckExist()
{
var rtn =g_mTokenPlugin.mTokenFindDevice();
if(rtn < 1)
{
if(_TimerErrorMessage != null)
{
alert(_TimerErrorMessage + " Error Code: " +g_mTokenPlugin.mTokenGetLastError());
}
if(_ExpireUrl != null)
{
window.location = _ExpireUrl;
}
}
return rtn;
};
/*******************************************************
*
* 函数名称K1_StartCheckTimer()
* 定时操作方法
* interval时间1000/errMsg输出的错误信息
* logonUrl跳转地址
* 此方法结合CheckExist方法可用来定时检测加
* 密Key是否存在,不存在即返回到指定页面(_ExpireUrl)
*
**********************************************************/
this.K1_StartCheckTimer = function(interval, errMsg, logonUrl)
{
_TimerErrorMessage = errMsg;
_ExpireUrl = logonUrl;
//定时检测
window.setInterval(K1_CheckExist, interval);
};
}
function K1ClientPlugin()
{
var url = "http://127.0.0.1:51111/K1_Client";
var xmlhttp ;
function AjaxIO(json) {
if(xmlhttp == null) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
if("https:" == document.location.protocol)
{
url = "https://127.0.0.1:51121/K1_Client";
}
xmlhttp.open("POST", url, false);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send("json=" + json);
}
this.mTokenGetVersion = function()
{
var json = '{"function":"mTokenGetVersion"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenFindDevice = function()
{
var json = '{"function":"mTokenFindDevice"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.devCount;
}else{
return -2;
}
};
this.mTokenGetLastError = function()
{
var json = '{"function":"mTokenGetLastError"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.errorCode;
}else{
return -2;
}
};
this.mTokenGetUID = function(keyIndex)
{
var json = '{"function":"mTokenGetUID", "keyIndex":' + keyIndex + '}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenOpen = function(keyUID, keyPassword, type)
{
var json = '{"function":"mTokenOpen", "keyUID":"' + keyUID + '", "passWd":"' + keyPassword + '", "passWdType":' + type + '}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.rtn;
}else{
return 1;
}
};
this.mTokenClose = function()
{
var json = '{"function":"mTokenClose"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.rtn;
}else{
return 1;
}
};
this.mTokenChangePwd = function(keyUID, type, oldPassword, newPassword)
{
var json = '{"function":"mTokenChangePwd", "keyUID":"' + keyUID + '", "oldUpin":"' + oldPassword + '", "newUpin":"' + newPassword + '", "passWdType":' + type + '}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.rtn;
}else{
return 1;
}
};
this.mTokenSHA1WithSeed = function(keyUID, randomStr)
{
var json = '{"function":"mTokenSHA1WithSeed", "keyUID":"' + keyUID + '", "random":"' + randomStr + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenSHA1WithSeedMac = function(keyUID, randomStr)
{
var json = '{"function":"mTokenSHA1WithSeed", "keyUID":"' + keyUID + '", "random":"' + randomStr + '", "useMac":1}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenGenResetPwdRequest = function(keyUID, userInfo)
{
var json = '{"function":"mTokenGenResetPwdRequest", "keyUID":"' + keyUID + '", "userInfo":"' + userInfo + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenResetPassword = function(keyUID, serverResponse)
{
var json = '{"function":"mTokenResetPassword", "keyUID":"' + keyUID + '", "response":"' + serverResponse + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.rtn;
}else{
return 1;
}
};
this.mTokenGenRandom = function(keyUID, randomLength)
{
var json = '{"function":"mTokenGenRandom", "keyUID":"' + keyUID + '", "inDataLen":' + randomLength + '}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenReadSecureStorage = function(keyUID, offset, dataLength)
{
var json = '{"function":"mTokenReadSecureStorage", "keyUID":"' + keyUID + '", "offset":' + offset + ', "inDataLen":' + dataLength + '}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenWriteSecureStorage = function(keyUID, offset, writeData)
{
var json = '{"function":"mTokenWriteSecureStorage", "keyUID":"' + keyUID + '", "offset":' + offset + ', "inData":"' + writeData + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.rtn;
}else{
return 1;
}
};
this.mTokenReadUserStorage = function(keyUID, offset, dataLength)
{
var json = '{"function":"mTokenReadUserStorage", "keyUID":"' + keyUID + '", "offset":' + offset + ', "inDataLen":' + dataLength + '}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenWriteUserStorage = function(keyUID, offset, writeData)
{
var json = '{"function":"mTokenWriteUserStorage", "keyUID":"' + keyUID + '", "offset":' + offset + ', "inData":"' + writeData + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.rtn;
}else{
return 1;
}
};
this.mTokenGetURL = function(keyUID)
{
var json = '{"function":"mTokenGetURL", "keyUID":"' + keyUID + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenGetLabel = function(keyUID)
{
var json = '{"function":"mTokenGetLabel", "keyUID":"' + keyUID + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenGetCompanyName = function(keyUID)
{
var json = '{"function":"mTokenGetCompanyName", "keyUID":"' + keyUID + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenGetRemarks = function(keyUID)
{
var json = '{"function":"mTokenGetRemarks", "keyUID":"' + keyUID + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenGetOpenType = function(keyUID)
{
var json = '{"function":"mTokenGetOpenType", "keyUID":"' + keyUID + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.openType;
}else{
return -1;
}
};
this.mTokenPwdRetryCount = function(keyUID, passwdType)
{
var json = '{"function":"mTokenPwdRetryCount", "keyUID":"' + keyUID + '", "passWdType":' + passwdType + '}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.pwdRetryCount;
}else{
return -1;
}
};
this.mTokenEncrypt = function(keyUID, method, paddingType, data)
{
var json = '{"function":"mTokenEncrypt", "keyUID":"' + keyUID + '", "method":' + method + ', "paddingType":' + paddingType + ', "inData":"' + data + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenDecrypt = function(keyUID, method, paddingType, data)
{
var json = '{"function":"mTokenDecrypt", "keyUID":"' + keyUID + '", "method":' + method + ', "paddingType":' + paddingType + ', "inData":"' + data + '"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
};
this.mTokenGetMacAddr = function()
{
var json = '{"function":"mTokenGetMacAddr"}';
AjaxIO(json);
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var obj = eval("(" + xmlhttp.responseText + ")");
return obj.outData;
}else{
return "";
}
}
}

3
src/environments/environment.prod.ts

@ -0,0 +1,3 @@
export const environment = {
production: true
};

16
src/environments/environment.ts

@ -0,0 +1,16 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.

BIN
src/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

15
src/index.html

@ -0,0 +1,15 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>中石化加油站</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href='./assets/icon/material-icons.css' rel="stylesheet">
</head>
<body>
<app-root></app-root>
</body>
</html>

13
src/main.ts

@ -0,0 +1,13 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
// window['CESIUM_BASE_URL'] = 'src/assets/cesium';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));

63
src/polyfills.ts

@ -0,0 +1,63 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/

122
src/styles.scss

@ -0,0 +1,122 @@
@import "./app/theme.scss";
html,
body {
width: 100%;
height: 100%;
margin: 0 auto;
padding: 0;
overflow: hidden;
}
ul,
ol,
dl,
li,
dt,
dd,
p,
form,
input,
h1,
h2,
h3,
h4,
h5,
h6,
section,
article,
aside,
header,
footer,
nav,
figure,
time,
mark,
main,
canvas {
margin: 0;
padding: 0;
}
b,
strong,
i,
em,
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 500;
font-style: normal;
}
img {
border: none;
}
a {
text-decoration: none;
color: #000;
}
ul,
ol,
li {
list-style: none;
overflow-x: hidden;
}
.clearfn:after {
content: "";
clear: both;
display: block;
overflow: hidden;
height: 0;
visibility: hidden;
}
//root标签
app-root {
height: 100%;
}
h1 {
font-size: 16px;
}
.mat-expansion-panel-body {
padding: 0px !important;
}
.mat-expansion-indicator::after {
color: black;
}
.example-sidenav .mat-drawer-inner-container {
overflow: hidden;
}
table th.mat-header-cell:last-of-type,
table td.mat-cell:last-of-type,
table td.mat-footer-cell:last-of-type {
padding-right: 0px;
}
.mat-tab-body {
height: 100%;
overflow-y: auto;
}
.mat-drawer-backdrop.mat-drawer-shown {
background-color: #fff;
}
.mat-content {
//可展开面板垂直居中
align-items: center;
}
//x轴滚动条隐藏
.example-sidenav-content {
overflow-x: hidden;
overflow-y: auto;
}
.mat-tab-body-wrapper {
overflow: auto !important;
}
//滚动条样式
::-webkit-scrollbar {
width: 5px;
background-color: white;
}
::-webkit-scrollbar-thumb {
background-color: #999;
}

20
src/test.ts

@ -0,0 +1,20 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

18
tsconfig.app.json

@ -0,0 +1,18 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": ["swiper"]
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts"
]
}

27
tsconfig.json

@ -0,0 +1,27 @@
{
"compileOnSave": false,
"compilerOptions": {
"allowJs": true,
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}

18
tsconfig.spec.json

@ -0,0 +1,18 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}

91
tslint.json

@ -0,0 +1,91 @@
{
"extends": "tslint:recommended",
"rules": {
"array-type": false,
"arrow-parens": false,
"deprecation": {
"severity": "warning"
},
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"import-blacklist": [
true,
"rxjs/Rx"
],
"interface-name": false,
"max-classes-per-file": false,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-consecutive-blank-lines": false,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-empty": false,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-switch-case-fall-through": true,
"no-var-requires": false,
"object-literal-key-quotes": [
true,
"as-needed"
],
"object-literal-sort-keys": false,
"ordered-imports": false,
"quotemark": [
true,
"single"
],
"trailing-comma": false,
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-inputs-metadata-property": true,
"no-output-native": true,
"no-output-on-prefix": true,
"no-output-rename": true,
"no-outputs-metadata-property": true,
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true
},
"rulesDirectory": [
"codelyzer"
]
}

7996
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save