Skip to content

Commit

Permalink
add list search-articles and search-applications
Browse files Browse the repository at this point in the history
  • Loading branch information
llkui committed Nov 14, 2020
1 parent 413eb12 commit 67d6054
Show file tree
Hide file tree
Showing 12 changed files with 744 additions and 147 deletions.
279 changes: 142 additions & 137 deletions src/app/admin/home/home.component.html

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/app/admin/home/home.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host ::ng-deep {
.ant-card {
background: inherit;
}
}
3 changes: 2 additions & 1 deletion src/app/admin/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Component } from '@angular/core';

@Component({
selector: 'app-home',
templateUrl: './home.component.html'
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})

export class HomeComponent {
Expand Down
96 changes: 96 additions & 0 deletions src/app/admin/list/search/applications.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<nz-card>
<div class="standard flex">
<div class="standard-label">所属类目:</div>
<div class="standard-content hasExpanded flex-1" [class.expanded]="expanded">
<nz-tag nzMode="checkable" [(nzChecked)]="typeAll" (nzCheckedChange)="typeChangeAll($event)">
<span>全部</span>
</nz-tag>
<ng-container *ngFor="let type of typeList">
<nz-tag nzMode="checkable" [(nzChecked)]="type.checked" (nzCheckedChange)="typeChange()">
<span>{{type.name}}</span>
</nz-tag>
</ng-container>
</div>
<a *ngIf="!expanded" (click)="expanded = true" class="select-trigger">展开<i nz-icon nzType="down"
nzTheme="outline"></i></a>
<a *ngIf="expanded" (click)="expanded = false" class="select-trigger">收起<i nz-icon nzType="up"
nzTheme="outline"></i></a>
</div>
<div class="standard flex">
<div class="standard-label">其它选项:</div>
<div class="standard-content flex-1">
<div nz-row [nzGutter]="16">
<div nz-col [nzXs]="24" [nzSm]="10" [nzLg]="8">
<nz-form-item>
<nz-form-label nzFor="author">作者</nz-form-label>
<nz-form-control [nzXs]="24" [nzSm]="16">
<nz-select [(ngModel)]="searchInfo.author" [nzPlaceHolder]="'不限'" class="max-width">
<nz-option nzValue="1" nzLabel="王昭君"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzXs]="24" [nzSm]="10" [nzLg]="8">
<nz-form-item>
<nz-form-label nzFor="author">好评度</nz-form-label>
<nz-form-control [nzXs]="24" [nzSm]="16">
<nz-select [(ngModel)]="searchInfo.like" [nzPlaceHolder]="'不限'" class="max-width">
<nz-option nzValue="1" nzLabel="优秀"></nz-option>
<nz-option nzValue="2" nzLabel="普通"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
</div>
</div>
</div>
</nz-card>
<div class="mt20">
<div nz-row [nzGutter]="18">
<div nz-col [nzXs]="24" [nzSm]="12" [nzMd]="8" [nzLg]="6" *ngFor="let application of applicationList">
<nz-card nzHoverable [nzActions]="[actionDownload, actionEdit, actionShareAlt, actionEllipsis]" class="mb20">
<nz-card-meta [nzAvatar]="avatarTemplate" [nzTitle]="application.title" [nzDescription]="descTpl">
</nz-card-meta>
</nz-card>
<ng-template #descTpl>
<div nz-row>
<div nz-col [nzSpan]="12">
<p class="user-title">活跃用户</p>
<div>
<span class="user-number">{{application.activeUser}}</span>
<span class="user-unit"></span>
</div>
</div>
<div nz-col [nzSpan]="12">
<p class="user-title">新增用户</p>
<div>
<span class="user-number">{{application.newUser | number}}</span>
</div>
</div>
</div>
</ng-template>
<ng-template #avatarTemplate>
<nz-avatar [nzSrc]="application.cover"></nz-avatar>
</ng-template>
<ng-template #actionDownload>
<i nz-tooltip nzTooltipTitle="下载" nz-icon nzType="download"></i>
</ng-template>
<ng-template #actionEdit>
<i nz-tooltip nzTooltipTitle="编辑" nz-icon nzType="edit"></i>
</ng-template>
<ng-template #actionShareAlt>
<i nz-tooltip nzTooltipTitle="分享" nz-icon nzType="share-alt"></i>
</ng-template>
<ng-template #actionEllipsis>
<i nz-dropdown [nzDropdownMenu]="menu" nz-icon nzType="ellipsis"></i>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu>
<li nz-menu-item>1st menu item</li>
<li nz-menu-item>2nd menu item</li>
<li nz-menu-item>3d menu item</li>
</ul>
</nz-dropdown-menu>
</ng-template>
</div>
</div>
</div>
78 changes: 78 additions & 0 deletions src/app/admin/list/search/applications.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
:host ::ng-deep {
.ant-tag {
font-size: 14px;
cursor: pointer;
margin-right: 24px;
}

.ant-form-item {
margin-bottom: 0;
}

.standard {
margin-bottom: 16px;
padding-bottom: 11px;
border-bottom: 1px dashed #f0f0f0;

&:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
}

.standard-label {
flex: 0 0 auto;
margin-right: 24px;
color: rgba(0, 0, 0, .85);
text-align: right;
line-height: 32px;
}

.standard-content {
line-height: 32px;
transition: all .3s;
overflow: hidden;

&.hasExpanded {
max-height: 32px;

&.expanded {
max-height: 200px;
}
}
}

.ant-select.max-width {
max-width: 200px;
width: 100%;
}

.select-trigger {
line-height: 32px;
}

.user-title {
font-size: 12px;
}

.user-number {
color: rgba(0, 0, 0, .85);
font-size: 24px;
line-height: 32px;
}

.user-unit {
color: rgba(0, 0, 0, .85);
margin-left: 2px;
}

.ant-card-actions {
background: #ffffff;
}

.ant-avatar {
width: 24px;
height: 24px;
}
}
99 changes: 98 additions & 1 deletion src/app/admin/list/search/applications.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,110 @@ import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-list-search-applications',
templateUrl: './applications.component.html'
templateUrl: './applications.component.html',
styleUrls: ['./applications.component.scss']
})

