Refactor(分享):分享标题、页面路径、图片通过接口获取
This commit is contained in:
@@ -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 })
|
||||||
|
}
|
||||||
|
|||||||
+23
-17
@@ -1,3 +1,4 @@
|
|||||||
|
import { getWeixinShareConfig } from '@/api/public'
|
||||||
export default{
|
export default{
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
@@ -17,23 +18,28 @@ 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({
|
||||||
desc: this.share.desc,
|
title: data.title || this.share.title,
|
||||||
content: this.share.content,
|
path: data.url || this.share.path,
|
||||||
success(res){
|
imageUrl: data.image || this.share.imageUrl,
|
||||||
uni.showToast({
|
desc: this.share.desc,
|
||||||
title:'分享成功'
|
content: this.share.content,
|
||||||
|
success(res){
|
||||||
|
uni.showToast({
|
||||||
|
title:'分享成功'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail(res){
|
||||||
|
uni.showToast({
|
||||||
|
title:'分享失败',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
fail(res){
|
})
|
||||||
uni.showToast({
|
|
||||||
title:'分享失败',
|
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user