设备扫码注册以及我的二维码修改

This commit is contained in:
仲么了
2023-08-31 11:15:58 +08:00
parent a105006e0f
commit 34b4061053
4 changed files with 37 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
// export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt // export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
export const MQTT_IP = 'pqmcn.com:8085/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt export const MQTT_IP = 'pqmcn.com:8884/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
const MQTT_USERNAME = 't_user'//mqtt用户名 const MQTT_USERNAME = 't_user'//mqtt用户名
const MQTT_PASSWORD = 'njcnpqs'//密码 const MQTT_PASSWORD = 'njcnpqs'//密码

View File

@@ -1,5 +1,5 @@
<template> <template>
<Cn-page :loading="loading" noPadding beforeRender> <Cn-page :loading="loading" noPadding>
<view slot="body"> <view slot="body">
<view class="detail" :style="{ opacity: domLoading ? '0' : '1' }" style="overflow: hidden"> <view class="detail" :style="{ opacity: domLoading ? '0' : '1' }" style="overflow: hidden">
<view class="detail-header"> <view class="detail-header">
@@ -321,7 +321,7 @@ export default {
this.client = mqtt.connect('wx://' + MQTT_IP, MQTT_OPTIONS) this.client = mqtt.connect('wx://' + MQTT_IP, MQTT_OPTIONS)
// #endif // #endif
// #ifdef H5 // #ifdef H5
this.client = mqtt.connect('ws://' + MQTT_IP, MQTT_OPTIONS) this.client = mqtt.connect('wss://' + MQTT_IP, MQTT_OPTIONS)
// #endif // #endif
this.client this.client
.on('connect', () => { .on('connect', () => {

View File

@@ -297,12 +297,13 @@ export default {
}, },
scanCode() { scanCode() {
uni.scanCode({ uni.scanCode({
success(res) { success: (res) => {
console.log('条码类型:' + res.scanType) console.log('条码类型:' + res.scanType)
console.log('条码内容:' + res.result) console.log('条码内容:' + res.result)
let content = JSON.parse(res.result) let content = JSON.parse(res.result)
console.log(content)
if (content.type === 'NDID') { if (content.type === 'NDID') {
this.formData.nDid = content.nDid this.formData.nDid = content.data
this.register() this.register()
} }
}, },

View File

@@ -1,5 +1,6 @@
<template> <template>
<view class="transfer"> <Cn-page :loading="loading" before-render>
<view class="transfer" slot="body">
<!-- <div class="transfer-img" ref="qrCodeUrl" /> --> <!-- <div class="transfer-img" ref="qrCodeUrl" /> -->
<Cn-htmlToImg domId="content" @renderFinish="renderFinish" style="display: flex"> <Cn-htmlToImg domId="content" @renderFinish="renderFinish" style="display: flex">
<view class="content" id="content"> <view class="content" id="content">
@@ -11,7 +12,7 @@
<view class="user-info-role">{{ roleName }}</view> <view class="user-info-role">{{ roleName }}</view>
</view> </view>
</view> </view>
<uqrcode size="260" ref="uqrcode" canvas-id="qrcode" :value="content" <uqrcode size="260" ref="uqrcode" canvas-id="qrcode" :value="content" @complete="loading = false"
:loading="false"></uqrcode> :loading="false"></uqrcode>
</view> </view>
</Cn-htmlToImg> </Cn-htmlToImg>
@@ -26,6 +27,7 @@
<button class="transfer-btn-item ml20" @click="home">转移成功</button> <button class="transfer-btn-item ml20" @click="home">转移成功</button>
</view> --> </view> -->
</view> </view>
</Cn-page>
</template> </template>
<script> <script>
// import QRCode from 'qrcodejs2' // import QRCode from 'qrcodejs2'
@@ -71,10 +73,12 @@ export default {
this.img = e this.img = e
}, },
save() { save() {
console.log(this.img)
if (!this.img) { if (!this.img) {
setTimeout(() => { setTimeout(() => {
this.save() this.save()
}, 500) }, 500)
return
} }
base64ToPath(this.img).then((res) => { base64ToPath(this.img).then((res) => {
console.log(res) console.log(res)