Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
兴科Sinco
开源百科
提交
822c0c4e
开
开源百科
项目概览
兴科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,发现更多精彩内容 >>
提交
822c0c4e
编写于
2月 16, 2021
作者:
X
xjh22222228
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(#70): restore delete
上级
b17bc70c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
28 deletion
+39
-28
src/components/card/index.component.html
src/components/card/index.component.html
+2
-2
src/components/card/index.component.ts
src/components/card/index.component.ts
+4
-2
src/utils/index.ts
src/utils/index.ts
+33
-24
未找到文件。
src/components/card/index.component.html
浏览文件 @
822c0c4e
...
...
@@ -60,7 +60,7 @@
<nz-dropdown-menu
#menu
="
nzDropdownMenu
"
>
<ul
nz-menu
nzSelectable
>
<li
nz-menu-item
(click)=
"toggleModal(); detail = dataSource"
>
编辑
</li>
<
!-- <
a
<a
nz-popconfirm
nzPopconfirmPlacement=
"rightTop"
nzOkType=
"danger"
...
...
@@ -69,7 +69,7 @@
(nzOnConfirm)=
"confirmDel($event)"
>
<li
nz-menu-item
nzDanger
>
删除
</li>
</a>
-->
</a>
</ul>
</nz-dropdown-menu>
</ng-template>
...
...
src/components/card/index.component.ts
浏览文件 @
822c0c4e
...
...
@@ -4,7 +4,7 @@
import
{
Component
,
OnInit
,
Input
}
from
'
@angular/core
'
import
{
NzMessageService
}
from
'
ng-zorro-antd/message
'
import
{
getToken
}
from
'
../../utils/user
'
import
{
setWebsiteList
,
copyText
}
from
'
../../utils
'
import
{
setWebsiteList
,
copyText
,
deleteByWeb
}
from
'
../../utils
'
import
{
websiteList
}
from
'
../../store
'
import
{
INavProps
,
ITagProp
,
INavFourProp
}
from
'
../../types
'
import
*
as
__tag
from
'
../../../data/tag.json
'
...
...
@@ -68,5 +68,7 @@ export class CardComponent implements OnInit {
this
.
toggleModal
()
}
confirmDel
()
{}
confirmDel
()
{
deleteByWeb
(
this
.
dataSource
)
}
}
src/utils/index.ts
浏览文件 @
822c0c4e
...
...
@@ -4,7 +4,7 @@
import
qs
from
'
qs
'
import
config
from
'
../../nav.config
'
import
Clipboard
from
'
clipboard
'
import
{
INavProps
,
ISearchEngineProps
}
from
'
../types
'
import
{
INav
FourProp
,
INav
Props
,
ISearchEngineProps
}
from
'
../types
'
import
*
as
db
from
'
../../data/db.json
'
export
const
websiteList
=
getWebsiteList
()
...
...
@@ -13,29 +13,6 @@ let total = 0
const
{
lightThemeConfig
,
searchEngineList
}
=
config
const
{
backgroundLinear
}
=
lightThemeConfig
export
function
debounce
(
func
,
wait
,
immediate
)
{
let
timeout
return
function
()
{
let
context
=
this
let
args
=
arguments
if
(
timeout
)
clearTimeout
(
timeout
)
if
(
immediate
)
{
let
callNow
=
!
timeout
timeout
=
setTimeout
(()
=>
{
timeout
=
null
},
wait
)
if
(
callNow
)
func
.
apply
(
context
,
args
)
}
else
{
timeout
=
setTimeout
(()
=>
{
func
.
apply
(
context
,
args
)
},
wait
)
}
}
}
export
function
randomInt
(
max
:
number
)
{
return
Math
.
floor
(
Math
.
random
()
*
max
)
}
...
...
@@ -379,3 +356,35 @@ export async function isValidImg(url: string): Promise<boolean> {
document
.
body
.
append
(
img
)
})
}
export
function
deleteByWeb
(
data
:
INavFourProp
)
{
function
f
(
arr
:
any
[])
{
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
const
item
=
arr
[
i
]
if
(
Array
.
isArray
(
item
.
nav
))
{
f
(
item
.
nav
)
continue
}
if
(
item
.
name
)
{
const
keys
=
Object
.
keys
(
item
)
let
eq
=
false
for
(
let
key
of
keys
)
{
eq
=
item
[
key
]
===
data
[
key
]
}
if
(
eq
)
{
arr
.
splice
(
i
,
1
)
const
{
q
}
=
queryString
()
if
(
q
)
{
window
.
location
.
reload
()
}
}
}
}
}
f
(
websiteList
)
setWebsiteList
(
websiteList
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录