diff --git a/api/public.js b/api/public.js index 38247e8..16e6de2 100644 --- a/api/public.js +++ b/api/public.js @@ -222,3 +222,8 @@ export function getAiSystemInfoSetting() { export function getAiSystemInfoTopic() { return request.get('/ai/systemTopic', {}, { login: false }) } + +// 获取通用分享配置 +export function getWeixinShareConfig() { + return request.get('/weixinShareConfig', {}, { login: false }) +} diff --git a/mixins/share-mixins.js b/mixins/share-mixins.js index 38fd6b3..b67c76a 100644 --- a/mixins/share-mixins.js +++ b/mixins/share-mixins.js @@ -1,3 +1,4 @@ +import { getWeixinShareConfig } from '@/api/public' export default{ data(){ return { @@ -17,23 +18,28 @@ export default{ isPrivateMessage: false, withShareTicket: false }) - return { - title: this.share.title, - path: this.share.path, - imageUrl: this.share.imageUrl, - desc: this.share.desc, - content: this.share.content, - success(res){ - uni.showToast({ - title:'分享成功' + return new Promise(async (resolve, reject) => { + const { success, data } = await getWeixinShareConfig() + if (success) { + resolve({ + title: data.title || this.share.title, + path: data.url || this.share.path, + imageUrl: data.image || this.share.imageUrl, + desc: this.share.desc, + content: this.share.content, + success(res){ + uni.showToast({ + title:'分享成功' + }) + }, + fail(res){ + uni.showToast({ + title:'分享失败', + icon:'none' + }) + } }) - }, - fail(res){ - uni.showToast({ - title:'分享失败', - icon:'none' - }) - } - } + } + }) } } \ No newline at end of file