|
@@ -246,52 +246,29 @@
|
|
|
/* 扫一扫*/
|
|
|
saoCode() {
|
|
|
let self = this;
|
|
|
- console.log('0-扫码>>>')
|
|
|
uni.scanCode({
|
|
|
onlyFromCamera: true,
|
|
|
success: function(res) {
|
|
|
- console.log('1-res>>>',res)
|
|
|
let list = res.result.split("?")[1].split("&");
|
|
|
- console.log('2-res>>>',list)
|
|
|
let codeData = {};
|
|
|
- console.log('3-res>>>',codeData)
|
|
|
list.forEach((item) => {
|
|
|
codeData[item.split("=")[0]] = item.split("=")[1];
|
|
|
})
|
|
|
- console.log('4-res>>>',codeData)
|
|
|
- setTimeout(function() {
|
|
|
- console.log('5-res>>>',codeData)
|
|
|
- if(codeData.type == 1 || codeData.type == 2 || codeData.type == 3 || codeData.type == 5 || codeData.type == 7 ||
|
|
|
- codeData.type == 8 || codeData.type == 9 || codeData.type == 10 ||
|
|
|
- codeData.type == 11 || codeData.type == 12){
|
|
|
- console.log('6-res>>>',codeData)
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(res.result)
|
|
|
- });
|
|
|
- }else{
|
|
|
- console.log('7-res>>>',codeData)
|
|
|
- uni.showToast({
|
|
|
- mask: true,
|
|
|
- icon: "none",
|
|
|
- position: "center",
|
|
|
- title: '请扫描正确的小程序二维码',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- }
|
|
|
- }, 1500);
|
|
|
- },
|
|
|
- fail:function(res){
|
|
|
- console.log('8-res>>>',res)
|
|
|
- uni.showToast({
|
|
|
- mask: true,
|
|
|
- icon: "none",
|
|
|
- position: "center",
|
|
|
- title: '二维码识别失败,请重新尝试',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- },
|
|
|
- complete:function(res){
|
|
|
- console.log('9-res>>>',res)
|
|
|
+ if(codeData.type == 1 || codeData.type == 2 || codeData.type == 3 || codeData.type == 5 || codeData.type == 7 ||
|
|
|
+ codeData.type == 8 || codeData.type == 9 || codeData.type == 10 ||
|
|
|
+ codeData.type == 11 || codeData.type == 12){
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(res.result)
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ mask: true,
|
|
|
+ icon: "none",
|
|
|
+ position: "center",
|
|
|
+ title: '请扫描正确的小程序二维码',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|