Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夜猫逐梦
1024程序员开源挑战赛
提交
06a8284c
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
06a8284c
编写于
11月 20, 2021
作者:
B
baiy
提交者:
ninecents
10月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化剪贴板操作和部分输入逻辑
上级
11db7f6c
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
198 addition
and
108 deletion
+198
-108
public/tool.html
public/tool.html
+0
-1
src/tool/clipboard.js
src/tool/clipboard.js
+40
-20
src/tool/model.js
src/tool/model.js
+63
-27
src/views/tool/ascii.vue
src/views/tool/ascii.vue
+1
-1
src/views/tool/barcode.vue
src/views/tool/barcode.vue
+2
-2
src/views/tool/base64.vue
src/views/tool/base64.vue
+4
-4
src/views/tool/code.vue
src/views/tool/code.vue
+1
-1
src/views/tool/crontab.vue
src/views/tool/crontab.vue
+15
-7
src/views/tool/decimalConvert.vue
src/views/tool/decimalConvert.vue
+1
-1
src/views/tool/diffs.vue
src/views/tool/diffs.vue
+1
-1
src/views/tool/encrypt.vue
src/views/tool/encrypt.vue
+1
-1
src/views/tool/hash.vue
src/views/tool/hash.vue
+1
-1
src/views/tool/hexString.vue
src/views/tool/hexString.vue
+1
-1
src/views/tool/html.vue
src/views/tool/html.vue
+1
-1
src/views/tool/ip.vue
src/views/tool/ip.vue
+6
-1
src/views/tool/json.vue
src/views/tool/json.vue
+1
-1
src/views/tool/jsonToObject.vue
src/views/tool/jsonToObject.vue
+16
-7
src/views/tool/jwt.vue
src/views/tool/jwt.vue
+1
-1
src/views/tool/pinyin.vue
src/views/tool/pinyin.vue
+1
-1
src/views/tool/qrCode.vue
src/views/tool/qrCode.vue
+8
-8
src/views/tool/randomString.vue
src/views/tool/randomString.vue
+1
-1
src/views/tool/regex.vue
src/views/tool/regex.vue
+1
-1
src/views/tool/serializeConversion.vue
src/views/tool/serializeConversion.vue
+1
-1
src/views/tool/sign.vue
src/views/tool/sign.vue
+1
-1
src/views/tool/text.vue
src/views/tool/text.vue
+1
-1
src/views/tool/time.vue
src/views/tool/time.vue
+1
-1
src/views/tool/timestamp.vue
src/views/tool/timestamp.vue
+22
-9
src/views/tool/unicode.vue
src/views/tool/unicode.vue
+1
-1
src/views/tool/url.vue
src/views/tool/url.vue
+1
-1
src/views/tool/uuid.vue
src/views/tool/uuid.vue
+1
-1
src/views/tool/variableConversion.vue
src/views/tool/variableConversion.vue
+1
-1
src/views/tool/websocket.vue
src/views/tool/websocket.vue
+1
-1
未找到文件。
public/tool.html
浏览文件 @
06a8284c
...
@@ -10,6 +10,5 @@
...
@@ -10,6 +10,5 @@
<div
id=
"page"
style=
"width: 800px;height: 550px;margin: 0 auto;padding: 0 10px;overflow-y:auto;"
>
<div
id=
"page"
style=
"width: 800px;height: 550px;margin: 0 auto;padding: 0 10px;overflow-y:auto;"
>
<div
id=
"app"
></div>
<div
id=
"app"
></div>
</div>
</div>
<div
id=
"clipboard"
></div>
</body>
</body>
</html>
</html>
src/tool/clipboard.js
浏览文件 @
06a8284c
import
{
isUtools
}
from
'
../helper
'
import
{
Base64
}
from
"
js-base64
"
;
// 剪贴板操作
// 剪贴板操作
export
const
copy
=
(
data
,
successCallback
)
=>
{
export
const
copy
=
(
data
,
successCallback
)
=>
{
document
.
querySelector
(
try
{
'
#clipboard
'
).
innerHTML
=
'
<textarea id="clipboard-text"></textarea>
'
navigator
.
clipboard
.
writeText
(
data
).
then
(
function
()
{
document
.
querySelector
(
'
#clipboard-text
'
).
value
=
data
successCallback
&&
successCallback
()
document
.
querySelector
(
'
#clipboard-text
'
).
select
()
},
function
(
e
)
{
if
(
document
.
execCommand
(
'
copy
'
))
{
console
.
log
(
'
copy failed
'
,
e
)
successCallback
&&
successCallback
()
});
}
catch
(
e
)
{
console
.
log
(
'
copy error
'
,
e
)
}
}
document
.
querySelector
(
'
#clipboard
'
).
innerHTML
=
''
}
}
export
const
paste
=
()
=>
{
export
const
paste
=
async
()
=>
{
document
.
querySelector
(
'
#clipboard
'
).
innerHTML
=
'
<textarea id="clipboard-text"></textarea>
'
return
new
Promise
((
resolve
)
=>
{
document
.
querySelector
(
'
#clipboard-text
'
).
select
()
try
{
document
.
execCommand
(
'
paste
'
)
navigator
.
clipboard
.
readText
().
then
((
text
)
=>
{
let
r
=
document
.
querySelector
(
'
#clipboard-text
'
).
value
||
document
.
querySelector
(
'
#clipboard-text
'
).
innerHTML
return
resolve
(
text
?
text
:
""
)
document
.
querySelector
(
'
#clipboard
'
).
innerHTML
=
''
}).
catch
((
e
)
=>
{
return
r
?
r
:
''
console
.
error
(
e
)
return
resolve
(
""
)
})
}
catch
{
resolve
(
""
)
}
});
}
}
export
const
copyImage
=
(
imageBase64
,
successCallback
=
""
)
=>
{
export
const
copyImage
=
(
imageBase64
,
successCallback
=
""
)
=>
{
if
(
isUtools
&&
imageBase64
){
if
(
imageBase64
)
{
window
.
utools
.
copyImage
(
imageBase64
)
try
{
successCallback
&&
successCallback
()
let
arr
=
imageBase64
.
split
(
'
,
'
)
let
mime
=
arr
[
0
].
match
(
/:
(
.*
?)
;/
)[
1
];
let
data
=
[
new
window
.
ClipboardItem
({
[
mime
]:
new
Blob
([
Base64
.
toUint8Array
(
arr
[
1
])],
{
type
:
mime
})
})];
navigator
.
clipboard
.
write
(
data
).
then
(
function
()
{
successCallback
&&
successCallback
()
},
function
(
e
)
{
console
.
log
(
'
copy image failed
'
,
e
)
});
}
catch
(
e
)
{
console
.
log
(
'
copy image error
'
,
e
)
}
}
}
}
}
...
...
src/tool/model.js
浏览文件 @
06a8284c
...
@@ -51,38 +51,74 @@ const debounceSaveToolDataMethod = _.debounce(function () {
...
@@ -51,38 +51,74 @@ const debounceSaveToolDataMethod = _.debounce(function () {
return
history
(
debounceSaveToolData
[
'
tool
'
]).
push
(
debounceSaveToolData
[
'
data
'
])
return
history
(
debounceSaveToolData
[
'
tool
'
]).
push
(
debounceSaveToolData
[
'
data
'
])
},
1000
)
},
1000
)
const
appendData
=
async
function
(
field
=
""
,
check
=
""
)
{
const
result
=
(
data
=
""
)
=>
{
if
(
data
){
if
(
!
check
||
(
_
.
isFunction
(
check
)
&&
check
(
data
))
// 函数校验
){
return
field
?
{[
field
]:
data
}
:
data
}
}
return
field
?
{}
:
""
}
return
new
Promise
(
async
(
resolve
)
=>
{
try
{
// 使用固定输入数据
if
(
fixeInputData
)
{
return
resolve
(
result
(
fixeInputData
))
}
if
(
setting
.
autoReadCopy
())
{
let
paste
=
(
await
clipboard
.
paste
()).
trim
()
if
(
paste
)
{
resolve
(
result
(
paste
))
}
}
resolve
(
result
())
}
catch
{
resolve
(
result
())
}
});
}
export
const
plugin
=
{
export
const
plugin
=
{
install
:
function
(
Vue
)
{
install
:
function
(
Vue
)
{
Vue
.
prototype
.
$getToolData
=
function
(
clipboardField
=
''
,
clipboardFieldRegex
=
""
)
{
Vue
.
prototype
.
$initToolData
=
function
(
input
=
""
,
inputCheck
=
""
,
field
=
"
current
"
,
isLoadHistory
=
true
)
{
let
data
=
history
(
model
.
getCurrentTool
()).
current
()
let
current
=
_
.
cloneDeep
(
this
[
field
])
if
(
clipboardField
)
{
if
(
isLoadHistory
)
{
let
inputData
=
""
;
Object
.
assign
(
current
,
this
.
$getToolData
())
if
(
fixeInputData
)
{
// 使用固定输入数据
}
inputData
=
fixeInputData
if
(
!
input
)
{
fixeInputData
=
""
this
[
field
]
=
current
}
else
if
(
setting
.
autoReadCopy
())
{
return
;
let
paste
=
clipboard
.
paste
()
}
if
(
!
data
[
clipboardField
]
&&
paste
)
{
if
(
setting
.
autoReadCopyFilter
())
{
// 初始化默认值
paste
=
paste
.
trim
()
if
(
!
(
input
in
current
)){
}
current
[
input
]
=
""
;
inputData
=
paste
}
// 保存默认值
let
inputDefault
=
current
[
input
]
current
[
input
]
=
""
;
appendData
(
input
,
inputCheck
).
then
((
append
)
=>
{
for
(
let
key
of
Object
.
keys
(
append
))
{
if
((
key
in
current
)
&&
!
current
[
key
])
{
current
[
key
]
=
append
[
key
]
}
}
}
}
if
(
inputData
){
if
(
!
current
[
input
]){
if
(
// 使用默认值
!
(
clipboardFieldRegex
instanceof
RegExp
)
current
[
input
]
=
inputDefault
||
(
clipboardFieldRegex
instanceof
RegExp
&&
clipboardFieldRegex
.
test
(
inputData
)
)
){
data
[
clipboardField
]
=
inputData
}
}
}
}
this
[
field
]
=
current
return
data
})
}
Vue
.
prototype
.
$getToolData
=
function
()
{
return
_
.
cloneDeep
(
history
(
model
.
getCurrentTool
()).
current
())
}
}
Vue
.
prototype
.
$saveToolData
=
function
(
data
,
ignoreDebounce
=
false
)
{
Vue
.
prototype
.
$saveToolData
=
function
(
data
,
ignoreDebounce
=
false
)
{
if
(
ignoreDebounce
)
{
if
(
ignoreDebounce
)
{
...
...
src/views/tool/ascii.vue
浏览文件 @
06a8284c
...
@@ -67,7 +67,7 @@ export default {
...
@@ -67,7 +67,7 @@ export default {
},
},
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
()
)
this
.
$initToolData
(
)
},
},
methods
:
{
methods
:
{
handle
()
{
handle
()
{
...
...
src/views/tool/barcode.vue
浏览文件 @
06a8284c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<div>
<div>
<div
style=
"height: 250px;line-height: 250px;text-align: center;vertical-align: middle;"
>
<div
style=
"height: 250px;line-height: 250px;text-align: center;vertical-align: middle;"
>
<canvas
@
click=
"saveImage"
:style=
"`border: $
{canvasBorder};vertical-align: middle;`" ref="barcode"
<canvas
@
click=
"saveImage"
:style=
"`border: $
{canvasBorder};vertical-align: middle;`" ref="barcode"
class="barcode" v-show="!validStr">
</canvas>
class="barcode" v-show="!validStr"
style="cursor:pointer"
>
</canvas>
<p
style=
"color: red"
v-show=
"validStr"
>
{{
validStr
}}
</p>
<p
style=
"color: red"
v-show=
"validStr"
>
{{
validStr
}}
</p>
</div>
</div>
<div
id=
"barcode-setting"
>
<div
id=
"barcode-setting"
>
...
@@ -146,7 +146,7 @@ import JsBarcode from 'jsbarcode'
...
@@ -146,7 +146,7 @@ import JsBarcode from 'jsbarcode'
export
default
{
export
default
{
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
text
"
)
)
this
.
$initToolData
(
'
text
'
)
},
},
computed
:
{
computed
:
{
showText
()
{
showText
()
{
...
...
src/views/tool/base64.vue
浏览文件 @
06a8284c
...
@@ -38,7 +38,7 @@ export default {
...
@@ -38,7 +38,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
'
input
'
)
)
this
.
$initToolData
(
'
input
'
)
},
},
methods
:
{
methods
:
{
handle
(
v
)
{
handle
(
v
)
{
...
@@ -52,10 +52,10 @@ export default {
...
@@ -52,10 +52,10 @@ export default {
}
}
else
{
else
{
this
.
current
.
output
=
Base64
.
decode
(
this
.
current
.
input
)
this
.
current
.
output
=
Base64
.
decode
(
this
.
current
.
input
)
this
.
$clipboardCopy
(
this
.
current
.
output
)
}
}
}
}
this
.
current
.
operation
=
v
this
.
current
.
operation
=
v
this
.
$clipboardCopy
(
this
.
current
.
output
)
this
.
$saveToolData
(
this
.
current
)
this
.
$saveToolData
(
this
.
current
)
}
}
},
},
...
@@ -69,9 +69,9 @@ export default {
...
@@ -69,9 +69,9 @@ export default {
},
},
exportFile
()
{
exportFile
()
{
let
arr
=
this
.
current
.
input
.
split
(
'
,
'
),
mime
=
arr
[
0
].
match
(
/:
(
.*
?)
;/
)[
1
];
let
arr
=
this
.
current
.
input
.
split
(
'
,
'
),
mime
=
arr
[
0
].
match
(
/:
(
.*
?)
;/
)[
1
];
let
objectUrl
=
window
.
URL
.
createObjectURL
(
new
Blob
([
new
Blob
([
Base64
.
toUint8Array
(
arr
[
1
])],
{
type
:
mime
}
)],
{
type
:
mime
}));
let
objectUrl
=
window
.
URL
.
createObjectURL
(
new
Blob
([
Base64
.
toUint8Array
(
arr
[
1
]
)],
{
type
:
mime
}));
let
aEle
=
document
.
createElement
(
"
a
"
);
let
aEle
=
document
.
createElement
(
"
a
"
);
aEle
.
download
=
`ctool
s
-base64-decode-
${
moment
().
unix
()}
`
+
(
mimeType
.
extension
(
mime
)
?
`.
${
mimeType
.
extension
(
mime
)}
`
:
""
);
aEle
.
download
=
`ctool-base64-decode-
${
moment
().
unix
()}
`
+
(
mimeType
.
extension
(
mime
)
?
`.
${
mimeType
.
extension
(
mime
)}
`
:
""
);
aEle
.
href
=
objectUrl
;
aEle
.
href
=
objectUrl
;
aEle
.
click
();
aEle
.
click
();
aEle
.
remove
();
aEle
.
remove
();
...
...
src/views/tool/code.vue
浏览文件 @
06a8284c
...
@@ -53,7 +53,7 @@ export default {
...
@@ -53,7 +53,7 @@ export default {
}
}
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
content
"
)
)
this
.
$initToolData
(
'
content
'
)
},
},
methods
:
{
methods
:
{
handle
(
language
)
{
handle
(
language
)
{
...
...
src/views/tool/crontab.vue
浏览文件 @
06a8284c
...
@@ -6,14 +6,15 @@
...
@@ -6,14 +6,15 @@
<span
slot=
"prepend"
>
{{
$t
(
'
crontab_expression
'
)
}}
</span>
<span
slot=
"prepend"
>
{{
$t
(
'
crontab_expression
'
)
}}
</span>
</Input>
</Input>
<heightResize
:append=
"['.page-option-input']"
>
<heightResize
:append=
"['.page-option-input']"
>
<autoHeightTextarea
:value=
"output"
:placeholder=
"$t('crontab_execute_time')"
/>
<autoHeightTextarea
:value=
"output"
:placeholder=
"$t('crontab_execute_time')"
/>
</heightResize>
</heightResize>
</Col>
</Col>
<Col
span=
"12"
class=
"page-option-reference"
>
<Col
span=
"12"
class=
"page-option-reference"
>
<Tabs
value=
"example"
>
<Tabs
value=
"example"
>
<TabPane
:label=
"$t('crontab_example')"
name=
"example"
>
<TabPane
:label=
"$t('crontab_example')"
name=
"example"
>
<heightResize
:reduce=
"52"
@
resize=
"resize"
>
<heightResize
:reduce=
"52"
@
resize=
"resize"
>
<Table
stripe
size=
"small"
:height=
"referenceHeight"
border
:columns=
"example.columns"
:data=
"example.data"
></Table>
<Table
stripe
size=
"small"
:height=
"referenceHeight"
border
:columns=
"example.columns"
:data=
"example.data"
></Table>
</heightResize>
</heightResize>
</TabPane>
</TabPane>
<TabPane
:label=
"$t('crontab_format')"
name=
"format"
style=
"text-align: center"
>
<TabPane
:label=
"$t('crontab_format')"
name=
"format"
style=
"text-align: center"
>
...
@@ -35,6 +36,7 @@ import moment from "moment"
...
@@ -35,6 +36,7 @@ import moment from "moment"
import
{
getCurrentLocale
}
from
"
../../i18n
"
;
import
{
getCurrentLocale
}
from
"
../../i18n
"
;
import
heightResize
from
"
./components/heightResize
"
;
import
heightResize
from
"
./components/heightResize
"
;
import
autoHeightTextarea
from
"
./components/autoHeightTextarea
"
;
import
autoHeightTextarea
from
"
./components/autoHeightTextarea
"
;
export
default
{
export
default
{
components
:
{
components
:
{
heightResize
,
heightResize
,
...
@@ -63,7 +65,14 @@ export default {
...
@@ -63,7 +65,14 @@ export default {
},
},
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
())
this
.
$initToolData
(
'
input
'
,
(
data
)
=>
{
try
{
cronstrue
.
toString
(
data
)
}
catch
{
return
false
}
return
true
})
this
.
example
.
data
=
this
.
example
.
data
.
map
((
item
)
=>
{
this
.
example
.
data
=
this
.
example
.
data
.
map
((
item
)
=>
{
return
{
return
{
example
:
item
,
example
:
item
,
...
@@ -75,16 +84,15 @@ export default {
...
@@ -75,16 +84,15 @@ export default {
conversion
(
input
)
{
conversion
(
input
)
{
return
cronstrue
.
toString
(
input
,
{
locale
:
this
.
locale
})
return
cronstrue
.
toString
(
input
,
{
locale
:
this
.
locale
})
},
},
resize
(
height
){
resize
(
height
)
{
this
.
referenceHeight
=
height
this
.
referenceHeight
=
height
}
}
},
},
data
()
{
data
()
{
return
{
return
{
referenceHeight
:
101
,
referenceHeight
:
101
,
current
:
{
current
:
{
input
:
"
2 */5 * * 2-5
"
,
input
:
"
2 */5 * * 2-5
"
operation
:
"
check
"
},
},
special
:
{
special
:
{
columns
:
[
columns
:
[
...
...
src/views/tool/decimalConvert.vue
浏览文件 @
06a8284c
...
@@ -42,7 +42,7 @@ import Radix from './library/radix.js'
...
@@ -42,7 +42,7 @@ import Radix from './library/radix.js'
const
alphabet
=
"
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@
"
;
const
alphabet
=
"
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@
"
;
export
default
{
export
default
{
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
watch
:
{
watch
:
{
convert
:
function
(
val
)
{
convert
:
function
(
val
)
{
...
...
src/views/tool/diffs.vue
浏览文件 @
06a8284c
...
@@ -63,7 +63,7 @@ export default {
...
@@ -63,7 +63,7 @@ export default {
}
}
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
()
)
this
.
$initToolData
(
)
},
},
methods
:
{
methods
:
{
setLanguage
(
lang
)
{
setLanguage
(
lang
)
{
...
...
src/views/tool/encrypt.vue
浏览文件 @
06a8284c
...
@@ -40,7 +40,7 @@ export default {
...
@@ -40,7 +40,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
methods
:
{
methods
:
{
handle
(
v
)
{
handle
(
v
)
{
...
...
src/views/tool/hash.vue
浏览文件 @
06a8284c
...
@@ -21,7 +21,7 @@ import crypto from "crypto-js"
...
@@ -21,7 +21,7 @@ import crypto from "crypto-js"
const
sm
=
require
(
'
sm-crypto
'
);
const
sm
=
require
(
'
sm-crypto
'
);
export
default
{
export
default
{
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
computed
:
{
computed
:
{
md5
()
{
md5
()
{
...
...
src/views/tool/hexString.vue
浏览文件 @
06a8284c
...
@@ -25,7 +25,7 @@ export default {
...
@@ -25,7 +25,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
methods
:
{
methods
:
{
handle
(
type
)
{
handle
(
type
)
{
...
...
src/views/tool/html.vue
浏览文件 @
06a8284c
...
@@ -22,7 +22,7 @@ export default {
...
@@ -22,7 +22,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
methods
:
{
methods
:
{
handle
(
v
)
{
handle
(
v
)
{
...
...
src/views/tool/ip.vue
浏览文件 @
06a8284c
...
@@ -32,7 +32,12 @@ export default {
...
@@ -32,7 +32,12 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
))
this
.
$initToolData
(
'
input
'
,(
input
)
=>
{
return
(
/^
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
$/
.
test
(
input
)
||
input
===
"
localhost
"
)
})
},
},
methods
:
{
methods
:
{
handle
()
{
handle
()
{
...
...
src/views/tool/json.vue
浏览文件 @
06a8284c
...
@@ -23,7 +23,7 @@ export default {
...
@@ -23,7 +23,7 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
'
content
'
)
)
this
.
$initToolData
(
'
content
'
)
},
},
methods
:
{
methods
:
{
handle
(
v
)
{
handle
(
v
)
{
...
...
src/views/tool/jsonToObject.vue
浏览文件 @
06a8284c
...
@@ -13,7 +13,8 @@
...
@@ -13,7 +13,8 @@
</Input>
</Input>
</option-block>
</option-block>
</div>
</div>
<input-block
top=
"10px"
right=
"10px"
:text=
"$t('jsonToObject_format')"
@
on-default-right-bottom-click=
"format"
>
<input-block
top=
"10px"
right=
"10px"
:text=
"$t('jsonToObject_format')"
@
on-default-right-bottom-click=
"format"
>
<heightResize
:append=
"['.page-option-block']"
>
<heightResize
:append=
"['.page-option-block']"
>
<code-editor
v-model=
"current.input"
:placeholder=
"$t('jsonToObject_input')"
language=
"json"
/>
<code-editor
v-model=
"current.input"
:placeholder=
"$t('jsonToObject_input')"
language=
"json"
/>
</heightResize>
</heightResize>
...
@@ -22,7 +23,8 @@
...
@@ -22,7 +23,8 @@
<Col
span=
"14"
>
<Col
span=
"14"
>
<input-block
top=
"10px"
right=
"10px"
>
<input-block
top=
"10px"
right=
"10px"
>
<heightResize>
<heightResize>
<code-editor
:placeholder=
"$t('jsonToObject_output')"
:value=
"output"
:language=
"languages[current.type]"
/>
<code-editor
:placeholder=
"$t('jsonToObject_output')"
:value=
"output"
:language=
"languages[current.type]"
/>
</heightResize>
</heightResize>
<template
slot=
"extra"
>
<template
slot=
"extra"
>
<RadioGroup
v-model=
"current.type"
type=
"button"
button-style=
"solid"
>
<RadioGroup
v-model=
"current.type"
type=
"button"
button-style=
"solid"
>
...
@@ -50,7 +52,14 @@ export default {
...
@@ -50,7 +52,14 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
())
this
.
$initToolData
(
'
input
'
,
(
input
)
=>
{
try
{
require
(
'
jsonlint
'
).
parse
(
input
)
}
catch
(
e
)
{
return
false
}
return
true
})
},
},
computed
:
{
computed
:
{
output
()
{
output
()
{
...
@@ -82,13 +91,13 @@ export default {
...
@@ -82,13 +91,13 @@ export default {
return
this
.
$t
(
'
jsonToObject_error
'
,
[
error
.
message
]).
toString
()
return
this
.
$t
(
'
jsonToObject_error
'
,
[
error
.
message
]).
toString
()
}
}
},
},
types
(){
types
()
{
return
Object
.
keys
(
this
.
languages
)
return
Object
.
keys
(
this
.
languages
)
}
}
},
},
methods
:{
methods
:
{
format
(){
format
()
{
if
(
this
.
current
.
input
.
trim
()){
if
(
this
.
current
.
input
.
trim
())
{
this
.
current
.
input
=
jsonFormatter
.
beautify
(
this
.
current
.
input
)
this
.
current
.
input
=
jsonFormatter
.
beautify
(
this
.
current
.
input
)
}
}
}
}
...
...
src/views/tool/jwt.vue
浏览文件 @
06a8284c
...
@@ -28,7 +28,7 @@ export default {
...
@@ -28,7 +28,7 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
computed
:
{
computed
:
{
output
()
{
output
()
{
...
...
src/views/tool/pinyin.vue
浏览文件 @
06a8284c
...
@@ -49,7 +49,7 @@ export default {
...
@@ -49,7 +49,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
({},
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
computed
:
{
computed
:
{
output
()
{
output
()
{
...
...
src/views/tool/qrCode.vue
浏览文件 @
06a8284c
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
<Col
span=
"14"
>
<Col
span=
"14"
>
<Input
v-model=
"current.generateInput"
:rows=
"14"
type=
"textarea"
:placeholder=
"$t('qrCode_generate_input')"
></Input>
<Input
v-model=
"current.generateInput"
:rows=
"14"
type=
"textarea"
:placeholder=
"$t('qrCode_generate_input')"
></Input>
</Col>
</Col>
<Col
span=
"10"
>
<Col
span=
"10"
style=
"text-align: center;"
>
<
div
style=
"text-align: center"
v-html=
"generateOutput"
></div
>
<
img
v-if=
"generateOutput"
@
click=
"()=>$clipboardCopyImages(generateOutput)"
style=
"width:300px;cursor:pointer"
:src=
"generateOutput"
/
>
</Col>
</Col>
</Row>
</Row>
</TabPane>
</TabPane>
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
</input-block>
</input-block>
<Input
v-model=
"readerOutput"
:rows=
"8"
type=
"textarea"
:placeholder=
"$t('qrCode_reader_output')"
></Input>
<Input
v-model=
"readerOutput"
:rows=
"8"
type=
"textarea"
:placeholder=
"$t('qrCode_reader_output')"
></Input>
</Col>
</Col>
<Col
span=
"10"
style=
"text-align: center"
v-html=
"readerInputImg"
></Col
>
<Col
span=
"10"
style=
"text-align: center"
v-html=
"readerInputImg"
/
>
</Row>
</Row>
</TabPane>
</TabPane>
</Tabs>
</Tabs>
...
@@ -61,13 +61,13 @@ export default {
...
@@ -61,13 +61,13 @@ export default {
created
()
{
created
()
{
let
feature
=
model
.
getToolCurrentFeature
(
'
generate
'
)
let
feature
=
model
.
getToolCurrentFeature
(
'
generate
'
)
if
(
feature
===
'
generate
'
)
{
if
(
feature
===
'
generate
'
)
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
'
generateInput
'
))
this
.
current
.
operation
=
feature
;
this
.
current
.
operation
=
feature
;
this
.
$initToolData
(
'
generateInput
'
)
}
else
if
(
feature
===
'
reader
'
)
{
}
else
if
(
feature
===
'
reader
'
)
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
'
readerInput
'
))
this
.
current
.
operation
=
feature
;
this
.
current
.
operation
=
feature
;
this
.
$initToolData
(
'
readerInput
'
)
}
else
{
}
else
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
()
)
this
.
$initToolData
(
)
}
}
},
},
methods
:
{
methods
:
{
...
@@ -81,8 +81,8 @@ export default {
...
@@ -81,8 +81,8 @@ export default {
this
.
generateOutput
=
this
.
$t
(
"
qrCode_generate_error
"
,
[
error
]);
this
.
generateOutput
=
this
.
$t
(
"
qrCode_generate_error
"
,
[
error
]);
return
;
return
;
}
}
this
.
$clipboardCopyImages
(
url
)
this
.
generateOutput
=
url
this
.
generateOutput
=
`<img style="width:300px" src="
${
url
}
" />`
this
.
$saveToolData
(
this
.
current
)
this
.
$saveToolData
(
this
.
current
)
})
})
},
},
...
...
src/views/tool/randomString.vue
浏览文件 @
06a8284c
...
@@ -56,7 +56,7 @@ export default {
...
@@ -56,7 +56,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
()
)
this
.
$initToolData
(
)
},
},
mounted
()
{
mounted
()
{
if
(
!
this
.
current
.
output
){
if
(
!
this
.
current
.
output
){
...
...
src/views/tool/regex.vue
浏览文件 @
06a8284c
...
@@ -54,7 +54,7 @@ export default {
...
@@ -54,7 +54,7 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
computed
:
{
computed
:
{
replaceContent
(){
replaceContent
(){
...
...
src/views/tool/serializeConversion.vue
浏览文件 @
06a8284c
...
@@ -38,7 +38,7 @@ export default {
...
@@ -38,7 +38,7 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
computed
:
{
computed
:
{
output
()
{
output
()
{
...
...
src/views/tool/sign.vue
浏览文件 @
06a8284c
...
@@ -78,7 +78,7 @@ export default {
...
@@ -78,7 +78,7 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
()
)
this
.
$initToolData
(
)
},
},
methods
:
{
methods
:
{
sign
()
{
sign
()
{
...
...
src/views/tool/text.vue
浏览文件 @
06a8284c
...
@@ -147,7 +147,7 @@ export default {
...
@@ -147,7 +147,7 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
content
"
)
)
this
.
$initToolData
(
'
content
'
)
},
},
computed
:
{
computed
:
{
stat
(){
stat
(){
...
...
src/views/tool/time.vue
浏览文件 @
06a8284c
...
@@ -61,7 +61,7 @@ import moment from 'moment'
...
@@ -61,7 +61,7 @@ import moment from 'moment'
export
default
{
export
default
{
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
()
)
this
.
$initToolData
(
)
},
},
computed
:
{
computed
:
{
poor
()
{
poor
()
{
...
...
src/views/tool/timestamp.vue
浏览文件 @
06a8284c
...
@@ -14,9 +14,15 @@
...
@@ -14,9 +14,15 @@
</Button>
</Button>
<DropdownMenu
slot=
"list"
>
<DropdownMenu
slot=
"list"
>
<DropdownItem
name=
"normalSecond"
>
{{
$t
(
'
timestamp_normal_second
'
)
}}
</DropdownItem>
<DropdownItem
name=
"normalSecond"
>
{{
$t
(
'
timestamp_normal_second
'
)
}}
</DropdownItem>
<DropdownItem
name=
"normalMillisecond"
>
{{
$t
(
'
timestamp_normal_millisecond
'
)
}}
</DropdownItem>
<DropdownItem
name=
"normalMillisecond"
>
{{
$t
(
'
timestamp_normal_millisecond
'
)
}}
</DropdownItem>
<DropdownItem
name=
"unixSecond"
>
{{
$t
(
'
timestamp_unix_second
'
)
}}
</DropdownItem>
<DropdownItem
name=
"unixSecond"
>
{{
$t
(
'
timestamp_unix_second
'
)
}}
</DropdownItem>
<DropdownItem
name=
"unixMillisecond"
>
{{
$t
(
'
timestamp_unix_millisecond
'
)
}}
</DropdownItem>
<DropdownItem
name=
"unixMillisecond"
>
{{
$t
(
'
timestamp_unix_millisecond
'
)
}}
</DropdownItem>
</DropdownMenu>
</DropdownMenu>
</Dropdown>
</Dropdown>
</
template
>
</
template
>
...
@@ -28,7 +34,10 @@
...
@@ -28,7 +34,10 @@
<span
slot=
"prepend"
>
{{ $t('timestamp_output') }}
</span>
<span
slot=
"prepend"
>
{{ $t('timestamp_output') }}
</span>
</Input>
</Input>
<
template
slot=
"extra"
>
<
template
slot=
"extra"
>
<Button
size=
"small"
type=
"primary"
@
click=
"()=>copy(output)"
>
{{
$t
(
'
timestamp_copy
'
)
}}
</Button>
<Button
size=
"small"
type=
"primary"
@
click=
"()=>copy(output)"
>
{{
$t
(
'
timestamp_copy
'
)
}}
</Button>
</
template
>
</
template
>
</input-block>
</input-block>
</option-block>
</option-block>
...
@@ -57,10 +66,14 @@ export default {
...
@@ -57,10 +66,14 @@ export default {
heightResize
heightResize
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
'
input
'
))
this
.
$initToolData
(
'
input
'
,
(
data
)
=>
{
if
(
!
this
.
current
.
input
)
{
return
(
this
.
current
.
input
=
moment
().
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
(
new
RegExp
(
/^
\d
+-
\d
+-
\d
+
\d
+:
\d
+:
\d
+$/
)).
test
(
data
)
}
||
(
new
RegExp
(
/^
\d
+-
\d
+-
\d
+
\d
+:
\d
+:
\d
+
\.\d
+$/
)).
test
(
data
)
||
(
new
RegExp
(
/^
\d{10}
$/
)).
test
(
data
)
||
(
new
RegExp
(
/^
\d{13}
$/
)).
test
(
data
)
)
})
},
},
mounted
()
{
mounted
()
{
this
.
timer
=
setInterval
(()
=>
{
this
.
timer
=
setInterval
(()
=>
{
...
@@ -127,7 +140,7 @@ export default {
...
@@ -127,7 +140,7 @@ export default {
},
},
methods
:
{
methods
:
{
copy
(
data
)
{
copy
(
data
)
{
if
(
data
){
if
(
data
)
{
this
.
$clipboardCopy
(
data
,
true
)
this
.
$clipboardCopy
(
data
,
true
)
}
}
},
},
...
@@ -147,7 +160,7 @@ export default {
...
@@ -147,7 +160,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
current
:
{
current
:
{
input
:
''
input
:
moment
().
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
},
},
timer
:
null
,
timer
:
null
,
timestamp
:
0
,
timestamp
:
0
,
...
...
src/views/tool/unicode.vue
浏览文件 @
06a8284c
...
@@ -36,7 +36,7 @@ export default {
...
@@ -36,7 +36,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
methods
:
{
methods
:
{
handle
(
operation
)
{
handle
(
operation
)
{
...
...
src/views/tool/url.vue
浏览文件 @
06a8284c
...
@@ -21,7 +21,7 @@ export default {
...
@@ -21,7 +21,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
methods
:
{
methods
:
{
handle
(
v
)
{
handle
(
v
)
{
...
...
src/views/tool/uuid.vue
浏览文件 @
06a8284c
...
@@ -40,7 +40,7 @@ export default {
...
@@ -40,7 +40,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
()
)
this
.
$initToolData
(
)
},
},
mounted
()
{
mounted
()
{
if
(
this
.
current
.
result
.
length
<
1
){
if
(
this
.
current
.
result
.
length
<
1
){
...
...
src/views/tool/variableConversion.vue
浏览文件 @
06a8284c
...
@@ -40,7 +40,7 @@ export default {
...
@@ -40,7 +40,7 @@ export default {
}
}
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
"
input
"
)
)
this
.
$initToolData
(
'
input
'
)
},
},
methods
:
{
methods
:
{
copy
(
type
)
{
copy
(
type
)
{
...
...
src/views/tool/websocket.vue
浏览文件 @
06a8284c
...
@@ -70,7 +70,7 @@ export default {
...
@@ -70,7 +70,7 @@ export default {
autoHeightTextarea
autoHeightTextarea
},
},
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
()
)
this
.
$initToolData
(
)
},
},
methods
:
{
methods
:
{
handle
()
{
handle
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录