From 953fba5b170f1deb4822456dc4670142247d92f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=87=A0=E6=B5=B7?= Date: Fri, 7 Aug 2020 21:10:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=8B=E9=93=BE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/view/link/link.component.html | 44 ++++++++-- src/app/view/link/link.component.less | 121 ++++++++++++++++++++++++-- src/app/view/link/link.component.ts | 6 +- 3 files changed, 154 insertions(+), 17 deletions(-) diff --git a/src/app/view/link/link.component.html b/src/app/view/link/link.component.html index 27d66d9..b818b8f 100644 --- a/src/app/view/link/link.component.html +++ b/src/app/view/link/link.component.html @@ -3,24 +3,54 @@ 友情链接 - - +
友链公告
+
+

+ 原创优先  + 技术优先  + 经常宕机  + 不合法规  + 插边球站  + 红标报毒  +

diff --git a/src/app/view/link/link.component.less b/src/app/view/link/link.component.less index 2eaa95e..e7233a6 100644 --- a/src/app/view/link/link.component.less +++ b/src/app/view/link/link.component.less @@ -16,15 +16,100 @@ i { list-style: none; display: flex; flex-wrap: wrap; - padding: 20px 10px; + justify-content: space-between; + align-items: flex-start; + li { - width: 25%; - margin: 10px 0; - height: 30px; - line-height: 30px; - text-align: center + flex: 1; + width: 20%; + min-width: 20%; // 加入这两个后每个item的宽度就生效了 + max-width: 20%; // 加入这两个后每个item的宽度就生效了 + height: 80px; + text-align: center; + overflow: hidden; + margin: 10px; + border-radius: 5px; + border: 1px solid rgba(0, 0, 0, .1); + + .link-icon { + display: none; + transition: 0.3s; + } + + .link-name, .link-info { + height: 80px; + width: 100%; + margin: 0; + transition: 0.3s; + padding: 0; + } + + .link-name { + // background: #eed1b3; + line-height: 80px; + cursor: pointer; + + i { + display: inline; + } + + } + + .link-info { + // background: #00d95a; + } } + + li:hover { + transition: 0.3s; + + + .link-icon { + //width: 80px; + height: 56px; + line-height: 56px; + // background: #00aaaa; + transition: 0.3s; + display: inline-block; + width: 56px; + float: left; + + img { + height: 80%; + width: 80%; + border-radius: 50%; + line-height: 56px; + //padding: 3px; + } + } + + + .link-name { + height: 24px; + line-height: 24px; + + i { + display: none; + transition: 0.3s; + } + } + + .link-info { + border-top: 1px solid rgba(150, 150, 150, .1); + height: 56px; + line-height: 56px; + padding-bottom: 2px; + + p { + width: 100%; + height: 100%; + text-align: left; + font-size: xx-small; + } + } + } + } .placard { @@ -32,14 +117,20 @@ i { margin: 0 auto; } +.site-middle, .placard { + background: #fff; + padding: 20px; +} + .placard-content { margin-top: 30px; margin-left: 30px; - border-left: 5px solid #aaa4a4; + border-left: 3px solid #6bc30d; + padding: 0; list-style: none; li { - padding-left: 15px; + padding-left: 20px; font-size: 1.2em; margin: 5px 0; } @@ -48,9 +139,12 @@ i { .applylink { float: right; border: none; - background: white; + background: #f6f1f1; border-radius: 5px; width: 150px; + height: 80px; + line-height: 80px; + font-size: x-large; } .applylink:hover { @@ -71,6 +165,15 @@ i { border-radius: 4px; } +@keyframes hiddenAnimation { + form { + height: 100%; + } + to { + height: 0%; + } +} + @media only screen and ( max-width: 768px ) { .site-middle, .placard { margin-left: 2px; diff --git a/src/app/view/link/link.component.ts b/src/app/view/link/link.component.ts index 790c4a8..007e0cc 100644 --- a/src/app/view/link/link.component.ts +++ b/src/app/view/link/link.component.ts @@ -4,6 +4,7 @@ import {Title} from '@angular/platform-browser'; import {ApiService} from '../../api/api.service'; import {ApplyLinkReq, Link} from '../../class/Link'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {Color, RandomColor} from '../../utils/color'; @Component({ selector: 'view-link', @@ -28,13 +29,16 @@ export class LinkComponent implements OnInit { linkList: Link[]; loading: boolean = false; applyFormGroup: FormGroup; + colors: Color[]; + ngOnInit() { window.scrollTo(0, 0); this.link = new Link(); this.apiService.links().subscribe({ next: data => this.linkList = data.result, - error: err => this.message.error(err.msg) + error: err => this.message.error(err.msg), + complete: () => this.colors = RandomColor(this.linkList.length) }); this.applyFormGroup = this.fb.group({ urlLinkProtocol: ['http://'],