Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-uniapp into master_hella

hella_online_20240829
niexiting 4 months ago
parent
commit
f2efcae5a8
  1. 134
      src/pages/point/index.vue

134
src/pages/point/index.vue

@ -91,6 +91,76 @@
methods: { methods: {
// qrcodeRef
forEachQrcodeRef(el,index,elLength,wait) {
let _this = this
console.log('11111111111111');
console.log(index);
if (index == elLength) {
console.log('99999999');
return;
}
const item = el[index];
setTimeout(() => {
console.log(el[index]);
console.log(item.canvasToTempFilePath);
// try{
item.canvasToTempFilePath({
success: (res) => {
console.log(res);
// base64
pathToBase64(res.tempFilePath).then(base64 => {
console.log(res.tempFilePath);
_this.data[index].barcodeBase64 = base64
if (index == elLength - 1) {
_this.isLoadFinish = true
uni.hideLoading();
}else {
console.log(index);
}
this.forEachQrcodeRef(el,index+1,el.length,100)
}).catch(err => {
console.log(err);
this.forEachQrcodeRef(el,index+1,el.length,100)
})
},
fail(err) {
console.log(err)
}
})
// }catch(e){
// console.log(e)
// //TODO handle the exception
// // this.forEachQrcodeRef(el,index,el.length)
// }
},wait);
},
// stringToBase64(str) {
// console.log('999999999999999');
// console.log(str);
// //
// // var encodeUTF8 = uni.getSystemInfoSync().platform === 'android' ? 'utf-8' : 'utf8';
// // console.log('8888888888888');
// // var utf8Str = uni.encode(str, encodeUTF8);
// // console.log(utf8Str); data
// // utf8base64
// var base64Str = btoa(str);
// console.log(base64Str);
// return base64Str;
// },
// getQrCodeBase64(index) {
// let _this = this
// // 使setTimeoutDOMcanvas
// setTimeout(() => {
// const qrcodeCanvas = this.$refs.qrcodeRef.$el.querySelector('canvas');
// if (qrcodeCanvas) {
// // canvasBase64URL
// _this.data[index].barcodeBase64 = qrcodeCanvas.toDataURL('image/png');
// } else {
// console.log('xxxxxxxxxxxxxxxxx')
// }
// }, 0);
// },
getListData(){ getListData(){
// //
// 线 线 // 线 线
@ -112,36 +182,45 @@
// }] // }]
let _this = this let _this = this
this.$nextTick(async () => { // this.$nextTick(async () => {
// //
const el = _this.$refs['qrcodeRef'] const el = _this.$refs['qrcodeRef']
let str = '' _this.forEachQrcodeRef(el,0,el.length,5000);
el.forEach(async (item, index) => { // // })
await item.canvasToTempFilePath({
success: async (res) => {
// base64
await pathToBase64(res.tempFilePath).then(base64 => {
_this.data[index].barcodeBase64 = base64
if (index == el.length - 1) {
_this.isLoadFinish = true
uni.hideLoading();
}else {
console.log(index);
}
}).catch(err => {
console.log(err);
})
},
fail(err) {
console.log('err:::', err)
}
})
}) // let _this = this
// this.$nextTick(async () => {
// //
// const el = _this.$refs['qrcodeRef']
// let str = ''
// el.forEach(async (item, index) => {
// await item.canvasToTempFilePath({
// success: async (res) => {
// // base64
// await pathToBase64(res.tempFilePath).then(base64 => {
// _this.data[index].barcodeBase64 = base64
// if (index == el.length - 1) {
// _this.isLoadFinish = true
// uni.hideLoading();
}) // }else {
// console.log(index);
// }
// }).catch(err => {
// console.log(err);
// })
// },
// fail(err) {
// console.log('err:::', err)
// }
// })
// })
// })
// })
}, },
// #ifdef APP // #ifdef APP
@ -250,7 +329,7 @@
}) })
this.newHtmlContent = this.newHtmlContent.replace( this.newHtmlContent = this.newHtmlContent.replace(
"mainBody", str); // "mainBody", str); //
console.log(this.newHtmlContent) // console.log(this.newHtmlContent)
}); });
// #endif // #endif
} }
@ -278,7 +357,10 @@
this.timer = null this.timer = null
} }
this.data = this.originData this.data = this.originData
this.getListData() console.log(287,'11111111')
this.$nextTick(()=> {
this.getListData()
})
},1000) },1000)
}, },
} }

Loading…
Cancel
Save