Skip to content

Commit

Permalink
fix: side swiper url field
Browse files Browse the repository at this point in the history
  • Loading branch information
xjh22222228 committed Aug 21, 2024
1 parent e4718c4 commit 3db7ff1
Show file tree
Hide file tree
Showing 15 changed files with 177 additions and 177 deletions.
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import WebpComponent from '../view/app/default/app.component'
import VipAuthComponent from '../view/system/vip-auth/index.component'

import { SafeHtmlPipe } from 'src/pipe/safeHtml.pipe'
import { ServiceCommonService } from 'src/services/common'
import { CommonService } from 'src/services/common'
import { JumpService } from 'src/services/jump'

import {
Expand Down Expand Up @@ -182,7 +182,7 @@ const icons: IconDefinition[] = [
],
providers: [
{ provide: NZ_I18N, useValue: zh_CN },
ServiceCommonService,
CommonService,
JumpService,
],
bootstrap: [AppComponent],
Expand Down
2 changes: 1 addition & 1 deletion src/components/web-list/index.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
nzTooltipPlacement="bottom"
nz-button
nz-tooltip
*ngFor="let item of dataList; trackBy: serviceCommon.trackByItemWeb"
*ngFor="let item of dataList; trackBy: commonService.trackByItemWeb"
(click)="jumpService.goUrl($event, item.url)"
>
<ng-template #titleTemplate let-thing>
Expand Down
4 changes: 2 additions & 2 deletions src/components/web-list/index.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IWebProps, INavProps } from 'src/types'
import { queryString, fuzzySearch, isMobile } from 'src/utils'
import { isLogin } from 'src/utils/user'
import { ActivatedRoute } from '@angular/router'
import { ServiceCommonService } from 'src/services/common'
import { CommonService } from 'src/services/common'
import { JumpService } from 'src/services/jump'
import event from 'src/utils/mitt'