export class SearchApplicationsComponent implements OnInit {
typeAll = false;
typeList = [];
searchInfo = {
author: null,
like: null
};
expanded = false;
applicationList = [];

constructor() { }

ngOnInit() {
this.typeList = [
{ id: 1, name: '类目一', checked: false },
{ id: 2, name: '类目二', checked: false },
{ id: 3, name: '类目三', checked: false },
{ id: 4, name: '类目四', checked: false },
{ id: 5, name: '类目五', checked: false },
{ id: 6, name: '类目六', checked: false },
{ id: 7, name: '类目七', checked: false },
{ id: 8, name: '类目八', checked: false },
{ id: 9, name: '类目九', checked: false },
{ id: 10, name: '类目十', checked: false },
{ id: 11, name: '类目十一', checked: false },
{ id: 12, name: '类目十二', checked: false },
];
this.applicationList = [
{
id: 1,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
title: 'Alipay',
activeUser: '19',
newUser: '1678'
},
{
id: 2,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
title: 'Angular',
activeUser: '17',
newUser: '1687'
},
{
id: 3,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png',
title: 'Ant Design',
activeUser: '10',
newUser: '1846'
},
{
id: 4,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png',
title: 'Ant Design Pro',
activeUser: '12',
newUser: '1158'
},
{
id: 5,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png',
title: 'Bootstrap',
activeUser: '15',
newUser: '1307'
},
{
id: 6,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png',
title: 'React',
activeUser: '18',
newUser: '1333'
},
{
id: 7,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png',
title: 'Vue',
activeUser: '15',
newUser: '1594'
},
{
id: 8,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png',
title: 'Webpack',
activeUser: '15',
newUser: '1874'
},
];
}

typeChangeAll($event) {
this.typeList.forEach(item => {
item.checked = $event;
});
}

typeChange() {
let checked = true;
this.typeList.forEach(item => {
if (!item.checked) {
checked = false;
}
});
this.typeAll = checked;
}
}
Loading

0 comments on commit 67d6054

Please sign in to comment.