Commit 41644b7a authored by 肖健's avatar 肖健

小程序内扫码完善

parent 7f6de3a8
......@@ -78,6 +78,7 @@ export default {
onLoad() {},
methods: {
setSelected(index) {
const that = this
if (index != 2) {
uni.navigateTo({
url: this.tabBar.list[index].pagePath,
......@@ -85,18 +86,60 @@ export default {
} else {
//扫码
// 允许从相机和相册扫码
uni.navigateTo({
url: '/pagesB/pages/move-car/scan',
});
// uni.navigateTo({
// url: '/pagesB/pages/move-car/scan',
// });
uni.scanCode({
success: function (res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
let path = res.path
if(path) {
let xcxIndexPath = uni.getStorageSync('xcxIndexPath')
if(xcxIndexPath) {
xcxIndexPath = path.replace(xcxIndexPath, '').replace("?", '')
if(xcxIndexPath.indexOf('scene') >= 0 ) {
let scene = xcxIndexPath.replace('scene=', '')
let param = {code : scene}
let opts = { url: '/app/index/check/move/code', method: 'post' }
that.http.httpTokenRequest(opts, param).then(res => {
console.info(res)
if (res.data.code == 200) {
if(res.data.data.bindFlag) {
that.gotoMoveCar(scene)
} else {
that.gotoBindMoveCar(scene)
}
}
})
}
}
} else {
uni.showToast({
title:'扫码失败',
icon:'none',
})
}
}
});
}
this.$forceUpdate();
},
//跳转到挪车页面
gotoMoveCar(s) {
let that = this;
uni.navigateTo({
url: '/pagesB/pages/move-car/oneMoveCar?scene=' + s
});
},
//跳转到绑定页面
gotoBindMoveCar(s) {
let that = this;
uni.navigateTo({
url: '/pagesB/pages/move-car/scan?moveCode=' + s
});
},
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment