Commit 5287727b authored by wanli's avatar wanli

feat(字节码文件转换前端): 支持上传多文件以及文件下载

parent 9383eeb7
No preview for this file type
...@@ -24,6 +24,14 @@ export function getReport(data) { ...@@ -24,6 +24,14 @@ export function getReport(data) {
}); });
} }
export function postByteCodeFile(data) {
return request({
url: "/api/v1/evm_store/build",
method: "post",
data
});
}
export function getWatchList() { export function getWatchList() {
return request({ return request({
url: "/api/v1/evm_store/watch", url: "/api/v1/evm_store/watch",
......
...@@ -230,6 +230,17 @@ export const constantRoutes = [ ...@@ -230,6 +230,17 @@ export const constantRoutes = [
meta: { title: 'opqcp', icon: 'home' } meta: { title: 'opqcp', icon: 'home' }
}] }]
}, },
{
path: '/evue',
redirect: '/evue/index',
component: Layout,
children: [{
path: 'index',
name: 'ByteCodeFile',
component: () => import('@/views/system/evue'),
meta: { title: 'evue', icon: 'home' }
}]
},
{ {
path: '/monitor', path: '/monitor',
redirect: '/monitor/index', redirect: '/monitor/index',
......
...@@ -85,6 +85,13 @@ export default { ...@@ -85,6 +85,13 @@ export default {
icon: "gongzuotai", icon: "gongzuotai",
path: "tool/index", path: "tool/index",
}, },
{
vue: "system/evue.vue",
title: "字节码文件转换",
name: "ByteCodeFile",
icon: "gongzuotai",
path: "tool/evue",
},
{ {
vue: "app-store/docs.vue", vue: "app-store/docs.vue",
title: "开发文档", title: "开发文档",
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-alert title="代码混淆工具" type="success"></el-alert> <el-alert title="EVUE文件转字节码文件" type="success"></el-alert>
<div style="margin: 10px 0px"> <div style="margin: 10px 0px">
<el-form> <el-form>
<el-form-item> <el-form-item>
...@@ -8,33 +8,32 @@ ...@@ -8,33 +8,32 @@
class="upload-demo" class="upload-demo"
action="/api/v1/evm_store/build" action="/api/v1/evm_store/build"
name="binfile" name="binfile"
drag
multiple
:on-success="handleUploaded" :on-success="handleUploaded"
:file-list="fileList" :file-list="fileList"
> >
<el-button size="small" type="primary">点击上传</el-button> <i class="el-icon-upload"></i>
<div slot="tip" class="el-upload__tip"> <div class="el-upload__text">
上传C源文件,转换完成后会自动下载 将文件拖到此处,或<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
请选择evue文件
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item>
<el-button type="success" @click="getConvertString">转换</el-button>
</el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { actionOpqcp } from "@/api/app-store"; // import { postByteCodeFile } from "@/api/app-store";
export default { export default {
name: "Opqcp", name: "ByteCodeFile",
data() { data() {
return { return {
fileList: [], fileList: [],
inputString: null,
outputString: null,
filename: "app.js",
}; };
}, },
methods: { methods: {
...@@ -48,42 +47,18 @@ export default { ...@@ -48,42 +47,18 @@ export default {
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
}, },
handleUploaded(response) { handleUploaded(response) {
if (response.code == 200) { console.log(response);
this.filename = response.data.filename this.downloadFile(response)
actionOpqcp({ filename: response.data.filepath })
.then((res) => {
this.$message.success(res.message);
// const a = document.createElement("a");
// a.href = url;
// a.download = filename;
// a.click();
})
.catch((err) => {
this.$message.error(err.message);
});
}
console.log(response)
}, },
downloadFile() { downloadFile(result) {
this.$prompt("请输入文件名", "提示", { const a = document.createElement("a");
confirmButtonText: "确定", a.download = result.data.filename
cancelButtonText: "取消", a.href = result.data.url;
inputValue: this.filename, a.target = ""
inputErrorMessage: "文件名格式不正确", a.click();
})
.then(({ value }) => {
if (value) this.filename = value;
this.createFile(this.outputString, this.filename);
})
.catch(() => {
this.$message({
type: "info",
message: "取消输入",
});
});
}, },
getConvertString() { getConvertString() {
console.log(123456789);
}, },
}, },
mounted() {}, mounted() {},
......
...@@ -36,7 +36,7 @@ module.exports = { ...@@ -36,7 +36,7 @@ module.exports = {
pathRewrite: {}, pathRewrite: {},
}, },
"/api/v1/evm_store": { "/api/v1/evm_store": {
target: "http://store.evmiot.com/", target: "http://localhost:3000/",
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
// 这里理解成用/api代替target里面的地址,后面组件中我们调用接口时直接用api代替 // 这里理解成用/api代替target里面的地址,后面组件中我们调用接口时直接用api代替
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment