|
@@ -17,7 +17,7 @@
|
|
|
<image :src = "imgUrl+'/index/bluetooth.png'"/>
|
|
<image :src = "imgUrl+'/index/bluetooth.png'"/>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
- <view class="item" @click="scan2">
|
|
|
|
|
|
|
+ <view class="item" @click="scan">
|
|
|
<image :src = "imgUrl+'/index/scan.png'"/>
|
|
<image :src = "imgUrl+'/index/scan.png'"/>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -45,23 +45,50 @@
|
|
|
},
|
|
},
|
|
|
onLoad: function() {
|
|
onLoad: function() {
|
|
|
},
|
|
},
|
|
|
|
|
+ onShow(){
|
|
|
|
|
+ this.readScanResult();
|
|
|
|
|
+ },
|
|
|
methods:{
|
|
methods:{
|
|
|
|
|
+ readScanResult(){
|
|
|
|
|
+ let self = this;
|
|
|
|
|
+ uni.$on("scanResult", data => {
|
|
|
|
|
+ getDeviceInfoFromQrcode(data).then(res=>{
|
|
|
|
|
+ if(res.data != null){
|
|
|
|
|
+ let imei = res.data.imei;
|
|
|
|
|
+ let ccid = res.data.ccid;
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ uni.$off('scanResult');
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
scan(){
|
|
scan(){
|
|
|
- uni.scanCode({
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- console.log('条码类型:' + res.scanType);
|
|
|
|
|
- console.log('条码内容:' + res.result);
|
|
|
|
|
- getDeviceInfoFromQrcode(res.result).then(res=>{
|
|
|
|
|
- if(res.data != null){
|
|
|
|
|
- let imei = res.data.imei;
|
|
|
|
|
- let ccid = res.data.ccid;
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if(window.location.href.indexOf("localhost") != -1){
|
|
|
|
|
+ this.scan2();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: '/pages/weitiandi/device/scan'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // uni.scanCode({
|
|
|
|
|
+ // success: function (res) {
|
|
|
|
|
+ // console.log('条码类型:' + res.scanType);
|
|
|
|
|
+ // console.log('条码内容:' + res.result);
|
|
|
|
|
+ // getDeviceInfoFromQrcode(res.result).then(res=>{
|
|
|
|
|
+ // if(res.data != null){
|
|
|
|
|
+ // let imei = res.data.imei;
|
|
|
|
|
+ // let ccid = res.data.ccid;
|
|
|
|
|
+ // uni.navigateTo({
|
|
|
|
|
+ // url: '/pages/weitiandi/device/index?id='+imei+'&ccid='+ccid
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
},
|
|
},
|
|
|
scan2(){
|
|
scan2(){
|
|
|
getDeviceInfoFromQrcode("http://wetiandi.com/app/index.php?i=1&j=1&c=entry&m=wdl_shopping&do=wepay&sn=GD1B342399").then(res=>{
|
|
getDeviceInfoFromQrcode("http://wetiandi.com/app/index.php?i=1&j=1&c=entry&m=wdl_shopping&do=wepay&sn=GD1B342399").then(res=>{
|