首页修改
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
<view class="transfer">
|
||||
<!-- <div class="transfer-img" ref="qrCodeUrl" /> -->
|
||||
<!-- <uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }"></uqrcode> -->
|
||||
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }" :loading="false"></uqrcode>
|
||||
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="content" :options="{ margin: 10 }"
|
||||
:loading="false"></uqrcode>
|
||||
|
||||
<canvas id="qrcode" width="200" height="200"></canvas>
|
||||
<view class="transfer-text">请让接收人员扫码接收</view>
|
||||
@@ -12,7 +13,7 @@
|
||||
<button class="transfer-btn-item" style="background-color: #fff; color: #111" @click="back">
|
||||
返回
|
||||
</button>
|
||||
<button class="transfer-btn-item ml20" @click="home">转移成功</button>
|
||||
<button class="transfer-btn-item ml20" @click="scan">扫一扫</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -22,22 +23,51 @@
|
||||
// import QRCode from 'qrcodejs2'
|
||||
// import UQRCode from '@/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
|
||||
|
||||
import {transferDevice} from "@/common/api/device";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
content: '',
|
||||
options: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
uni.navigateBack({delta: 1})
|
||||
},
|
||||
home() {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
uni.navigateBack({delta: 1})
|
||||
},
|
||||
transferDevice(userId) {
|
||||
transferDevice(this.options.id, userId).then((res) => {
|
||||
uni.showToast({
|
||||
title: '移交成功',
|
||||
icon: 'none',
|
||||
})
|
||||
uni.navigateBack()
|
||||
})
|
||||
},
|
||||
scan() {
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
let data = JSON.parse(res.result)
|
||||
if (data.type === 'userId') {
|
||||
this.transferDevice(data.id)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请扫描正确的二维码',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
this.options = options
|
||||
this.content = JSON.stringify({
|
||||
type: 'transferDevice',
|
||||
id: options.id,
|
||||
|
||||
Reference in New Issue
Block a user