Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夜猫逐梦
1024程序员开源挑战赛
提交
ae48e33b
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,发现更多精彩内容 >>
提交
ae48e33b
编写于
8月 11, 2021
作者:
B
baiy
提交者:
ninecents
10月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
base64支持对文件编码和解码 #59
上级
dba64a83
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
88 addition
and
49 deletion
+88
-49
package-lock.json
package-lock.json
+38
-32
package.json
package.json
+8
-7
src/views/tool/base64.vue
src/views/tool/base64.vue
+42
-10
未找到文件。
package-lock.json
浏览文件 @
ae48e33b
...
...
@@ -2101,9 +2101,9 @@
"dev": true
},
"async-validator": {
"version": "3.5.
1
",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-3.5.
1
.tgz",
"integrity": "sha512-
DDmKA7sdSAJtTVeNZHrnr2yojfFaoeW8MfQN8CeuXg8DDQHTqKk9Fdv38dSvnesHoO8MUwMI2HphOeSyIF+wm
Q=="
"version": "3.5.
2
",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-3.5.
2
.tgz",
"integrity": "sha512-
8eLCg00W9pIRZSB781UUX/H6Oskmm8xloZfr09lz5bikRpBVDlJ3hRVuxxP1SxcwsEYfJ4IU8Q19Y8/893r3r
Q=="
},
"asynckit": {
"version": "0.4.0",
...
...
@@ -3669,9 +3669,9 @@
}
},
"cronstrue": {
"version": "1.11
2
.0",
"resolved": "https://registry.npmjs.org/cronstrue/-/cronstrue-1.11
2
.0.tgz",
"integrity": "sha512-
sVw7RKaOm4l3DRGeOXpdxDKL5qcFrKy9diZHob/kie14OYuOV3uCxAthb56OOf/M2u+FCYPiBMYhZuFibuxwMQ
=="
"version": "1.11
4
.0",
"resolved": "https://registry.npmjs.org/cronstrue/-/cronstrue-1.11
4
.0.tgz",
"integrity": "sha512-
j1JuBHTJKKX41NUJVHmWn2ZYHnLipsIoq7bAZVeVzehA9+rmG6v9NgMiMa0KiiFzozihgt4yGNe5aMVc/IoYLg
=="
},
"cross-spawn": {
"version": "6.0.5",
...
...
@@ -4459,9 +4459,9 @@
"dev": true
},
"element-resize-detector": {
"version": "1.2.
2
",
"resolved": "https://registry.npmjs.org/element-resize-detector/-/element-resize-detector-1.2.
2
.tgz",
"integrity": "sha512-+
LOXRkCJc4I5WhEJxIDjhmE3raF8jtOMBDqSCgZTMz2TX3oXAX5pE2+MDeopJlGdXzP7KzPbBJaUGfNaP9HG4A
==",
"version": "1.2.
3
",
"resolved": "https://registry.npmjs.org/element-resize-detector/-/element-resize-detector-1.2.
3
.tgz",
"integrity": "sha512-+
dhNzUgLpq9ol5tyhoG7YLoXL3ssjfFW+0gpszXPwRU6NjGr1fVHMEAF8fVzIiRJq57Nre0RFeIjJwI8Nh2NmQ
==",
"requires": {
"batch-processor": "1.0.0"
}
...
...
@@ -7455,12 +7455,18 @@
"dev": true
},
"mime-types": {
"version": "2.1.30",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz",
"integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==",
"dev": true,
"version": "2.1.32",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz",
"integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==",
"requires": {
"mime-db": "1.47.0"
"mime-db": "1.49.0"
},
"dependencies": {
"mime-db": {
"version": "1.49.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz",
"integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA=="
}
}
},
"mimic-fn": {
...
...
@@ -8425,11 +8431,11 @@
"dev": true
},
"php-array-reader": {
"version": "1.
2
.0",
"resolved": "https://registry.npmjs.org/php-array-reader/-/php-array-reader-1.
2
.0.tgz",
"integrity": "sha512-
l8eo0tt3lrDwrIKCMtWQBKq83zrYK0Yb31NRv1MFhUPKRMvVQKww+Ga0rdiot2W5izc96EcZJhsv44il4WPs0Q
==",
"version": "1.
3
.0",
"resolved": "https://registry.npmjs.org/php-array-reader/-/php-array-reader-1.
3
.0.tgz",
"integrity": "sha512-
mTWGcWL7U0R6AkR0OYTxJXkvVGDaoIQC0rTa5ljxWoL8bG4nlRXG0hqIsORKXFfTQDqC76ei7qw/sjwoZ/ACyg
==",
"requires": {
"php-parser": "^3.0.
0-prerelease.8
"
"php-parser": "^3.0.
3
"
}
},
"php-parser": {
...
...
@@ -11877,9 +11883,9 @@
}
},
"view-design": {
"version": "4.
5.0
",
"resolved": "https://registry.npmjs.org/view-design/-/view-design-4.
5.0
.tgz",
"integrity": "sha512-0
VL4YAlJ/IqEL6on0buUuTd9awjCqkqWrre3A42LXcrIn+fV69dYvQVyP/ukBOn9dOTfUMCgpiQnxBKFZQXVb
Q==",
"version": "4.
6.1
",
"resolved": "https://registry.npmjs.org/view-design/-/view-design-4.
6.1
.tgz",
"integrity": "sha512-0
pc9j8SEmmSWa/GGRM3H3T9WdEQ7IJHr2AMKJAIsW/1ft4glwhhuRN/lXDR11jHz/6g4nRZwzlneIbc0SpGFd
Q==",
"requires": {
"async-validator": "^3.3.0",
"deepmerge": "^2.2.1",
...
...
@@ -11898,9 +11904,9 @@
"dev": true
},
"vue": {
"version": "2.6.1
2
",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.1
2
.tgz",
"integrity": "sha512-
uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg
=="
"version": "2.6.1
4
",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.1
4
.tgz",
"integrity": "sha512-
x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ
=="
},
"vue-cli-plugin-iview": {
"version": "1.0.6",
...
...
@@ -11964,9 +11970,9 @@
}
},
"vue-router": {
"version": "3.5.
1
",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.
1
.tgz",
"integrity": "sha512-
RRQNLT8Mzr8z7eL4p7BtKvRaTSGdCbTy2+Mm5HTJvLGYSSeG9gDzNasJPP/yOYKLy+/cLG/ftrqq5fvkFwBJEw
=="
"version": "3.5.
2
",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.
2
.tgz",
"integrity": "sha512-
807gn82hTnjCYGrnF3eNmIw/dk7/GE4B5h69BlyCK9KHASwSloD1Sjcn06zg9fVG4fYH2DrsNBZkpLtb25WtaQ
=="
},
"vue-style-loader": {
"version": "4.1.3",
...
...
@@ -11979,9 +11985,9 @@
}
},
"vue-template-compiler": {
"version": "2.6.1
2
",
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.1
2
.tgz",
"integrity": "sha512-O
zzZ52zS41YUbkCBfdXShQTe69j1gQDZ9HIX8miuC9C3rBCk9wIRjLiZZLrmX9V+Ftq/YEyv1JaVr5Y/hNtBy
g==",
"version": "2.6.1
4
",
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.1
4
.tgz",
"integrity": "sha512-O
DQS1SyMbjKoO1JBJZojSw6FE4qnh9rIpUZn2EUT86FKizx9uH5z6uXiIrm4/Nb/gwxTi/o17ZDEGWAXHvtC7
g==",
"dev": true,
"requires": {
"de-indent": "^1.0.2",
...
...
@@ -12648,8 +12654,8 @@
}
},
"x2js": {
"version": "git
+ssh://git@github.com/abdolence/x2js.git
#185e410b3fa621070fea1f86a389b477afa216b9",
"from": "
x2js@
github:abdolence/x2js"
"version": "git
hub:abdolence/x2js
#185e410b3fa621070fea1f86a389b477afa216b9",
"from": "github:abdolence/x2js"
},
"xml-formatter": {
"version": "2.4.0",
...
...
package.json
浏览文件 @
ae48e33b
{
"name"
:
"c-tool"
,
"version"
:
"1.6.
2
"
,
"version"
:
"1.6.
3
"
,
"private"
:
true
,
"scripts"
:
{
"serve"
:
"vue-cli-service serve --port 8081"
,
...
...
@@ -12,7 +12,7 @@
"
babel-runtime
"
:
"
^6.26.0
"
,
"
code-formatter
"
:
"
0.0.1
"
,
"
cron-parser
"
:
"
^2.16.3
"
,
"
cronstrue
"
:
"
^1.1
00
.0
"
,
"
cronstrue
"
:
"
^1.1
14
.0
"
,
"
crypto-js
"
:
"
^3.3.0
"
,
"
diff
"
:
"
^4.0.2
"
,
"
file
"
:
"
^0.2.2
"
,
...
...
@@ -26,8 +26,9 @@
"
jwt-decode
"
:
"
^3.1.2
"
,
"
lodash
"
:
"
^4.17.21
"
,
"
lscache
"
:
"
^1.3.0
"
,
"
mime-types
"
:
"
^2.1.32
"
,
"
moment
"
:
"
^2.29.1
"
,
"
php-array-reader
"
:
"
^1.
2
.0
"
,
"
php-array-reader
"
:
"
^1.
3
.0
"
,
"
phparr
"
:
"
^0.2.0
"
,
"
properties-to-json
"
:
"
^0.1.7
"
,
"
qrcode
"
:
"
^1.4.4
"
,
...
...
@@ -38,10 +39,10 @@
"
sm-crypto
"
:
"
^0.1.4
"
,
"
system
"
:
"
^2.0.1
"
,
"
uuid
"
:
"
^8.3.2
"
,
"
view-design
"
:
"
^4.
3.2
"
,
"
vue
"
:
"
^2.6.1
2
"
,
"
view-design
"
:
"
^4.
6.1
"
,
"
vue
"
:
"
^2.6.1
4
"
,
"
vue-codemirror
"
:
"
^4.0.6
"
,
"
vue-router
"
:
"
^3.
4.3
"
,
"
vue-router
"
:
"
^3.
5.2
"
,
"
x2js
"
:
"
github:abdolence/x2js
"
,
"
xml-formatter
"
:
"
^2.4.0
"
},
...
...
@@ -55,7 +56,7 @@
"
less
"
:
"
^2.7.3
"
,
"
less-loader
"
:
"
^5.0.0
"
,
"
vue-cli-plugin-iview
"
:
"
^1.0.6
"
,
"
vue-template-compiler
"
:
"
^2.6.1
2
"
"
vue-template-compiler
"
:
"
^2.6.1
4
"
},
"eslintConfig"
:
{
"root"
:
true
,
...
...
src/views/tool/base64.vue
浏览文件 @
ae48e33b
...
...
@@ -5,42 +5,74 @@
<FormItem>
<ButtonGroup>
<Button
type=
"primary"
@
click=
"handle('encode')"
>
编码
</Button>
<Button
type=
"primary"
@
click=
"handle('decode')"
>
解
密
</Button>
<Button
type=
"primary"
@
click=
"handle('decode')"
>
解
码
</Button>
</ButtonGroup>
</FormItem>
<FormItem>
<Checkbox
v-model=
"current.isUriSafe"
>
Url Safe
</Checkbox>
</FormItem>
<FormItem
style=
"float: right;"
>
<Upload
action=
"#"
:before-upload=
"handleUpload"
>
<Button
type=
"primary"
icon=
"md-arrow-round-up"
>
上传文件
</Button>
</Upload>
</FormItem>
</option-block>
<Input
v-model=
"current.output"
:rows=
"7"
type=
"textarea"
placeholder=
"结果"
></Input>
</div>
</
template
>
<
script
>
import
{
Base64
}
from
'
js-base64
'
import
{
Base64
}
from
'
js-base64
'
import
mimeType
from
'
mime-types
'
import
moment
from
"
moment
"
;
export
default
{
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
(
'
input
'
))
},
methods
:
{
handle
(
v
)
{
handle
(
v
)
{
if
(
this
.
current
.
input
)
{
if
(
v
===
"
encode
"
){
this
.
current
.
output
=
Base64
.
encode
(
this
.
current
.
input
,
this
.
current
.
isUriSafe
)
}
else
{
this
.
current
.
output
=
Base64
.
decode
(
this
.
current
.
input
)
if
(
v
===
"
encode
"
)
{
this
.
current
.
output
=
Base64
.
encode
(
this
.
current
.
input
,
this
.
current
.
isUriSafe
)
}
else
{
if
(
this
.
current
.
input
.
indexOf
(
'
,
'
)
!==
-
1
)
{
// 文件 base64 内容
this
.
exportFile
();
}
else
{
this
.
current
.
output
=
Base64
.
decode
(
this
.
current
.
input
)
}
}
this
.
current
.
operation
=
v
this
.
$clipboardCopy
(
this
.
current
.
output
)
this
.
$saveToolData
(
this
.
current
)
console
.
log
(
this
.
current
)
}
},
handleUpload
(
file
)
{
let
r
=
new
FileReader
()
r
.
readAsDataURL
(
file
)
r
.
onloadend
=
()
=>
{
this
.
current
.
output
=
r
.
result
}
return
false
},
exportFile
()
{
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
aEle
=
document
.
createElement
(
"
a
"
);
aEle
.
download
=
`ctools-base64-decode-
${
moment
().
unix
()}
`
+
(
mimeType
.
extension
(
mime
)
?
`.
${
mimeType
.
extension
(
mime
)}
`
:
""
);
aEle
.
href
=
objectUrl
;
aEle
.
click
();
aEle
.
remove
();
window
.
URL
.
revokeObjectURL
(
objectUrl
);
}
},
data
()
{
data
()
{
return
{
current
:
{
input
:
''
,
isFile
:
false
,
output
:
''
,
operation
:
''
,
isUriSafe
:
false
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录