This commit is contained in:
3321822538@qq.com 2024-05-25 11:34:26 +08:00
parent 18421bc31b
commit 984d221e2e
6 changed files with 53 additions and 14 deletions

View File

@ -72,8 +72,15 @@
onlyFromCamera: true, onlyFromCamera: true,
scanType: ['qrCode'], scanType: ['qrCode'],
success: res => { success: res => {
console.log('扫描结果:', res); function getQueryParam(url, paramName) {
this.deviceNo = res.result; 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 => { fail: err => {
console.error('扫描失败:', err); console.error('扫描失败:', err);

View File

@ -167,11 +167,19 @@
onlyFromCamera: true, onlyFromCamera: true,
scanType: ['qrCode'], scanType: ['qrCode'],
success: res => { success: res => {
console.log('扫描结果:', res); // console.log('', res);
this.$u.get(`/app/device/${res.result}/bySn`).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}/bySn`).then((res) =>{
if(res.code == 200){ if(res.code == 200){
this.qrResult = 'CTKG-' + res.data.mac this.qrResult = 'CTKG-' + res.data.mac
// console.log(this.qrResult);
// uni.navigateTo({ // uni.navigateTo({
// url:'/page_fenbao/device/lianjie?mac=' + this.qrResult + '&storeId=' + this.storeId // url:'/page_fenbao/device/lianjie?mac=' + this.qrResult + '&storeId=' + this.storeId
// }) // })

View File

@ -88,9 +88,17 @@
onlyFromCamera: true, onlyFromCamera: true,
scanType: ['qrCode'], scanType: ['qrCode'],
success: res => { success: res => {
console.log('扫描结果:', res); // console.log('', res);
let id = res.result // 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){ if(res.code == 200){
uni.navigateTo({ uni.navigateTo({
url: '/page_components/fuwu/index?id=' + id url: '/page_components/fuwu/index?id=' + id
@ -295,13 +303,14 @@
width: 150rpx; width: 150rpx;
height: 134rpx; height: 134rpx;
// background-color: #D9D8FF; // background-color: #D9D8FF;
border-radius: 10rpx; border-radius: 20rpx;
// margin-right: 28rpx; // margin-right: 28rpx;
image{ image{
width: 100%; width: 100%;
height: 100%; height: 100%;
mode: "aspectFill"; mode: "aspectFill";
margin-top: 10rpx; margin-top: 10rpx;
border-radius: 20rpx;
} }
} }
.cen{ .cen{

View File

@ -102,8 +102,15 @@
onlyFromCamera: true, onlyFromCamera: true,
scanType: ['qrCode'], scanType: ['qrCode'],
success: res => { success: res => {
console.log('扫描结果:', res); function getQueryParam(url, paramName) {
this.qrResult = res.result; // 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 => { fail: err => {
console.error('扫描失败:', err); console.error('扫描失败:', err);

View File

@ -483,6 +483,8 @@
scanType: ['qrCode'], scanType: ['qrCode'],
success: res => { success: res => {
console.log('扫描结果:', res); console.log('扫描结果:', res);
this.qrResult = res.result; this.qrResult = res.result;
// this.$u.get(`/app/device/${this.qrResult}/withSuitList`).then((res) =>{ // this.$u.get(`/app/device/${this.qrResult}/withSuitList`).then((res) =>{
// if(res.code == 200){ // if(res.code == 200){

View File

@ -128,9 +128,15 @@
onlyFromCamera: true, onlyFromCamera: true,
scanType: ['qrCode'], scanType: ['qrCode'],
success: res => { success: res => {
// console.log('', res); function getQueryParam(url, paramName) {
let id = res.result let regex = new RegExp(`[?&]${paramName}=([^&]*)`);
this.$u.get(`/app/device/${res.result}/withSuitList`).then((res) => { 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) { if (res.code == 200) {
uni.navigateTo({ uni.navigateTo({
url: '/page_components/fuwu/index?id=' + id url: '/page_components/fuwu/index?id=' + id