Commit 5fcd2fe2 authored by spc's avatar spc

fixed

parents d1e75afe 004fd931
......@@ -718,6 +718,27 @@ onMounted(async() => {
initData();
});
// 监听 visible 变化,设置页面滚动状态
watch(() => props.visible, (newVal) => {
// #ifdef MP-WEIXIN
if (newVal) {
// 弹窗展示时,禁止页面滚动
wx.setPageStyle({
style: {
overflow: 'hidden'
}
});
} else {
// 弹窗关闭时,恢复页面滚动
wx.setPageStyle({
style: {
overflow: 'auto'
}
});
}
// #endif
}, { immediate: true });
// 监听 babyStage 和 dueDate
watch(
() => [formData.value.babyStage, formData.value.babyBirthday],
......
......@@ -24,7 +24,9 @@
/>
</view>
<view class="task_content">
<text class="task_title">{{ task?.taskTodoExtra?.title }}</text>
<text class="task_title">
{{ task?.taskTodoExtra?.title }}{{ (task?.taskTodoExtra?.type === 'BROWSE_PAGE' || task?.taskTodoExtra?.type === 'EXCHANGE_GOODS') ? `(${task?.taskTodoExtra?.completeCount || 0}/${task?.taskTodoExtra?.completeLimit || 0})` : '' }}
</text>
<text class="task_points">{{ task?.taskTodoExtra?.desc }}</text>
</view>
<view
......
......@@ -66,10 +66,7 @@
}
},
"requiredBackgroundModes" : [ "share" ],
"embeddedAppIdList" : [ "wx4205ec55b793245e", "wxab14ac8f684ad962" ],
"optimization" : {
"subpackages" : true
}
"embeddedAppIdList" : [ "wx4205ec55b793245e", "wxab14ac8f684ad962" ]
},
"mp-alipay" : {
"usingComponents" : true
......
......@@ -358,6 +358,43 @@
}
}
// 从 scene 参数中解析 id
const parseIdFromScene = (scene) => {
if (!scene || typeof scene !== 'string') {
return ''
}
try {
// 先对 scene 字符串进行 URL 解码
const decodedScene = decodeURIComponent(scene)
// scene 格式可能是 "id=xxx" 或 "id=xxx&other=yyy"
const params = decodedScene.split('&')
for (const param of params) {
const [key, value] = param.split('=')
if (key === 'id' && value) {
// value 可能也需要解码(如果 value 本身也被编码了)
return decodeURIComponent(value)
}
}
} catch (error) {
console.warn('解析 scene 参数失败:', error)
// 如果解码失败,尝试直接解析原始 scene
const params = scene.split('&')
for (const param of params) {
const [key, value] = param.split('=')
if (key === 'id' && value) {
try {
return decodeURIComponent(value)
} catch (e) {
return value
}
}
}
}
return ''
}
// 页面初始化逻辑
const initPage = async () => {
console.log('🔍 initPage:页面初始化逻辑');
......@@ -379,11 +416,56 @@
// 调用 home 接口获取登录状态
await homeStore.loadHomeInfo()
// 获取页面跳转参数中的 id 和 index
// 获取页面跳转参数中的 id
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
console.log('🔍 currentPage:', currentPage);
const id = currentPage.options?.id || ''
// 优先从 options.id 获取
let id = currentPage.options?.id || ''
// 如果 options.id 不存在,尝试从 scene 参数中解析
if (!id) {
// 尝试从 currentPage.options.scene 获取
const scene = currentPage.options?.scene || ''
if (scene) {
id = parseIdFromScene(scene)
console.log('🔍 从 currentPage.options.scene 解析到 id:', id)
}
// 如果还是没有,尝试从 wx.getLaunchOptionsSync() 获取(扫码进入场景)
if (!id) {
try {
const launchOptions = wx.getLaunchOptionsSync()
if (launchOptions && launchOptions.scene) {
// 如果是扫码场景(scene 值为 1047 或 1048),从 query 中获取 scene 参数
if (launchOptions.scene === 1047 || launchOptions.scene === 1048) {
const sceneParam = launchOptions.query?.scene || ''
if (sceneParam) {
id = parseIdFromScene(sceneParam)
console.log('🔍 从 launchOptions.query.scene 解析到 id:', id)
}
}
}
} catch (error) {
console.warn('获取 launchOptions 失败:', error)
}
}
// 如果还是没有,尝试从 wx.getEnterOptionsSync() 获取
if (!id) {
try {
const enterOptions = wx.getEnterOptionsSync()
if (enterOptions && enterOptions.query && enterOptions.query.scene) {
id = parseIdFromScene(enterOptions.query.scene)
console.log('🔍 从 enterOptions.query.scene 解析到 id:', id)
}
} catch (error) {
console.warn('获取 enterOptions 失败:', error)
}
}
}
if (id) {
console.log('🔍 获取到页面参数 id:', id)
recordId.value = id // 立即保存ID,确保分享时能获取到
......
......@@ -6,7 +6,7 @@
mode="aspectFill" />
<image class="hlax_btn" :src="$baseUrl + 'heliaixinTool/btn_go_see2.png'" v-if="toolCfg.link?.go_see"
@click="onTips" />
<!-- go_see=true,有按钮,否则没有按钮 -->
<!-- go_see=true,有按钮,否则没有按钮 -->
</view>
</template>
......@@ -16,7 +16,8 @@
onMounted,
getCurrentInstance,
computed
} from "vue";
} from "vue";
import md from '../../md.js';
import {
usePageCfgStore
} from "@/stores/pageCfg";
......@@ -30,11 +31,34 @@
pageCfgStore?.toolList.find((item) => item.title == "鹤礼爱心") || {}
);
onMounted(() => {})
onMounted(() => {
console.log('啊啊啊啊啊啊')
if (toolCfg.value.link && toolCfg.value.link.go_see) { //已登录并且已报名
md.sensorComponentLogTake({
xcxComponentExposure: 'true',
pageName: '鹤礼2.0活动详情页',
componentName: '鹤礼2.0活动详情页-已报名用户',
componentContent: '去查看',
});
} else { //未登录或者未报名
md.sensorComponentLogTake({
xcxComponentExposure: 'true',
pageName: '鹤礼2.0活动详情页',
componentName: '鹤礼2.0活动详情页-未报名用户',
componentContent: '未报名',
});
}
})
//点击去查看按钮提示
const onTips = () => {
console.log("toolCfg:::", toolCfg);
md.sensorComponentLogTake({
xcxComponentClick: 'true',
pageName: '鹤礼2.0活动详情页',
componentName: '鹤礼2.0活动详情页-未报名用户',
componentContent: '未报名',
});
uni.showToast({
title: '可去' + toolCfg.value?.link?.channelName + '渠道查看',
icon: "none"
......
......@@ -111,14 +111,14 @@ const shareOptions = {
imageUrl: $baseUrl + 'share/share_home0901.jpg',
},
1: {
title: '星妈会 | 品牌页分享文案',
path: '/pages/index/index?pageType=brand',
imageUrl: $baseUrl + 'common/shareImg.png',
title: "星妈会 | 陪伴成长每一步",
path: "/pages/index/index?pageType=brand",
imageUrl: $baseUrl + "common/shareImg.png",
},
2: {
title: '星妈会 | 解锁你的会员服务',
path: '/pages/index/index?pageType=integral',
imageUrl: $baseUrl + 'common/shareImg.png',
title: "星妈会 | 解锁你的会员服务",
path: "/pages/index/index?pageType=integral",
imageUrl: $baseUrl + "common/shareImg.png",
},
};
......@@ -251,6 +251,8 @@ const handleTaskComplete = async (taskIdParam) => {
} else {
console.info('taskCompleteJSON res error:', integralStore.queryTodoResult);
}
await integralStore.getSigninAndTaskInfo();//刷新任务接口
};
onShow(async () => {
......@@ -554,9 +556,10 @@ const handleTaskClick = async (data) => {
const extra3 = JSON.parse(data?.task?.taskTodoExtra?.extra);
if (extra3.length > 0) {
const idx = Math.floor(Math.random() * extra3.length);
let url =
'subPackages/shopMainProcess/product/index?productId={productId}&skuId={skuId}&entrySource=xmh_wechatmp_points_north';
url = url.replace('{productId}', extra3[0].itemId).replace('{skuId}', extra3[0].skuId);
url = url.replace('{productId}', extra3[idx].itemId).replace('{skuId}', extra3[idx].skuId);
jump({
type: JumpType.MINI,
url: url,
......
......@@ -356,9 +356,12 @@ export default {
this.checkUserStatus();
// 页面返回时刷新商品详情接口
// 根据 initOptions 中的参数判断使用哪个接口刷新
// 如果 initOptions 中有 activityId 和 sessionKey,使用秒杀接口;否则使用普通接口
if (this.initOptions) {
if (this.isSeckill && this.initOptions.activityId && this.initOptions.sessionKey) {
// 秒杀商品刷新
// 检查 initOptions 中是否有秒杀参数
if (this.initOptions.activityId && this.initOptions.sessionKey) {
// 秒杀商品刷新:使用 initOptions 中的秒杀参数
const seckillParams = {
gid: this.initOptions.appGoodsId || this.initOptions.gid || this.initOptions.id || this.initOptions.goodsId || '',
activityId: this.initOptions.activityId,
......@@ -366,15 +369,16 @@ export default {
};
if (seckillParams.gid && seckillParams.activityId && seckillParams.sessionKey) {
this.fetchSeckillDetail(seckillParams);
return;
}
} else if (!this.isSeckill) {
// 普通商品刷新
const apiParams = {
gid: this.initOptions.gid || this.initOptions.id || this.initOptions.goodsId || ''
};
if (apiParams.gid) {
this.fetchGoodsDetail(apiParams);
}
}
// 普通商品刷新
const apiParams = {
gid: this.initOptions.gid || this.initOptions.id || this.initOptions.goodsId || ''
};
if (apiParams.gid) {
this.fetchGoodsDetail(apiParams);
}
}
},
......
......@@ -3071,13 +3071,13 @@ const handleViewBenefits = () => {
};
// 任务按钮点击事件
const handleTaskButtonClick = () => {
const handleTaskButtonClick = async () => {
// jump({
// type: JumpType.INNER,
// url: '/activities/1015/home'
// })
// return
await integralStore.getSigninAndTaskInfo();//刷新任务接口
console.log('任务按钮点击');
console.log('taskTodo数据:', integralStore?.signinAndTaskInfo?.data?.taskTodo);
globalStore.showTaskPop(integralStore?.signinAndTaskInfo?.data?.taskTodo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment