Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanli
evm-store
Commits
0faf429a
Commit
0faf429a
authored
Aug 11, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix(字节码文件转换工具): 前端增加多文件上传以及自动转换
parent
84822239
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
38 deletions
+77
-38
frontend/src/settings.js
frontend/src/settings.js
+1
-1
frontend/src/views/system/apps.vue
frontend/src/views/system/apps.vue
+32
-22
frontend/src/views/system/evue.vue
frontend/src/views/system/evue.vue
+44
-15
No files found.
frontend/src/settings.js
View file @
0faf429a
...
@@ -90,7 +90,7 @@ export default {
...
@@ -90,7 +90,7 @@ export default {
title
:
"
字节码文件转换
"
,
title
:
"
字节码文件转换
"
,
name
:
"
ByteCodeFile
"
,
name
:
"
ByteCodeFile
"
,
icon
:
"
gongzuotai
"
,
icon
:
"
gongzuotai
"
,
path
:
"
tool/evue
"
,
path
:
"
evue/index
"
,
},
},
{
{
vue
:
"
app-store/docs.vue
"
,
vue
:
"
app-store/docs.vue
"
,
...
...
frontend/src/views/system/apps.vue
View file @
0faf429a
...
@@ -145,7 +145,12 @@
...
@@ -145,7 +145,12 @@
</el-form-item>
</el-form-item>
<el-form-item
label=
"打包算法"
prop=
"algorithm"
>
<el-form-item
label=
"打包算法"
prop=
"algorithm"
>
<el-select
v-model=
"post.algorithm"
>
<el-select
v-model=
"post.algorithm"
>
<el-option
v-for=
"(item, index) in aList"
:label=
"item.name"
:value=
"item.value"
:key=
"index"
></el-option>
<el-option
v-for=
"(item, index) in aList"
:label=
"item.name"
:value=
"item.value"
:key=
"index"
></el-option>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"应用名称"
prop=
"app_name"
>
<el-form-item
label=
"应用名称"
prop=
"app_name"
>
...
@@ -252,7 +257,7 @@ export default {
...
@@ -252,7 +257,7 @@ export default {
list
:
[],
list
:
[],
aList
:
[
aList
:
[
{
name
:
"
zlib
"
,
value
:
"
zlib
"
},
{
name
:
"
zlib
"
,
value
:
"
zlib
"
},
{
name
:
"
eheatshrink
"
,
value
:
"
h
"
}
{
name
:
"
eheatshrink
"
,
value
:
"
h
"
}
,
],
],
selectList
:
[],
selectList
:
[],
categoryList
:
[],
categoryList
:
[],
...
@@ -315,11 +320,13 @@ export default {
...
@@ -315,11 +320,13 @@ export default {
});
});
},
},
fetchCategory
()
{
fetchCategory
()
{
getAppsList
({
scope_type
:
"
distinct
"
}).
then
(
res
=>
{
getAppsList
({
scope_type
:
"
distinct
"
})
this
.
categoryList
=
res
.
data
.
then
((
res
)
=>
{
}).
catch
(
err
=>
{
this
.
categoryList
=
res
.
data
;
console
.
log
(
err
.
message
)
})
})
.
catch
((
err
)
=>
{
console
.
log
(
err
.
message
);
});
},
},
handleSizeChange
(
e
)
{
handleSizeChange
(
e
)
{
this
.
form
.
pagesize
=
e
;
this
.
form
.
pagesize
=
e
;
...
@@ -388,14 +395,14 @@ export default {
...
@@ -388,14 +395,14 @@ export default {
this
.
post
.
fileList
.
push
(
file
);
this
.
post
.
fileList
.
push
(
file
);
},
},
handleUploadRemove
(
file
,
fileList
)
{
handleUploadRemove
(
file
,
fileList
)
{
console
.
log
(
file
,
file
List
);
console
.
log
(
fileList
);
for
(
let
i
=
0
;
i
<
this
.
post
.
app_files
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
post
.
app_files
.
length
;
i
++
)
{
if
(
this
.
post
.
app_files
[
i
].
uuid
==
file
.
response
.
data
.
uuid
)
{
if
(
this
.
post
.
app_files
[
i
].
uuid
==
file
.
response
.
data
.
uuid
)
{
this
.
post
.
app_files
.
splice
(
i
,
1
);
this
.
post
.
app_files
.
splice
(
i
,
1
);
break
;
break
;
}
}
}
}
// this.post.app_files = fileList;
// this.post.app_files = fileList;
},
},
handleLogoChange
(
file
)
{
handleLogoChange
(
file
)
{
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
);
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
);
...
@@ -431,17 +438,18 @@ export default {
...
@@ -431,17 +438,18 @@ export default {
this
.
$refs
.
logo
.
submit
();
this
.
$refs
.
logo
.
submit
();
let
formData
=
new
FormData
();
let
formData
=
new
FormData
();
this
.
post
.
fileList
.
forEach
(
item
=>
{
this
.
post
.
fileList
.
forEach
(
(
item
)
=>
{
formData
.
append
(
"
fileList
"
,
item
.
file
)
formData
.
append
(
"
fileList
"
,
item
.
file
);
});
});
formData
.
append
(
"
logo
"
,
this
.
post
.
logo
.
file
)
formData
.
append
(
"
logo
"
,
this
.
post
.
logo
.
file
)
;
Object
.
keys
(
this
.
post
).
forEach
(
k
=>
{
Object
.
keys
(
this
.
post
).
forEach
(
(
k
)
=>
{
if
(
this
.
post
[
k
]
&&
typeof
this
.
post
[
k
]
!==
"
object
"
)
{
if
(
this
.
post
[
k
]
&&
typeof
this
.
post
[
k
]
!==
"
object
"
)
{
formData
.
append
(
k
,
this
.
post
[
k
])
formData
.
append
(
k
,
this
.
post
[
k
]);
}
}
});
});
addApp
(
formData
).
then
((
res
)
=>
{
addApp
(
formData
)
.
then
((
res
)
=>
{
this
.
$message
({
this
.
$message
({
type
:
"
success
"
,
type
:
"
success
"
,
message
:
`添加成功:
${
res
.
message
}
`
,
message
:
`添加成功:
${
res
.
message
}
`
,
...
@@ -450,9 +458,8 @@ export default {
...
@@ -450,9 +458,8 @@ export default {
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
this
.
$message
.
error
(
err
.
message
);
this
.
$message
.
error
(
err
.
message
);
});
});
}
}
else
if
(
this
.
dialogTitle
===
"
编辑
"
)
{
else
if
(
this
.
dialogTitle
===
"
编辑
"
)
{
updateApp
(
this
.
currentValue
.
uuid
,
this
.
post
)
updateApp
(
this
.
currentValue
.
uuid
,
this
.
post
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
// this.$set(this.list, this.currentIndex, Object.assign(this.currentValue, tmp))
// this.$set(this.list, this.currentIndex, Object.assign(this.currentValue, tmp))
...
@@ -474,8 +481,11 @@ export default {
...
@@ -474,8 +481,11 @@ export default {
});
});
},
},
onAdd
()
{
onAdd
()
{
setTimeout
(()
=>
{
this
.
clear
();
},
100
);
setTimeout
(()
=>
{
this
.
post
.
sort
=
this
.
form
.
pagesize
*
(
this
.
form
.
pagenum
-
1
)
+
this
.
list
.
length
+
1
;
this
.
clear
();
},
100
);
this
.
post
.
sort
=
this
.
form
.
pagesize
*
(
this
.
form
.
pagenum
-
1
)
+
this
.
list
.
length
+
1
;
this
.
dialogTitle
=
"
添加
"
;
this
.
dialogTitle
=
"
添加
"
;
this
.
dialogVisible
=
true
;
this
.
dialogVisible
=
true
;
},
},
...
...
frontend/src/views/system/evue.vue
View file @
0faf429a
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-alert
title=
"
EVUE文件转字节码文件
"
type=
"success"
></el-alert>
<el-alert
title=
"
字节码文件在线转换
"
type=
"success"
></el-alert>
<div
style=
"margin: 10px 0px"
>
<div
style=
"margin: 10px 0px"
>
<el-form>
<el-form>
<el-form-item>
<el-form-item>
<el-upload
<el-upload
class=
"upload-demo"
action=
"/api/v1/evm_store/build"
name=
"binfile"
name=
"binfile"
drag
drag
multiple
multiple
:on-success=
"handleUploaded"
ref=
"upload"
:file-list=
"fileList"
action=
"null"
:auto-upload=
"false"
:http-request=
"handleUploadFile"
:on-remove=
"handleUploadRemove"
>
>
<i
class=
"el-icon-upload"
></i>
<i
class=
"el-icon-upload"
></i>
<div
class=
"el-upload__text"
>
<div
class=
"el-upload__text"
>
将文件拖到此处,或
<em>
点击上传
</em>
将文件拖到此处,或
<em>
点击上传
</em>
</div>
</div>
<div
class=
"el-upload__tip"
slot=
"tip"
>
<div
class=
"el-upload__tip"
slot=
"tip"
>
请选择evue文件
</div>
请选择evue文件
</div>
</el-upload>
</el-upload>
</el-form-item>
</el-form-item>
<el-form-item>
<el-button
@
click=
"uploadFile"
>
开始上传
</el-button>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
//
import { postByteCodeFile } from "@/api/app-store";
import
{
postByteCodeFile
}
from
"
@/api/app-store
"
;
export
default
{
export
default
{
name
:
"
ByteCodeFile
"
,
name
:
"
ByteCodeFile
"
,
...
@@ -48,20 +50,47 @@ export default {
...
@@ -48,20 +50,47 @@ export default {
},
},
handleUploaded
(
response
)
{
handleUploaded
(
response
)
{
if
(
response
.
code
===
200
)
{
if
(
response
.
code
===
200
)
{
this
.
downloadFile
(
response
)
this
.
downloadFile
(
response
)
;
}
else
{
}
else
{
this
.
$message
.
warning
(
response
.
message
)
this
.
$message
.
warning
(
response
.
message
);
}
},
handleUploadFile
(
file
)
{
this
.
fileList
.
push
(
file
);
},
handleUploadRemove
(
file
,
fileList
)
{
console
.
log
(
fileList
);
for
(
let
i
=
0
;
i
<
this
.
fileList
.
length
;
i
++
)
{
if
(
this
.
fileList
[
i
].
uid
==
file
.
uid
)
{
this
.
fileList
.
splice
(
i
,
1
);
break
;
}
}
}
},
},
downloadFile
(
result
)
{
downloadFile
(
result
)
{
const
a
=
document
.
createElement
(
"
a
"
);
const
a
=
document
.
createElement
(
"
a
"
);
a
.
download
=
result
.
data
.
filename
a
.
download
=
result
.
data
.
filename
;
a
.
href
=
result
.
data
.
url
;
a
.
href
=
result
.
data
.
url
;
a
.
target
=
""
a
.
target
=
""
;
a
.
click
();
a
.
click
();
},
},
getConvertString
()
{
uploadFile
()
{
console
.
log
(
123456789
);
this
.
$refs
.
upload
.
submit
();
let
formData
=
new
FormData
();
this
.
fileList
.
forEach
((
item
)
=>
{
formData
.
append
(
"
binfile
"
,
item
.
file
);
});
postByteCodeFile
(
formData
)
.
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
this
.
downloadFile
(
res
);
}
else
{
this
.
$message
.
warning
(
res
.
message
);
}
})
.
catch
((
err
)
=>
{
this
.
$message
.
error
(
err
.
message
);
});
},
},
},
},
mounted
()
{},
mounted
()
{},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment