分享图片自定义

This commit is contained in:
linfeng 2023-05-16 09:40:33 +08:00
parent 6dfb588983
commit 27231d6325

View File

@ -92,7 +92,8 @@
data() { data() {
return { return {
userInfo: '', userInfo: '',
hasLogin: false hasLogin: false,
shareCover: 'http://pic.linfeng.tech/logo.png'
}; };
}, },
onLoad() { onLoad() {
@ -102,6 +103,7 @@
menus: ['shareAppMessage', 'shareTimeline'] menus: ['shareAppMessage', 'shareTimeline']
}); });
//#endif //#endif
this.getSysInfo()
}, },
onShow() { onShow() {
if (uni.getStorageSync('hasLogin')) { if (uni.getStorageSync('hasLogin')) {
@ -112,11 +114,10 @@
} }
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
let imgURL = 'http://pic.linfeng.tech/logo.png';
return { return {
title: this.$c.miniappName, title: this.$c.miniappName,
path: '/pages/index/index', path: '/pages/index/index',
imageUrl: imgURL imageUrl: this.shareCover
}; };
}, },
methods: { methods: {
@ -145,20 +146,25 @@
url: url url: url
}); });
}, },
commercialLink(){ getSysInfo() {
this.$H.get('system/miniConfig').then(res => {
this.shareCover = res.result.intro;
});
},
commercialLink() {
// #ifdef H5 // #ifdef H5
window.open("https://www.linfeng.tech") window.open("https://www.linfeng.tech")
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.navigateToMiniProgram({ uni.navigateToMiniProgram({
appId:'wx1d4a8967c92bda9b', appId: 'wx1d4a8967c92bda9b',
path:'pages/index/index', path: 'pages/index/index',
success: res => { success: res => {
console.log("打开成功", res); console.log("打开成功", res);
}, },
fail: err => { fail: err => {
console.log(err); console.log(err);
} }
}) })
// #endif // #endif
} }