feat: 接入天河链存证接口
This commit is contained in:
@@ -157,24 +157,9 @@
|
||||
<n-form-item :label="t('pages.outbound.outImage')">
|
||||
<media-upload v-model="outImages" type="image" :max="8" />
|
||||
</n-form-item>
|
||||
<n-divider style="margin: 4px 0 14px">{{ t('pages.outbound.onchainSection') }}</n-divider>
|
||||
<n-grid :cols="2" :x-gap="16">
|
||||
<n-form-item-gi span="2" :label="t('pages.blockchain.txHash')">
|
||||
<n-input v-model:value="outboundForm.txHash" :placeholder="t('pages.outbound.txHashTip')" />
|
||||
</n-form-item-gi>
|
||||
<n-form-item-gi :label="t('pages.blockchain.onchainAt')">
|
||||
<n-date-picker v-model:formatted-value="outboundForm.onchainAt" value-format="yyyy-MM-dd HH:mm" type="datetime" clearable style="width: 100%" />
|
||||
</n-form-item-gi>
|
||||
<n-form-item-gi span="2">
|
||||
<n-collapse>
|
||||
<n-collapse-item :title="t('pages.outbound.moreOnchainInfo')" name="more-onchain">
|
||||
<n-form-item :label="t('pages.blockchain.blockHeight')">
|
||||
<n-input-number v-model:value="outboundForm.blockHeight" :min="0" style="width: 100%" />
|
||||
</n-form-item>
|
||||
</n-collapse-item>
|
||||
</n-collapse>
|
||||
</n-form-item-gi>
|
||||
</n-grid>
|
||||
<n-alert type="info" :bordered="false" class="onchain-tip">
|
||||
{{ t('pages.outbound.onchainAutoTip') }}
|
||||
</n-alert>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
<div style="text-align: right">
|
||||
@@ -293,9 +278,6 @@ const outImages = ref<any[]>([]);
|
||||
const outboundForm = reactive<any>({
|
||||
outTime: null,
|
||||
remark: '',
|
||||
txHash: '',
|
||||
onchainAt: null,
|
||||
blockHeight: null,
|
||||
});
|
||||
|
||||
const columns = computed<DataTableColumns<any>>(() => {
|
||||
@@ -721,12 +703,6 @@ function formatDateTime(value?: string | Date | null) {
|
||||
return value ? dayjs(value).format('YYYY-MM-DD HH:mm') : null;
|
||||
}
|
||||
|
||||
function toNumber(value: unknown) {
|
||||
if (value === null || value === undefined || value === '') return null;
|
||||
const n = Number(value);
|
||||
return Number.isFinite(n) ? n : null;
|
||||
}
|
||||
|
||||
function fileName(key: string) {
|
||||
return key.split('/').pop() || key;
|
||||
}
|
||||
@@ -743,12 +719,8 @@ function getOutImages(row: any) {
|
||||
|
||||
function openOutboundModal(row: any) {
|
||||
outboundTarget.value = row;
|
||||
const latestProof = row.latestProof;
|
||||
outboundForm.outTime = formatDateTime(row.outTime);
|
||||
outboundForm.remark = row.remark || '';
|
||||
outboundForm.txHash = latestProof?.txHash || '';
|
||||
outboundForm.onchainAt = formatDateTime(latestProof?.onchainAt);
|
||||
outboundForm.blockHeight = toNumber(latestProof?.blockHeight);
|
||||
outImages.value = getOutImages(row);
|
||||
outboundModal.value = true;
|
||||
}
|
||||
@@ -765,9 +737,6 @@ async function saveOutbound(triggerOnchain: boolean) {
|
||||
outTime: outboundForm.outTime ? dayjs(outboundForm.outTime).toISOString() : null,
|
||||
outImageKey: outImages.value[0]?.key ?? null,
|
||||
outImageKeys: outImages.value.map((item) => item.key).filter(Boolean),
|
||||
txHash: outboundForm.txHash || undefined,
|
||||
onchainAt: outboundForm.onchainAt ? dayjs(outboundForm.onchainAt).toISOString() : undefined,
|
||||
blockHeight: outboundForm.blockHeight ?? undefined,
|
||||
remark: outboundForm.remark || null,
|
||||
});
|
||||
if (triggerOnchain) {
|
||||
@@ -932,6 +901,9 @@ onUnmounted(() => {
|
||||
.mr8 {
|
||||
margin-right: 8px;
|
||||
}
|
||||
.onchain-tip {
|
||||
margin-top: 4px;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.toolbar-control,
|
||||
.toolbar-control.wide,
|
||||
|
||||
Reference in New Issue
Block a user