|
|
|
@ -1,25 +1,27 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="app-container"> |
|
|
|
|
<el-form label-width="80px" :model="requestBody"> |
|
|
|
|
<el-form-item label="加密key"> |
|
|
|
|
<el-form-item label="密钥"> |
|
|
|
|
<el-input v-model="requestBody.key"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="order明文" > |
|
|
|
|
<el-input type="textarea" v-model="requestBody.order"></el-input> |
|
|
|
|
<el-form-item label="原始报文" > |
|
|
|
|
<el-input type="textarea" :autosize="{ minRows: 10}" v-model="requestBody.order"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-button type="primary" @click="onEncrypt">加密</el-button> |
|
|
|
|
<el-button type="primary" @click="decrypt">解密</el-button> |
|
|
|
|
<el-button type="primary" @click="onFormatJson">JSON格式化</el-button> |
|
|
|
|
<el-button type="primary" @click="clear">清空数据</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="返回报文"> |
|
|
|
|
<el-input type="textarea" v-model="requestBody.resp"></el-input> |
|
|
|
|
<el-input :autosize="{ minRows: 17}" type="textarea" v-model="requestBody.resp"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { encrypt } from "@/api/sandbox/encrypt"; |
|
|
|
|
import { decrypt, encrypt } from '@/api/sandbox/encrypt' |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
@ -37,6 +39,18 @@ export default { |
|
|
|
|
encrypt(this.requestBody).then(res => { |
|
|
|
|
if (res.code === 200) { |
|
|
|
|
this.requestBody.resp = res.data; |
|
|
|
|
}else { |
|
|
|
|
this.$modal.msgError("加密失败!"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
decrypt() { |
|
|
|
|
this.requestBody.resp = ""; |
|
|
|
|
decrypt(this.requestBody).then(res => { |
|
|
|
|
if (res.code === 200) { |
|
|
|
|
this.requestBody.resp = res.data; |
|
|
|
|
}else { |
|
|
|
|
this.$modal.msgError("解密失败!"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
@ -48,8 +62,12 @@ export default { |
|
|
|
|
// Handle JSON parse error |
|
|
|
|
console.error("Invalid JSON"); |
|
|
|
|
this.$modal.msgError("JSON格式化失败,请检查格式!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
clear(){ |
|
|
|
|
this.requestBody.key = ""; |
|
|
|
|
this.requestBody.order = ""; |
|
|
|
|
this.requestBody.resp = ""; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|