commit
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
<el-card shadow="never" class="pc-signature-card">
|
||||
<div class="pc-signature">
|
||||
<el-link type="primary">扫描下方二维码进行签字</el-link>
|
||||
<div class="signature-body">
|
||||
<QrCode v-if="!signatureContent" :options="{ width: 126 }" :value="signatureAddress" class="signature-qrcode"></QrCode>
|
||||
<div class="signature-body" v-loading="loading">
|
||||
<QrCode v-if="!signatureContent" :options="{ width: 126 }" :value="signatureAddress"
|
||||
class="signature-qrcode"></QrCode>
|
||||
<el-image v-if="signatureContent" :src="signatureContent" class="signature-image"></el-image>
|
||||
</div>
|
||||
<el-link type="danger" icon="el-icon-edit" @click="signatureAgain" v-if="signatureContent">重签</el-link>
|
||||
@@ -38,7 +39,8 @@ module.exports = {
|
||||
id: new Date().getTime() + Math.floor(Math.random() * 10000) + 1,
|
||||
signatureAddress: null,
|
||||
interval: null,
|
||||
signatureContent: null
|
||||
signatureContent: null,
|
||||
loading: true,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -64,6 +66,16 @@ module.exports = {
|
||||
this.signatureContent = data.value
|
||||
this.$emit("input", data.value)
|
||||
})
|
||||
|
||||
// 可选:轮询或 watch ready 状态
|
||||
const checkReady = () => {
|
||||
if (window.webSocketPubSub.ws.readyState === 1) {
|
||||
this.loading = false; // 允许签字
|
||||
} else {
|
||||
setTimeout(checkReady, 100);
|
||||
}
|
||||
};
|
||||
checkReady();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
this.isSubscribed = true
|
||||
this.sendJoinMessage()
|
||||
}
|
||||
}, 500)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 事件处理
|
||||
@@ -202,6 +202,7 @@
|
||||
// )
|
||||
// 连接建立时不立即发送 join,等待订阅完成
|
||||
this.ping()
|
||||
console.log('websocket open success')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +246,7 @@
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
}, 2000) // 延迟2秒重连
|
||||
}, 1000) // 延迟2秒重连
|
||||
}
|
||||
|
||||
// 窗口事件处理
|
||||
|
||||
Reference in New Issue
Block a user