From 3643bdf6f685cf027bab3ed6044b93c5a0f8127e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= Date: Wed, 26 Nov 2025 15:19:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B5=B7=E6=8A=A5?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagesA/article-detail/article-detail.vue | 143 ++++++++++++++++++++--- 1 file changed, 127 insertions(+), 16 deletions(-) diff --git a/pagesA/article-detail/article-detail.vue b/pagesA/article-detail/article-detail.vue index b9cce5e..bb09d91 100644 --- a/pagesA/article-detail/article-detail.vue +++ b/pagesA/article-detail/article-detail.vue @@ -69,7 +69,7 @@ - + 豆瓣资源 @@ -101,7 +101,7 @@ :loading="true" :lines="3" :tip-text="`此处内容已隐藏,「${getRestrictReadTypeName(result)}可见」`" - :button-text="`${getRestrictReadTypeName(result)}`" + :button-text="`${getRestrictReadTypeName(result)}`" button-color="#1890ff" skeleton-color="#f0f0f0" skeleton-highlight="#e0e0e0" @@ -129,7 +129,7 @@ :loading="true" :lines="3" :tip-text="`此处内容已隐藏,「${getRestrictReadTypeName(result)}可见」`" - :button-text="`${getRestrictReadTypeName(result)}`" + :button-text="`${getRestrictReadTypeName(result)}`" button-color="#1890ff" skeleton-color="#f0f0f0" skeleton-highlight="#e0e0e0" @@ -158,14 +158,17 @@ - + 豆瓣资源 {{ doubanIsOpen ? '收起' : '展开' }} - + { + uni.showModal({ + title: '提示', + content: '保存到相册未授权,是否去授权?', + success: (res) => { + if (res.confirm) { + // uni.authorize({ + // scope: 'scope.writePhotosAlbum', + // success() { + // uni.showToast({ + // icon: 'none', + // title: '授权成功,请重新保存' + // }); + // resolve(true); + // }, + // fail: (err) => { + // uni.showToast({ + // icon: 'none', + // title: '授权失败,请手动授权' + // }); + // resolve(false); + // } + // }); + uni.openSetting({ + success: (res) => { + if (res.authSetting['scope.writePhotosAlbum'] === true) { + uni.showToast({ + icon: 'none', + title: '授权成功,请重新保存' + }); + resolve(true); + } else { + uni.showToast({ + icon: 'none', + title: '未进行授权操作' + }); + resolve(false); + } + }, + fail: (err) => { + uni.showToast({ + icon: 'none', + title: '授权失败' + }); + resolve(false); + } + }); + } + }, + fail: () => { + resolve(false); + } + }); + }); + }, + fnCheckAlbumAppAuthorize() { + return new Promise((resolve) => { + // #ifdef MP-WEIXIN + uni.getSetting({ + success: async (res) => { + if (res.authSetting['scope.writePhotosAlbum'] === false) { + const authorize = await this.fnGetAlbumAuthorize(); + console.log('authorize1', authorize); + if (!authorize) { + uni.openSetting({ + success: (res) => { + console.log('授权1', res); + } + }); + console.log('打开授权页面1'); + } + resolve(false); + } else { + resolve(true); + } + }, + fail: async () => { + const authorize = await this.fnGetAlbumAuthorize(); + console.log('authorize2', authorize); + if (!authorize) { + uni.openSetting({ + success: (res) => { + console.log('授权2', res); + } + }); + console.log('打开授权页面2'); + } + resolve(false); + } + }); + // #endif + // #ifndef MP-WEIXIN + resolve(true); + // #endif + }); + }, + async fnSavePoster() { // this.$refs.rCanvas.saveImage(this.poster.res.tempFilePath); + + // 检查授权 + const authorize = await this.fnCheckAlbumAppAuthorize(); + if (!authorize) return; + uni.saveImageToPhotosAlbum({ filePath: this.poster.url, success: () => { uni.$tm.toast('保存成功'); }, fail: (e) => { - uni.$tm.toast('保存失败,请重试'); + if(!e?.errMsg.includes('cancel')){ + uni.$tm.toast('保存失败,请重试'); + } } }); }, @@ -1238,8 +1349,8 @@ export default { this.verificationCodeModal.show = true; return; } else if (restrictReadEnable === 'comment') { - this.fnToComment(); - return; + this.fnToComment(); + return; } else if (restrictReadEnable === 'login') { uni.showToast({ title: '前往web端登录后访问',