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