Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
茶陵後
Git2
提交
b5484b08
G
Git2
项目概览
茶陵後
/
Git2
与 Fork 源项目一致
Fork自
gitcode_dev / 开源百科
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Git2
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b5484b08
编写于
2月 04, 2021
作者:
X
xjh22222228
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 支持后台更换LOGO
上级
f50787db
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
102 addition
and
16 deletion
+102
-16
README.md
README.md
+7
-8
nav.config.ts
nav.config.ts
+1
-2
src/components/fixbar/index.component.ts
src/components/fixbar/index.component.ts
+4
-0
src/constants/index.ts
src/constants/index.ts
+3
-1
src/services/index.ts
src/services/index.ts
+3
-2
src/types/index.d.ts
src/types/index.d.ts
+1
-0
src/view/admin/index.component.html
src/view/admin/index.component.html
+17
-2
src/view/admin/index.component.scss
src/view/admin/index.component.scss
+26
-0
src/view/admin/index.component.ts
src/view/admin/index.component.ts
+40
-1
未找到文件。
README.md
浏览文件 @
b5484b08
...
...
@@ -28,6 +28,7 @@
-
[
Sim 在线预览
](
https://nav3.cn/#/sim
)
-
[
Light 在线预览
](
https://nav3.cn/#/light
)
-
[
Side 在线预览
](
https://nav3.cn/#/side
)
-
[
App 在线预览
](
https://nav3.cn/#/app
)
![
Preview
](
https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/1.png
)
![
Preview
](
https://raw.githubusercontent.com/xjh22222228/public/gh-pages/nav/2.png
)
...
...
@@ -38,13 +39,14 @@
##
拥有出色的
特性
## 特性
`发现导航`
的理念就是做一款无需依赖后端服务既简单又方便,没有繁杂的配置和数据库等配置概念, 做到开箱即用。
-
🍰 内置
`800+`
实用网站。
-
🍰 支持
SEO, 没有可不行
。
-
🍰 支持
SEO
。
-
🍰 完全纯静态, 提供自动化部署功能。
-
🍰 三叉树分类、结构清晰、分类清晰。
-
🍰 支持一个网站多个分类。
-
🍰 颜值与简约并存,不再是杀马特时代。
-
🍰 支持多种浏览模式,创新。
-
🍰 支持足迹记忆。
...
...
@@ -55,7 +57,7 @@
-
🍰 多款主题切换。
-
🍰 支持暗黑模式。
-
🍰 支持快捷键操作,一步到位。
-
🍰 支持
在线新增数据, 没有传统的后台概念
。
-
🍰 支持
后台管理, 无需部署
。
...
...
@@ -91,14 +93,11 @@ server {
```
## 配置
所有可配置位于文件
`nav.config.ts`
。
## 关于升级
在升级之前请保存根目录下的
`data`
文件夹,最好把
`nav.config.ts`
配置文件也保存一份以防万一, 升级完后替换即可。
## 升级
在升级之前请备份根目录下的
`data`
文件夹和
`nav.config.ts`
, 升级完后替换即可。
点击右上角
`Watch`
按钮第一时间跟踪版本升级。
...
...
nav.config.ts
浏览文件 @
b5484b08
import
{
IConfig
}
from
'
./src/types
'
// 网站 LOGO 替换根目录下的 logo.png, 务必为 png 后缀
const
c
:
IConfig
=
{
// [必填], 请填写您的仓库地址
gitRepoUrl
:
'
https://github.com/xjh22222228/nav
'
,
...
...
@@ -20,7 +19,7 @@ const c: IConfig = {
// 网站关键字
keywords
:
'
导航,前端资源,社区站点,设计师,实用工具,学习资源,运营,网络安全,node.js
'
,
// 默认主题: Light | Sim | Side
// 默认主题: Light | Sim | Side
| App
theme
:
'
Light
'
,
// 搜索引擎列表, 为空时不显示搜索引擎
...
...
src/components/fixbar/index.component.ts
浏览文件 @
b5484b08
...
...
@@ -41,6 +41,10 @@ export class FixbarComponent {
{
name
:
'
切换到 Side
'
,
url
:
'
/side
'
},
{
name
:
'
切换到 App
'
,
url
:
'
/app
'
}
]
...
...
src/constants/index.ts
浏览文件 @
b5484b08
...
...
@@ -9,7 +9,9 @@ export const DB_PATH = 'data/db.json'
export
const
TAG_PATH
=
'
data/tag.json
'
export
const
VERSION
=
'
5.1.0
'
export
const
LOGO_PATH
=
'
logo.png
'
export
const
VERSION
=
'
5.1.1
'
// keyboard event
const
prefix
=
isMac
()
?
'
command
'
:
'
ctrl
'
...
...
src/services/index.ts
浏览文件 @
b5484b08
...
...
@@ -43,9 +43,10 @@ type Iupdate = {
message
:
string
content
:
string
path
:
string
isEncode
?:
boolean
}
export
async
function
updateFileContent
(
{
message
,
content
,
path
}:
Iupdate
,
{
message
,
content
,
path
,
isEncode
=
true
}:
Iupdate
,
authToken
?:
string
)
{
const
_token
=
`
${
authToken
?
authToken
:
token
}
`
.
trim
()
...
...
@@ -53,7 +54,7 @@ export async function updateFileContent(
return
http
.
put
(
`/repos/
${
authorName
}
/
${
branchName
}
/contents/
${
path
}
`
,
{
message
:
`rebot(CI):
${
message
}
`
,
content
:
encode
(
content
)
,
content
:
isEncode
?
encode
(
content
)
:
content
,
sha
:
fileInfo
.
data
.
sha
},
{
headers
:
{
...
...
src/types/index.d.ts
浏览文件 @
b5484b08
...
...
@@ -5,6 +5,7 @@ export type ThemeType =
|
'
Light
'
|
'
Sim
'
|
'
Side
'
|
'
App
'
export
interface
ITagProp
{
[
tagName
:
string
]:
{
...
...
src/view/admin/index.component.html
浏览文件 @
b5484b08
...
...
@@ -3,9 +3,24 @@
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleSync()"
[nzLoading]=
"syncLoading"
>
同步到远端
</button>
<button
nz-button
style=
"margin-left: 15px;"
(click)=
"handleReset()"
>
重置初始数据
</button>
<div>
<div
class=
"content"
>
<p><b>
1、所有数据设置完毕后点击 “同步到远端”,拖拽表格进行排序
</b></p>
<p><b>
2、网站分类需手动维护, 编辑
<a
[href]=
"gitRepoUrl + '/edit/main/data/tag.json'"
target=
"_blank"
>
tag.json
</a></b></p>
<p><b>
2、网站分类需手动维护,
<a
[href]=
"gitRepoUrl + '/edit/main/data/tag.json'"
target=
"_blank"
>
点击编辑
</a></b></p>
<div
class=
"logo-wrapper"
>
<label
id=
"file"
>
<img
src=
"assets/logo.png"
alt=
""
class=
"logo"
>
<p
style=
"white-space: nowrap; margin-top: 5px;"
>
{{ uploading ? '上传中...' : '更换LOGO, 仅支持 PNG' }}
</p>
<input
type=
"file"
name=
"file"
(change)=
"onFileChange($event)"
accept=
"image/png"
>
</label>
</div>
</div>
<nz-tabset
*ngIf=
"isLogin"
[nzSelectedIndex]=
"tabActive"
(nzSelectedIndexChange)=
"onTabChange($event)"
>
...
...
src/view/admin/index.component.scss
浏览文件 @
b5484b08
.admin
{
padding
:
50px
;
}
.content
{
position
:
relative
;
.logo-wrapper
{
position
:
absolute
;
top
:
-45px
;
left
:
480px
;
width
:
180px
;
text-align
:
center
;
cursor
:
pointer
;
text-align
:
center
;
}
.logo
{
width
:
100px
;
height
:
100px
;
border
:
1px
solid
#f2f2f2
;
border-radius
:
50%
;
cursor
:
pointer
;
}
input
[
type
=
"file"
]
{
display
:
none
;
}
}
\ No newline at end of file
src/view/admin/index.component.ts
浏览文件 @
b5484b08
...
...
@@ -12,7 +12,7 @@ import { NzNotificationService } from 'ng-zorro-antd/notification'
import
{
FormBuilder
,
FormGroup
,
Validators
}
from
'
@angular/forms
'
import
{
setWebsiteList
,
getLogoUrl
}
from
'
../../utils
'
import
{
updateFileContent
}
from
'
../../services
'
import
{
DB_PATH
}
from
'
../../constants
'
import
{
DB_PATH
,
LOGO_PATH
}
from
'
../../constants
'
import
*
as
__tag
from
'
../../../data/tag.json
'
import
config
from
'
../../../nav.config
'
...
...
@@ -31,6 +31,7 @@ export default class WebpComponent {
isLogin
=
!!
getToken
()
showCreateModal
=
false
syncLoading
=
false
uploading
=
false
tabActive
=
0
editIdx
=
0
isEdit
=
false
...
...
@@ -69,6 +70,44 @@ export default class WebpComponent {
});
}
onFileChange
(
e
)
{
const
that
=
this
const
{
files
}
=
e
.
target
if
(
files
.
length
<=
0
)
return
;
const
file
=
files
[
0
]
if
(
file
.
type
!==
'
image/png
'
)
{
return
this
.
message
.
error
(
'
仅支持 PNG 格式
'
)
}
const
fileReader
=
new
FileReader
()
fileReader
.
readAsDataURL
(
file
)
fileReader
.
onload
=
function
()
{
that
.
uploading
=
true
const
url
=
(
this
.
result
as
string
).
split
(
'
,
'
)[
1
]
const
logoEL
=
document
.
querySelector
(
'
.logo
'
)
as
HTMLImageElement
const
tempSrc
=
logoEL
.
src
logoEL
.
src
=
this
.
result
as
string
updateFileContent
({
message
:
'
update logo
'
,
content
:
url
,
isEncode
:
false
,
path
:
LOGO_PATH
}).
then
(()
=>
{
that
.
message
.
success
(
'
更换成功,需要等待5分钟同步时间
'
)
}).
catch
(
res
=>
{
logoEL
.
src
=
tempSrc
that
.
notification
.
error
(
`错误:
${
res
?.
response
?.
status
??
401
}
`
,
'
更换LOGO失败,请重试!
'
)
}).
finally
(()
=>
{
that
.
uploading
=
false
})
}
}
addMoreUrl
()
{
this
.
urlArr
.
push
(
null
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录