<template>
|
<div :ref="'settings'" class="settings-sub-container">
|
<el-form ref="form" :model="formData" label-width="150px" class="margin-top-20">
|
<el-form-item label="货主编号">
|
<el-input v-model="formData.consignorCode" class="w-500 app-secret"></el-input>
|
</el-form-item>
|
<el-form-item label="token">
|
<el-input v-model="formData.token" class="w-500 app-secret"></el-input>
|
</el-form-item>
|
<el-form-item label="时间戳timestamp">
|
<el-input v-model="formData.timestamp" class="w-300 app-secret"></el-input>
|
<el-button type="text" icon="el-icon-yrt-shuaxin" @click="refreshTimestamp">刷新</el-button>
|
</el-form-item>
|
<el-form-item label="随机数nonce">
|
<el-input v-model="formData.nonce" class="w-300 app-secret"></el-input>
|
<el-button type="text" icon="el-icon-yrt-shuaxin" @click="refreshNonce">刷新</el-button>
|
</el-form-item>
|
<el-form-item label="签名signature">
|
<el-input v-model="formData.signature" class="w-500 app-secret"></el-input>
|
</el-form-item>
|
<el-form-item label="推送内容">
|
<el-input v-model="formData.json" :rows="3" type="textarea" class="w-500 app-secret"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" icon="el-icon-yrt-shuaxin1" @click="createSignature()">生成签名</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
name: "settings-pda",
|
|
components: {},
|
data() {
|
return {
|
Type_Id: 585, // 通用参数类别ID,不可修改
|
// 编辑数据对象
|
formData: {
|
consignorCode: null,
|
token: null,
|
timestamp: null,
|
nonce: null,
|
signature: null
|
},
|
// 接口数据
|
valueList: []
|
};
|
},
|
mounted() {
|
this.refreshTimestamp();
|
this.refreshNonce();
|
},
|
methods: {
|
handleClose(tag) {},
|
// 刷新timestamp
|
refreshTimestamp() {
|
this.formData.timestamp = new Date().valueOf();
|
this.formData.signature = null;
|
},
|
// 刷新timestamp
|
refreshNonce() {
|
this.formData.nonce = Math.random()
|
.toString(36)
|
.substr(2);
|
this.formData.signature = null;
|
},
|
// 生成签名
|
createSignature() {
|
const signature = this.common.getSignature2(
|
this.formData.consignorCode,
|
this.formData.token,
|
this.formData.timestamp,
|
this.formData.nonce,
|
this.formData.json
|
);
|
this.$set(this.formData, "signature", signature);
|
if (signature) {
|
this.$message.success("生成成功");
|
}
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.settings-sub-container {
|
/deep/ .sub-title {
|
font-size: 14px;
|
padding-bottom: 10px;
|
border-bottom: 1px solid #ebeef5;
|
padding-top: 20px;
|
margin-bottom: 10px;
|
}
|
/deep/ .el-form-item__label {
|
font-weight: normal;
|
}
|
.remark {
|
color: #888;
|
}
|
/deep/ .el-form-item {
|
margin-bottom: 20px;
|
}
|
.form-footer {
|
margin-top: 30px;
|
}
|
}
|
</style>
|