Expand All @@ -33,7 +33,7 @@ export class WebListComponent {
constructor(
public jumpService: JumpService,
private activatedRoute: ActivatedRoute,
public serviceCommon: ServiceCommonService
public commonService: CommonService
) {}

ngOnInit() {
Expand Down
2 changes: 1 addition & 1 deletion src/services/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import event from 'src/utils/mitt'
@Injectable({
providedIn: 'root',
})
export class ServiceCommonService {
export class CommonService {
isLogin = isLogin
settings = settings
websiteList: INavProps[] = websiteList
Expand Down
30 changes: 15 additions & 15 deletions src/view/app/default/app.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<section class="app-page user-select-none">
<header class="header">
<div class="header-top">
<img [src]="serviceCommon.settings.favicon" class="logo" alt="logo" />
<img [src]="commonService.settings.favicon" class="logo" alt="logo" />
<div class="open" [class.active]="open" (click)="handleToggleOpen()">
<i></i>
<i></i>
Expand All @@ -12,12 +12,12 @@
<nav class="nav-open" [class.active]="open">
<div
*ngFor="
let item of serviceCommon.websiteList;
let item of commonService.websiteList;
let i = index;
trackBy: serviceCommon.trackByItem
trackBy: commonService.trackByItem
"
(click)="handleCilckNav(i)"
[class.active]="serviceCommon.page === i"
[class.active]="commonService.page === i"
class="nav-title"
>
{{ item.title }}
Expand All @@ -27,25 +27,25 @@

<app-search-engine />

<div class="wrapper" *ngIf="serviceCommon.websiteList[serviceCommon.page]">
<div class="wrapper" *ngIf="commonService.websiteList[commonService.page]">
<nav
class="children-nav"
*ngIf="serviceCommon.websiteList[serviceCommon.page]?.nav?.length"
*ngIf="commonService.websiteList[commonService.page]?.nav?.length"
>
<span
class="tag"
*ngFor="
let item of serviceCommon.websiteList[serviceCommon.page].nav;
let item of commonService.websiteList[commonService.page].nav;
let i = index;
trackBy: serviceCommon.trackByItem
trackBy: commonService.trackByItem
"
[class.active]="serviceCommon.id === i"
(click)="serviceCommon.handleSidebarNav(i)"
[class.active]="commonService.id === i"
(click)="commonService.handleSidebarNav(i)"
>
{{ item.title }}
</span>
</nav>
<div *ngFor="let item of serviceCommon.currentList; index as i">
<div *ngFor="let item of commonService.currentList; index as i">
<h2 class="block-title" *ngIf="item.title">
{{ item.title }} x {{ item.nav.length }}
</h2>
Expand All @@ -66,14 +66,14 @@ <h2 class="block-title" *ngIf="item.title">
*ngFor="
let el of item.nav;
index as j;
trackBy: serviceCommon.trackByItemWeb
trackBy: commonService.trackByItemWeb
"
>
<app-card
[cardStyle]="serviceCommon.settings.appCardStyle"
[cardStyle]="commonService.settings.appCardStyle"
[dataSource]="el"
[indexs]="[serviceCommon.page, serviceCommon.id, i, j]"
[searchKeyword]="serviceCommon.searchKeyword"
[indexs]="[commonService.page, commonService.id, i, j]"
[searchKeyword]="commonService.searchKeyword"
class="column-border"
></app-card>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/view/app/default/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See https://github.com/xjh22222228/nav

import { Component } from '@angular/core'
import { ServiceCommonService } from 'src/services/common'
import { CommonService } from 'src/services/common'

@Component({
selector: 'app-home',
Expand All @@ -13,12 +13,12 @@ import { ServiceCommonService } from 'src/services/common'
export default class WebpComponent {
open: boolean = false

constructor(public serviceCommon: ServiceCommonService) {}
constructor(public commonService: CommonService) {}

ngOnInit() {}

handleCilckNav(index: number) {
this.serviceCommon.handleCilckTopNav(index)
this.commonService.handleCilckTopNav(index)
this.handleToggleOpen()
}

Expand Down
66 changes: 33 additions & 33 deletions src/view/light/index.component.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<div
class="index-wrapper dark-bg"
[class.noimg]="serviceCommon.settings.lightImages.length <= 0"
[class.noimg]="commonService.settings.lightImages.length <= 0"
>
<div class="light-box">
<main class="homepage dark-border-color dark-bg">
<nav class="top-nav dark-scrollbar dark-border-color dark-bg">
<span
*ngFor="
let item of serviceCommon.websiteList.slice(
let item of commonService.websiteList.slice(
0,
serviceCommon.overIndex
commonService.overIndex
);
index as i;
trackBy: serviceCommon.trackByItem
trackBy: commonService.trackByItem
"
(click)="serviceCommon.handleCilckTopNav(i)"
[class.active]="serviceCommon.page === i"
[class.dark-text-active]="serviceCommon.page === i"
(click)="commonService.handleCilckTopNav(i)"
[class.active]="commonService.page === i"
[class.dark-text-active]="commonService.page === i"
class="over-item ripple-btn dark-text"
>
{{ item.title }}
</span>
<!-- More -->
<app-web-more-menu
*ngIf="serviceCommon.overIndex < serviceCommon.websiteList.length"
*ngIf="commonService.overIndex < commonService.websiteList.length"
[data]="
serviceCommon.websiteList.slice(serviceCommon.overIndex, 99999)
commonService.websiteList.slice(commonService.overIndex, 99999)
"
[index]="serviceCommon.overIndex"
[page]="serviceCommon.page"
(onClick)="serviceCommon.handleCilckTopNav($event)"
[index]="commonService.overIndex"
[page]="commonService.page"
(onClick)="commonService.handleCilckTopNav($event)"
/>
</nav>

Expand All @@ -38,16 +38,16 @@
class="sidebar dark-bg dark-border-color dark-scrollbar"
id="sidebar"
>
<div *ngIf="serviceCommon.websiteList[serviceCommon.page]">
<div *ngIf="commonService.websiteList[commonService.page]">
<div
class="tag dark-text"
[class.active]="serviceCommon.id === i"
[class.dark-item-active]="serviceCommon.id === i"
(click)="serviceCommon.handleSidebarNav(i)"
[class.active]="commonService.id === i"
[class.dark-item-active]="commonService.id === i"
(click)="commonService.handleSidebarNav(i)"
*ngFor="
let item of serviceCommon.websiteList[serviceCommon.page].nav;
let item of commonService.websiteList[commonService.page].nav;
index as i;
trackBy: serviceCommon.trackByItem
trackBy: commonService.trackByItem
"
>
{{ item.title }}
Expand All @@ -58,25 +58,25 @@
<div class="main dark-scrollbar">
<app-search-engine></app-search-engine>

<div *ngIf="serviceCommon.currentList.length > 0; else noData">
<div *ngIf="commonService.currentList.length > 0; else noData">
<nz-spin
nzSimple
*ngIf="serviceCommon.sliceMax === 0"
*ngIf="commonService.sliceMax === 0"
class="position-center"
></nz-spin>
<div
*ngFor="
let item of serviceCommon.currentList.slice(
let item of commonService.currentList.slice(
0,
serviceCommon.sliceMax
commonService.sliceMax
);
index as i;
trackBy: serviceCommon.trackByItem
trackBy: commonService.trackByItem
"
>
<app-toolbar-title
[dataSource]="item"
(onCollapse)="serviceCommon.onCollapse(item, i)"
(onCollapse)="commonService.onCollapse(item, i)"
[index]="i"
>
</app-toolbar-title>
Expand All @@ -97,14 +97,14 @@
*ngFor="
let el of item.nav;
index as j;
trackBy: serviceCommon.trackByItemWeb
trackBy: commonService.trackByItemWeb
"
>
<app-card
[cardStyle]="serviceCommon.settings.lightCardStyle"
[cardStyle]="commonService.settings.lightCardStyle"
[dataSource]="el"
[indexs]="[serviceCommon.page, serviceCommon.id, i, j]"
[searchKeyword]="serviceCommon.searchKeyword"
[indexs]="[commonService.page, commonService.id, i, j]"
[searchKeyword]="commonService.searchKeyword"
class="column-border"
></app-card>
</div>
Expand All @@ -121,11 +121,11 @@

<div
class="right dark-scrollbar"
*ngIf="serviceCommon.settings.lightImages.length > 0"
*ngIf="commonService.settings.lightImages.length > 0"
>
<div
class="aditem cursor-pointer"
*ngFor="let item of serviceCommon.settings.lightImages; index as i"
*ngFor="let item of commonService.settings.lightImages; index as i"
(click)="jumpService.goUrl($event, item['url'])"
>
<img class="adsimg" [src]="item['src']" />
Expand All @@ -134,11 +134,11 @@
</div>

<div>
<app-footer [content]="serviceCommon.settings.lightFooterHTML"></app-footer>
<app-footer [content]="commonService.settings.lightFooterHTML"></app-footer>
</div>
<app-fixbar
(onCollapse)="serviceCommon.onCollapseAll()"
[collapsed]="serviceCommon.collapsed"
(onCollapse)="commonService.onCollapseAll()"
[collapsed]="commonService.collapsed"
selector=".main"
/>
</div>
8 changes: 4 additions & 4 deletions src/view/light/index.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { Component } from '@angular/core'
import { randomBgImg } from 'src/utils'
import { ServiceCommonService } from 'src/services/common'
import { CommonService } from 'src/services/common'
import { JumpService } from 'src/services/jump'

@Component({
Expand All @@ -14,7 +14,7 @@ import { JumpService } from 'src/services/jump'
})
export default class LightComponent {
constructor(
public serviceCommon: ServiceCommonService,
public commonService: CommonService,
public jumpService: JumpService
) {}

Expand All @@ -23,8 +23,8 @@ export default class LightComponent {
}

ngAfterViewInit() {
if (this.serviceCommon.settings.lightOverType === 'ellipsis') {
this.serviceCommon.getOverIndex('.top-nav .over-item')
if (this.commonService.settings.lightOverType === 'ellipsis') {
this.commonService.getOverIndex('.top-nav .over-item')
}
}
}
Loading

0 comments on commit 3db7ff1

Please sign in to comment.