first commit
This commit is contained in:
33
com/share.js
Normal file
33
com/share.js
Normal file
@@ -0,0 +1,33 @@
|
||||
module.exports = {
|
||||
onLoad(options) {
|
||||
if (options && options.invite_code) {
|
||||
uni.setStorageSync('invite_code', options.invite_code);
|
||||
}
|
||||
|
||||
//设置默认的转发参数
|
||||
uni.$u.mpShare = {
|
||||
title: '羿充电', // 默认为小程序名称
|
||||
path: '', // 默认为当前页面路径
|
||||
imageUrl: '' // 默认为当前页面的截图
|
||||
}
|
||||
},
|
||||
// #ifdef MP-WEIXIN
|
||||
onShareAppMessage() {
|
||||
let user = uni.getStorageSync('user');
|
||||
|
||||
let invite_code = user ? user.invite_code : '';
|
||||
uni.$u.mpShare.path = uni.$u.page() + '?invite_code=' + invite_code; // 默认为当前页面路径
|
||||
|
||||
return uni.$u.mpShare
|
||||
},
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
onShareTimeline() {
|
||||
let user = uni.getStorageSync('user');
|
||||
let invite_code = user ? user.invite_code : '';
|
||||
uni.$u.mpShare.path = uni.$u.page() + '?invite_code=' + invite_code; // 默认为当前页面路径
|
||||
|
||||
return uni.$u.mpShare
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
Reference in New Issue
Block a user