Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夜猫逐梦
1024程序员开源挑战赛
提交
91646f69
1
1024程序员开源挑战赛
项目概览
夜猫逐梦
/
1024程序员开源挑战赛
与 Fork 源项目一致
Fork自
GitCode / 1024程序员开源挑战赛(10.23-11.14)
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1
1024程序员开源挑战赛
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
91646f69
编写于
11月 13, 2021
作者:
B
baiy
提交者:
ninecents
10月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ASCII i18n
上级
260008d9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
202 addition
and
63 deletion
+202
-63
src/i18n/build.js
src/i18n/build.js
+3
-2
src/i18n/index.js
src/i18n/index.js
+3
-2
src/i18n/locales/en/ascii.i18n.json5
src/i18n/locales/en/ascii.i18n.json5
+84
-0
src/i18n/locales/zh_CN/ascii.i18n.json5
src/i18n/locales/zh_CN/ascii.i18n.json5
+51
-0
src/views/tool/ascii.vue
src/views/tool/ascii.vue
+26
-24
src/views/tool/library/ascii.js
src/views/tool/library/ascii.js
+35
-35
未找到文件。
src/i18n/build.js
浏览文件 @
91646f69
...
@@ -129,8 +129,9 @@ module.exports = {
...
@@ -129,8 +129,9 @@ module.exports = {
if
(
matchString
)
{
if
(
matchString
)
{
matchString
.
forEach
((
wildcard
)
=>
{
matchString
.
forEach
((
wildcard
)
=>
{
if
((
wildcard
in
values
)
&&
!
(
wildcard
in
replaceHash
))
{
let
key
=
wildcard
.
replace
(
"
{
"
,
""
).
replace
(
"
}
"
,
''
)
replaceHash
[
wildcard
]
=
values
[
wildcard
]
if
((
key
in
values
)
&&
!
(
wildcard
in
replaceHash
))
{
replaceHash
[
wildcard
]
=
values
[
key
]
}
}
});
});
}
}
...
...
src/i18n/index.js
浏览文件 @
91646f69
...
@@ -58,8 +58,9 @@ const translate = (code, key, values = {}) => {
...
@@ -58,8 +58,9 @@ const translate = (code, key, values = {}) => {
if
(
matchString
)
{
if
(
matchString
)
{
matchString
.
forEach
((
wildcard
)
=>
{
matchString
.
forEach
((
wildcard
)
=>
{
if
((
wildcard
in
values
)
&&
!
(
wildcard
in
replaceHash
))
{
let
key
=
wildcard
.
replace
(
"
{
"
,
""
).
replace
(
"
}
"
,
''
)
replaceHash
[
wildcard
]
=
values
[
wildcard
]
if
((
key
in
values
)
&&
!
(
wildcard
in
replaceHash
))
{
replaceHash
[
wildcard
]
=
values
[
key
]
}
}
});
});
}
}
...
...
src/i18n/locales/en/ascii.i18n.json5
0 → 100644
浏览文件 @
91646f69
{
"convent": "Convent",
"input_prompt": "Multiple characters are separated by space",
"input_10": "DEC",
"input_16": "HEX",
"input_8": "OCT",
"input_2": "BIN",
"input_string": "String",
"clear": "Clear",
"code_table": "ASCII table",
"yes": "Y",
"no": "N",
"input_null_prompt": "Please enter the corresponding code",
"convent_error": "Conversion exception: {0}",
"is_show": "Is Show",
"description": "Description",
"code_nul": "Null char",
"code_soh": "Start of Heading",
"code_stx": "Start of Text",
"code_etx": "End of Text",
"code_eot": "End of Transmission",
"code_enq": "Enquiry",
"code_ack": "Acknowledgment",
"code_bel": "Bell",
"code_bs": "Back Space",
"code_tab": "Horizontal Tab",
"code_lf": "Line Feed",
"code_vt": "Vertical Tab",
"code_ff": "Form Feed",
"code_cr": "Carriage Return",
"code_so": "Shift Out / X-On",
"code_si": "Shift In / X-Off",
"code_dle": "Data Line Escape",
"code_dc1": "Device Control 1 (oft. XON)",
"code_dc2": "Device Control 2",
"code_dc3": "Device Control 3 (oft. XOFF)",
"code_dc4": "Device Control 4",
"code_nak": "Negative Acknowledgement",
"code_syn": "Synchronous Idle",
"code_etb": "End of Transmit Block",
"code_can": "Cancel",
"code_em": "End of Medium",
"code_sub": "Substitute",
"code_esc": "Escape",
"code_fs": "File Separator",
"code_gs": "Group Separator",
"code_rs": "Record Separator",
"code_us": "Unit Separator",
"code_del": "Delete",
"code_space": "Space",
}
src/i18n/locales/zh_CN/ascii.i18n.json5
0 → 100644
浏览文件 @
91646f69
{
"convent": "转换",
"input_prompt": "多个字符用空格分隔",
"input_10": "十进制",
"input_16": "十六进制",
"input_8": "八进制",
"input_2": "二进制",
"input_string": "字符串",
"clear": "清空",
"code_table": "编码表",
"yes": "是",
"no": "否",
"input_null_prompt": "请输入对应的待转换编码",
"convent_error": "转换异常: {0}",
"is_show": "是否显示",
"description": "描述",
"code_nul": "空字符(Null)",
"code_soh": "标题开始",
"code_stx": "本文开始",
"code_etx": "本文结束",
"code_eot": "传输结束",
"code_enq": "请求",
"code_ack": "确认回应",
"code_bel": "响铃",
"code_bs": "退格",
"code_tab": "水平定位符号",
"code_lf": "换行键",
"code_vt": "垂直定位符号",
"code_ff": "换页键",
"code_cr": "归位键",
"code_so": "取消变换(Shift out)",
"code_si": "启用变换(Shift in)",
"code_dle": "跳出数据通讯",
"code_dc1": "设备控制一(XON 启用软件速度控制)",
"code_dc2": "设备控制二",
"code_dc3": "设备控制三(XOFF 停用软件速度控制)",
"code_dc4": "设备控制四",
"code_nak": "确认失败回应",
"code_syn": "同步用暂停",
"code_etb": "区块传输结束",
"code_can": "取消",
"code_em": "连接介质中断",
"code_sub": "替换",
"code_esc": "跳出",
"code_fs": "文件分割符",
"code_gs": "组群分隔符",
"code_rs": "记录分隔符",
"code_us": "单元分隔符",
"code_del": "删除",
"code_space": "空格"
}
src/views/tool/ascii.vue
浏览文件 @
91646f69
<
template
>
<
template
>
<div>
<div>
<Tabs
v-model=
"operation"
>
<Tabs
v-model=
"operation"
>
<TabPane
label=
"转换
"
name=
"convent"
>
<TabPane
:label=
"$t('ascii_convent')
"
name=
"convent"
>
<option-block>
<option-block>
<Input
v-model=
"current.data.dec"
placeholder=
"多个字符用空格分隔
"
>
<Input
v-model=
"current.data.dec"
:placeholder=
"$t('ascii_input_prompt')
"
>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
十进制
</strong></div>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
{{
$t
(
'
ascii_input_10
'
)
}}
</strong></div>
</Input>
</Input>
</option-block>
</option-block>
<option-block>
<option-block>
<Input
v-model=
"current.data.hex"
placeholder=
"多个字符用空格分隔
"
>
<Input
v-model=
"current.data.hex"
:placeholder=
"$t('ascii_input_prompt')
"
>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
十六进制
</strong></div>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
{{
$t
(
'
ascii_input_16
'
)
}}
</strong></div>
</Input>
</Input>
</option-block>
</option-block>
<option-block>
<option-block>
<Input
v-model=
"current.data.oct"
placeholder=
"多个字符用空格分隔
"
>
<Input
v-model=
"current.data.oct"
:placeholder=
"$t('ascii_input_prompt')
"
>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
八进制
</strong></div>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
{{
$t
(
'
ascii_input_8
'
)
}}
</strong></div>
</Input>
</Input>
</option-block>
</option-block>
<option-block>
<option-block>
<Input
v-model=
"current.data.bin"
placeholder=
"多个字符用空格分隔
"
>
<Input
v-model=
"current.data.bin"
:placeholder=
"$t('ascii_input_prompt')
"
>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
二进制
</strong></div>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
{{
$t
(
'
ascii_input_2
'
)
}}
</strong></div>
</Input>
</Input>
</option-block>
</option-block>
<option-block>
<option-block>
<Input
v-model=
"current.data.str"
>
<Input
v-model=
"current.data.str"
>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
字符串
</strong></div>
<div
slot=
"prepend"
style=
"width: 100px"
><strong>
{{
$t
(
'
ascii_input_string
'
)
}}
</strong></div>
</Input>
</Input>
</option-block>
</option-block>
<option-block
:style=
"
{textAlign:'center'}">
<option-block
:style=
"
{textAlign:'center'}">
<FormItem>
<FormItem>
<ButtonGroup>
<ButtonGroup>
<Button
type=
"primary"
@
click=
"handle()"
style=
"margin-right: 5px"
>
转换
</Button>
<Button
type=
"primary"
@
click=
"handle()"
style=
"margin-right: 5px"
>
{{
$t
(
'
ascii_convent
'
)
}}
</Button>
<Button
type=
"primary"
@
click=
"clear()"
>
清空
</Button>
<Button
type=
"primary"
@
click=
"clear()"
>
{{
$t
(
'
ascii_clear
'
)
}}
</Button>
</ButtonGroup>
</ButtonGroup>
</FormItem>
</FormItem>
</option-block>
</option-block>
</TabPane>
</TabPane>
<TabPane
label=
"编码表
"
name=
"reader"
>
<TabPane
:label=
"$t('ascii_code_table')
"
name=
"reader"
>
<Table
:columns=
"referenceColumns"
:data=
"reference"
>
<Table
:columns=
"referenceColumns"
:data=
"reference"
>
</Table>
</Table>
</TabPane>
</TabPane>
...
@@ -59,7 +59,7 @@ export default {
...
@@ -59,7 +59,7 @@ export default {
oct
:
ob
.
oct
(),
oct
:
ob
.
oct
(),
bin
:
ob
.
bin
(),
bin
:
ob
.
bin
(),
str
:
ob
.
str
(),
str
:
ob
.
str
(),
show
:
isShow
?
"
是
"
:
"
否
"
,
show
:
isShow
?
this
.
$t
(
'
ascii_yes
'
):
this
.
$t
(
'
ascii_no
'
)
,
explain
:
isShow
?
ob
.
str
()
:
ascii
.
ascii_hidden
[
ascii
.
ascii_map
[
index
]]
explain
:
isShow
?
ob
.
str
()
:
ascii
.
ascii_hidden
[
ascii
.
ascii_map
[
index
]]
})
})
}
}
...
@@ -82,10 +82,12 @@ export default {
...
@@ -82,10 +82,12 @@ export default {
}
}
}
}
if
(
!
s
){
if
(
!
s
){
throw
"
请输入对应的待转换编码
"
throw
new
Error
(
this
.
$t
(
'
ascii_input_null_prompt
'
).
toString
())
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
return
this
.
$Message
.
error
(
"
转换异常:
"
+
err
);
return
this
.
$Message
.
error
(
this
.
$t
(
'
ascii_convent_error
'
,[
err
.
message
]).
toString
()
);
}
}
for
(
const
type
of
this
.
types
)
{
for
(
const
type
of
this
.
types
)
{
this
.
current
.
data
[
type
]
=
ascii
.
convent
(
s
,
currentType
,
type
)
this
.
current
.
data
[
type
]
=
ascii
.
convent
(
s
,
currentType
,
type
)
...
@@ -113,40 +115,40 @@ export default {
...
@@ -113,40 +115,40 @@ export default {
operation
:
"
convent
"
,
operation
:
"
convent
"
,
referenceColumns
:
[
referenceColumns
:
[
{
{
title
:
'
十进制
'
,
title
:
this
.
$t
(
'
ascii_input_10
'
)
,
key
:
'
dec
'
,
key
:
'
dec
'
,
width
:
100
width
:
100
},
},
{
{
title
:
'
十六进制
'
,
title
:
this
.
$t
(
'
ascii_input_16
'
)
,
key
:
'
hex
'
,
key
:
'
hex
'
,
width
:
100
width
:
100
},
},
{
{
title
:
'
八进制
'
,
title
:
this
.
$t
(
'
ascii_input_8
'
)
,
key
:
'
oct
'
,
key
:
'
oct
'
,
width
:
100
width
:
100
},
},
{
{
title
:
'
二进制
'
,
title
:
this
.
$t
(
'
ascii_input_2
'
)
,
key
:
'
bin
'
,
key
:
'
bin
'
,
},
},
{
{
title
:
'
字符
'
,
title
:
this
.
$t
(
'
ascii_input_string
'
)
,
key
:
'
str
'
,
key
:
'
str
'
,
width
:
100
width
:
100
},
},
{
{
title
:
'
是否可见
'
,
title
:
this
.
$t
(
'
ascii_is_show
'
)
,
key
:
'
show
'
,
key
:
'
show
'
,
width
:
100
width
:
100
},
},
{
{
title
:
'
字符说明
'
,
title
:
this
.
$t
(
'
ascii_description
'
)
,
key
:
'
explain
'
,
key
:
'
explain
'
,
}
}
],
],
}
}
}
}
}
}
</
script
>
</
script
>
\ No newline at end of file
src/views/tool/library/ascii.js
浏览文件 @
91646f69
...
@@ -10,39 +10,39 @@ const ASCII_MAP = ['NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', 'BS',
...
@@ -10,39 +10,39 @@ const ASCII_MAP = ['NUL', 'SOH', 'STX', 'ETX', 'EOT', 'ENQ', 'ACK', 'BEL', 'BS',
'
q
'
,
'
r
'
,
'
s
'
,
'
t
'
,
'
u
'
,
'
v
'
,
'
w
'
,
'
x
'
,
'
y
'
,
'
z
'
,
'
{
'
,
'
|
'
,
'
}
'
,
'
~
'
,
'
DEL
'
]
'
q
'
,
'
r
'
,
'
s
'
,
'
t
'
,
'
u
'
,
'
v
'
,
'
w
'
,
'
x
'
,
'
y
'
,
'
z
'
,
'
{
'
,
'
|
'
,
'
}
'
,
'
~
'
,
'
DEL
'
]
// ASCII 不可显示字符
// ASCII 不可显示字符
const
ASCII_HIDDEN
=
{
const
ASCII_HIDDEN
=
{
'
NUL
'
:
"
空字符(Null)
"
,
'
NUL
'
:
__
(
'
ascii_code_nul
'
)
,
'
SOH
'
:
"
标题开始
"
,
'
SOH
'
:
__
(
'
ascii_code_soh
'
)
,
'
STX
'
:
"
本文开始
"
,
'
STX
'
:
__
(
'
ascii_code_stx
'
)
,
'
ETX
'
:
"
本文结束
"
,
'
ETX
'
:
__
(
'
ascii_code_etx
'
)
,
'
EOT
'
:
"
传输结束
"
,
'
EOT
'
:
__
(
'
ascii_code_eot
'
)
,
'
ENQ
'
:
"
请求
"
,
'
ENQ
'
:
__
(
'
ascii_code_enq
'
)
,
'
ACK
'
:
"
确认回应
"
,
'
ACK
'
:
__
(
'
ascii_code_ack
'
)
,
'
BEL
'
:
"
响铃
"
,
'
BEL
'
:
__
(
'
ascii_code_bel
'
)
,
'
BS
'
:
"
退格
"
,
'
BS
'
:
__
(
'
ascii_code_bs
'
)
,
'
TAB
'
:
"
水平定位符号
"
,
'
TAB
'
:
__
(
'
ascii_code_tab
'
)
,
'
LF
'
:
"
换行键
"
,
'
LF
'
:
__
(
'
ascii_code_lf
'
)
,
'
VT
'
:
"
垂直定位符号
"
,
'
VT
'
:
__
(
'
ascii_code_vt
'
)
,
'
FF
'
:
"
换页键
"
,
'
FF
'
:
__
(
'
ascii_code_ff
'
)
,
'
CR
'
:
"
归位键
"
,
'
CR
'
:
__
(
'
ascii_code_cr
'
)
,
'
SO
'
:
"
取消变换(Shift out)
"
,
'
SO
'
:
__
(
'
ascii_code_so
'
)
,
'
SI
'
:
"
启用变换(Shift in)
"
,
'
SI
'
:
__
(
'
ascii_code_si
'
)
,
'
DLE
'
:
"
跳出数据通讯
"
,
'
DLE
'
:
__
(
'
ascii_code_dle
'
)
,
'
DC1
'
:
"
设备控制一(XON 启用软件速度控制)
"
,
'
DC1
'
:
__
(
'
ascii_code_dc1
'
)
,
'
DC2
'
:
"
设备控制二
"
,
'
DC2
'
:
__
(
'
ascii_code_dc2
'
)
,
'
DC3
'
:
"
设备控制三(XOFF 停用软件速度控制)
"
,
'
DC3
'
:
__
(
'
ascii_code_dc3
'
)
,
'
DC4
'
:
"
设备控制四
"
,
'
DC4
'
:
__
(
'
ascii_code_dc4
'
)
,
'
NAK
'
:
"
确认失败回应
"
,
'
NAK
'
:
__
(
'
ascii_code_nak
'
)
,
'
SYN
'
:
"
同步用暂停
"
,
'
SYN
'
:
__
(
'
ascii_code_syn
'
)
,
'
ETB
'
:
"
区块传输结束
"
,
'
ETB
'
:
__
(
'
ascii_code_etb
'
)
,
'
CAN
'
:
"
取消
"
,
'
CAN
'
:
__
(
'
ascii_code_can
'
)
,
'
EM
'
:
"
连接介质中断
"
,
'
EM
'
:
__
(
'
ascii_code_em
'
)
,
'
SUB
'
:
"
替换
"
,
'
SUB
'
:
__
(
'
ascii_code_sub
'
)
,
'
ESC
'
:
"
跳出
"
,
'
ESC
'
:
__
(
'
ascii_code_esc
'
)
,
'
FS
'
:
"
文件分割符
"
,
'
FS
'
:
__
(
'
ascii_code_fs
'
)
,
'
GS
'
:
"
组群分隔符
"
,
'
GS
'
:
__
(
'
ascii_code_gs
'
)
,
'
RS
'
:
"
记录分隔符
"
,
'
RS
'
:
__
(
'
ascii_code_rs
'
)
,
'
US
'
:
"
单元分隔符
"
,
'
US
'
:
__
(
'
ascii_code_us
'
)
,
'
DEL
'
:
"
删除
"
,
'
DEL
'
:
__
(
'
ascii_code_del
'
)
,
}
}
const
radix
=
new
Radix
();
const
radix
=
new
Radix
();
...
@@ -50,7 +50,7 @@ class Ascii {
...
@@ -50,7 +50,7 @@ class Ascii {
constructor
(
c
,
type
=
"
str
"
)
{
constructor
(
c
,
type
=
"
str
"
)
{
let
dec
=
-
1
;
let
dec
=
-
1
;
c
=
c
+
""
;
c
=
c
+
""
;
if
(
type
!==
"
str
"
){
if
(
type
!==
"
str
"
)
{
c
=
c
.
toLowerCase
();
c
=
c
.
toLowerCase
();
}
}
switch
(
type
)
{
switch
(
type
)
{
...
@@ -95,7 +95,7 @@ class Ascii {
...
@@ -95,7 +95,7 @@ class Ascii {
}
}
str
()
{
str
()
{
return
ASCII_MAP
[
this
.
decData
]
return
ASCII_MAP
[
this
.
decData
]
===
"
"
?
__
(
'
ascii_code_space
'
)
:
ASCII_MAP
[
this
.
decData
]
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录