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() {
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{
data(){
return {
@@ -17,10 +18,13 @@ export default{
isPrivateMessage: false,
withShareTicket: false
})
return {
title: this.share.title,
path: this.share.path,
imageUrl: this.share.imageUrl,
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){
@@ -34,6 +38,8 @@ export default{
icon:'none'
})
}
})
}
})
}
}