Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夜猫逐梦
1024程序员开源挑战赛
提交
a851e776
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看板
提交
a851e776
编写于
11月 13, 2021
作者:
B
baiy
提交者:
ninecents
10月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hash 优化
上级
36a955e1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
106 addition
and
48 deletion
+106
-48
src/components/inputBlock.vue
src/components/inputBlock.vue
+34
-0
src/tool.js
src/tool.js
+2
-0
src/tool/clipboard.js
src/tool/clipboard.js
+2
-4
src/views/tool/hash.vue
src/views/tool/hash.vue
+68
-44
未找到文件。
src/components/inputBlock.vue
0 → 100644
浏览文件 @
a851e776
<
template
>
<div
style=
"position: relative;"
>
<slot></slot>
<div
class=
"right-bottom"
>
<slot
name=
"extra"
>
<Button
v-if=
"text"
type=
"primary"
size=
"small"
@
click=
"buttonClick"
>
{{
text
}}
</Button>
</slot>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'
inputBlock
'
,
props
:
{
text
:
{
type
:
String
,
default
:
""
}
},
methods
:
{
buttonClick
()
{
this
.
$emit
(
'
on-default-right-bottom-click
'
);
}
}
};
</
script
>
<
style
scoped
>
.right-bottom
{
position
:
absolute
;
bottom
:
4px
;
right
:
4px
;
}
</
style
>
src/tool.js
浏览文件 @
a851e776
...
...
@@ -3,6 +3,7 @@ import ViewUI from 'view-design'
import
'
./statics/theme.less
'
import
router
from
'
./tool.router
'
import
optionBlock
from
'
./components/optionBlock
'
import
inputBlock
from
'
./components/inputBlock
'
import
{
plugin
as
modelPlugin
}
from
'
./tool/model
'
import
cache
from
'
./tool/cache
'
import
setting
from
'
./tool/setting
'
...
...
@@ -21,6 +22,7 @@ const run = () => {
Vue
.
use
(
ViewUI
)
Vue
.
use
(
modelPlugin
)
Vue
.
component
(
'
option-block
'
,
optionBlock
);
Vue
.
component
(
'
input-block
'
,
inputBlock
);
new
Vue
({
i18n
,
...
...
src/tool/clipboard.js
浏览文件 @
a851e776
...
...
@@ -12,12 +12,10 @@ export const copy = (data,successCallback)=>{
}
export
const
paste
=
()
=>
{
document
.
querySelector
(
'
#clipboard
'
).
innerHTML
=
'
<textarea id="clipboard-text"></textarea>
'
document
.
querySelector
(
'
#clipboard
'
).
innerHTML
=
'
<textarea id="clipboard-text"></textarea>
'
document
.
querySelector
(
'
#clipboard-text
'
).
select
()
document
.
execCommand
(
'
paste
'
)
let
r
=
document
.
querySelector
(
'
#clipboard-text
'
).
value
||
document
.
querySelector
(
'
#clipboard-text
'
).
innerHTML
let
r
=
document
.
querySelector
(
'
#clipboard-text
'
).
value
||
document
.
querySelector
(
'
#clipboard-text
'
).
innerHTML
document
.
querySelector
(
'
#clipboard
'
).
innerHTML
=
''
return
r
?
r
:
''
}
...
...
src/views/tool/hash.vue
浏览文件 @
a851e776
<
template
>
<div>
<Input
v-model=
"current.input"
:rows=
"7"
type=
"textarea"
placeholder=
"内容"
></Input>
<option-block>
<FormItem>
<ButtonGroup>
<Button
type=
"primary"
@
click=
"handle(v)"
v-for=
"v in type"
:key=
"v"
>
{{
v
}}
</Button>
</ButtonGroup>
</FormItem>
<FormItem>
<Checkbox
v-model=
"current.isUppercase"
>
大写字母
</Checkbox>
</FormItem>
</option-block>
<Input
v-model=
"current.output"
:rows=
"7"
type=
"textarea"
placeholder=
"结果"
></Input>
<div
id=
"tool-hash"
>
<Row
:gutter=
"10"
>
<Col
span=
"8"
>
<input-block
text=
"内容"
>
<Input
v-model=
"current.input"
:rows=
"18"
type=
"textarea"
placeholder=
"内容"
></Input>
<Checkbox
slot=
"extra"
v-model=
"current.isUppercase"
>
大写字母
</Checkbox>
</input-block>
</Col>
<Col
span=
"16"
>
<input-block
style=
"margin-bottom: 6px"
:text=
"type"
v-for=
"type in types"
:key=
"type"
@
on-default-right-bottom-click=
"()=>copy(type)"
>
<Input
:value=
"result(type)"
:placeholder=
"type"
:rows=
"3"
type=
"textarea"
></Input>
</input-block>
</Col>
</Row>
</div>
</
template
>
<
script
>
import
crypto
from
"
crypto-js
"
const
sm
=
require
(
'
sm-crypto
'
);
export
default
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
))
},
methods
:
{
handle
(
v
)
{
if
(
this
.
current
.
input
)
{
switch
(
v
)
{
case
"
md5
"
:
this
.
current
.
output
=
crypto
.
MD5
(
this
.
current
.
input
).
toString
();
break
;
case
"
sha1
"
:
this
.
current
.
output
=
crypto
.
SHA1
(
this
.
current
.
input
).
toString
();
break
;
case
"
sha256
"
:
this
.
current
.
output
=
crypto
.
SHA256
(
this
.
current
.
input
).
toString
();
break
;
case
"
sha512
"
:
this
.
current
.
output
=
crypto
.
SHA512
(
this
.
current
.
input
).
toString
();
break
;
case
"
sm3
"
:
this
.
current
.
output
=
require
(
'
sm-crypto
'
).
sm3
(
this
.
current
.
input
);
break
;
default
:
return
;
}
if
(
this
.
current
.
isUppercase
)
{
this
.
current
.
output
=
this
.
current
.
output
.
toUpperCase
()
}
this
.
current
.
operation
=
v
;
this
.
$clipboardCopy
(
this
.
current
.
output
);
computed
:
{
md5
()
{
if
(
!
this
.
current
.
input
)
{
return
""
;
}
let
result
=
crypto
.
MD5
(
this
.
current
.
input
).
toString
();
return
this
.
current
.
isUppercase
?
result
.
toUpperCase
()
:
result
;
},
sha1
()
{
if
(
!
this
.
current
.
input
)
{
return
""
;
}
let
result
=
crypto
.
SHA1
(
this
.
current
.
input
).
toString
();
return
this
.
current
.
isUppercase
?
result
.
toUpperCase
()
:
result
;
},
sha256
()
{
if
(
!
this
.
current
.
input
)
{
return
""
;
}
let
result
=
crypto
.
SHA256
(
this
.
current
.
input
).
toString
();
return
this
.
current
.
isUppercase
?
result
.
toUpperCase
()
:
result
;
},
sha512
()
{
if
(
!
this
.
current
.
input
)
{
return
""
;
}
let
result
=
crypto
.
SHA512
(
this
.
current
.
input
).
toString
();
return
this
.
current
.
isUppercase
?
result
.
toUpperCase
()
:
result
;
},
sm3
()
{
if
(
!
this
.
current
.
input
)
{
return
""
;
}
let
result
=
sm
.
sm3
(
this
.
current
.
input
);
return
this
.
current
.
isUppercase
?
result
.
toUpperCase
()
:
result
;
},
},
watch
:
{
current
:
{
handler
()
{
this
.
$saveToolData
(
this
.
current
);
},
deep
:
true
}
},
methods
:{
result
(
type
){
return
this
[
type
]
},
copy
(
type
){
if
(
this
[
type
]){
this
.
$clipboardCopy
(
this
[
type
])
}
}
},
...
...
@@ -57,11 +83,9 @@ export default {
current
:
{
input
:
""
,
isUppercase
:
false
,
output
:
""
,
operation
:
""
},
type
:
[
'
md5
'
,
'
sha1
'
,
'
sha256
'
,
'
sha512
'
,
"
sm3
"
]
type
s
:
[
'
md5
'
,
'
sha1
'
,
'
sha256
'
,
'
sha512
'
,
"
sm3
"
]
}
},
}
</
script
>
\ No newline at end of file
</
script
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录