|
|
|
@ -1,15 +1,15 @@ |
|
|
|
|
<!-- 加密测试 --> |
|
|
|
|
<template> |
|
|
|
|
<div class="app-container"> |
|
|
|
|
<el-form label-width="80px" :model="requestBody"> |
|
|
|
|
<el-form-item label="加密key"> |
|
|
|
|
<el-input v-model="requestBody.key"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="order明文"> |
|
|
|
|
<el-form-item label="order明文" > |
|
|
|
|
<el-input type="textarea" v-model="requestBody.order"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-button type="primary" @click="onSubmit">加密</el-button> |
|
|
|
|
<el-button type="primary" @click="onEncrypt">加密</el-button> |
|
|
|
|
<el-button type="primary" @click="onFormatJson">JSON格式化</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="返回报文"> |
|
|
|
|
<el-input type="textarea" v-model="requestBody.resp"></el-input> |
|
|
|
@ -19,7 +19,7 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {encrypt} from "@/api/sandbox/encrypt" |
|
|
|
|
import { encrypt } from "@/api/sandbox/encrypt"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
@ -29,17 +29,28 @@ export default { |
|
|
|
|
order: "", |
|
|
|
|
resp: "" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
onSubmit() { |
|
|
|
|
this.requestBody.resp = "" |
|
|
|
|
onEncrypt() { |
|
|
|
|
this.requestBody.resp = ""; |
|
|
|
|
encrypt(this.requestBody).then(res => { |
|
|
|
|
if (res.code == 200) { |
|
|
|
|
this.requestBody.resp = res.data |
|
|
|
|
if (res.code === 200) { |
|
|
|
|
this.requestBody.resp = res.data; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
onFormatJson() { |
|
|
|
|
try { |
|
|
|
|
const formattedJson = JSON.stringify(JSON.parse(this.requestBody.order), null, 2); |
|
|
|
|
this.requestBody.order = formattedJson; |
|
|
|
|
} catch (error) { |
|
|
|
|
// Handle JSON parse error |
|
|
|
|
console.error("Invalid JSON"); |
|
|
|
|
this.$modal.msgError("JSON格式化失败,请检查格式!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|