Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
开源百科
提交
33b519b0
开
开源百科
项目概览
gitcode_dev
/
开源百科
通知
256
Star
3
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
17
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
代码片段
项目成员
Pages
开
开源百科
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
17
Issue
17
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
33b519b0
编写于
4月 23, 2021
作者:
X
xjh22222228
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: own visible
上级
8bfc3ade
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
165 addition
and
80 deletion
+165
-80
README.md
README.md
+1
-1
src/components/create-web/index.component.html
src/components/create-web/index.component.html
+16
-14
src/components/create-web/index.component.scss
src/components/create-web/index.component.scss
+1
-4
src/components/create-web/index.component.ts
src/components/create-web/index.component.ts
+4
-0
src/components/fixbar/index.component.ts
src/components/fixbar/index.component.ts
+1
-1
src/styles.scss
src/styles.scss
+6
-0
src/types/index.d.ts
src/types/index.d.ts
+4
-0
src/utils/index.ts
src/utils/index.ts
+36
-8
src/utils/user.ts
src/utils/user.ts
+2
-0
src/view/admin/index.component.html
src/view/admin/index.component.html
+49
-7
src/view/admin/index.component.ts
src/view/admin/index.component.ts
+9
-2
src/view/index/light/index.component.html
src/view/index/light/index.component.html
+10
-2
src/view/index/light/index.component.ts
src/view/index/light/index.component.ts
+4
-13
src/view/index/side/index.component.html
src/view/index/side/index.component.html
+5
-1
src/view/index/side/index.component.ts
src/view/index/side/index.component.ts
+4
-13
src/view/index/sim/index.component.html
src/view/index/sim/index.component.html
+9
-1
src/view/index/sim/index.component.ts
src/view/index/sim/index.component.ts
+4
-13
未找到文件。
README.md
浏览文件 @
33b519b0
...
...
@@ -197,6 +197,6 @@ Thank you for your [contribution](https://github.com/xjh22222228/nav/issues), me
感谢您的认可:
| 姓名 | 支持金额 |
| --------------------------------------- |----------- |
|
[
aiyou9
](
https://github.com/aiyou9
)
| ¥
4
0.00 |
|
[
aiyou9
](
https://github.com/aiyou9
)
| ¥
5
0.00 |
| 路人甲 | ¥50.00 |
src/components/create-web/index.component.html
浏览文件 @
33b519b0
<nz-modal
[nzWidth]=
"560"
[(nzVisible)]=
"visible"
[nzTitle]=
"detail ? '编辑' : '新增'"
(nzOnCancel)=
"handleCancel()"
...
...
@@ -24,29 +25,30 @@
<div
class=
"row"
>
<div
class=
"col"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"
8
"
nzRequired
>
快捷方式
</nz-form-label>
<nz-form-control
[nzSpan]=
"
16
"
>
<nz-form-label
[nzSpan]=
"
15
"
nzRequired
>
快捷方式
</nz-form-label>
<nz-form-control
[nzSpan]=
"
9
"
>
<nz-switch
formControlName=
"top"
></nz-switch>
</nz-form-control>
</nz-form-item>
</div>
<div
class=
"col"
>
<!-- <nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>是否公开</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-switch formControlName="visible"></nz-switch>
<nz-form-item>
<nz-form-label
[nzSpan]=
"15"
nzRequired
>
仅自己可见
</nz-form-label>
<nz-form-control
[nzSpan]=
"9"
>
<nz-switch
formControlName=
"ownVisible"
></nz-switch>
</nz-form-control>
</nz-form-item>
</div>
<div
class=
"col"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"8"
>
推荐指数
</nz-form-label>
<nz-form-control
[nzSpan]=
"24"
>
<nz-rate
formControlName=
"rate"
nzAllowHalf
></nz-rate>
</nz-form-control>
</nz-form-item>
-->
</nz-form-item>
</div>
</div>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
>
推荐指数
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
>
<nz-rate
formControlName=
"rate"
nzAllowHalf
></nz-rate>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
>
图标地址
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
>
...
...
src/components/create-web/index.component.scss
浏览文件 @
33b519b0
...
...
@@ -4,8 +4,5 @@
.row
{
display
:
flex
;
.col
{
flex
:
1
;
}
justify-content
:
space-around
;
}
src/components/create-web/index.component.ts
浏览文件 @
33b519b0
...
...
@@ -42,6 +42,7 @@ export class CreateWebComponent implements OnInit {
title
:
[
''
,
[
Validators
.
required
]],
url
:
[
''
,
[
Validators
.
required
]],
top
:
[
false
],
ownVisible
:
[
false
],
rate
:
[
5
],
url0
:
[
''
],
url1
:
[
''
],
...
...
@@ -68,6 +69,7 @@ export class CreateWebComponent implements OnInit {
this
.
validateForm
.
get
(
'
icon
'
)
!
.
setValue
(
detail
.
icon
||
''
)
this
.
validateForm
.
get
(
'
url
'
)
!
.
setValue
(
detail
.
url
||
''
)
this
.
validateForm
.
get
(
'
top
'
)
!
.
setValue
(
detail
.
top
??
false
)
this
.
validateForm
.
get
(
'
ownVisible
'
)
!
.
setValue
(
detail
.
ownVisible
??
false
)
this
.
validateForm
.
get
(
'
rate
'
)
!
.
setValue
(
detail
.
rate
??
5
)
if
(
typeof
detail
.
urls
===
'
object
'
)
{
...
...
@@ -184,6 +186,7 @@ export class CreateWebComponent implements OnInit {
icon
,
url
,
top
,
ownVisible
,
rate
,
desc
,
url0
,
...
...
@@ -214,6 +217,7 @@ export class CreateWebComponent implements OnInit {
rate
:
rate
??
0
,
desc
:
desc
||
''
,
top
:
top
??
false
,
ownVisible
:
ownVisible
??
false
,
icon
,
url
,
urls
...
...
src/components/fixbar/index.component.ts
浏览文件 @
33b519b0
...
...
@@ -173,7 +173,7 @@ export class FixbarComponent {
this
.
modal
.
info
({
nzTitle
:
'
同步数据到远端
'
,
nzOkText
:
'
确定同步
'
,
nzContent
:
'
确定将所有数据同步到远端吗?
这可能需要消耗一定的时间。
'
,
nzContent
:
'
确定将所有数据同步到远端吗?
'
,
nzOnOk
:
()
=>
{
this
.
syncLoading
=
true
;
...
...
src/styles.scss
浏览文件 @
33b519b0
...
...
@@ -112,6 +112,12 @@ em {
-webkit-box-orient
:
vertical
;
}
.remove
{
position
:
fixed
!
important
;
top
:
-10000px
!
important
;
left
:
-10000px
!
important
;
}
/* 搜索高亮关键字 */
b
{
color
:
#f50
!
important
;
...
...
src/types/index.d.ts
浏览文件 @
33b519b0
...
...
@@ -25,6 +25,7 @@ export interface INavFourProp {
rate
?:
number
// 0-5
top
?:
boolean
index
?:
number
// sort
ownVisible
?:
boolean
urls
?:
{
[
tagName
:
string
]:
string
}
...
...
@@ -35,6 +36,7 @@ export interface INavThreeProp {
icon
?:
string
|
null
createdAt
?:
string
collapsed
?:
boolean
ownVisible
?:
boolean
nav
:
INavFourProp
[]
}
...
...
@@ -43,6 +45,7 @@ export interface INavTwoProp {
icon
?:
string
|
null
createdAt
?:
string
collapsed
?:
boolean
ownVisible
?:
boolean
nav
:
INavThreeProp
[]
}
...
...
@@ -51,6 +54,7 @@ export interface INavProps extends Object {
id
?:
number
icon
?:
string
|
null
createdAt
?:
string
ownVisible
?:
boolean
nav
:
INavTwoProp
[]
}
...
...
src/utils/index.ts
浏览文件 @
33b519b0
...
...
@@ -4,12 +4,13 @@
import
qs
from
'
qs
'
import
config
from
'
../../nav.config
'
import
Clipboard
from
'
clipboard
'
import
{
INavFourProp
,
INavProps
,
ISearchEngineProps
}
from
'
../types
'
import
{
INavFourProp
,
INav
ThreeProp
,
INav
Props
,
ISearchEngineProps
}
from
'
../types
'
import
*
as
db
from
'
../../data/db.json
'
import
*
as
s
from
'
../../data/search.json
'
import
{
STORAGE_KEY_MAP
}
from
'
../constants
'
import
{
isLogin
}
from
'
./user
'
export
const
websiteList
=
getWebsiteList
()
export
const
websiteList
:
INavProps
[]
=
getWebsiteList
()
let
total
=
0
const
{
lightThemeConfig
}
=
config
...
...
@@ -188,7 +189,7 @@ export function adapterWebsiteList(websiteList: any[], parentItem?: any) {
return
websiteList
;
}
export
function
getWebsiteList
()
{
export
function
getWebsiteList
()
:
INavProps
[]
{
let
webSiteList
=
adapterWebsiteList
((
db
as
any
).
default
)
const
scriptElAll
=
document
.
querySelectorAll
(
'
script
'
)
const
scriptUrl
=
scriptElAll
[
scriptElAll
.
length
-
1
].
src
...
...
@@ -247,10 +248,13 @@ export function toggleCollapseAll(wsList?: INavProps[]): boolean {
export
function
setLocation
()
{
const
{
page
,
id
}
=
queryString
()
window
.
localStorage
.
setItem
(
STORAGE_KEY_MAP
.
location
,
JSON
.
stringify
({
page
,
id
}))
window
.
localStorage
.
setItem
(
STORAGE_KEY_MAP
.
location
,
JSON
.
stringify
({
page
,
id
}
))
}
export
function
getDefaultSearchEngine
():
ISearchEngineProps
{
...
...
@@ -265,7 +269,10 @@ export function getDefaultSearchEngine(): ISearchEngineProps {
}
export
function
setDefaultSearchEngine
(
engine
:
ISearchEngineProps
)
{
window
.
localStorage
.
setItem
(
STORAGE_KEY_MAP
.
engine
,
JSON
.
stringify
(
engine
))
window
.
localStorage
.
setItem
(
STORAGE_KEY_MAP
.
engine
,
JSON
.
stringify
(
engine
)
)
}
export
function
isDark
():
boolean
{
...
...
@@ -429,3 +436,24 @@ export function getTextContent(value: string): string {
div
.
innerHTML
=
value
return
div
.
textContent
}
export
function
matchCurrentList
():
INavThreeProp
[]
{
const
{
id
,
page
}
=
queryString
()
let
data
=
[]
try
{
if
(
websiteList
[
page
]
&&
websiteList
[
page
]?.
nav
?.
length
>
0
&&
(
isLogin
||
!
websiteList
[
page
].
nav
[
id
].
ownVisible
)
)
{
data
=
websiteList
[
page
].
nav
[
id
].
nav
}
else
{
data
=
[]
}
}
catch
{
data
=
[]
}
return
data
}
src/utils/user.ts
浏览文件 @
33b519b0
...
...
@@ -8,3 +8,5 @@ export function getToken() {
export
function
setToken
(
token
:
string
)
{
return
window
.
localStorage
.
setItem
(
'
token
'
,
token
)
}
export
const
isLogin
:
boolean
=
!!
getToken
()
src/view/admin/index.component.html
浏览文件 @
33b519b0
<div
class=
"admin"
>
<button
nz-button
style=
"margin-bottom: 15px;"
(click)=
"goBack()"
>
返回主页
</button>
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleSync()"
[nzLoading]=
"syncLoading"
>
同步到远端
</button>
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleReset()"
>
重置初始数据
</button>
<button
nz-button
style=
"margin-bottom: 15px;"
(click)=
"goBack()"
>
返回主页
</button>
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleSync()"
[nzLoading]=
"syncLoading"
>
同步到远端
</button>
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleReset()"
>
重置初始数据
</button>
<div
class=
"content"
>
<p><b>
1、所有数据设置完毕后点击 “同步到远端”,拖拽表格进行排序
</b></p>
...
...
@@ -44,6 +63,7 @@
<tr>
<th>
图标
</th>
<th>
分类名称
</th>
<th>
仅自己可见
</th>
<th>
创建时间
</th>
<th>
操作
</th>
</tr>
...
...
@@ -58,6 +78,9 @@
</app-logo>
</td>
<td>
{{ data.title }}
</td>
<td>
<i
*ngIf=
"data.ownVisible"
nz-icon
nzType=
"check"
nzTheme=
"outline"
></i>
</td>
<td>
{{ data.createdAt }}
</td>
<td>
<a
(click)=
"handleEditBtn(data, idx)"
>
编辑
</a>
...
...
@@ -105,6 +128,7 @@
<tr>
<th>
图标
</th>
<th>
分类名称
</th>
<th>
仅自己可见
</th>
<th>
创建时间
</th>
<th>
操作
</th>
</tr>
...
...
@@ -119,6 +143,9 @@
</app-logo>
</td>
<td>
{{ data.title }}
</td>
<td>
<i
*ngIf=
"data.ownVisible"
nz-icon
nzType=
"check"
nzTheme=
"outline"
></i>
</td>
<td>
{{ data.createdAt }}
</td>
<td>
<a
(click)=
"handleEditBtn(data, idx)"
>
编辑
</a>
...
...
@@ -181,6 +208,7 @@
<tr>
<th>
图标
</th>
<th>
分类名称
</th>
<th>
仅自己可见
</th>
<th>
创建时间
</th>
<th>
操作
</th>
</tr>
...
...
@@ -195,6 +223,9 @@
</app-logo>
</td>
<td>
{{ data.title }}
</td>
<td>
<i
*ngIf=
"data.ownVisible"
nz-icon
nzType=
"check"
nzTheme=
"outline"
></i>
</td>
<td>
{{ data.createdAt }}
</td>
<td>
<a
(click)=
"handleEditBtn(data, idx)"
>
编辑
</a>
...
...
@@ -273,6 +304,7 @@
<th>
图标
</th>
<th>
网站名称
</th>
<th>
网站分类
</th>
<th>
仅自己可见
</th>
<th
nzWidth=
"300px"
>
网站描述
</th>
<th>
创建时间
</th>
<th>
操作
</th>
...
...
@@ -295,6 +327,9 @@
<a
[href]=
"data.urls[key]"
target=
"_blank"
>
{{ key }}
</a>
</nz-tag>
</td>
<td>
<i
*ngIf=
"data.ownVisible"
nz-icon
nzType=
"check"
nzTheme=
"outline"
></i>
</td>
<td>
<pre
class=
"desc"
>
{{ data.desc }}
</pre>
</td>
...
...
@@ -334,15 +369,22 @@
<ng-container
*nzModalContent
>
<form
nz-form
[formGroup]=
"validateForm"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"
4
"
nzRequired
>
分类名称
</nz-form-label>
<nz-form-control
[nzSpan]=
"
20
"
nzErrorTip=
"请输入名称"
>
<nz-form-label
[nzSpan]=
"
6
"
nzRequired
>
分类名称
</nz-form-label>
<nz-form-control
[nzSpan]=
"
18
"
nzErrorTip=
"请输入名称"
>
<input
formControlName=
"title"
nz-input
placeholder=
"发现导航"
/>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
>
图标地址
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
>
<nz-form-label
[nzSpan]=
"6"
nzRequired
>
仅自己可见
</nz-form-label>
<nz-form-control
[nzSpan]=
"18"
>
<nz-switch
formControlName=
"ownVisible"
></nz-switch>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[nzSpan]=
"6"
>
图标地址
</nz-form-label>
<nz-form-control
[nzSpan]=
"18"
>
<nz-input-group
[nzPrefix]=
"prefixIcon"
>
<input
formControlName=
"icon"
nz-input
placeholder=
"https://example.com/favicon.png"
/>
</nz-input-group>
...
...
src/view/admin/index.component.ts
浏览文件 @
33b519b0
...
...
@@ -59,6 +59,7 @@ export default class WebpComponent {
this
.
validateForm
=
this
.
fb
.
group
({
title
:
[
''
,
[
Validators
.
required
]],
icon
:
[
''
],
ownVisible
:
[
false
],
})
}
...
...
@@ -295,7 +296,7 @@ export default class WebpComponent {
this
.
modal
.
info
({
nzTitle
:
'
同步数据到远端
'
,
nzOkText
:
'
确定同步
'
,
nzContent
:
'
确定将所有数据同步到远端吗?
这可能需要消耗一定的时间。
'
,
nzContent
:
'
确定将所有数据同步到远端吗?
'
,
nzOnOk
:
()
=>
{
this
.
syncLoading
=
true
...
...
@@ -328,7 +329,7 @@ export default class WebpComponent {
this
.
validateForm
.
controls
[
i
].
updateValueAndValidity
()
}
let
{
title
,
icon
}
=
this
.
validateForm
.
value
let
{
title
,
icon
,
ownVisible
}
=
this
.
validateForm
.
value
if
(
!
title
)
return
...
...
@@ -338,6 +339,7 @@ export default class WebpComponent {
case
0
:
{
this
.
websiteList
[
this
.
editIdx
].
title
=
title
this
.
websiteList
[
this
.
editIdx
].
icon
=
icon
this
.
websiteList
[
this
.
editIdx
].
ownVisible
=
ownVisible
}
break
...
...
@@ -345,6 +347,7 @@ export default class WebpComponent {
case
1
:
{
this
.
twoTableData
[
this
.
editIdx
].
title
=
title
this
.
twoTableData
[
this
.
editIdx
].
icon
=
icon
this
.
twoTableData
[
this
.
editIdx
].
ownVisible
=
ownVisible
}
break
...
...
@@ -352,6 +355,7 @@ export default class WebpComponent {
case
2
:
{
this
.
threeTableData
[
this
.
editIdx
].
title
=
title
this
.
threeTableData
[
this
.
editIdx
].
icon
=
icon
this
.
threeTableData
[
this
.
editIdx
].
ownVisible
=
ownVisible
}
break
}
...
...
@@ -370,6 +374,7 @@ export default class WebpComponent {
createdAt
,
title
,
icon
,
ownVisible
,
nav
:
[]
})
}
...
...
@@ -386,6 +391,7 @@ export default class WebpComponent {
createdAt
,
title
,
icon
,
ownVisible
,
nav
:
[]
})
}
...
...
@@ -402,6 +408,7 @@ export default class WebpComponent {
createdAt
,
title
,
icon
,
ownVisible
,
nav
:
[]
})
}
...
...
src/view/index/light/index.component.html
浏览文件 @
33b519b0
...
...
@@ -13,6 +13,7 @@
(click)=
"handleCilckTopNav(i)"
[class.active]=
"page === i"
[class.dark-text-active]=
"page === i"
[class.remove]=
"!isLogin && item.ownVisible"
class=
"ripple-btn dark-text"
>
{{ item.title }}
...
...
@@ -28,6 +29,7 @@
[class.dark-item-active]=
"id === i"
(click)=
"handleSidebarNav(i)"
*ngFor=
"let item of websiteList[page].nav; index as i"
[class.remove]=
"!isLogin && item.ownVisible"
>
<div
class=
"ripple-btn"
>
{{ item.title }}
</div>
</li>
...
...
@@ -38,7 +40,7 @@
<app-search-engine></app-search-engine>
<div
*ngIf=
"currentList.length > 0; else noData"
>
<div
*ngFor=
"let item of currentList; index as i"
>
<div
*ngFor=
"let item of currentList; index as i"
[class.remove]=
"!isLogin && item.ownVisible"
>
<app-toolbar-title
[dataSource]=
"item"
(onCollapse)=
"onCollapse(item, i)"
...
...
@@ -52,7 +54,13 @@
[nzGutter]=
"[16, 16]"
[style.display]=
"item.collapsed ? 'none' : ''"
>
<div
class=
"gutter-row"
nz-col
[nzSpan]=
"8"
*ngFor=
"let el of item.nav"
>
<div
class=
"gutter-row"
nz-col
[nzSpan]=
"8"
*ngFor=
"let el of item.nav"
[class.remove]=
"!isLogin && el.ownVisible"
>
<app-card
[dataSource]=
"el"
></app-card>
</div>
</div>
...
...
src/view/index/light/index.component.ts
浏览文件 @
33b519b0
...
...
@@ -10,7 +10,9 @@ import {
queryString
,
setWebsiteList
,
toggleCollapseAll
,
matchCurrentList
}
from
'
../../../utils
'
import
{
isLogin
}
from
'
../../../utils/user
'
import
{
initRipple
,
setAnnotate
}
from
'
../../../utils/ripple
'
import
{
websiteList
}
from
'
../../../store
'
...
...
@@ -27,22 +29,11 @@ export default class LightComponent {
currentList
:
INavThreeProp
[]
=
[]
id
:
number
=
0
page
:
number
=
0
isLogin
=
isLogin
ngOnInit
()
{
randomBgImg
()
const
initList
=
()
=>
{
try
{
if
(
this
.
websiteList
[
this
.
page
]
&&
this
.
websiteList
[
this
.
page
]?.
nav
?.
length
>
0
)
{
this
.
currentList
=
this
.
websiteList
[
this
.
page
].
nav
[
this
.
id
].
nav
}
else
{
this
.
currentList
=
[]
}
}
catch
(
error
)
{
this
.
currentList
=
[]
}
}
this
.
activatedRoute
.
queryParams
.
subscribe
(()
=>
{
const
tempPage
=
this
.
page
const
{
id
,
page
,
q
}
=
queryString
()
...
...
@@ -52,7 +43,7 @@ export default class LightComponent {
if
(
q
)
{
this
.
currentList
=
fuzzySearch
(
this
.
websiteList
,
q
)
}
else
{
ini
tList
()
this
.
currentList
=
matchCurren
tList
()
}
if
(
tempPage
!==
page
)
{
...
...
src/view/index/side/index.component.html
浏览文件 @
33b519b0
...
...
@@ -11,11 +11,14 @@
[(nzOpen)]=
"pageIdx === openIndex"
[nzTitle]=
"item.title"
*ngFor=
"let item of websiteList; index as pageIdx;"
[class.remove]=
"!isLogin && item.ownVisible"
(nzOpenChange)=
"openIndex = pageIdx"
>
<ul>
<li
nz-menu-item
*ngFor=
"let el of item.nav; let idIdx = index;"
nz-menu-item
*ngFor=
"let el of item.nav; let idIdx = index;"
[class.remove]=
"!isLogin && item.ownVisible"
[nzSelected]=
"page === pageIdx && id === idIdx"
(click)=
"handleSidebarNav(pageIdx, idIdx)"
>
...
...
@@ -60,6 +63,7 @@
<div
*ngFor=
"let el of item.nav"
class=
"gutter-row"
[class.remove]=
"!isLogin && el.ownVisible"
nz-col
[nzSpan]=
"6"
[nzXs]=
"24"
...
...
src/view/index/side/index.component.ts
浏览文件 @
33b519b0
...
...
@@ -10,7 +10,9 @@ import {
queryString
,
setWebsiteList
,
toggleCollapseAll
,
matchCurrentList
}
from
'
../../../utils
'
import
{
isLogin
}
from
'
../../../utils/user
'
import
{
websiteList
}
from
'
../../../store
'
import
{
LOGO_CDN
}
from
'
../../../constants
'
import
*
as
s
from
'
../../../../data/search.json
'
...
...
@@ -34,22 +36,11 @@ export default class SideComponent {
searchEngineList
=
searchEngineList
marginTop
:
number
=
searchEngineList
.
length
>
0
?
157
:
50
isFirst
=
false
isLogin
=
isLogin
constructor
(
private
router
:
Router
,
private
activatedRoute
:
ActivatedRoute
)
{}
ngOnInit
()
{
const
initList
=
()
=>
{
try
{
if
(
this
.
websiteList
[
this
.
page
]
&&
this
.
websiteList
[
this
.
page
]?.
nav
?.
length
>
0
)
{
this
.
currentList
=
this
.
websiteList
[
this
.
page
].
nav
[
this
.
id
].
nav
}
else
{
this
.
currentList
=
[]
}
}
catch
(
error
)
{
this
.
currentList
=
[]
}
}
this
.
activatedRoute
.
queryParams
.
subscribe
(()
=>
{
const
{
id
,
page
,
q
}
=
queryString
()
this
.
page
=
page
...
...
@@ -58,7 +49,7 @@ export default class SideComponent {
if
(
q
)
{
this
.
currentList
=
fuzzySearch
(
this
.
websiteList
,
q
)
}
else
{
ini
tList
()
this
.
currentList
=
matchCurren
tList
()
}
setWebsiteList
(
this
.
websiteList
)
...
...
src/view/index/sim/index.component.html
浏览文件 @
33b519b0
...
...
@@ -10,6 +10,7 @@
*ngFor=
"let item of websiteList; let i = index;"
[class.active]=
"page === i"
[class.dark-text-active]=
"page === i"
[class.remove]=
"!isLogin && item.ownVisible"
class=
"ripple-btn dark-text"
(click)=
"handleCilckTopNav(i)"
>
...
...
@@ -25,6 +26,7 @@
(click)=
"handleSidebarNav(i)"
[class.active]=
"id === i"
[class.dark-item-active]=
"id === i"
[class.remove]=
"!isLogin && item.ownVisible"
class=
"ripple-btn dark-text"
>
{{ item.title }}
...
...
@@ -39,7 +41,13 @@
<app-toolbar-title
[dataSource]=
"item"
(onCollapse)=
"onCollapse(item, i)"
[index]=
"i"
></app-toolbar-title>
<div
nz-row
[nzGutter]=
"[16, 16]"
[style.display]=
"item.collapsed ? 'none' : ''"
>
<div
class=
"gutter-row"
nz-col
[nzSpan]=
"8"
*ngFor=
"let el of item.nav; let idx=index"
>
<div
class=
"gutter-row"
nz-col
[nzSpan]=
"8"
*ngFor=
"let el of item.nav; let idx=index"
[class.remove]=
"!isLogin && el.ownVisible"
>
<app-card
[dataSource]=
"el"
></app-card>
</div>
</div>
...
...
src/view/index/sim/index.component.ts
浏览文件 @
33b519b0
...
...
@@ -10,7 +10,9 @@ import {
setWebsiteList
,
toggleCollapseAll
,
totalWeb
,
matchCurrentList
}
from
'
../../../utils
'
import
{
isLogin
}
from
'
../../../utils/user
'
import
{
initRipple
,
setAnnotate
}
from
'
../../../utils/ripple
'
import
{
websiteList
}
from
'
../../../store
'
...
...
@@ -34,20 +36,9 @@ export default class SimComponent {
title
:
string
=
title
posterImageUrls
?:
string
=
simThemeConfig
.
posterImageUrls
[
0
]
description
:
string
=
simThemeConfig
.
description
.
replace
(
'
${total}
'
,
String
(
totalWeb
()))
isLogin
=
isLogin
ngOnInit
()
{
const
initList
=
()
=>
{
try
{
if
(
this
.
websiteList
[
this
.
page
]
&&
this
.
websiteList
[
this
.
page
]?.
nav
?.
length
>
0
)
{
this
.
currentList
=
this
.
websiteList
[
this
.
page
].
nav
[
this
.
id
].
nav
}
else
{
this
.
currentList
=
[]
}
}
catch
(
error
)
{
this
.
currentList
=
[]
}
}
this
.
activatedRoute
.
queryParams
.
subscribe
(()
=>
{
const
tempPage
=
this
.
page
const
{
id
,
page
,
q
}
=
queryString
()
...
...
@@ -57,7 +48,7 @@ export default class SimComponent {
if
(
q
)
{
this
.
currentList
=
fuzzySearch
(
this
.
websiteList
,
q
)
}
else
{
ini
tList
()
this
.
currentList
=
matchCurren
tList
()
}
if
(
tempPage
!==
page
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录