Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
兴科Sinco
开源百科
提交
361b113b
开
开源百科
项目概览
兴科Sinco
/
开源百科
与 Fork 源项目一致
Fork自
GitCode官方 / 开源百科
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
开
开源百科
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
361b113b
编写于
1月 24, 2021
作者:
X
xjh22222228
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove edit mode
上级
642c0998
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
24 addition
and
173 deletion
+24
-173
README.md
README.md
+0
-1
src/components/card/index.component.html
src/components/card/index.component.html
+11
-29
src/components/card/index.component.ts
src/components/card/index.component.ts
+3
-111
src/components/fixbar/index.component.html
src/components/fixbar/index.component.html
+0
-6
src/components/fixbar/index.component.ts
src/components/fixbar/index.component.ts
+1
-10
src/constants/index.ts
src/constants/index.ts
+1
-4
src/store/index.ts
src/store/index.ts
+0
-4
src/view/admin/index.component.html
src/view/admin/index.component.html
+1
-1
src/view/index/light/index.component.html
src/view/index/light/index.component.html
+3
-3
src/view/index/side/index.component.html
src/view/index/side/index.component.html
+1
-1
src/view/index/sim/index.component.html
src/view/index/sim/index.component.html
+3
-3
未找到文件。
README.md
浏览文件 @
361b113b
...
...
@@ -123,7 +123,6 @@ server {
## 快捷键
mac下是
`Command`
,windows 下是
`Ctrl`
-
`ctrl+e`
开启或关闭编辑模式
-
`ctrl+v`
查看信息
-
`ctrl+d`
开启或关闭暗黑模式
...
...
src/components/card/index.component.html
浏览文件 @
361b113b
...
...
@@ -86,31 +86,7 @@
</div>
<ng-template
#card
>
<div
class=
"container"
nz-dropdown
[nzDropdownMenu]=
"menu"
[nzDisabled]=
"!isEditing.value || hasKeyword() || !isLogin"
[nzClickHide]=
"false"
>
<ng-content></ng-content>
</div>
<nz-dropdown-menu
#menu
="
nzDropdownMenu
"
>
<ul
nz-menu
nzSelectable
>
<li
nz-menu-item
(click)=
"clickEdit()"
>
编辑
</li>
<a
*ngIf=
"isLogin"
nz-popconfirm
nzPopconfirmPlacement=
"rightTop"
nzOkType=
"danger"
nzPopconfirmTitle=
"您确定要删除吗?"
nzPopconfirmPlacement=
"bottom"
(nzOnConfirm)=
"confirmDel($event)"
>
<li
nz-menu-item
nzDanger
>
删除
</li>
</a>
</ul>
</nz-dropdown-menu>
<ng-content></ng-content>
</ng-template>
<nz-modal
...
...
@@ -122,13 +98,13 @@
<ng-container
*nzModalContent
>
<form
nz-form
[formGroup]=
"validateForm"
(ngSubmit)=
"handleOk()"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
nzRequired
>
{{ getEditType() === EditType.isWebsite ? '网站名称' : '分类名称'}}
</nz-form-label>
<nz-form-label
[nzSpan]=
"4"
nzRequired
>
网站名称
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
nzErrorTip=
"请输入名称"
>
<input
formControlName=
"title"
nz-input
placeholder=
"发现导航"
/>
</nz-form-control>
</nz-form-item>
<nz-form-item
*ngIf=
"getEditType() === EditType.isWebsite"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
nzRequired
>
网站链接
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
>
<input
formControlName=
"url"
nz-input
placeholder=
"https://nav3.cn"
(blur)=
"onUrlBlur($event)"
/>
...
...
@@ -148,10 +124,16 @@
</nz-form-control>
</nz-form-item>
<nz-form-item
*ngIf=
"getEditType() === EditType.isWebsite"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
>
网站描述
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
>
<input
formControlName=
"desc"
nz-input
placeholder=
"发现导航, 精选实用导航网站"
/>
<textarea
formControlName=
"desc"
placeholder=
"发现导航, 精选实用导航网站"
nz-input
[nzAutosize]=
"{ minRows: 3, maxRows: 5 }"
>
</textarea>
</nz-form-control>
</nz-form-item>
</form>
...
...
src/components/card/index.component.ts
浏览文件 @
361b113b
...
...
@@ -6,10 +6,8 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'
import
{
NzMessageService
}
from
'
ng-zorro-antd/message
'
import
{
NzNotificationService
}
from
'
ng-zorro-antd/notification
'
import
{
getToken
}
from
'
../../utils/user
'
import
{
setWebsiteList
,
queryString
,
getLogoUrl
,
copyText
}
from
'
../../utils
'
import
{
websiteList
,
isEditing
}
from
'
../../store
'
import
{
Router
}
from
'
@angular/router
'
import
{
setAnnotate
}
from
'
../../utils/ripple
'
import
{
setWebsiteList
,
getLogoUrl
,
copyText
}
from
'
../../utils
'
import
{
websiteList
}
from
'
../../store
'
import
{
INavProps
}
from
'
../../types
'
enum
EditType
{
...
...
@@ -35,7 +33,6 @@ export class CardComponent implements OnInit {
objectKeys
=
Object
.
keys
websiteList
:
INavProps
[]
=
websiteList
isLogin
:
boolean
=
!!
getToken
()
isEditing
=
isEditing
showModal
=
false
EditType
=
EditType
iconUrl
=
''
...
...
@@ -45,7 +42,6 @@ export class CardComponent implements OnInit {
constructor
(
private
fb
:
FormBuilder
,
private
message
:
NzMessageService
,
private
router
:
Router
,
private
notification
:
NzNotificationService
,
)
{}
...
...
@@ -94,10 +90,6 @@ export class CardComponent implements OnInit {
this
.
iconUrl
=
e
.
target
.
value
}
hasKeyword
()
{
return
!!
queryString
().
q
}
toggleModal
()
{
this
.
showModal
=
!
this
.
showModal
}
...
...
@@ -114,44 +106,6 @@ export class CardComponent implements OnInit {
if
(
!
title
)
return
title
=
title
.
trim
()
if
(
type
===
EditType
.
isOne
)
{
const
exists
=
this
.
websiteList
.
some
((
item
,
idx
)
=>
(
item
.
title
===
title
&&
idx
!==
this
.
oIdx
))
if
(
exists
)
{
this
.
message
.
error
(
`已存在
${
title
}
, 不可重复添加`
)
return
}
this
.
websiteList
[
this
.
oIdx
].
title
=
title
this
.
websiteList
[
this
.
oIdx
].
icon
=
icon
}
if
(
type
===
EditType
.
isTwo
)
{
const
w
=
this
.
websiteList
[
this
.
oIdx
].
nav
const
exists
=
w
.
some
((
item
,
idx
)
=>
(
item
.
title
===
title
&&
idx
!==
this
.
twoIdx
))
if
(
exists
)
{
this
.
message
.
error
(
`已存在
${
title
}
, 不可重复添加`
)
return
}
w
[
this
.
twoIdx
].
title
=
title
w
[
this
.
twoIdx
].
icon
=
icon
}
if
(
type
===
EditType
.
isThree
)
{
const
w
=
this
.
websiteList
[
this
.
oIdx
].
nav
[
this
.
twoIdx
].
nav
const
exists
=
w
.
some
((
item
,
idx
)
=>
(
item
.
title
===
title
&&
idx
!==
this
.
threeIdx
))
if
(
exists
)
{
this
.
message
.
error
(
`已存在
${
title
}
, 不可重复添加`
)
return
}
w
[
this
.
threeIdx
].
title
=
title
w
[
this
.
threeIdx
].
icon
=
icon
}
if
(
type
===
EditType
.
isWebsite
)
{
const
w
=
this
.
websiteList
[
this
.
oIdx
]
.
nav
[
this
.
twoIdx
]
...
...
@@ -161,7 +115,7 @@ export class CardComponent implements OnInit {
item
.
name
===
title
&&
idx
!==
this
.
fourIdx
))
if
(
exists
)
{
this
.
message
.
error
(
`已存在
${
title
}
,
不可重复添加
`
)
this
.
message
.
error
(
`已存在
${
title
}
,
请修改
`
)
return
}
w
[
this
.
fourIdx
].
name
=
title
...
...
@@ -183,26 +137,6 @@ export class CardComponent implements OnInit {
const
type
=
this
.
getEditType
()
try
{
if
(
type
===
EditType
.
isOne
)
{
const
{
title
,
icon
}
=
this
.
websiteList
[
this
.
oIdx
]
this
.
validateForm
.
get
(
'
title
'
)
!
.
setValue
(
title
)
this
.
validateForm
.
get
(
'
icon
'
)
!
.
setValue
(
icon
)
}
if
(
type
===
EditType
.
isTwo
)
{
const
{
title
,
icon
}
=
this
.
websiteList
[
this
.
oIdx
].
nav
[
this
.
twoIdx
]
this
.
validateForm
.
get
(
'
title
'
)
!
.
setValue
(
title
)
this
.
validateForm
.
get
(
'
icon
'
)
!
.
setValue
(
icon
)
}
if
(
type
===
EditType
.
isThree
)
{
const
{
title
,
icon
}
=
this
.
websiteList
[
this
.
oIdx
]
.
nav
[
this
.
twoIdx
]
.
nav
[
this
.
threeIdx
]
this
.
validateForm
.
get
(
'
title
'
)
!
.
setValue
(
title
)
this
.
validateForm
.
get
(
'
icon
'
)
!
.
setValue
(
icon
)
}
if
(
type
===
EditType
.
isWebsite
)
{
const
{
name
,
icon
,
url
,
desc
}
=
this
.
websiteList
[
this
.
oIdx
]
.
nav
[
this
.
twoIdx
]
...
...
@@ -247,53 +181,11 @@ export class CardComponent implements OnInit {
}
confirmDel
()
{
const
{
page
,
id
}
=
queryString
()
try
{
switch
(
this
.
getEditType
()
as
EditType
)
{
case
EditType
.
isWebsite
:
this
.
websiteList
[
this
.
oIdx
].
nav
[
this
.
twoIdx
].
nav
[
this
.
threeIdx
].
nav
.
splice
(
this
.
fourIdx
,
1
)
break
case
EditType
.
isThree
:
this
.
websiteList
[
this
.
oIdx
].
nav
[
this
.
twoIdx
].
nav
.
splice
(
this
.
threeIdx
,
1
)
break
case
EditType
.
isTwo
:
// 删除二级分类
if
(
this
.
websiteList
[
this
.
oIdx
]?.
nav
?.
length
<=
1
)
{
return
this
.
message
.
error
(
'
至少保留一项, 请先添加再删除!
'
)
}
this
.
router
.
navigate
([
this
.
router
.
url
.
split
(
'
?
'
)[
0
]],
{
queryParams
:
{
page
,
id
:
id
>
0
?
id
-
1
:
0
,
}
})
delete
this
.
websiteList
[
this
.
oIdx
].
id
this
.
websiteList
[
this
.
oIdx
].
nav
.
splice
(
this
.
twoIdx
,
1
)
break
case
EditType
.
isOne
:
if
(
this
.
websiteList
.
length
===
1
)
{
this
.
message
.
error
(
'
至少保留一项, 请先添加再删除!
'
)
return
}
this
.
router
.
navigate
([
this
.
router
.
url
.
split
(
'
?
'
)[
0
]],
{
queryParams
:
{
page
:
page
>
0
?
page
-
1
:
0
,
id
:
0
}
})
this
.
websiteList
.
splice
(
this
.
oIdx
,
1
)
setTimeout
(()
=>
{
setAnnotate
()
},
100
)
break
}
setWebsiteList
(
this
.
websiteList
)
...
...
src/components/fixbar/index.component.html
浏览文件 @
361b113b
...
...
@@ -39,12 +39,6 @@
</div>
</span>
<span
*ngIf=
"isLogin"
nz-tooltip
[nzTooltipTitle]=
"isEditing.value ? '关闭编辑模式' : '开启编辑模式'"
>
<div
class=
"wrapper dark-bg dark-border-color dark-action-hover"
(click)=
"toggleEditMode()"
>
<i
class=
"iconfont iconsuo"
[class.iconunlock]=
"isEditing.value"
></i>
</div>
</span>
<span
nz-tooltip
nzTooltipTitle=
"新增数据"
>
<div
class=
"wrapper dark-bg dark-border-color dark-action-hover"
(click)=
"toggleModal()"
>
<i
class=
"iconfont iconchuangjian"
></i>
...
...
src/components/fixbar/index.component.ts
浏览文件 @
361b113b
...
...
@@ -9,7 +9,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'
import
{
NzNotificationService
}
from
'
ng-zorro-antd/notification
'
import
{
getToken
}
from
'
../../utils/user
'
import
{
updateFileContent
}
from
'
../../services
'
import
{
websiteList
,
isEditing
}
from
'
../../store
'
import
{
websiteList
}
from
'
../../store
'
import
{
DB_PATH
,
KEY_MAP
,
VERSION
}
from
'
../../constants
'
import
{
Router
,
ActivatedRoute
}
from
'
@angular/router
'
import
{
setAnnotate
}
from
'
../../utils/ripple
'
...
...
@@ -29,7 +29,6 @@ export class FixbarComponent {
showCreateModal
=
false
syncLoading
=
false
isLogin
=
!!
getToken
()
isEditing
=
isEditing
themeList
=
[
{
name
:
'
切换到 Light
'
,
...
...
@@ -76,10 +75,6 @@ export class FixbarComponent {
e
.
preventDefault
()
this
.
viewInfo
()
})
hotkeys
(
KEY_MAP
.
edit
,
(
e
)
=>
{
e
.
preventDefault
()
this
.
isEditing
.
value
=
!
this
.
isEditing
.
value
})
hotkeys
(
KEY_MAP
.
dark
,
(
e
)
=>
{
e
.
preventDefault
()
this
.
toggleMode
()
...
...
@@ -127,10 +122,6 @@ export class FixbarComponent {
},
100
)
}
toggleEditMode
()
{
this
.
isEditing
.
value
=
!
this
.
isEditing
.
value
}
goTop
()
{
if
(
this
.
selector
)
{
const
el
=
document
.
querySelector
(
this
.
selector
)
...
...
src/constants/index.ts
浏览文件 @
361b113b
...
...
@@ -7,14 +7,11 @@ function isMac() {
export
const
DB_PATH
=
'
data/db.json
'
export
const
VERSION
=
'
5.0.
7
'
export
const
VERSION
=
'
5.0.
8
'
// keyboard event
const
prefix
=
isMac
()
?
'
command
'
:
'
ctrl
'
export
const
KEY_MAP
=
{
// 编辑模式
edit
:
`
${
prefix
}
+e`
,
// 查看信息
view
:
`
${
prefix
}
+v`
,
...
...
src/store/index.ts
浏览文件 @
361b113b
...
...
@@ -3,7 +3,3 @@
import
{
websiteList
as
w
}
from
'
../utils
'
export
const
websiteList
=
w
export
const
isEditing
=
{
value
:
false
}
src/view/admin/index.component.html
浏览文件 @
361b113b
<div
class=
"admin"
>
<button
nz-button
style=
"margin-bottom: 15px;"
(click)=
"goBack()"
>
返回主页
</button>
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleSync()"
>
同步到远端
</button>
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleSync()"
[nzLoading]=
"syncLoading"
>
同步到远端
</button>
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleReset()"
>
重置初始数据
</button>
<nz-tabset
*ngIf=
"isLogin"
[nzSelectedIndex]=
"tabActive"
(nzSelectedIndexChange)=
"onTabChange($event)"
>
...
...
src/view/index/light/index.component.html
浏览文件 @
361b113b
...
...
@@ -15,7 +15,7 @@
[class.dark-text-active]=
"page === i"
class=
"ripple-btn dark-text"
>
<app-card
[oIdx]=
"i"
>
<app-card>
{{ item.title }}
</app-card>
</a>
...
...
@@ -31,7 +31,7 @@
(click)=
"handleSidebarNav(i)"
*ngFor=
"let item of websiteList[page].nav; let i = index"
>
<app-card
[oIdx]=
"page"
[twoIdx]=
"i"
>
<app-card>
<div
class=
"ripple-btn"
>
{{ item.title }}
</div>
</app-card>
</li>
...
...
@@ -44,7 +44,7 @@
<div
*ngIf=
"currentList.length > 0; else noData"
>
<div
*ngFor=
"let item of currentList; let i=index"
>
<div
class=
"title-wrapper dark-border-color"
*ngIf=
"item.title"
>
<app-card
[oIdx]=
"page"
[twoIdx]=
"id"
[threeIdx]=
"i"
>
<app-card>
<h2
class=
"block-title"
>
<app-logo
[src]=
"item.icon"
...
...
src/view/index/side/index.component.html
浏览文件 @
361b113b
...
...
@@ -37,7 +37,7 @@
class=
"title dark-primary dark-border-color"
*ngIf=
"item.title"
>
<app-card
[oIdx]=
"page"
[twoIdx]=
"id"
[threeIdx]=
"i"
>
<app-card>
<span
class=
"cursor-pointer"
(click)=
"onCollapse(item, i)"
>
<app-logo
[src]=
"item.icon"
...
...
src/view/index/sim/index.component.html
浏览文件 @
361b113b
...
...
@@ -13,7 +13,7 @@
class=
"ripple-btn dark-text"
(click)=
"handleCilckTopNav(i)"
>
<app-card
[oIdx]=
"i"
>
<app-card>
{{ item.title }}
</app-card>
</a>
...
...
@@ -29,7 +29,7 @@
[class.dark-item-active]=
"id === i"
class=
"ripple-btn dark-text"
>
<app-card
[oIdx]=
"page"
[twoIdx]=
"i"
>
<app-card>
{{ item.title }}
</app-card>
</div>
...
...
@@ -43,7 +43,7 @@
class=
"title dark-primary dark-border-color"
*ngIf=
"item.title"
>
<app-card
[oIdx]=
"page"
[twoIdx]=
"id"
[threeIdx]=
"i"
>
<app-card>
<span
class=
"cursor-pointer"
(click)=
"onCollapse(item, i)"
>
<app-logo
[src]=
"item.icon"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录