mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 17:49:36 +08:00
描述: 扫码开门
This commit is contained in:
parent
fc232f8e8a
commit
d9068e21fb
@ -3,10 +3,10 @@ import {
|
|||||||
} from '../selfRequest';
|
} from '../selfRequest';
|
||||||
|
|
||||||
|
|
||||||
// 用户信息
|
// 开门
|
||||||
export function callScanUrl(data) {
|
export function callScanUrl(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/equipment/scanOpenDoor',
|
url: '/api/equipment/scanChangyangOpenDoor',
|
||||||
method: "get",
|
method: "get",
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
|
@ -169,6 +169,18 @@ Page({
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log('onLoad options', options);
|
console.log('onLoad options', options);
|
||||||
let _this = this;
|
let _this = this;
|
||||||
|
|
||||||
|
// 获取到二维码原始链接内容
|
||||||
|
if (options.q) {
|
||||||
|
let url = decodeURIComponent(options.q)
|
||||||
|
let urlParam = getUrlParamsObj(url);
|
||||||
|
// 是否携带其他参数
|
||||||
|
if (!urlParam.noParam) {
|
||||||
|
_this.setData({
|
||||||
|
qrcodeParam: urlParam
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 切换tabbar
|
// 切换tabbar
|
||||||
@ -213,6 +225,11 @@ Page({
|
|||||||
bannerList
|
bannerList
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// 判断是否开门
|
||||||
|
if (_this.data.qrcodeParam) {
|
||||||
|
// 扫码调用地址
|
||||||
|
_this.scanCallUrl()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
app.selfShowMsg(res.msg, '/pages/login/login')
|
app.selfShowMsg(res.msg, '/pages/login/login')
|
||||||
}
|
}
|
||||||
@ -240,22 +257,59 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 成功通知
|
// 扫一扫
|
||||||
showSuccessMsg(msg) {
|
jumpScan() {
|
||||||
Notify({
|
let _this = this;
|
||||||
type: 'success',
|
wx.scanCode({
|
||||||
top: '160rpx',
|
scanType: 'qrCode',
|
||||||
message: msg
|
success(res) {
|
||||||
});
|
console.log('success', res)
|
||||||
|
let url = res.result;
|
||||||
|
// 判断二维码是否符合规范
|
||||||
|
if (url.indexOf(app.DOMAIN_NAME_PREFIX) != -1) {
|
||||||
|
let urlParam = getUrlParamsObj(url);
|
||||||
|
// 判断是否有设备参数
|
||||||
|
if (!urlParam.noParam) {
|
||||||
|
_this.setData({
|
||||||
|
qrcodeParam: urlParam
|
||||||
|
})
|
||||||
|
// 扫码调用地址
|
||||||
|
_this.scanCallUrl()
|
||||||
|
} else {
|
||||||
|
// 危险通知
|
||||||
|
app.vantNotifyErrTop(Notify, '请预约会议!')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 危险通知
|
||||||
|
app.vantNotifyErrTop(Notify, '二维码不正确!')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
console.log('fail', res)
|
||||||
|
// 危险通知
|
||||||
|
app.vantNotifyErrTop(Notify, '扫码失败!')
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 危险通知
|
// 扫码调用地址
|
||||||
showErrMsg(msg) {
|
scanCallUrl() {
|
||||||
Notify({
|
let _this = this;
|
||||||
type: 'danger',
|
let qrcodeParam = _this.data.qrcodeParam;
|
||||||
top: '160rpx',
|
qrcodeParam.userId = wx.getStorageSync('userId')
|
||||||
message: msg
|
callScanUrl(qrcodeParam).then(res => {
|
||||||
});
|
// 清空扫码数据
|
||||||
|
_this.setData({
|
||||||
|
qrcodeParam: null
|
||||||
|
})
|
||||||
|
if (res.code == 0) {
|
||||||
|
// 成功通知
|
||||||
|
app.vantNotifySuccessTop(Notify, res.msg)
|
||||||
|
} else {
|
||||||
|
// 危险通知
|
||||||
|
app.vantNotifyErrTop(Notify, res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
})
|
})
|
@ -1,7 +1,7 @@
|
|||||||
<view class="containerView public">
|
<view class="containerView public">
|
||||||
|
|
||||||
<view class="topHead">
|
<view class="topHead">
|
||||||
<!-- <image class="scanImg" src="{{IMG_NAME + '/profile/static/index/scan.png'}}" mode="aspectFill" bind:tap="jumpScan"></image> -->
|
<image class="scanImg" src="{{IMG_NAME + '/profile/static/index/scan.png'}}" mode="aspectFill" bind:tap="jumpScan"></image>
|
||||||
<view class="title ellipsisFont">{{parkName}}</view>
|
<view class="title ellipsisFont">{{parkName}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user