qrcode() {
uni.getLocation({
success: ({
latitude,
longitude
}) => {
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: async (res) => {
let jsonQR = JSON.parse(res.result);
if (!jsonQR.placeId) return void 0;
const data = await this.getPlaceById(jsonQR.placeId);
if (!data) return void uni.showToast({
title: "场所信息获取失败",
icon: "none"
});
let distance = this.distance(data.latitude, data.longitude,
latitude, longitude) * 1000;
if (distance > data.bufferRange) {
uni.showToast({
icon: "none",
title: "请在设备附近进行扫码巡查",
})
} else {
this.placeId = data.id;
this.responsibleId = data.responsibleId;
let userId = uni.getStorageSync("USERBEAN").id;
let userType = uni.getStorageSync("USERBEAN").roleType;
if (this.responsibleId.indexOf(userId) != -1 || userType
.indexOf("1") != -1 || userType.indexOf("2") != -1) {
this.$refs.rolePopue.open();
} else {
uni.navigateTo({
url: './place/codePatrol?id=' + this.placeId
})
}
}
},
fail(e){
console.log(e)
},
complete: () => {
console.log("complete")
}
});
},
fail: () => {
uni.showToast({
icon: "none",
title: "请检查定位服务及权限是否开启"
})
}
})
},
7***@qq.com (作者)
这在客户的手机上的,我这里没有此设备呢
2021-12-07 14:51
真真假假
我也经常出现这种问题,包括模拟机和真机都会出现
2022-02-09 16:38