From 7572b00f3d4475f68c4d1a716431d75339660e65 Mon Sep 17 00:00:00 2001 From: xjh22222228 Date: Mon, 5 Oct 2020 08:43:33 +0800 Subject: [PATCH] Update Data --- config/index.ts | 3 --- data/utilityTool/devops.ts | 6 ++++++ src/app/app.component.html | 2 +- src/app/app.component.ts | 33 ++++++++++++--------------------- src/view/index.component.scss | 1 + 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/config/index.ts b/config/index.ts index db3f3bd..349af20 100644 --- a/config/index.ts +++ b/config/index.ts @@ -16,9 +16,6 @@ export const webpLanguage = [ 'Git' ]; -// 网站运行开始时间 -export const start = new Date(2018, 3, 26, 0, 0, 0, 0); - // 如果没有请赋值空字符串 export const git = 'https://github.com/xjh22222228/nav'; diff --git a/data/utilityTool/devops.ts b/data/utilityTool/devops.ts index b6d9522..29957e9 100644 --- a/data/utilityTool/devops.ts +++ b/data/utilityTool/devops.ts @@ -349,6 +349,12 @@ const nav = { desc: '一个简单的公共IP地址API', link: 'https://www.ipify.org/', }, + { + icon: '', + name: '归属地查询', + desc: '淘宝免费归属地查询', + link: 'https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=13333333333', + }, ] }, ] diff --git a/src/app/app.component.html b/src/app/app.component.html index 17ca13e..4552def 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -6,7 +6,7 @@ class="github-link" *ngIf="git" > - + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a4135d9..2e7367d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -13,39 +13,20 @@ export class AppComponent { constructor (private router: Router, private activatedRoute: ActivatedRoute) {} nav: Array = nav; - page: number = 0; includeTotal: number = 0; git: string = git; caseNumber: string = caseNumber; ngOnInit() { - const screenWidth = window.innerWidth; const hash = window.location.hash; const params = new URLSearchParams(hash.slice(hash.indexOf('?'))); const page = params.get('page'); const id = params.get('id'); const q = params.get('q'); - const queryParams = { - page, - id, - q - }; + const queryParams = { page, id, q }; - if (screenWidth < 768) { - this.router.navigate(['/app'], { queryParams }); - } else { - this.router.navigate(['/index'], { queryParams }); - } + this.goRoute(queryParams); - this.activatedRoute.queryParams.subscribe(query => { - const page = +query.page || 0; - if (page > this.nav.length - 1) { - this.page = this.nav.length - 1; - } else { - this.page = page; - } - }); - this.computedTotal(); } @@ -53,6 +34,16 @@ export class AppComponent { setInterval(this.setBackground, 10000); } + goRoute(queryParams: object) { + const screenWidth = window.innerWidth; + + if (screenWidth < 768) { + this.router.navigate(['/app'], { queryParams }); + } else { + this.router.navigate(['/index'], { queryParams }); + } + } + // 计算收录个数 computedTotal() { let total = 0; diff --git a/src/view/index.component.scss b/src/view/index.component.scss index 7c6ef31..be0fe28 100644 --- a/src/view/index.component.scss +++ b/src/view/index.component.scss @@ -157,6 +157,7 @@ border-radius: 50%; pointer-events: none; border: 1px solid #eee; + background-color: #fff; } .name { -- GitLab