1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-06-12 13:19:31 +08:00

fix: 修复海报保存问题

This commit is contained in:
小莫唐尼
2025-11-26 15:19:04 +08:00
parent 21fee2dc9a
commit 3643bdf6f6
+117 -6
View File
@@ -69,7 +69,7 @@
</view>
</view>
</view>
<view v-if="!calcAuditModeEnabled && result._doubanUrls.length !== 0 && doubanPluginConfig.position==='top'" class="pa-24 pb-0">
<view v-if="!calcAuditModeEnabled && result._doubanUrls.length !== 0 && doubanPluginConfig.position === 'top'" class="pa-24 pb-0">
<view class="vote-wrap copyright-wrap bg-white pa-24 round-4">
<view class="copyright-title text-weight-b flex items-center justify-between">
<text>豆瓣资源</text>
@@ -158,7 +158,10 @@
</view>
<!-- 豆瓣 -->
<view v-if="!calcAuditModeEnabled && result._doubanUrls.length !== 0 && doubanPluginConfig.position==='bottom'" class="vote-wrap copyright-wrap bg-white mt-24 pa-24 round-4">
<view
v-if="!calcAuditModeEnabled && result._doubanUrls.length !== 0 && doubanPluginConfig.position === 'bottom'"
class="vote-wrap copyright-wrap bg-white mt-24 pa-24 round-4"
>
<view class="copyright-title text-weight-b flex items-center justify-between">
<text>豆瓣资源</text>
<text class="vote-opra" @click="doubanIsOpen = !doubanIsOpen">
@@ -506,7 +509,11 @@ export default {
voteIsOpen: true,
reloadVote: false,
doubanIsOpen: true
doubanIsOpen: true,
appAuthorize: {
writePhotosAlbum: ''
}
};
},
computed: {
@@ -548,8 +555,8 @@ export default {
pluginsConfig() {
return this.haloConfigs.pluginConfig;
},
doubanPluginConfig(){
return this.pluginsConfig.doubanPlugin
doubanPluginConfig() {
return this.pluginsConfig.doubanPlugin;
}
},
watch: {
@@ -1116,16 +1123,120 @@ export default {
this.poster.showCanvas = false;
this.poster.loading = true;
},
fnSavePoster() {
fnGetAlbumAuthorize() {
return new Promise((resolve) => {
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) => {
if(!e?.errMsg.includes('cancel')){
uni.$tm.toast('保存失败,请重试');
}
}
});
},
fnShareTo() {