Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
开源百科
提交
929aaaba
开
开源百科
项目概览
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,发现更多精彩内容 >>
提交
929aaaba
编写于
10月 06, 2021
作者:
X
xjh22222228
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: locale
上级
1af9ae31
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
59 addition
and
33 deletion
+59
-33
src/app/app.component.ts
src/app/app.component.ts
+9
-1
src/app/app.module.ts
src/app/app.module.ts
+0
-6
src/components/create-web/index.component.html
src/components/create-web/index.component.html
+14
-14
src/components/create-web/index.component.ts
src/components/create-web/index.component.ts
+6
-4
src/locale/english.ts
src/locale/english.ts
+16
-5
src/locale/zh_CN.ts
src/locale/zh_CN.ts
+12
-1
src/view/admin/index.component.scss
src/view/admin/index.component.scss
+2
-2
未找到文件。
src/app/app.component.ts
浏览文件 @
929aaaba
...
...
@@ -4,6 +4,8 @@
import
{
Component
}
from
'
@angular/core
'
import
{
Router
,
ActivatedRoute
}
from
'
@angular/router
'
import
{
queryString
,
setLocation
}
from
'
../utils
'
import
{
en_US
,
NzI18nService
,
zh_CN
}
from
'
ng-zorro-antd/i18n
'
import
{
getLocale
}
from
'
src/locale
'
@
Component
({
selector
:
'
app-xiejiahe
'
,
...
...
@@ -11,11 +13,17 @@ import { queryString, setLocation } from '../utils'
styleUrls
:
[
'
./app.component.scss
'
]
})
export
class
AppComponent
{
constructor
(
private
router
:
Router
,
private
activatedRoute
:
ActivatedRoute
)
{}
constructor
(
private
router
:
Router
,
private
activatedRoute
:
ActivatedRoute
,
private
i18n
:
NzI18nService
)
{}
ngOnInit
()
{
this
.
goRoute
()
this
.
activatedRoute
.
queryParams
.
subscribe
(
setLocation
)
if
(
getLocale
()
===
'
zh-CN
'
)
{
this
.
i18n
.
setLocale
(
zh_CN
);
}
else
{
this
.
i18n
.
setLocale
(
en_US
);
}
}
goRoute
()
{
...
...
src/app/app.module.ts
浏览文件 @
929aaaba
...
...
@@ -54,17 +54,11 @@ import { ToolbarTitleWebComponent } from '../components/toolbar-title/index.comp
import
{
WebListComponent
}
from
'
../components/web-list/index.component
'
;
import
{
NZ_I18N
}
from
'
ng-zorro-antd/i18n
'
;
import
{
zh_CN
}
from
'
ng-zorro-antd/i18n
'
;
import
{
registerLocaleData
}
from
'
@angular/common
'
;
import
zh
from
'
@angular/common/locales/zh
'
;
import
{
HttpClientModule
}
from
'
@angular/common/http
'
;
import
{
BrowserAnimationsModule
}
from
'
@angular/platform-browser/animations
'
;
import
{
LogoComponent
}
from
'
../components/logo/logo.component
'
;
import
{
CardComponent
}
from
'
../components/card/index.component
'
if
(
config
.
language
===
'
zh-CN
'
)
{
registerLocaleData
(
zh
);
}
const
appRoutes
:
Routes
=
[
{
path
:
'
sim
'
,
...
...
src/components/create-web/index.component.html
浏览文件 @
929aaaba
<nz-modal
[nzWidth]=
"560"
[(nzVisible)]=
"visible"
[nzTitle]=
"detail ?
'编辑' : '新增'
"
[nzTitle]=
"detail ?
$t('_edit') : $t('_add')
"
(nzOnCancel)=
"handleCancel()"
(nzOnOk)=
"handleOk()"
[nzOkLoading]=
"uploading"
...
...
@@ -9,15 +9,15 @@
<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=
"请输入名称
"
>
<input
formControlName=
"title"
nz-input
placeholder=
"发现导航
"
/>
<nz-form-label
[nzSpan]=
"4"
nzRequired
>
{{ $t('_webName') }}
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
[nzErrorTip]=
"$t('_requiredName')
"
>
<input
formControlName=
"title"
nz-input
[placeholder]=
"$t('_webTitle')
"
/>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
nzRequired
>
网站链接
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
nzErrorTip=
"请输入网站链接
"
>
<nz-form-label
[nzSpan]=
"4"
nzRequired
>
{{ $t('_webLink') }}
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
[nzErrorTip]=
"$t('_requiredLink')
"
>
<input
formControlName=
"url"
nz-input
placeholder=
"https://nav3.cn"
(blur)=
"onUrlBlur($event)"
/>
</nz-form-control>
</nz-form-item>
...
...
@@ -25,7 +25,7 @@
<div
class=
"row"
>
<div
class=
"col"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"15"
nzRequired
>
快捷方式
</nz-form-label>
<nz-form-label
[nzSpan]=
"15"
nzRequired
>
{{ $t('_shortcut') }}
</nz-form-label>
<nz-form-control
[nzSpan]=
"9"
>
<nz-switch
formControlName=
"top"
></nz-switch>
</nz-form-control>
...
...
@@ -33,7 +33,7 @@
</div>
<div
class=
"col"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"15"
nzRequired
>
仅自己可见
</nz-form-label>
<nz-form-label
[nzSpan]=
"15"
nzRequired
>
{{ $t('_onlyOwnVisible') }}
</nz-form-label>
<nz-form-control
[nzSpan]=
"9"
>
<nz-switch
formControlName=
"ownVisible"
></nz-switch>
</nz-form-control>
...
...
@@ -41,7 +41,7 @@
</div>
<div
class=
"col"
>
<nz-form-item>
<nz-form-label
[nzSpan]=
"8"
>
推荐指数
</nz-form-label>
<nz-form-label
[nzSpan]=
"8"
>
{{ $t('_recommend') }}
</nz-form-label>
<nz-form-control
[nzSpan]=
"24"
>
<nz-rate
formControlName=
"rate"
nzAllowHalf
></nz-rate>
</nz-form-control>
...
...
@@ -50,13 +50,13 @@
</div>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
>
图标地址
</nz-form-label>
<nz-form-label
[nzSpan]=
"4"
>
{{ $t('_iconAddr') }}
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
>
<nz-input-group
[nzPrefix]=
"prefixIcon"
[nzSuffix]=
"suffixIconSearch"
>
<input
formControlName=
"icon"
nz-input
placeholder=
"支持将截图或复制图片粘贴此处上传
"
[placeholder]=
"$t('_copyUpload')
"
(blur)=
"onIconBlur($event)"
(focus)=
"onIconFocus($event)"
/>
...
...
@@ -69,7 +69,7 @@
<i
nz-icon
nzType=
"loading"
nzTheme=
"outline"
*ngIf=
"uploading; else loading"
></i>
<ng-template
#loading
>
<label
id=
"file"
>
<i
nz-icon
nzType=
"upload"
nzTheme=
"outline"
class=
"cursor-pointer"
title=
"上传
"
></i>
<i
nz-icon
nzType=
"upload"
nzTheme=
"outline"
class=
"cursor-pointer"
[title]=
"$t('_upload')
"
></i>
<input
type=
"file"
name=
"file"
...
...
@@ -84,7 +84,7 @@
</nz-form-item>
<nz-form-item>
<nz-form-label
[nzSpan]=
"4"
>
网站描述
</nz-form-label>
<nz-form-label
[nzSpan]=
"4"
>
{{ $t('_webDesc') }}
</nz-form-label>
<nz-form-control
[nzSpan]=
"20"
>
<textarea
formControlName=
"desc"
...
...
@@ -132,7 +132,7 @@
<nz-form-label
[nzSpan]=
"4"
[nzNoColon]=
"true"
></nz-form-label>
<nz-form-control
[nzSpan]=
"20"
>
<button
nz-button
nzType=
"default"
nzBlock
(click)=
"addMoreUrl()"
>
<i
nz-icon
nzType=
"plus"
></i>
继续添加关联链接
<i
nz-icon
nzType=
"plus"
></i>
{{ $t('_continueAdd') }}
</button>
</nz-form-control>
</nz-form-item>
...
...
src/components/create-web/index.component.ts
浏览文件 @
929aaaba
...
...
@@ -9,6 +9,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'
import
{
NzNotificationService
}
from
'
ng-zorro-antd/notification
'
import
*
as
__tag
from
'
../../../data/tag.json
'
import
{
createFile
}
from
'
../../services
'
import
{
$t
}
from
'
src/locale
'
const
tagMap
:
ITagProp
=
(
__tag
as
any
).
default
const
tagKeys
=
Object
.
keys
(
tagMap
)
...
...
@@ -24,6 +25,7 @@ export class CreateWebComponent implements OnInit {
@
Output
()
onCancel
=
new
EventEmitter
()
@
Output
()
onOk
=
new
EventEmitter
()
$t
=
$t
validateForm
!
:
FormGroup
;
iconUrl
=
''
urlArr
=
[]
...
...
@@ -146,11 +148,11 @@ export class CreateWebComponent implements OnInit {
path
}).
then
(()
=>
{
that
.
validateForm
.
get
(
'
icon
'
)
!
.
setValue
(
path
)
that
.
message
.
success
(
'
上传成功
'
)
that
.
message
.
success
(
$t
(
'
_uploadSuccess
'
)
)
}).
catch
(
res
=>
{
that
.
notification
.
error
(
`
错误
:
${
res
?.
response
?.
status
??
401
}
`
,
'
上传失败,请重试!
'
`
${
$t
(
'
_error
'
)}
:
${
res
?.
response
?.
status
??
401
}
`
,
$t
(
'
_uploadFail
'
)
)
}).
finally
(()
=>
{
that
.
uploading
=
false
...
...
@@ -164,7 +166,7 @@ export class CreateWebComponent implements OnInit {
const
file
=
files
[
0
]
if
(
!
file
.
type
.
startsWith
(
'
image
'
))
{
return
this
.
message
.
error
(
'
请不要上传非法图片
'
)
return
this
.
message
.
error
(
$t
(
'
_notUpload
'
)
)
}
this
.
handleUploadImage
(
file
)
}
...
...
src/locale/english.ts
浏览文件 @
929aaaba
...
...
@@ -33,7 +33,7 @@ export default {
_unknow
:
'
Unknow
'
,
_repeatOper
:
'
Please do not operate frequently
'
,
_syncDataOut
:
'
Synchronize data to remote
'
,
_confirmSync
:
'
确定同步
'
,
_confirmSync
:
'
OK to sync
'
,
_confirmSyncTip
:
'
Are you sure to synchronize all data to the remote end?
'
,
_syncSuccessTip
:
'
The synchronization is successful. It takes about 5 minutes to build
'
,
_error
:
'
Error
'
,
...
...
@@ -75,7 +75,7 @@ export default {
_allContentMsg2
:
'
2. Website classification needs to be maintained manually,
'
,
_updateLogo
:
'
Replace logo, only PNG is supported
'
,
_tagName
:
'
Classification name
'
,
_onlyOwnVisible
:
'
Visible only to yours
elf
'
,
_onlyOwnVisible
:
'
Only S
elf
'
,
_createAt
:
'
Create At
'
,
_action
:
'
Action
'
,
_delWarn
:
'
This will delete all data under the category. Are you sure you want to delete it?
'
,
...
...
@@ -83,8 +83,19 @@ export default {
_mgr2
:
'
Management level 2 Classification
'
,
_mgr3
:
'
Management level 3 Classification
'
,
_mgrWeb
:
'
Manage website
'
,
_webName
:
'
Website n
ame
'
,
_webName
:
'
N
ame
'
,
_webTag
:
'
Website classification
'
,
_webDesc
:
'
Website description
'
,
_requiredName
:
'
Please enter a name
'
_webDesc
:
'
Description
'
,
_webLink
:
'
Link
'
,
_requiredName
:
'
Please enter a name
'
,
_requiredLink
:
'
Please enter the website link
'
,
_uploadSuccess
:
'
Uploaded successfully
'
,
_uploadFail
:
'
Upload failed, please try again!
'
,
_notUpload
:
'
Please do not upload illegal pictures
'
,
_shortcut
:
'
Shortcut
'
,
_recommend
:
'
Recommended
'
,
_iconAddr
:
'
Icon Link
'
,
_copyUpload
:
'
Support to paste screenshots or copy pictures here to upload
'
,
_upload
:
'
Upload
'
,
_continueAdd
:
'
Continue to add affiliate links
'
}
src/locale/zh_CN.ts
浏览文件 @
929aaaba
...
...
@@ -86,5 +86,16 @@ export default {
_webName
:
'
网站名称
'
,
_webTag
:
'
网站分类
'
,
_webDesc
:
'
网站描述
'
,
_requiredName
:
'
请输入名称
'
_webLink
:
'
网站链接
'
,
_requiredName
:
'
请输入名称
'
,
_requiredLink
:
'
请输入网站链接
'
,
_uploadSuccess
:
'
上传成功
'
,
_uploadFail
:
'
上传失败,请重试!
'
,
_notUpload
:
'
请不要上传非法图片
'
,
_shortcut
:
'
快捷方式
'
,
_recommend
:
'
推荐指数
'
,
_iconAddr
:
'
图标地址
'
,
_copyUpload
:
'
支持将截图或复制图片粘贴此处上传
'
,
_upload
:
'
上传
'
,
_continueAdd
:
'
继续添加关联链接
'
}
src/view/admin/index.component.scss
浏览文件 @
929aaaba
...
...
@@ -8,7 +8,7 @@
.logo-wrapper
{
position
:
absolute
;
top
:
-45px
;
left
:
4
80px
;
left
:
5
80px
;
width
:
180px
;
text-align
:
center
;
cursor
:
pointer
;
...
...
@@ -26,7 +26,7 @@
.book-wrapper
{
position
:
absolute
;
top
:
-45px
;
left
:
65
0px
;
left
:
83
0px
;
width
:
180px
;
text-align
:
center
;
cursor
:
pointer
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录