This commit is contained in:
chenyuwu
2026-08-20 09:07:29 +08:00
parent 80e346f200
commit 2d0fa32dc7
3 changed files with 44 additions and 4 deletions
+33 -1
View File
@@ -1,6 +1,17 @@
// app.ts // app.ts
// import { BASE_URL, appId } from './env'
// const DEFAULT_SHARE_CONFIG = {
// title: '吉林敖东控糖胶囊 辅助降血糖',
// imageUrl: '/pages/index/assets/test.jpg',
// }
App<IAppOption>({ App<IAppOption>({
globalData: {}, globalData: {
// shareConfig: { ...DEFAULT_SHARE_CONFIG },
},
onLaunch() { onLaunch() {
const updateManager = wx.getUpdateManager() const updateManager = wx.getUpdateManager()
@@ -35,7 +46,28 @@ App<IAppOption>({
const envVersion = wx.getAccountInfoSync().miniProgram.envVersion const envVersion = wx.getAccountInfoSync().miniProgram.envVersion
if (envVersion !== 'release') { if (envVersion !== 'release') {
wx.reLaunch({ url: '/pages/tools/index' }) wx.reLaunch({ url: '/pages/tools/index' })
return
} }
// this.fetchShareConfig()
}, },
// fetchShareConfig() {
// wx.request({
// url: `${BASE_URL}/api/ad/ww-join-fans/share/${appId}`,
// method: 'GET',
// success: (res: any) => {
// const data = res.data?.data ?? res.data
// if (data?.title || data?.imageUrl) {
// this.globalData.shareConfig = {
// title: data.title || DEFAULT_SHARE_CONFIG.title,
// imageUrl: data.imageUrl || DEFAULT_SHARE_CONFIG.imageUrl,
// }
// }
// },
// fail: () => {
// // 请求失败时继续使用默认分享文案和背景图
// },
// })
// },
}) })
+6 -3
View File
@@ -1,6 +1,7 @@
// index.ts // index.ts
import { BASE_URL, appId } from '../../env' import { BASE_URL, appId } from '../../env'
Component({ Component({
data: { data: {
showPopup: false, showPopup: false,
@@ -17,16 +18,18 @@ Component({
methods: { methods: {
// 转发给好友 // 转发给好友
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '吉林敖东控糖胶囊 辅助降血糖 ¥89.22起', title: '吉林敖东控糖胶囊 辅助降血糖',
path: '/pages/index/index',
imageUrl: '/pages/index/assets/test.jpg', imageUrl: '/pages/index/assets/test.jpg',
} }
}, },
// 分享到朋友圈 // 分享到朋友圈
onShareTimeline() { onShareTimeline() {
return { return {
title: '吉林敖东控糖胶囊 辅助降血糖 ¥89.22起', title: '吉林敖东控糖胶囊 辅助降血糖',
imageUrl: '/pages/index/assets/test.jpg', imageUrl: '/pages/index/assets/test.jpg',
} }
}, },
+5
View File
@@ -3,6 +3,11 @@
interface IAppOption { interface IAppOption {
globalData: { globalData: {
userInfo?: WechatMiniprogram.UserInfo, userInfo?: WechatMiniprogram.UserInfo,
// shareConfig: {
// title: string,
// imageUrl: string,
// }
} }
// fetchShareConfig:any,
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback, userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback,
} }