Refactor(分享):分享标题、页面路径、图片通过接口获取

This commit is contained in:
lifizer
2025-08-20 17:16:57 +08:00
parent 4d4760397d
commit 881a1e1477
2 changed files with 28 additions and 17 deletions
+5
View File
@@ -222,3 +222,8 @@ export function getAiSystemInfoSetting() {
export function getAiSystemInfoTopic() { export function getAiSystemInfoTopic() {
return request.get('/ai/systemTopic', {}, { login: false }) return request.get('/ai/systemTopic', {}, { login: false })
} }
// 获取通用分享配置
export function getWeixinShareConfig() {
return request.get('/weixinShareConfig', {}, { login: false })
}
+10 -4
View File
@@ -1,3 +1,4 @@
import { getWeixinShareConfig } from '@/api/public'
export default{ export default{
data(){ data(){
return { return {
@@ -17,10 +18,13 @@ export default{
isPrivateMessage: false, isPrivateMessage: false,
withShareTicket: false withShareTicket: false
}) })
return { return new Promise(async (resolve, reject) => {
title: this.share.title, const { success, data } = await getWeixinShareConfig()
path: this.share.path, if (success) {
imageUrl: this.share.imageUrl, resolve({
title: data.title || this.share.title,
path: data.url || this.share.path,
imageUrl: data.image || this.share.imageUrl,
desc: this.share.desc, desc: this.share.desc,
content: this.share.content, content: this.share.content,
success(res){ success(res){
@@ -34,6 +38,8 @@ export default{
icon:'none' icon:'none'
}) })
} }
})
} }
})
} }
} }