Commit 8d2b131d authored by nanahira's avatar nanahira

complete layout

parent 21cf81d4
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<br /> <br />
<img class="no-select" draggable="false" style="margin:0 auto;width:580px;position: relative;top:40px;" src="assets/img/desc.png" /> <img class="no-select" draggable="false" style="margin:0 auto;width:580px;position: relative;top:40px;" src="assets/img/desc.png" />
<div style="margin:0 auto;position: relative; top:-50px;"> <div style="margin:0 auto;position: relative; top:-50px;">
<a href="{{ latest_current | async }}"> <a href="{{ latest_current }}">
<!--<button nz-button nzType="primary" nzSize="large" nzShape="round"><i nz-icon type="download"></i>下载游戏 <!--<button nz-button nzType="primary" nzSize="large" nzShape="round"><i nz-icon type="download"></i>下载游戏
</button>--> </button>-->
<img <img
...@@ -206,9 +206,9 @@ ...@@ -206,9 +206,9 @@
排表、打印实卡比赛卡表等特色功能 <br /> 排表、打印实卡比赛卡表等特色功能 <br />
</p> </p>
<p style="font-size: 20px;color:#313154;">2019年7月进行了 1521293 场对战</p> <p style="font-size: 20px;color:#313154;">{{matchCount.year}}年{{matchCount.month}}月进行了 {{matchCount.count}} 场对战</p>
<!-- <nz-statistic [nzValueStyle]="{ color: '#000D1E' }" [nzValue]="stats_online | async | number" [nzTitle]=""></nz-statistic>--> <!-- <nz-statistic [nzValueStyle]="{ color: '#000D1E' }" [nzValue]="stats_online | async | number" [nzTitle]=""></nz-statistic>-->
<button nz-button nzType="primary" nzSize="large"><i nz-icon nzType="double-right" nzTheme="outline"></i>进入决斗数据库</button> <button nz-button nzType="primary" nzSize="large" (click)='navigateToUrl("https://mycard.moe/ygopro/arena")'><i nz-icon nzType="double-right" nzTheme="outline"></i>进入决斗数据库</button>
</div> </div>
<div nz-col> <div nz-col>
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
让你的游戏人生有趣起来 <br /> 让你的游戏人生有趣起来 <br />
</p> </p>
<!-- <nz-statistic [nzValueStyle]="{ color: '#000D1E' }" [nzValue]="1949101 | number" [nzTitle]=""></nz-statistic>--> <!-- <nz-statistic [nzValueStyle]="{ color: '#000D1E' }" [nzValue]="1949101 | number" [nzTitle]=""></nz-statistic>-->
<button nz-button nzType="primary" nzSize="large"><i nz-icon nzType="double-right" nzTheme="outline"></i>查看近期赛事</button> <button nz-button nzType="primary" nzSize="large" (click)='navigateToUrl("https://event.ygobbs.com")'><i nz-icon nzType="double-right" nzTheme="outline"></i>查看近期赛事</button>
</div> </div>
<!-- <!--
<div nz-col nzSpan="8"> <div nz-col nzSpan="8">
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</section> </section>
<section class="foot"> <section class="foot">
<p>© MyCard 2019 all rights reserved.</p> <p>© MyCard 2021 all rights reserved.</p>
</section> </section>
</nz-content> </nz-content>
</nz-layout> </nz-layout>
...@@ -3,21 +3,37 @@ import {HttpClient} from "@angular/common/http"; ...@@ -3,21 +3,37 @@ import {HttpClient} from "@angular/common/http";
import {map} from "rxjs/operators"; import {map} from "rxjs/operators";
import yaml from 'yaml'; import yaml from 'yaml';
interface HomePageMatchCountDto {
count: number;
year: number;
month: number;
}
@Component({ @Component({
selector: 'app-layout', selector: 'app-layout',
templateUrl: './layout.component.html', templateUrl: './layout.component.html',
styleUrls: ['./layout.component.css'] styleUrls: ['./layout.component.css']
}) })
export class LayoutComponent{ export class LayoutComponent implements OnInit {
matchCount: HomePageMatchCountDto = {
count: 100,
year: 1000,
month: 1
}
latest_win32 = this.http latest_win32 = this.http
.get('https://cdn01.moecube.com/downloads/latest.yml', { responseType: 'text' }) .get('https://cdn01.moecube.com/downloads/latest.yml', { responseType: 'text' })
.pipe(map(rawData => 'https://cdn01.moecube.com/downloads/' + yaml.parse(rawData).path)); .pipe(map(rawData => 'https://cdn01.moecube.com/downloads/' + yaml.parse(rawData).path));
latest_linux = this.http
.get('https://cdn01.moecube.com/downloads/latest-linux.yml', { responseType: 'text' })
.pipe(map(rawData => 'https://cdn01.moecube.com/downloads/' + yaml.parse(rawData).path));
latest_drawin = this.http latest_drawin = this.http
.get('https://cdn01.moecube.com/downloads/latest-mac.yml', { responseType: 'text' }) .get('https://cdn01.moecube.com/downloads/latest-mac.yml', { responseType: 'text' })
.pipe(map((rawData) => 'https://cdn01.moecube.com/downloads/' + yaml.parse(rawData).path.replace('-mac.zip', '.dmg'))); .pipe(map((rawData) => 'https://cdn01.moecube.com/downloads/' + yaml.parse(rawData).path.replace('-mac.zip', '.dmg')));
latest_current = navigator.platform.match(/Mac/i) ? this.latest_drawin : this.latest_win32; latest_current = ''
stats_signups = this.http stats_signups = this.http
.get('https://ygobbs.com/admin/dashboard.json', { .get('https://ygobbs.com/admin/dashboard.json', {
...@@ -33,10 +49,29 @@ export class LayoutComponent{ ...@@ -33,10 +49,29 @@ export class LayoutComponent{
}) })
); );
constructor(private http: HttpClient, @Inject(LOCALE_ID) public locale: string) {} constructor(private http: HttpClient, @Inject(LOCALE_ID) public locale: string) {
}
async ngOnInit() {
if(navigator.platform.match(/Mac/i)) {
this.latest_current = await this.latest_drawin.toPromise();
} else if (navigator.platform.match(/Linux/i)) {
this.latest_current = await this.latest_linux.toPromise();
} else {
this.latest_current = await this.latest_win32.toPromise();
}
this.matchCount = await this.http.get<HomePageMatchCountDto>('https://api.mycard.moe/ygopro/arena/homepageCount', {
responseType: 'json'
}).toPromise();
}
setLocale(locale) { setLocale(locale) {
document.cookie = `locale=${locale}`; document.cookie = `locale=${locale}`;
location.reload(); location.reload();
} }
navigateToUrl(url: string) {
location.href = url;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment