This commit is contained in:
GaoHao 2024-11-04 16:02:37 +08:00
commit 35ea6dfbfe
2 changed files with 1 additions and 57 deletions

View File

@ -39,9 +39,7 @@ onShow(() => {
})
const saveImage = () => {
// #ifdef APP-PLUS
uni.downloadFile({
url: vdata.QrcodeUrl,
success: (res) => {
@ -65,64 +63,10 @@ const saveImage = () => {
infoBox.showErrorToast('保存失败')
}
})
// #endif
//#ifdef MP-WEIXIN
downloadQR()
//#endif
}
//#ifdef MP-WEIXIN
function downloadQR() {
wx.getSetting({
//
success(res) {
console.log(res)
if (res.authSetting['scope.writePhotosAlbum']) {
saveWxQrcodeImg(vdata.QrcodeUrl)
} else {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
saveWxQrcodeImg(vdata.QrcodeUrl)
},
})
}
},
})
}
//#endif
const saveWxQrcodeImg = (data) => {
const fileManager = wx.getFileSystemManager()
console.log( )
const filePath = wx.env.USER_DATA_PATH + '/qrCode'+new Date().getTime()+'.png'
//
fileManager.writeFile({
filePath: filePath,
data: data.slice(22),
encoding: 'base64',
success: (res) => {
wx.saveImageToPhotosAlbum({
filePath: filePath,
success: function (res) {
//
infoBox.showSuccessToast('保存成功')
},
fail: function (err) {
console.log(err)
//
infoBox.showErrorToast('保存失败')
},
})
},
fail: (err) => {
infoBox.showErrorToast('保存失败')
},
})
}
</script>
<style lang="scss" scoped>
.page-wrapper {

View File

@ -46,7 +46,7 @@
<view class="right">
<view>
<up-checkbox-group><up-checkbox label="免桌位费" v-model:checked="vdata.isTableFee" activeColor="#0FC161" shape="circle" @change="isTableFeeChange"> </up-checkbox></up-checkbox-group>
</view></up-icon>
</view>
</view>
</view>
<view class="page-cell m">