pull/1/head
袁野 3 years ago
parent 4bf838ffc2
commit 6c0b1e5bf0
  1. 2
      src/app/admin/index/index/index.component.ts
  2. 10
      src/app/app-common.module.ts
  3. 13
      src/app/app-routing.module.ts
  4. 2
      src/app/pipes/index.ts
  5. 2
      src/app/services/company.service.ts
  6. 2
      src/app/services/icon.service.ts
  7. 79
      src/app/services/route-strategy.service.ts
  8. 3
      src/styles.scss

@ -12,7 +12,7 @@ export class IndexComponent implements OnInit {
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
console.log((96.3 + 92.4 + 96.4 + 97.5 + 99.6 + 98.5 + 96.6 + 94.4 + 95.7 + 95.2 + 97.8 + 98.9 ) / 12 - 0.393 * 2.03);
} }

@ -26,7 +26,9 @@ import {
DiscountCodeStatusPipe, DiscountCodeStatusPipe,
RechargePricePipe, RechargePricePipe,
RechargeStatusPipe, RechargeStatusPipe,
ChannelMarkPipe ChannelMarkPipe,
TypePipe,
StatusPipe
} from './pipes'; } from './pipes';
@ -47,7 +49,10 @@ const PIPES = [
DiscountCodeStatusPipe, DiscountCodeStatusPipe,
RechargePricePipe, RechargePricePipe,
RechargeStatusPipe, RechargeStatusPipe,
ChannelMarkPipe ChannelMarkPipe,
ChannelMarkPipe,
TypePipe,
StatusPipe,
]; ];
@ -61,7 +66,6 @@ const PIPES = [
], ],
declarations: [ declarations: [
...PIPES, ...PIPES,
ChannelMarkPipe,
], ],
exports: [ exports: [

@ -1,7 +1,8 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router'; import {Routes, RouterModule, RouteReuseStrategy} from '@angular/router';
import {NavigationComponent} from './admin/navigation/navigation.component'; import {NavigationComponent} from './admin/navigation/navigation.component';
import {InitGuardService} from './services/init-guard.service'; import {InitGuardService} from './services/init-guard.service';
import {RouteStrategyService} from "./services/route-strategy.service";
const routes: Routes = [ const routes: Routes = [
{path: '', pathMatch: 'full', redirectTo: 'adminLogin'}, {path: '', pathMatch: 'full', redirectTo: 'adminLogin'},
@ -86,13 +87,21 @@ const routes: Routes = [
loadChildren: () => import('./admin/cms/cms.module').then(m => m.CmsModule), loadChildren: () => import('./admin/cms/cms.module').then(m => m.CmsModule),
canActivate: [InitGuardService] canActivate: [InitGuardService]
}, },
{
path: 'activate',
loadChildren: () => import('./admin/activate/activate.module').then(m => m.ActivateModule),
canActivate: [InitGuardService]
},
], ],
}, },
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forRoot(routes)], imports: [RouterModule.forRoot(routes)],
exports: [RouterModule] exports: [RouterModule],
providers: [
{ provide: RouteReuseStrategy, useClass: RouteStrategyService }
],
}) })
export class AppRoutingModule { export class AppRoutingModule {
} }

@ -15,3 +15,5 @@ export * from './discount-code-status.pipe';
export * from './recharge-price.pipe'; export * from './recharge-price.pipe';
export * from './recharge-status.pipe'; export * from './recharge-status.pipe';
export * from './channel-mark.pipe'; export * from './channel-mark.pipe';
export * from './activate/type.pipe';
export * from './activate/status.pipe';

@ -6,6 +6,8 @@ import {environment} from '../../environments/environment';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class CompanyService { export class CompanyService {
constructor( constructor(

@ -12,7 +12,7 @@ export class IconService {
constructor(private iconService: NzIconService) { constructor(private iconService: NzIconService) {
this.iconService.fetchFromIconfont({ this.iconService.fetchFromIconfont({
scriptUrl: 'https://at.alicdn.com/t/font_2424521_irl9t133o8k.js' scriptUrl: 'https://at.alicdn.com/t/font_2424521_tjuuaif43i.js'
}); });
} }
} }

@ -0,0 +1,79 @@
import { Injectable } from '@angular/core';
import { RouteReuseStrategy, DetachedRouteHandle, ActivatedRouteSnapshot } from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class RouteStrategyService implements RouteReuseStrategy {
public static handlers: { [key: string]: DetachedRouteHandle } = {};
public static deleteRouteSnapshot(path: string): void {
const name = path.replace(/\//g, '_');
if (RouteStrategyService.handlers[name]) {
delete RouteStrategyService.handlers[name];
}
}
/**
*
* false时则路由发生变化并且其余方法会被调用
* @param {ActivatedRouteSnapshot} future
* @param {ActivatedRouteSnapshot} curr
* @returns {boolean}
* @memberof CacheRouteReuseStrategy
*/
public shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
return future.routeConfig === curr.routeConfig
&& JSON.stringify(future.params) === JSON.stringify(curr.params);
}
/**
*
* true store
* @param {ActivatedRouteSnapshot} route
* @returns {boolean}
* @memberof CacheRouteReuseStrategy
*/
public shouldDetach(route: ActivatedRouteSnapshot): boolean {
if (!route.routeConfig || route.routeConfig.loadChildren) {
return false
}
return true
}
/**
*
* RouteHandle
* RouteHandle
* @param {ActivatedRouteSnapshot} route
* @param {DetachedRouteHandle} detachedTree
* @memberof CacheRouteReuseStrategy
*/
public store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void {
RouteStrategyService.handlers[this.getPath(route)] = detachedTree;
}
/**
* true retrieve
* false
* @param {ActivatedRouteSnapshot} route
* @returns {boolean}
* @memberof CacheRouteReuseStrategy
*/
public shouldAttach(route: ActivatedRouteSnapshot): boolean {
return !!RouteStrategyService.handlers[this.getPath(route)];
}
/**
* cached route
* RouteHandle
* 使 RouteHandle
* @param {ActivatedRouteSnapshot} route
* @returns {(DetachedRouteHandle | null)}
* @memberof CacheRouteReuseStrategy
*/
public retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null {
return RouteStrategyService.handlers[this.getPath(route)] || null;
}
private getPath(route: ActivatedRouteSnapshot): string {
// tslint:disable-next-line: no-string-literal
return route['_routerState'].url.replace(/\//g, '_')
+ '_' + (route.routeConfig.loadChildren || route.routeConfig.component.toString().split('(')[0].split(' ')[1] );
}
}

@ -47,6 +47,9 @@
.search-area { .search-area {
text-align: center; text-align: center;
button {
margin-left: 10px;
}
} }
.ant-advanced-search-form { .ant-advanced-search-form {
padding: 24px; padding: 24px;

Loading…
Cancel
Save