diff --git a/page_fenbao/statulist/fault/yichang/index.vue b/page_fenbao/statulist/fault/yichang/index.vue index 514cbd9..40989db 100644 --- a/page_fenbao/statulist/fault/yichang/index.vue +++ b/page_fenbao/statulist/fault/yichang/index.vue @@ -72,8 +72,15 @@ onlyFromCamera: true, scanType: ['qrCode'], success: res => { - console.log('扫描结果:', res); - this.deviceNo = res.result; + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`); + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null; + } + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue); + this.deviceNo = getQueryParam(decodedValue, 'deviceNo') + // this.deviceNo = res.result; }, fail: err => { console.error('扫描失败:', err); diff --git a/page_fenbao/statulist/myshop/shopdetail/index.vue b/page_fenbao/statulist/myshop/shopdetail/index.vue index 2c2258e..b1fc2b5 100644 --- a/page_fenbao/statulist/myshop/shopdetail/index.vue +++ b/page_fenbao/statulist/myshop/shopdetail/index.vue @@ -167,11 +167,19 @@ onlyFromCamera: true, scanType: ['qrCode'], success: res => { - console.log('扫描结果:', res); - this.$u.get(`/app/device/${res.result}/bySn`).then((res) =>{ + // console.log('扫描结果:', res); + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`); + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null; + } + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue); + let id = getQueryParam(decodedValue, 'deviceNo') + this.$u.get(`/app/device/${id}/bySn`).then((res) =>{ if(res.code == 200){ this.qrResult = 'CTKG-' + res.data.mac - + // console.log(this.qrResult); // uni.navigateTo({ // url:'/page_fenbao/device/lianjie?mac=' + this.qrResult + '&storeId=' + this.storeId // }) diff --git a/page_user/mapditu/index.vue b/page_user/mapditu/index.vue index d7aff09..2b23788 100644 --- a/page_user/mapditu/index.vue +++ b/page_user/mapditu/index.vue @@ -88,9 +88,17 @@ onlyFromCamera: true, scanType: ['qrCode'], success: res => { - console.log('扫描结果:', res); - let id = res.result - this.$u.get(`/app/device/${res.result}/withSuitList`).then((res) =>{ + // console.log('扫描结果:', res); + // let id = res.result + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`); + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null; + } + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue); + let id = getQueryParam(decodedValue, 'deviceNo') + this.$u.get(`/app/device/${id}/withSuitList`).then((res) =>{ if(res.code == 200){ uni.navigateTo({ url: '/page_components/fuwu/index?id=' + id @@ -295,13 +303,14 @@ width: 150rpx; height: 134rpx; // background-color: #D9D8FF; - border-radius: 10rpx; + border-radius: 20rpx; // margin-right: 28rpx; image{ width: 100%; height: 100%; mode: "aspectFill"; margin-top: 10rpx; + border-radius: 20rpx; } } .cen{ diff --git a/page_user/switchs.vue b/page_user/switchs.vue index cef4f88..e4c76e2 100644 --- a/page_user/switchs.vue +++ b/page_user/switchs.vue @@ -102,8 +102,15 @@ onlyFromCamera: true, scanType: ['qrCode'], success: res => { - console.log('扫描结果:', res); - this.qrResult = res.result; // 将扫描结果存储在数据中 + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`); + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null; + } + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue); + this.qrResult = getQueryParam(decodedValue, 'deviceNo') + // this.qrResult = res.result; // 将扫描结果存储在数据中 }, fail: err => { console.error('扫描失败:', err); diff --git a/pages/index/index.vue b/pages/index/index.vue index d40ce57..88a56fe 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -483,6 +483,8 @@ scanType: ['qrCode'], success: res => { console.log('扫描结果:', res); + + this.qrResult = res.result; // this.$u.get(`/app/device/${this.qrResult}/withSuitList`).then((res) =>{ // if(res.code == 200){ diff --git a/pages/shouye/index.vue b/pages/shouye/index.vue index 518a945..c119356 100644 --- a/pages/shouye/index.vue +++ b/pages/shouye/index.vue @@ -128,9 +128,15 @@ onlyFromCamera: true, scanType: ['qrCode'], success: res => { - // console.log('扫描结果:', res); - let id = res.result - this.$u.get(`/app/device/${res.result}/withSuitList`).then((res) => { + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`); + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null; + } + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue); + let id = getQueryParam(decodedValue, 'deviceNo') + this.$u.get(`/app/device/${id}/withSuitList`).then((res) => { if (res.code == 200) { uni.navigateTo({ url: '/page_components/fuwu/index?id=' + id