This commit is contained in:
parent
c17eaf593e
commit
86108ff4e9
|
|
@ -631,7 +631,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
// 身份证读卡器表单
|
// 身份证读卡器表单
|
||||||
idCardReaderForm: {
|
idCardReaderForm: {
|
||||||
idCardReaderAddress: '127.0.0.1:8080', // 身份证读卡器地址
|
idCardReaderAddress: 'ws://127.0.0.1:24011', // 身份证读卡器地址
|
||||||
},
|
},
|
||||||
// 身份证信息表单
|
// 身份证信息表单
|
||||||
idCardInfoForm: {
|
idCardInfoForm: {
|
||||||
|
|
@ -931,6 +931,7 @@ export default {
|
||||||
|
|
||||||
editUploadFileList: [], // 编辑时已上传的文件列表
|
editUploadFileList: [], // 编辑时已上传的文件列表
|
||||||
isEditContract: false, // 是否是编辑状态
|
isEditContract: false, // 是否是编辑状态
|
||||||
|
webSocket: null, // websocket连接
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -1439,6 +1440,36 @@ export default {
|
||||||
const age = new Date().getFullYear() - birthday.slice(0, 4)
|
const age = new Date().getFullYear() - birthday.slice(0, 4)
|
||||||
this.idCardInfoForm.age = age
|
this.idCardInfoForm.age = age
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 建立一个websocket连接
|
||||||
|
createWebSocket() {
|
||||||
|
this.webSocket = new WebSocket(
|
||||||
|
this.idCardReaderForm.idCardReaderAddress,
|
||||||
|
)
|
||||||
|
|
||||||
|
this.webSocket.onopen = function (evt) {
|
||||||
|
console.log('建立连接成功', evt)
|
||||||
|
}
|
||||||
|
this.webSocket.onclose = function (evt) {
|
||||||
|
console.log('断开连接', evt)
|
||||||
|
}
|
||||||
|
this.webSocket.onmessage = function (evt) {
|
||||||
|
console.log('收到消息', evt)
|
||||||
|
}
|
||||||
|
this.webSocket.onerror = function (evt) {
|
||||||
|
console.log('错误', evt)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 断开websocket连接
|
||||||
|
closeWebSocket() {
|
||||||
|
this.webSocket.close()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 下载身份证读卡器驱动
|
||||||
|
downloadIdCardReaderDriver() {
|
||||||
|
// window.open(this.idCardReaderForm.idCardReaderAddress)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
|
|
@ -1451,6 +1482,13 @@ export default {
|
||||||
})
|
})
|
||||||
|
|
||||||
this.getLotProjectSelectList()
|
this.getLotProjectSelectList()
|
||||||
|
this.createWebSocket()
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
if (this.webSocket) {
|
||||||
|
this.closeWebSocket()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue