Commit 09ff4637 authored by zhangchenchen's avatar zhangchenchen

feat: 鹤小飞资源位样式调整

parent 3d83a00b
import requestModule from './request.js';
const {
api
} = requestModule;
const { api } = requestModule;
export const fetchBrandJSON = () => api.get('/c/front/content',{type:'brand_V1'});
\ No newline at end of file
export const fetchBrandJSON = (type = 'brand_V1') => api.get('/c/front/content', { type });
import requestModule from './request.js';
const {
api
} = requestModule;
const { api } = requestModule;
/**
* 获取首页信息
......@@ -9,11 +7,9 @@ const {
*/
export const fetchHomeInfo = () => api.get('/c/user/index');
export const fetchCanEatIndex = () => api.get('/c/eat/index');
export const fetchCanEatJoin = (data) => api.post('/c/eat/join', data);
export const fetchHomeJSON = () => api.get('/c/front/content', { type: 'home_V1' });
export const fetchHomeJSON = (type = 'home_V1') => api.get('/c/front/content', { type });
export const fetchGameActConfigJSON = () => api.get('/c/front/content', { type: 'gameActConfig' });
import requestModule from './request.js';
const {
api
} = requestModule;
const { api } = requestModule;
/**
* 获取积分信息
* @returns
*/
export const fetchIntegralJSON = () => api.get('/c/front/content',{type:'integral_V1'});
export const fetchIntegralJSON = (type = 'integral_V1') => api.get('/c/front/content', { type });
/**
* 获取生日礼接口
......@@ -35,7 +33,7 @@ export const getResourceList = () => api.get('/c/resource/list');
export const getSigninAndTaskInfoJSON = () => api.get('/c/activity/todo/list');
//签到接口
export const checkInJSON = (activityId) => api.post('/c/activity/todo/checkIn', {activityId});
export const checkInJSON = (activityId) => api.post('/c/activity/todo/checkIn', { activityId });
//获取秒杀列表
export const getSeckillList = () => api.get('/c/seckill/list');
......@@ -43,7 +41,7 @@ export const getSeckillList = () => api.get('/c/seckill/list');
export const taskCompleteJSON = (activityId) => api.post('/c/activity/todo/complete', { activityId });
//获取异业券接口
export const getPointsBenefitCouponJSON = () => api.get('/c/resource/pointsBenefit/coupon');
export const getPointsBenefitCouponJSON = (type) => api.get('/c/resource/pointsBenefit/coupon', { type });
//查询任务结果接口
export const queryTodoResultJSON = (activityId) => api.get('/c/activity/todo/queryTodoResult');
......@@ -52,16 +50,18 @@ export const queryTodoResultJSON = (activityId) => api.get('/c/activity/todo/que
export const getOriginInviteHomeJSON = () => api.get('/c/activity/origin_invite/home');
//邀请助力接口
export const assistInviteJSON = (invitationCode, wxUnionId) => api.post('/c/activity/origin_invite/assist', {
export const assistInviteJSON = (invitationCode, wxUnionId) =>
api.post('/c/activity/origin_invite/assist', {
invitationCode,
wxUnionId
});
wxUnionId,
});
//获取邀请记录列表接口
export const getInvitationListJSON = () => api.get('/c/activity/origin_invite/invitationList');
//邀请绑定接口
export const originInviteBindJSON = (unionId, shareCode) => api.post('/c/api/activity/originInviteBind', {
export const originInviteBindJSON = (unionId, shareCode) =>
api.post('/c/api/activity/originInviteBind', {
unionId,
shareCode
});
shareCode,
});
import requestModule from './request.js';
const {
api
} = requestModule;
const { api } = requestModule;
/**
* 获取用户信息
......@@ -22,9 +20,10 @@ export const getGestationalWeeks = (dueDate) => api.get('/c/user/calGestationalW
* @param {*} code
* @returns
*/
export const autoLoginByCode = (code) => api.get('/c/login/autologin', {
export const autoLoginByCode = (code) =>
api.get('/c/login/autologin', {
code,
});
});
/**
* 手机号授权,调用微信手机号快速验证组件,获取encryptedData、iv、code
......@@ -46,18 +45,13 @@ export const fetchMemberInfo = () => api.get('/c/user/memberInfo');
*/
export const updateBabyInfo = (data) => api.post('/c/user/saveBaby', data);
export const fetchUserJSON = () => api.get('/c/front/content', { type: 'my_V1' });
export const fetchUserJSON = (type = 'my_V1') => api.get('/c/front/content', { type });
/** 查询用户是否参与生育补贴和鹤礼2.0*/
export const checkParticipation = (data) => api.get('/c/fertility/index', data);
export const doTerminate = () => api.post('/c/user/terminate');
/**
* 获取积分兑换记录列表(分页)
* @param {Object} params - 请求参数
......@@ -66,8 +60,6 @@ export const doTerminate = () => api.post('/c/user/terminate');
*/
export const getExchangeList = (params = {}) => api.get('/c/user/exchange/list', { params });
/**
*
* @param {orderNo} data
......
......@@ -4,14 +4,25 @@
<Brand v-if="globalStore.curTabIndex == 1 && !globalStore.isWxFriendCircle" :scroll-top="scrollTop" />
<Integral v-if="globalStore.curTabIndex == 2 && !globalStore.isWxFriendCircle" :scrollTop="scrollTop" />
<My v-if="globalStore.curTabIndex == 3 && !globalStore.isWxFriendCircle" />
<TabBar v-if="!globalStore.isWxFriendCircle" :curTabIndex="globalStore.curTabIndex" @tabClick="handleTabClick" />
<TabBar
v-if="!globalStore.isWxFriendCircle"
:curTabIndex="globalStore.curTabIndex"
@tabClick="handleTabClick"
/>
<WxFriendCircleSimplePage v-if="globalStore.isWxFriendCircle" />
<!-- 邀请奖品弹窗 -->
<InvitePrizePanel :visible="globalStore.isShowInvitePrizePanel" :inviteCount="globalStore.inviteCount"
:prizeName="globalStore.prizeName" :prizeImage="globalStore.prizeImage" :prizeType="globalStore.prizeType"
:memberId="globalStore.memberId" @close="handleCloseInvitePrizePanel" @record="handleInvitePrizePanelRecord"
@prize="handleInvitePrizePanelPrize" />
<InvitePrizePanel
:visible="globalStore.isShowInvitePrizePanel"
:inviteCount="globalStore.inviteCount"
:prizeName="globalStore.prizeName"
:prizeImage="globalStore.prizeImage"
:prizeType="globalStore.prizeType"
:memberId="globalStore.memberId"
@close="handleCloseInvitePrizePanel"
@record="handleInvitePrizePanelRecord"
@prize="handleInvitePrizePanelPrize"
/>
<!-- 任务完成弹窗 -->
<!-- <TaskComplete
......@@ -23,43 +34,73 @@
/> -->
<!-- 任务弹窗 -->
<TaskPop :visible="globalStore.isShowTaskPop" :taskTodo="globalStore.taskTodo" @close="handleCloseTaskPop"
@taskClick="handleTaskClick" />
<TaskPop
:visible="globalStore.isShowTaskPop"
:taskTodo="globalStore.taskTodo"
@close="handleCloseTaskPop"
@taskClick="handleTaskClick"
/>
<!-- 任务完成提示弹窗 -->
<TaskCompleteTips :visible="globalStore.isShowTaskComplete" :points="globalStore.taskCompletePoints"
:taskTitle="globalStore.taskCompleteTitle" @close="handleCloseTaskCompleteTips" />
<TaskCompleteTips
:visible="globalStore.isShowTaskComplete"
:points="globalStore.taskCompletePoints"
:taskTitle="globalStore.taskCompleteTitle"
@close="handleCloseTaskCompleteTips"
/>
<!-- 任务信息弹窗 -->
<TaskPerson :visible="globalStore.isShowTaskPerson" @close="handleCloseTaskPerson"
@submit="handleTaskPersonSubmit" />
<TaskPerson
:visible="globalStore.isShowTaskPerson"
@close="handleCloseTaskPerson"
@submit="handleTaskPersonSubmit"
/>
<!-- 公众号弹窗 -->
<GongzhonghaoPop :visible="showGongzhonghaoPop" :title="gongzhonghaoTitle" :description="gongzhonghaoDescription"
:qrCodeUrl="gongzhonghaoQrCodeUrl" @close="handleCloseGongzhonghaoPop" @download="handleDownloadQrCode" />
<GongzhonghaoPop
:visible="showGongzhonghaoPop"
:title="gongzhonghaoTitle"
:description="gongzhonghaoDescription"
:qrCodeUrl="gongzhonghaoQrCodeUrl"
@close="handleCloseGongzhonghaoPop"
@download="handleDownloadQrCode"
/>
<!-- 视频弹窗 -->
<view v-if="showVideo" class="video-popup1">
<video :src="currentVideoUrl" controls autoplay :style="{ width: videoWidth + 'px', height: videoHeight + 'px' }"
@loadedmetadata="onVideoLoadedMeta" @play="onVideoPlay"></video>
<video
:src="currentVideoUrl"
controls
autoplay
:style="{ width: videoWidth + 'px', height: videoHeight + 'px' }"
@loadedmetadata="onVideoLoadedMeta"
@play="onVideoPlay"
></video>
<view class="close-btn-bottom" @tap="closeVideo">×</view>
</view>
<button v-if="isBackApp" class="back-app" open-type="launchApp" app-parameter="wechat"
@binderror="handleLaunchAppError" :style="{
<button
v-if="isBackApp"
class="back-app"
open-type="launchApp"
app-parameter="wechat"
@binderror="handleLaunchAppError"
:style="{
backgroundImage: `url(${$baseUrl}homepage/backAppBtn.png)`,
}">
}"
>
<!-- <text class="back-text">返回app</text> -->
</button>
<!-- 悬浮授权手机号模块 -->
<view class="auth-phone-module" v-if="!userStore.memberInfo?.mobile">
<image class="auth-phone-bg" :src="$baseUrl + 'homepage/Q3Res/accessBg3.png'"></image>
<view class="auth-phone-btn-container">
<image class="auth-phone-btn" :src="$baseUrl + 'homepage/Q3Res/accessBtn3.png'" @tap="handleAuthPhoneClick">
<image
class="auth-phone-btn"
:src="$baseUrl + 'homepage/Q3Res/accessBtn3.png'"
@tap="handleAuthPhoneClick"
>
</image>
</view>
</view>
......@@ -67,26 +108,26 @@
</template>
<script setup>
import { ref, getCurrentInstance, onMounted, nextTick } from "vue";
import { onLoad, onShareAppMessage, onShareTimeline, onPageScroll, onShow } from "@dcloudio/uni-app";
import TabBar from "@/components/TabBar.vue";
import Home from "@/views/Home.vue";
import Brand from "@/views/Brand.vue";
import Integral from "@/views/Integral.vue";
import My from "@/views/My.vue";
import { ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline, onPageScroll, onShow } from '@dcloudio/uni-app';
import TabBar from '@/components/TabBar.vue';
import Home from '@/views/Home.vue';
import Brand from '@/views/Brand.vue';
import Integral from '@/views/Integral.vue';
import My from '@/views/My.vue';
import md from '@/md';
import WxFriendCircleSimplePage from "@/components/WxFriendCircleSimplePage.vue";
import InvitePrizePanel from "@/components/integralArea/InvitePrizePanel.vue";
import WxFriendCircleSimplePage from '@/components/WxFriendCircleSimplePage.vue';
import InvitePrizePanel from '@/components/integralArea/InvitePrizePanel.vue';
// import TaskComplete from "@/components/qiandao/TaskComplete.vue";
import TaskPop from "@/components/renwu/TaskPop.vue";
import TaskPerson from "@/components/renwu/TaskPerson.vue";
import TaskPop from '@/components/renwu/TaskPop.vue';
import TaskPerson from '@/components/renwu/TaskPerson.vue';
import TaskCompleteTips from '@/components/renwu/TaskCompleteTips.vue';
import { useGlobalStore } from "@/stores/global.js";
import { useUserStore } from "@/stores/user.js";
import { jump, JumpType } from "../../utils";
import { taskCompleteJSON } from "../../api/integral";
import { useIntegralStore } from "@/stores/integral";
import GongzhonghaoPop from "@/components/renwu/GongzhonghaoPop.vue";
import { useGlobalStore } from '@/stores/global.js';
import { useUserStore } from '@/stores/user.js';
import { jump, JumpType } from '../../utils';
import { taskCompleteJSON } from '../../api/integral';
import { useIntegralStore } from '@/stores/integral';
import GongzhonghaoPop from '@/components/renwu/GongzhonghaoPop.vue';
const globalStore = useGlobalStore();
const userStore = useUserStore();
......@@ -98,23 +139,22 @@ const isBackApp = ref(false);
const taskId = ref(0);
const shareOptions = {
0: {
title: "8000万中国妈妈信赖的育儿品牌",
path: "/pages/index/index?pageType=home",
imageUrl: $baseUrl + "share/share_home0901.jpg",
title: '8000万中国妈妈信赖的育儿品牌',
path: '/pages/index/index?pageType=home',
imageUrl: $baseUrl + 'share/share_home0901.jpg',
},
1: {
title: "飞鹤提供家庭营养一站式解决方案",
path: "/pages/index/index?pageType=brand",
imageUrl: $baseUrl + "share/share_brand.png",
title: '飞鹤提供家庭营养一站式解决方案',
path: '/pages/index/index?pageType=brand',
imageUrl: $baseUrl + 'share/share_brand.png',
},
2: {
title: "超凡吸收!更多妈妈推荐的奶粉",
path: "/pages/index/index?pageType=integral",
imageUrl: $baseUrl + "share/share_integral.png",
title: '超凡吸收!更多妈妈推荐的奶粉',
path: '/pages/index/index?pageType=integral',
imageUrl: $baseUrl + 'share/share_integral.png',
},
};
// 公众号弹窗参数
const showGongzhonghaoPop = ref(false);
......@@ -128,7 +168,6 @@ const currentVideoUrl = ref('');
const videoWidth = ref(375);
const videoHeight = ref(210);
// 处理返回APP失败的情况
const handleLaunchAppError = (e) => {
console.error('返回APP失败:', e.detail.errMsg);
......@@ -142,7 +181,7 @@ const handleLaunchAppError = (e) => {
uni.showToast({
title: errorMessage,
icon: 'none',
duration: 2000
duration: 2000,
});
};
......@@ -152,10 +191,10 @@ function handleTabClick({ index }) {
if (!userStore.memberInfo?.mobile) {
nextTick(() => {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
xcxComponentExposure: 'true',
pageName: `${['首页', '品牌', '积分', '我的'][index]}`,
componentName: "去授权手机号引导",
componentContent: "去授权手机号引导"
componentName: '去授权手机号引导',
componentContent: '去授权手机号引导',
});
});
}
......@@ -164,17 +203,16 @@ function handleTabClick({ index }) {
// 处理授权手机号按钮点击
const handleAuthPhoneClick = () => {
md.sensorComponentLogTake({
xcxComponentClick: "true",
xcxComponentClick: 'true',
pageName: `${['首页', '品牌', '积分', '我的'][globalStore.curTabIndex]}`,
componentName: "去授权手机号引导",
componentContent: "去授权手机号引导"
componentName: '去授权手机号引导',
componentContent: '去授权手机号引导',
});
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
})
}
url: '/pages/activity/register',
});
};
// 检查任务结果并更新全局状态
const checkAndUpdateTaskResult = async () => {
......@@ -212,7 +250,6 @@ onMounted(async () => {
globalStore.prizeType = unclaimedPrize?.prizeType;
globalStore.memberId = res.data?.memberId;
}
}
console.log('邀请活动首页数据:', res);
});
......@@ -223,7 +260,6 @@ const handleCloseTaskCompleteTips = async () => {
await checkAndUpdateTaskResult();
};
// 完成任务并显示完成提示
const handleTaskComplete = async (taskIdParam) => {
taskId.value = 0;
......@@ -243,15 +279,13 @@ onShow(async () => {
if (!userStore.memberInfo?.mobile) {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
xcxComponentExposure: 'true',
pageName: `${['首页', '品牌', '积分', '我的'][globalStore.curTabIndex]}`,
componentName: "去授权手机号引导",
componentContent: "去授权手机号引导"
componentName: '去授权手机号引导',
componentContent: '去授权手机号引导',
});
}
//完成了浏览任务
if (taskId.value > 0) {
await handleTaskComplete(taskId.value);
......@@ -259,9 +293,9 @@ onShow(async () => {
});
onLoad((options) => {
const optionsSync = wx.getEnterOptionsSync()
const optionsSync = wx.getEnterOptionsSync();
if (optionsSync.scene == '1154') {
globalStore.setIsWxFriendCircle(true)
globalStore.setIsWxFriendCircle(true);
}
// 加载会员信息,确保能正确判断手机号授权状态
......@@ -274,19 +308,32 @@ onLoad((options) => {
isBackApp.value = false;
}
console.warn('options231', options, globalStore.isWxFriendCircle)
if (
options.scene &&
typeof options.scene === 'string' &&
(options.scene.startsWith('home_') ||
options.scene.startsWith('brand_') ||
options.scene.startsWith('integral_') ||
options.scene.startsWith('my_'))
) {
const [page] = options.scene.split('_');
globalStore.setPreviewScene(page, options.scene);
options.pageType = page;
}
console.warn('options231', options, globalStore.isWxFriendCircle);
if (options.pageType) {
switch (options.pageType) {
case "home":
case 'home':
globalStore.setCurTabIndex(0);
break;
case "brand":
case 'brand':
globalStore.setCurTabIndex(1);
break;
case "integral":
case 'integral':
globalStore.setCurTabIndex(2);
break;
case "my":
case 'my':
globalStore.setCurTabIndex(3);
break;
}
......@@ -314,9 +361,6 @@ onPageScroll((e) => {
// }
// });
// 邀请奖品弹窗相关方法
// const handleInviteClick = () => {
// console.log('邀请按钮点击,显示奖品弹窗');
......@@ -344,7 +388,8 @@ const handleCloseTaskComplete = () => {
globalStore.isShowTaskComplete = false;
};
const handleAcceptTaskComplete = () => {//当前未用到
const handleAcceptTaskComplete = () => {
//当前未用到
// console.log('接受任务完成奖励');
// globalStore.isShowTaskComplete = false;
// 这里可以添加接受奖励后的逻辑
......@@ -355,7 +400,6 @@ const handleCloseTaskPop = () => {
globalStore.closeTaskPop();
};
//去完成按钮,完成任务
const handleTaskClick = async (data) => {
console.log('任务点击:', data);
......@@ -364,7 +408,7 @@ const handleTaskClick = async (data) => {
if (!data.task) {
uni.showToast({
title: '任务不存在',
icon: 'none'
icon: 'none',
});
return;
}
......@@ -377,7 +421,7 @@ const handleTaskClick = async (data) => {
globalStore.showTaskPerson(); // 延迟显示TaskPerson
}, 100);
break;
case 'BROWSE_PAGE'://浏览商城
case 'BROWSE_PAGE': //浏览商城
globalStore.closeTaskPop();
taskId.value = data?.task?.id;
// 这里可以设置任务ID用于后续完成检测
......@@ -391,58 +435,57 @@ const handleTaskClick = async (data) => {
jump({
type: JumpType.MINI,
url: url,
extra: { envVersion: "release", appId: "wx4205ec55b793245e", embedded: true }
extra: { envVersion: 'release', appId: 'wx4205ec55b793245e', embedded: true },
});
} else if (extra1.type == 'PAGE' || extra1.type == 'MINI_APP') {
jump({
type: JumpType.INNER,
url: extra1.url
url: extra1.url,
});
} else if (extra1.type == 'MINI_APP_THIRD') {
jump({
type: JumpType.MINI,
url: extra1.url,
extra: { envVersion: "release", appId: extra1.value, embedded: true }
extra: { envVersion: 'release', appId: extra1.value, embedded: true },
});
} else if (extra1.type == 'SELF_GOODS') {
jump({
type: JumpType.INNER,
url: `/v3/goodDetail/goodDetail?gid=${extra1.value}`
url: `/v3/goodDetail/goodDetail?gid=${extra1.value}`,
});
} else {
jump({
type: JumpType.H5,
url: extra1.url
url: extra1.url,
});
}
// console.log('extra66666:', extra1);
break;
case 'FirstOrder'://完成首单优选消费
case 'FirstOrder': //完成首单优选消费
const extra2 = JSON.parse(data?.task?.taskTodoExtra?.extra);
console.log('extra666661111:', extra2);
jump({
type: JumpType.MINI,
url: 'subPackages/xmhMainProcess/member/index?entrySource=xmh_wechatmp_points_recgoodsbot',
extra: { envVersion: "release", appId: "wx4205ec55b793245e", embedded: true }
extra: { envVersion: 'release', appId: 'wx4205ec55b793245e', embedded: true },
});
break;
case 'EXCHANGE_GOODS'://消费商品
case 'EXCHANGE_GOODS': //消费商品
const extra3 = JSON.parse(data?.task?.taskTodoExtra?.extra);
if (extra3.length > 0) {
let url = 'subPackages/shopMainProcess/product/index?productId={productId}&skuId={skuId}&entrySource=xmh_wechatmp_points_north';
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);
jump({
type: JumpType.MINI,
url: url,
extra: { envVersion: "release", appId: "wx4205ec55b793245e", embedded: true }
})
extra: { envVersion: 'release', appId: 'wx4205ec55b793245e', embedded: true },
});
}
break;
case 'FollowWx'://关注公众号
case 'FollowWx': //关注公众号
globalStore.closeTaskPop(); // 先关闭TaskPop
setTimeout(() => {
// 设置公众号弹窗参数
......@@ -452,7 +495,7 @@ const handleTaskClick = async (data) => {
showGongzhonghaoPop.value = true; // 延迟显示公众号弹窗
}, 100);
break;
case 'AddQw'://添加企业微信
case 'AddQw': //添加企业微信
globalStore.closeTaskPop(); // 先关闭TaskPop
setTimeout(() => {
// 设置公众号弹窗参数
......@@ -462,17 +505,17 @@ const handleTaskClick = async (data) => {
showGongzhonghaoPop.value = true; // 延迟显示企业微信弹窗
}, 100);
break;
case 'Register'://注册会员
case 'Register': //注册会员
// 这里可以处理注册逻辑
uni.showToast({
title: '请先注册会员',
icon: 'none'
icon: 'none',
});
break;
default:
uni.showToast({
title: '任务类型不支持',
icon: 'none'
icon: 'none',
});
break;
}
......@@ -486,7 +529,7 @@ const handleCloseTaskPerson = () => {
// 关闭公众号弹窗
const handleCloseGongzhonghaoPop = () => {
showGongzhonghaoPop.value = false;
}
};
// 处理下载二维码
const handleDownloadQrCode = (title) => {
......@@ -496,7 +539,7 @@ const handleDownloadQrCode = (title) => {
md.sensorLogTake({
xcxClick: `${title}拉起半屏二维码入口页面点击`,
pageName: `${title}拉起半屏二维码入口页面点击`,
buttonName: `下载二维码`
buttonName: `下载二维码`,
});
if (title === '公众号') {
......@@ -506,9 +549,10 @@ const handleDownloadQrCode = (title) => {
const courseUrl = 'https://course.feihe.com/momclub-picture/homepage/qrcode_qw.png';
downloadQrCode(courseUrl);
}
}
};
const downloadQrCode = (imgurl) => {//现在二维码图片
const downloadQrCode = (imgurl) => {
//现在二维码图片
uni.downloadFile({
url: imgurl,
success: (downloadRes) => {
......@@ -518,31 +562,31 @@ const downloadQrCode = (imgurl) => {//现在二维码图片
success: (res) => {
uni.showToast({
title: '保存成功',
icon: 'success'
icon: 'success',
});
},
fail: (err) => {
uni.showToast({
title: '保存失败',
icon: 'none'
icon: 'none',
});
}
},
});
} else {
uni.showToast({
title: '下载失败',
icon: 'none'
icon: 'none',
});
}
},
fail: (err) => {
uni.showToast({
title: '下载失败',
icon: 'none'
icon: 'none',
});
}
},
});
}
};
const handleTaskPersonSubmit = (formData) => {
console.log('任务信息提交:', formData);
......@@ -550,13 +594,12 @@ const handleTaskPersonSubmit = (formData) => {
// 可以显示成功提示
uni.showToast({
title: '信息提交成功',
icon: 'success'
icon: 'success',
});
};
// 视频弹窗相关方法
const closeVideo = async () => {
//完成了浏览任务
if (taskId.value > 0) {
await handleTaskComplete(taskId.value);
......@@ -571,7 +614,7 @@ const onVideoLoadedMeta = (e) => {
const pageWidth = uni.upx2px(750);
const ratio = height / width;
videoWidth.value = pageWidth;
videoHeight.value = pageWidth;// pageWidth * ratio;
videoHeight.value = pageWidth; // pageWidth * ratio;
};
const onVideoPlay = () => {
......@@ -589,13 +632,11 @@ const onVideoPlay = () => {
}
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
// .back-app{
......
import {
defineStore
} from 'pinia';
import { defineStore } from 'pinia';
const cuk = uni.getStorageSync('cuk')
const openId = uni.getStorageSync('openId')
const unionId = uni.getStorageSync('unionId')
const cuk = uni.getStorageSync('cuk');
const openId = uni.getStorageSync('openId');
const unionId = uni.getStorageSync('unionId');
export const useGlobalStore = defineStore('global', {
state: () => {
return {
cuk: cuk, // 用户登录后获取的凭证,调用接口时headers中携带
curTabIndex: 0, // 当前Tab索引
isWxFriendCircle:false,
isWxFriendCircle: false,
isShowLoading: false,
openId: openId,
unionId: unionId,
......@@ -24,17 +22,18 @@ export const useGlobalStore = defineStore('global', {
isShowTaskPerson: false, // 是否显示任务信息弹窗
taskTodo: [], // 任务数据
invateUseType: '', // 邀请用户类型
previewScene: {}, // 预览场景
};
},
actions: {
setBaseUrl(url){
this.baseUrl = url
setBaseUrl(url) {
this.baseUrl = url;
},
/**
* 设置用户cuk
* @param {Object} cuk
*/
setCuk(cuk,openId,unionId) {
setCuk(cuk, openId, unionId) {
this.cuk = cuk;
this.openId = openId;
this.unionId = unionId;
......@@ -54,12 +53,12 @@ export const useGlobalStore = defineStore('global', {
* 设置当前是否是小程序朋友圈单页环境
* @param {boolean} v
*/
setIsWxFriendCircle(v){
this.isWxFriendCircle = v
setIsWxFriendCircle(v) {
this.isWxFriendCircle = v;
},
setIsShowLoading(v){
this.isShowLoading = v
setIsShowLoading(v) {
this.isShowLoading = v;
},
/**
......@@ -102,6 +101,24 @@ export const useGlobalStore = defineStore('global', {
closeTaskPerson() {
this.isShowTaskPerson = false;
},
/**
* 设置预览场景
* @param {*} page 页面名称,例如'home'、'brand'、'integral'、'my'
* @param {*} sceneValue 场景值,以页面名称开头,例如'home_1069'、'brand_1154'
*/
setPreviewScene(page, sceneValue) {
this.previewScene = {
[page]: sceneValue,
};
},
/**
* 获取预览场景
* @param {*} page 页面名称,例如'home'、'brand'、'integral'、'my'
* @returns 场景值,以页面名称开头,例如'home_1069'、'brand_1154'
*/
getPreviewScene(page) {
return this.previewScene[page];
},
/**
* 清除认证信息(注销时使用)
......
import { defineStore } from "pinia";
import { getSigninAndTaskInfoJSON, checkInJSON, getSeckillList, getPointsBenefitCouponJSON, queryTodoResultJSON, getOriginInviteHomeJSON, assistInviteJSON, getInvitationListJSON, originInviteBindJSON } from "../api/integral";
import { defineStore } from 'pinia';
import {
getSigninAndTaskInfoJSON,
checkInJSON,
getSeckillList,
getPointsBenefitCouponJSON,
queryTodoResultJSON,
getOriginInviteHomeJSON,
assistInviteJSON,
getInvitationListJSON,
originInviteBindJSON,
} from '../api/integral';
import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json';
import checkInMock from '../mock/checkIndata.json';
import pointsBenefitCouponMock from '../mock/pointsBenefitCoupon.json';
......@@ -7,7 +17,7 @@ import queryTodoResultMock from '../mock/queryTodoResult.json';
import originInviteHomeMock from '../mock/originInviteHome.json';
import assistInviteMock from '../mock/assistInvite.json';
import invitationListMock from '../mock/invitationList.json';
export const useIntegralStore = defineStore("integral", {
export const useIntegralStore = defineStore('integral', {
state: () => {
return {
_signinAndTaskInfo: null,
......@@ -23,23 +33,22 @@ export const useIntegralStore = defineStore("integral", {
},
actions: {
async getSigninAndTaskInfo(isdebug = false) {
if(isdebug) {
if (isdebug) {
this._signinAndTaskInfo = signinAndTaskInfoMock;
return signinAndTaskInfoMock;
}else{
} else {
const res = await getSigninAndTaskInfoJSON();
this._signinAndTaskInfo = res;
return res;
}
},
async checkIn(activityId,isdebug = false) {
async checkIn(activityId, isdebug = false) {
// if(isdebug) {
// this._checkInData = checkInMock; // 存储到state中
// return checkInMock;
// }else{
const res = await checkInJSON(activityId);
this._checkInData = res; // 存储到state中
return res;
// }
......@@ -74,51 +83,51 @@ export const useIntegralStore = defineStore("integral", {
return res;
// }
},
async getPointsBenefitCoupon(isdebug = false) {
async getPointsBenefitCoupon(type) {
// if(isdebug) {
// this._pointsBenefitCoupon = pointsBenefitCouponMock;
// return pointsBenefitCouponMock;
// }else{
const res = await getPointsBenefitCouponJSON();
const res = await getPointsBenefitCouponJSON(type);
this._pointsBenefitCoupon = res;
return res;
// }
},
async queryTodoResultServer(isdebug = false) {
if(isdebug) {
if (isdebug) {
this._queryTodoResult = queryTodoResultMock;
return queryTodoResultMock;
}else{
} else {
const res = await queryTodoResultJSON();
this._queryTodoResult = res;
return res;
}
},
async getOriginInviteHome(isdebug = false) {
if(isdebug) {
if (isdebug) {
this._originInviteHome = originInviteHomeMock;
return originInviteHomeMock;
}else{
} else {
const res = await getOriginInviteHomeJSON();
this._originInviteHome = res;
return res;
}
},
async assistInvite(invitationCode, wxUnionId, isdebug = false) {
if(isdebug) {
if (isdebug) {
this._assistInviteData = assistInviteMock;
return assistInviteMock;
}else{
} else {
const res = await assistInviteJSON(invitationCode, wxUnionId);
this._assistInviteData = res;
return res;
}
},
async getInvitationList(isdebug = false) {
if(isdebug) {
if (isdebug) {
this._invitationList = invitationListMock;
return invitationListMock;
}else{
} else {
const res = await getInvitationListJSON();
this._invitationList = res;
return res;
......@@ -131,14 +140,32 @@ export const useIntegralStore = defineStore("integral", {
},
},
getters: {
signinAndTaskInfo : (state) => {return state._signinAndTaskInfo; },
checkInData : (state) => {return state._checkInData; },
seckillData : (state) => {return state._seckillData; },
pointsBenefitCoupon : (state) => {return state._pointsBenefitCoupon; },
queryTodoResult : (state) => {return state._queryTodoResult; },
originInviteHome : (state) => {return state._originInviteHome; },
assistInviteData : (state) => {return state._assistInviteData; },
invitationList : (state) => {return state._invitationList; },
originInviteBindData : (state) => {return state._originInviteBindData; },
signinAndTaskInfo: (state) => {
return state._signinAndTaskInfo;
},
checkInData: (state) => {
return state._checkInData;
},
seckillData: (state) => {
return state._seckillData;
},
pointsBenefitCoupon: (state) => {
return state._pointsBenefitCoupon;
},
queryTodoResult: (state) => {
return state._queryTodoResult;
},
originInviteHome: (state) => {
return state._originInviteHome;
},
assistInviteData: (state) => {
return state._assistInviteData;
},
invitationList: (state) => {
return state._invitationList;
},
originInviteBindData: (state) => {
return state._originInviteBindData;
},
},
});
import {
defineStore
} from "pinia";
import {
fetchUserJSON,
checkParticipation
} from "@/api/user";
import {
useUserStore
} from "./user";
import { defineStore } from 'pinia';
import { fetchUserJSON, checkParticipation } from '@/api/user';
import { useUserStore } from './user';
// 渠道名称配置
export const CHANNELS = {
......@@ -19,7 +12,7 @@ export const CHANNELS = {
hl2dsKS: '快手',
hl2dsWS: '微商城',
hl2dsTMC: '猫超',
hl2dsXHS: '小红书'
hl2dsXHS: '小红书',
};
// 获取渠道名称
......@@ -27,7 +20,7 @@ export function getChannelName(code) {
return CHANNELS[code] || '线上报名';
}
export const usePageCfgStore = defineStore("pageCfg", {
export const usePageCfgStore = defineStore('pageCfg', {
state: () => {
return {
toolList: [],
......@@ -42,10 +35,8 @@ export const usePageCfgStore = defineStore("pageCfg", {
};
},
actions: {
async fetchCfg() {
const {
data
} = await fetchUserJSON();
async fetchCfg(type) {
const { data } = await fetchUserJSON(type);
// const data = {
// "wheelOptionsYZ": [
......@@ -486,46 +477,52 @@ export const usePageCfgStore = defineStore("pageCfg", {
//-----------这部分是专门判断"生育补贴"和"鹤礼爱心"的逻辑-------------
const memberId = useUserStore().userInfo?.memberId;
const res = await checkParticipation()
const res = await checkParticipation();
// let res = {"code":"000000","data":{"channel":"DS","dsPlatform":"hl2dsXHS","fertilityJoined":true,"v2Joined":true},"message":"success","ok":true,"success":true};
console.log("生育补贴和鹤礼爱心是否参与::::", res);
if (memberId == 'not_login' || !res.data?.fertilityJoined) { //未登录或者未参与,就删除生育补贴配置项,不展示
tools = tools.filter(item => item.title !== "生育补贴");
console.log('生育补贴和鹤礼爱心是否参与::::', res);
if (memberId == 'not_login' || !res.data?.fertilityJoined) {
//未登录或者未参与,就删除生育补贴配置项,不展示
tools = tools.filter((item) => item.title !== '生育补贴');
}
if (memberId != 'not_login' && res.data?.v2Joined) { //已登录并且已报名
if (res.data?.channel == "DS") { //DS:表示线上报名,跳转链接换成本地页面的路径,并且有去查看按钮
if (memberId != 'not_login' && res.data?.v2Joined) {
//已登录并且已报名
if (res.data?.channel == 'DS') {
//DS:表示线上报名,跳转链接换成本地页面的路径,并且有去查看按钮
let channelName = getChannelName(res.data?.dsPlatform);
tools = tools.map(item =>
item.title === "鹤礼爱心" ? {
tools = tools.map((item) =>
item.title === '鹤礼爱心'
? {
...item,
link: {
...item.link,
type: 1, // type=1跳转本地页面
url: "/pages/heliaixinTools/heliaixinTools",
url: '/pages/heliaixinTools/heliaixinTools',
go_see: true, //有“去查看”按钮
channelName: channelName, //报名渠道的名称
},
}
} :
item
: item
);
} else { //线下报名,正常跳转,不用处理
} else {
//线下报名,正常跳转,不用处理
}
} else { //未登录或者未报名,跳转链接换成本地页面的链接
tools = tools.map(item =>
item.title === "鹤礼爱心" ? {
} else {
//未登录或者未报名,跳转链接换成本地页面的链接
tools = tools.map((item) =>
item.title === '鹤礼爱心'
? {
...item,
link: {
...item.link,
type: 1, // type=1跳转本地页面
url: "/pages/heliaixinTools/heliaixinTools"
url: '/pages/heliaixinTools/heliaixinTools',
},
}
} :
item
: item
);
}
console.log("tools---------::", tools)
console.log('tools---------::', tools);
this.toolList = tools;
//-----------这部分是专门判断"生育补贴"和"鹤礼爱心"的逻辑-------------
......
......@@ -312,6 +312,7 @@
:appid="erqiPeizhi.appId1"
:product-id="erqiPeizhi.productId1"
custom-content="true"
class="store-product-container"
>
<view class="ipcontainer">
<image
......@@ -329,8 +330,8 @@
>
</image>
<view class="ipcontext">
<view class="ipcontext-title">{{ '竖版标题' }}</view>
<view class="ipcontext-desc">{{ '竖版描述' }}</view>
<view class="ipcontext-desc">{{ erqiPeizhi.ipTitle1 || '' }}</view>
<view class="ipcontext-title">{{ erqiPeizhi.ipDesc1 || '' }}</view>
</view>
</view>
</store-product>
......@@ -343,8 +344,13 @@
:appid="erqiPeizhi.appId2"
:product-id="erqiPeizhi.productId2"
custom-content="true"
class="store-product-container"
>
<view class="ipcontainer">
<view class="ipcontext">
<view class="ipcontext-title">{{ erqiPeizhi.ipTitle2 || '' }}</view>
<view class="ipcontext-desc">{{ erqiPeizhi.ipDesc2 || '' }}</view>
</view>
<image
:data-log="{
xcxClick: '品牌故事-三屏页面点击',
......@@ -358,10 +364,6 @@
"
>
</image>
<view class="ipcontext">
<view class="ipcontext-title">{{ '横版标题' }}</view>
<view class="ipcontext-desc">{{ '横版描述' }}</view>
</view>
</view>
</store-product>
</view>
......@@ -491,7 +493,9 @@ import { fetchBrandJSON } from '../api/brand';
import { jump, JumpType } from '../utils';
import md from '../md';
import ExposureTracker from '../utils/exposure';
import { useGlobalStore } from '@/stores/global.js';
const globalStore = useGlobalStore();
// 定义需要曝光检测的元素配置
const EXPOSURE_CONFIGS = [
{
......@@ -600,7 +604,7 @@ export default {
},
methods: {
async initBrandInfo() {
const { data } = await fetchBrandJSON();
const { data } = await fetchBrandJSON(globalStore.getPreviewScene('brand'));
if (data) {
this.swiperList = data.swiperList || [
{
......@@ -1443,13 +1447,23 @@ export default {
.ipcontainer {
position: relative;
image,.ipcontext {
position: absolute;
.ipcontext {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
font-size: 24rpx;
text-align: center;
.ipcontext-desc,
.ipcontext-title {
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ipcontext-title {
color: @color-gold-main;
}
}
}
......@@ -1464,34 +1478,53 @@ export default {
display: flex;
justify-content: center;
align-items: center;
.store-product-container {
display: flex;
justify-content: center;
align-items: center;
}
}
.ip1 {
width: 288rpx;
height: 380rpx;
overflow: hidden;
.ipcontainer{
width: 288 * 0.8rpx;
height: 380 * 0.8rpx;
.ipcontainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
width: 268rpx;
.ipcontext {
width: 100%;
margin-top: 6rpx;
}
}
image {
width: 288 * 0.8rpx;
height: 380 * 0.8rpx;
width: 213rpx;
height: 172rpx;
}
}
.ip2 {
width: 342rpx;
height: 201rpx;
.ipcontainer{
width: 342 * 0.75rpx;
height: 201 * 0.75rpx;
.ipcontainer {
height: 172rpx;
width: 322rpx;
display: flex;
flex-direction: row-reverse;
align-items: center;
justify-content: space-between;
.ipcontext {
width: 160rpx;
}
}
image {
width: 342 * 0.75rpx;
height: 201 * 0.75rpx;
width: 162rpx;
height: 172rpx;
}
}
......
<template>
<view class="home-container" @scroll="onPageScroll">
<!-- 可拖拽悬浮图片 -->
<view class="floating-image-container" v-if="floatIcon.imageUrl && !isAnyPopupVisible"
<view
class="floating-image-container"
v-if="floatIcon.imageUrl && !isAnyPopupVisible"
:style="{ left: floatIconPosition.left + 'px', top: floatIconPosition.top + 'px' }"
@touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd" @tap="onfloatIconClick">
<image class="floating-image"
:src="floatIcon.imageUrl.indexOf('http') === 0 ? floatIcon.imageUrl : $baseUrl + floatIcon.imageUrl">
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
@tap="onfloatIconClick"
>
<image
class="floating-image"
:src="floatIcon.imageUrl.indexOf('http') === 0 ? floatIcon.imageUrl : $baseUrl + floatIcon.imageUrl"
>
</image>
</view>
<view class="content">
<swiper id="firstScreen" class="swiper banner" circular :autoplay="autoplay" :interval="interval"
:duration="duration" :indicator-dots="false" @change="onBannerSwiperChange">
<swiper
id="firstScreen"
class="swiper banner"
circular
:autoplay="autoplay"
:interval="interval"
:duration="duration"
:indicator-dots="false"
@change="onBannerSwiperChange"
>
<swiper-item v-for="(item, index) in swiperList" :key="item.url">
<view class="swiper-item banneritem">
<image @tap="jumpBannerHandler(item, index)" class="b-img"
:src="item.url.indexOf('http') === 0 ? item.url : $baseUrl + item.url"></image>
<image
@tap="jumpBannerHandler(item, index)"
class="b-img"
:src="item.url.indexOf('http') === 0 ? item.url : $baseUrl + item.url"
></image>
</view>
</swiper-item>
</swiper>
......@@ -27,26 +46,43 @@
</view>
<!-- 自定义指示点,仿照示意图 -->
<view class="custom-banner-indicator">
<view v-for="(item, idx) in swiperList" :key="item.url + idx"
:class="['banner-dot', { 'active': idx === bannerCurrentIndex }]"></view>
<view
v-for="(item, idx) in swiperList"
:key="item.url + idx"
:class="['banner-dot', { active: idx === bannerCurrentIndex }]"
></view>
</view>
<view class="barbox" :style="`top:${statusBarHeight}px;`">
<image class="btnlogo" :src="$baseUrl + 'homepage/btnlogo.png'"></image>
<image :data-log="{
<image
:data-log="{
xcxClick: '首页-首屏页面点击',
pageName: '首页-首屏',
buttonName: '搜索框'
}" class="btnsearch" @tap="goSearchHandler" :src="$baseUrl + 'homepage/btnsearch.png'">
buttonName: '搜索框',
}"
class="btnsearch"
@tap="goSearchHandler"
:src="$baseUrl + 'homepage/btnsearch.png'"
>
</image>
<view class="customer-btn-wrap">
<image :data-log="{
<image
:data-log="{
xcxClick: '首页-首屏页面点击',
pageName: '首页-首屏',
buttonName: '客服入口'
}" @tap="goCustomerHandler" class="btncustomer" :src="$baseUrl + 'homepage/btncustomer.png'">
buttonName: '客服入口',
}"
@tap="goCustomerHandler"
class="btncustomer"
:src="$baseUrl + 'homepage/btncustomer.png'"
>
</image>
<button v-if="homeStore && !homeStore.isLogin" open-type="getPhoneNumber"
@getphonenumber="onGetPhoneNumber" class="phone-auth-btn-cover"></button>
<button
v-if="homeStore && !homeStore.isLogin"
open-type="getPhoneNumber"
@getphonenumber="onGetPhoneNumber"
class="phone-auth-btn-cover"
></button>
</view>
</view>
<!-- <view :data-log="{
......@@ -62,19 +98,34 @@
<view v-if="toolList?.tools?.length > 0" class="tools_box">
<view class="tools_maintitle">{{ toolList.maintitle }}</view>
<view class="tools_subtitle">{{ toolList.subtitle }}</view>
<swiper :vertical="false" :circular="true" class="tool_swiper" :display-multiple-items="1.65"
:next-margin="'0rpx'" :previous-margin="'0'" @change="onSwiperChange">
<swiper-item v-for="(item, index) in toolList.tools" :key="index"
:class="['swiperItem', { 'active': currentIndex === index }]">
<swiper
:vertical="false"
:circular="true"
class="tool_swiper"
:display-multiple-items="1.65"
:next-margin="'0rpx'"
:previous-margin="'0'"
@change="onSwiperChange"
>
<swiper-item
v-for="(item, index) in toolList.tools"
:key="index"
:class="['swiperItem', { active: currentIndex === index }]"
>
<view class="tool">
<!-- <button
v-if="homeStore && !homeStore.isLogin && item.title!='星妈会Lab' && item.title!='星妈起名' && item.title!='喂养工具' && item.title!='产检提醒' && item.title!='宝宝生长测评' && item.title!='体质测试'"
open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber" class="sq_btn"></button> -->
<image class="tool_bg" :src="$baseUrl + 'homepage/Q3Res/toolBg.png'"
@tap="handleToolClick(item)">
<image
class="tool_bg"
:src="$baseUrl + 'homepage/Q3Res/toolBg.png'"
@tap="handleToolClick(item)"
>
</image>
<image class="tool_icon"
:src="item.icon?.indexOf('http') === 0 ? item.icon : $baseUrl + item.icon"></image>
<image
class="tool_icon"
:src="item.icon?.indexOf('http') === 0 ? item.icon : $baseUrl + item.icon"
></image>
<!-- <image class="tool_jt" :src="$baseUrl + toolList.jtIcon"></image> -->
<view class="tool_title">{{ item.title }}</view>
<view class="tool_context">{{ item.context }}</view>
......@@ -84,8 +135,12 @@
<!-- 自定义指示点 -->
<view class="custom-indicator">
<view v-for="(item, index) in toolList.tools" :key="index" class="indicator-dot"
:class="{ 'active': currentIndex === index }">
<view
v-for="(item, index) in toolList.tools"
:key="index"
class="indicator-dot"
:class="{ active: currentIndex === index }"
>
</view>
</view>
</view>
......@@ -105,7 +160,9 @@
<!-- 已答题状态显示区域 -->
<view v-else-if="canEatData.isAnswered || canEatData.myAnswer" class="can-eat-answer-section">
<view class="answer-status">
<view class="correct-answer">正确答案:{{ ['能吃', '少吃', '慎吃', '禁吃'][canEatData.correct] }}</view>
<view class="correct-answer"
>正确答案:{{ ['能吃', '少吃', '慎吃', '禁吃'][canEatData.correct] }}</view
>
</view>
<view class="analysis-link" @tap="viewAnalysis">{{ '查看问题解析 >' }}</view>
</view>
......@@ -113,40 +170,53 @@
<!--专家团-->
<view class="et_box" id="expertTeam">
<view class="et_maintitle">{{ expertTeam.maintitle }}</view>
<view :data-log="{
<view
:data-log="{
xcxClick: '首页-二屏页面点击',
pageName: '首页-二屏',
buttonName: '专家团副标题点击'
}" class="et_subtitle">
buttonName: '专家团副标题点击',
}"
class="et_subtitle"
>
<view class="txtlink" @tap="showPopup1(1, 1)">星妈会医生在线答疑群,为孩子成长保驾护航</view>
<image id="et_joingroup" class="icon_more" @tap="showPopup1(1, 2)"
:src="$baseUrl + 'homepage/et_more.png'"></image>
<image
id="et_joingroup"
class="icon_more"
@tap="showPopup1(1, 2)"
:src="$baseUrl + 'homepage/et_more.png'"
></image>
</view>
<view class="et_main_box">
<view class="et_con_bg">
<view class="et_tab_box">
<view class="tab_box" @tap="onSelEtTap(0)">
<image class="et_tab" v-show="etTabSelIndex == 0"
:src="$baseUrl + 'homepage/et_sel_tab11.png'">
<image
class="et_tab"
v-show="etTabSelIndex == 0"
:src="$baseUrl + 'homepage/et_sel_tab11.png'"
>
</image>
<image class="et_tab" v-show="etTabSelIndex != 0"
:src="$baseUrl + 'homepage/et_tab11.png'">
<image class="et_tab" v-show="etTabSelIndex != 0" :src="$baseUrl + 'homepage/et_tab11.png'">
</image>
</view>
<view class="tab_box" @tap="onSelEtTap(1)">
<image class="et_tab" v-show="etTabSelIndex == 1"
:src="$baseUrl + 'homepage/et_sel_tab2.png'">
<image
class="et_tab"
v-show="etTabSelIndex == 1"
:src="$baseUrl + 'homepage/et_sel_tab2.png'"
>
</image>
<image class="et_tab" v-show="etTabSelIndex != 1"
:src="$baseUrl + 'homepage/et_tab2.png'">
<image class="et_tab" v-show="etTabSelIndex != 1" :src="$baseUrl + 'homepage/et_tab2.png'">
</image>
</view>
<view class="tab_box" @tap="onSelEtTap(2)">
<image class="et_tab" v-show="etTabSelIndex == 2"
:src="$baseUrl + 'homepage/et_sel_tab3.png'">
<image
class="et_tab"
v-show="etTabSelIndex == 2"
:src="$baseUrl + 'homepage/et_sel_tab3.png'"
>
</image>
<image class="et_tab" v-show="etTabSelIndex != 2"
:src="$baseUrl + 'homepage/et_tab3.png'">
<image class="et_tab" v-show="etTabSelIndex != 2" :src="$baseUrl + 'homepage/et_tab3.png'">
</image>
</view>
</view>
......@@ -206,44 +276,62 @@
}" @tap="jumpLink(contentItem.link, contentItem.videoUrl, index, $event)"></image>
</view> -->
<view v-if="childrenInfoList.length > 0" id="childrenInfoList" class="channelbox">
<text class="maintitle">{{ childrenInfoListMianTitle }}</text>
<view class="subtitle_box">
<text class="subtitle">从专业到实用,一站式解决你的育儿难题</text>
<image id="childrenInfoListMore" class="icon_more" :src="$baseUrl + 'homepage/home_more_btn_v2.png'"
<image
id="childrenInfoListMore"
class="icon_more"
:src="$baseUrl + 'homepage/home_more_btn_v2.png'"
:data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `次位内容资源位-查看更多文字`
}" :data-comlog="{
buttonName: `次位内容资源位-查看更多文字`,
}"
:data-comlog="{
xcxComponentClick: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: '育儿智库-more'
}" @tap="jumpLink(suggest.link, false, false, $event)"></image>
componentContent: '育儿智库-more',
}"
@tap="jumpLink(suggest.link, false, false, $event)"
></image>
</view>
<view class="channelscroll">
<view class="box">
<view class="infobox" :key="index" :id="'childrenInfoList' + index"
v-for="(infoItem, index) in childrenInfoList" :data-log="{
<view
class="infobox"
:key="index"
:id="'childrenInfoList' + index"
v-for="(infoItem, index) in childrenInfoList"
:data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `次位内容资源位-轮播-${index + 1}`
}" :data-comlog="{
buttonName: `次位内容资源位-轮播-${index + 1}`,
}"
:data-comlog="{
xcxComponentClick: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: infoItem.desc
}" @tap="jumpLink(infoItem.link, false, false, $event)">
<image class="infoimg"
:src="infoItem.bgUrl?.indexOf('http') === 0 ? infoItem.bgUrl : $baseUrl + infoItem.bgUrl">
componentContent: infoItem.desc,
}"
@tap="jumpLink(infoItem.link, false, false, $event)"
>
<image
class="infoimg"
:src="infoItem.bgUrl?.indexOf('http') === 0 ? infoItem.bgUrl : $baseUrl + infoItem.bgUrl"
>
</image>
<view class="infotitlebox">
<view class="infotitlecon">
<view class="infotitle">{{ infoItem.desc }}</view>
<image v-if="infoItem.isNew" class="infotitletag"
:src="$baseUrl + 'homepage/home_new_tag_v3.png'">New</image>
<image
v-if="infoItem.isNew"
class="infotitletag"
:src="$baseUrl + 'homepage/home_new_tag_v3.png'"
>New</image
>
</view>
<view class="infodesc">{{ infoItem.desc2 }}</view>
</view>
......@@ -262,30 +350,47 @@
<text class="maintitle">{{ channelTabListMianTitle }}</text>
<view class="subtitle_box">
<text class="subtitle">用声音传递爱与智慧,守护宝贝成长的每一步</text>
<image class="icon_more" :src="$baseUrl + 'homepage/home_more_btn_v2.png'" :data-log="{
<image
class="icon_more"
:src="$baseUrl + 'homepage/home_more_btn_v2.png'"
:data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `首位内容资源位-查看更多文字`
}" @tap="jumpLink(voiceStory.link, false, false, $event)"></image>
buttonName: `首位内容资源位-查看更多文字`,
}"
@tap="jumpLink(voiceStory.link, false, false, $event)"
></image>
</view>
<view class="listbox">
<view @tap="channelTabHandler(index, $event)" :data-log="{
<view
@tap="channelTabHandler(index, $event)"
:data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `首页内容资源位分类${index + 1}-${item}`
}" :class="channelTabIndex === index ? 'tabitem tabActive' : 'tabitem'" v-for="(item, index) in channelTabList"
:key="index">
buttonName: `首页内容资源位分类${index + 1}-${item}`,
}"
:class="channelTabIndex === index ? 'tabitem tabActive' : 'tabitem'"
v-for="(item, index) in channelTabList"
:key="index"
>
{{ item }}
</view>
</view>
<view class="channelscroll2">
<view class="box2">
<view class="infobox2" :key="index"
v-for="(infoItem, index) in changelInfoList[channelTabIndex]" :data-log="{
<view
class="infobox2"
:key="index"
v-for="(infoItem, index) in changelInfoList[channelTabIndex]"
:data-log="{
xcxClick: '首页-三屏页面点击',
pageName: '首页-三屏',
buttonName: `首页内容资源位分类${channelTabIndex + 1}-${channelTabList[channelTabIndex]}-${index + 1}`
}" @tap="jumpLink(infoItem.link, false, false, $event)">
buttonName: `首页内容资源位分类${channelTabIndex + 1}-${channelTabList[channelTabIndex]}-${
index + 1
}`,
}"
@tap="jumpLink(infoItem.link, false, false, $event)"
>
<image class="infoimg2" :src="$baseUrl + infoItem.bgUrl"></image>
<view class="infotitle2box">
<view class="infotitle2">
......@@ -307,18 +412,27 @@
<view id="fourthScreen" class="bottomlink">
<image class="bottombg" :src="$baseUrl + 'homepage/bottombg.png'"></image>
<view class="box">
<image class="icon" :id="'bottomLink' + index" v-for="(icon, index) in bottomLinkList" :key="index"
<image
class="icon"
:id="'bottomLink' + index"
v-for="(icon, index) in bottomLinkList"
:key="index"
:data-log="{
xcxClick: '首页-四屏页面点击',
pageName: '首页-四屏',
buttonName: `${qrNameList[index]}`
}" :data-comlog="{
buttonName: `${qrNameList[index]}`,
}"
:data-comlog="{
xcxComponentClick: 'true',
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '跳转工具',
componentContent: `${qrNameList[index]}`
}" :src="$baseUrl + icon.bgUrl" :style="icon._style" @tap="showPopup(index, $event)"></image>
componentContent: `${qrNameList[index]}`,
}"
:src="$baseUrl + icon.bgUrl"
:style="icon._style"
@tap="showPopup(index, $event)"
></image>
</view>
</view>
</view>
......@@ -329,8 +443,13 @@
</view> -->
<view>
<!-- 普通弹窗 企微等二维码-->
<uni-popup :is-mask-click="false" :safe-area="false" ref="popup" background-color="#fff"
border-radius="48rpx">
<uni-popup
:is-mask-click="false"
:safe-area="false"
ref="popup"
background-color="#fff"
border-radius="48rpx"
>
<view v-if="qrObj !== null" class="popup-content">
<image class="btnclose" @tap="closePop" :src="$baseUrl + 'homepage/btnclose.png'"></image>
<view class="title">
......@@ -338,10 +457,13 @@
</view>
<rich-text class="desc" :nodes="qrObj.desc || ''"></rich-text>
<image :show-menu-by-longpress="true" class="qrcode" :src="$baseUrl + (qrObj.qrUrl || '')"></image>
<image @tap="downloadHandler($baseUrl + (qrObj.qrUrl || ''))" class="btndownload"
:src="$baseUrl + 'homepage/btn_download.png'"></image>
<image
@tap="downloadHandler($baseUrl + (qrObj.qrUrl || ''))"
class="btndownload"
:src="$baseUrl + 'homepage/btn_download.png'"
></image>
</view>
<view v-else class="popup-content" style="height: 977rpx;">
<view v-else class="popup-content" style="height: 977rpx">
<image class="xingmahui" :src="$baseUrl + 'homepage/xingmahui.png'"></image>
<image class="btnclose" @tap="closePop" :src="$baseUrl + 'homepage/btnclose.png'"></image>
</view>
......@@ -352,19 +474,35 @@
<uni-popup :is-mask-click="false" :safe-area="false" ref="imagePopup" background-color="transparent">
<view class="image-popup-content">
<image class="popup-image" :src="popupImageUrl" mode="aspectFit" @tap="imagePopupJump"></image>
<image class="popup-close-btn" @tap="closeImagePopup" :src="$baseUrl + 'homepage/btnclose.png'"></image>
<image
class="popup-close-btn"
@tap="closeImagePopup"
:src="$baseUrl + 'homepage/btnclose.png'"
></image>
</view>
</uni-popup>
<view v-if="showVideo" class="video-popup">
<video :src="currentVideoUrl" controls autoplay :style="{ width: '100vw', height: videoHeight }"></video>
<video
:src="currentVideoUrl"
controls
autoplay
:style="{ width: '100vw', height: videoHeight }"
></video>
<view class="close-btn-bottom" @tap="closeVideo">×</view>
</view>
<RegisterLayer v-model="showRegisterLayer" />
<!-- 答案解析弹窗 -->
<CanEatAnswerPopup :visible="showAnswerPopup" :isCorrect="isAnswerCorrect" :rewardInfo="rewardInfo"
:question="currentQuestion" :correctAnswer="correctAnswer" :analysis="answerAnalysis"
:allResult="canEatData?.analysis?.allResult" @close="showAnswerPopup = false" />
<CanEatAnswerPopup
:visible="showAnswerPopup"
:isCorrect="isAnswerCorrect"
:rewardInfo="rewardInfo"
:question="currentQuestion"
:correctAnswer="correctAnswer"
:analysis="answerAnalysis"
:allResult="canEatData?.analysis?.allResult"
@close="showAnswerPopup = false"
/>
<!-- 金币动画模块 -->
<view class="gold-coin-animation" v-if="showGoldCoinAnimation" @tap="hideGoldCoinAnimation">
......@@ -374,72 +512,63 @@
<view class="gold-coin-title">{{ goldCoinConfig.title }}</view>
<view class="gold-coin-description">{{ goldCoinConfig.description }}</view>
<view class="gold-coin-container">
<image class="gold-coin gold-coin-1"
:src="goldCoinConfig.imageUrl || $baseUrl + 'homepage/Q3Res/goldCoin.png'"></image>
<image
class="gold-coin gold-coin-1"
:src="goldCoinConfig.imageUrl || $baseUrl + 'homepage/Q3Res/goldCoin.png'"
></image>
</view>
</view>
</view>
</view>
</template>
<script>
import {
jump,
JumpType
} from '../utils';
import {
useHomeStore
} from '../stores/home';
import {
fetchHomeJSON,
fetchCanEatIndex,
fetchCanEatJoin
} from '../api/home';
import {
useUserStore
} from '../stores/user';
import RegisterLayer from "../components/RegisterLayer.vue";
import { jump, JumpType } from '../utils';
import { useHomeStore } from '../stores/home';
import { fetchHomeJSON, fetchCanEatIndex, fetchCanEatJoin } from '../api/home';
import { useUserStore } from '../stores/user';
import RegisterLayer from '../components/RegisterLayer.vue';
import CanEatAnswerPopup from '../components/CanEatAnswerPopup.vue';
import md from '../md';
import ExposureTracker from '../utils/exposure';
import {
getHealthField
} from "@/api/common";
import { getHealthField } from '@/api/common';
import { useGlobalStore } from '@/stores/global.js';
const globalStore = useGlobalStore();
// const homeStore = useHomeStore();
const userStore = useUserStore();
// 定义需要曝光检测的元素配置
const EXPOSURE_CONFIGS = [{
const EXPOSURE_CONFIGS = [
{
id: 'firstScreen',
logParams: {
xcxPage: '首页-首屏页面浏览',
pageName: '首页-首屏'
}
},
// 可以添加更多需要曝光检测的元素配置
{
pageName: '首页-首屏',
},
},
// 可以添加更多需要曝光检测的元素配置
{
id: 'secondScreen',
logParams: {
xcxPage: '首页-二屏页面浏览',
pageName: '首页-二屏'
}
},
{
pageName: '首页-二屏',
},
},
{
id: 'thirdScreen',
logParams: {
xcxPage: '首页-三屏页面浏览',
pageName: '首页-三屏'
}
},
{
pageName: '首页-三屏',
},
},
{
id: 'fourthScreen',
logParams: {
xcxPage: '首页-四屏页面浏览',
pageName: '首页-四屏'
}
}
pageName: '首页-四屏',
},
},
];
export default {
......@@ -459,7 +588,7 @@ export default {
// 悬浮图片位置配置
floatIconPosition: {
left: 300, // 初始左位置
top: 500 // 初始上位置
top: 500, // 初始上位置
},
// 答案弹窗相关数据
showAnswerPopup: false,
......@@ -492,8 +621,8 @@ export default {
autoplay: true,
interval: 4000,
duration: 500,
indicatoractiveColor: "#a6a0a1",
indicatorColor: "rgba(255, 255, 255, 1)",
indicatoractiveColor: '#a6a0a1',
indicatorColor: 'rgba(255, 255, 255, 1)',
toolList: {},
expertTeam: {},
vipCardList: [],
......@@ -505,27 +634,32 @@ export default {
bottomLinkList: [],
qrInfoObj: undefined,
popupIndex: 0,
qrInfoList: [{
qrInfoList: [
{
title: '',
desc: '',
qrUrl: ''
}, {
qrUrl: '',
},
{
title: '',
desc: '',
qrUrl: ''
}, {
qrUrl: '',
},
{
title: '',
desc: '',
qrUrl: ''
}, {
qrUrl: '',
},
{
title: '',
desc: '',
qrUrl: ''
}],
qrUrl: '',
},
],
qrObj: {
title: '',
desc: '',
qrUrl: ''
qrUrl: '',
},
showVideo: false,
currentVideoUrl: '',
......@@ -555,13 +689,13 @@ export default {
goldCoinConfig: {
title: '',
description: '',
imageUrl: '' // 奖品图片URL
}
}
imageUrl: '', // 奖品图片URL
},
};
},
components: {
RegisterLayer,
CanEatAnswerPopup
CanEatAnswerPopup,
},
computed: {
homeStore() {
......@@ -582,13 +716,13 @@ export default {
// 金币动画是否显示
if (this.showGoldCoinAnimation) return true;
return false;
}
},
},
props: {
scrollTop: {
type: Number,
default: 0
}
default: 0,
},
},
watch: {
homeStore: {
......@@ -600,13 +734,13 @@ export default {
}
},
deep: true,
immediate: true
immediate: true,
},
scrollTop: {
handler(newVal) {
this.checkExposure(newVal);
}
}
},
},
},
mounted() {
const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
......@@ -639,20 +773,18 @@ export default {
testSource() {
uni.navigateTo({
url: '/pages/syWebview/syWebview?p=xmh'
})
url: '/pages/syWebview/syWebview?p=xmh',
});
},
async initHomeInfo() {
const {
data
} = await fetchHomeJSON();
console.warn("data", data)
const { data } = await fetchHomeJSON(globalStore.getPreviewScene('home'));
console.warn('data', data);
if (data) {
this.swiperList = data.swiperList || [
{
"link": {},
"title": "默认图",
"url": this.$baseUrl + "homepage/homeSwiperDefaultBg.png"
link: {},
title: '默认图',
url: this.$baseUrl + 'homepage/homeSwiperDefaultBg.png',
},
];
this.vipConfigList = data.vipConfigList;
......@@ -670,15 +802,16 @@ export default {
this.suggest = data.suggest;
this.childrenInfoListMianTitle = data.childrenInfoListMianTitle;
this.channelTabListMianTitle = data.channelTabListMianTitle;
this.popupImageUrl = data.popupImageObj?.imageUrl?.startsWith('http') ? data.popupImageObj?.imageUrl : this.$baseUrl + data.popupImageObj?.imageUrl || '';
this.popupImageUrl = data.popupImageObj?.imageUrl?.startsWith('http')
? data.popupImageObj?.imageUrl
: this.$baseUrl + data.popupImageObj?.imageUrl || '';
this.popupImageObj = data.popupImageObj || {};
this.floatIcon = data.floatIcon || {};
if (this.homeStore.isLogin) {
this.vipCardList[0] = data.vipConfigList.find(item => item.grade === this.homeStore.homeInfo
?.grade);
this.vipCardList[0] = data.vipConfigList.find(
(item) => item.grade === this.homeStore.homeInfo?.grade
);
this.vipCardList[0].level = this.homeStore.homeInfo?.gradeName;
} else {
this.vipCardList[0] = data.vipConfigList[0];
......@@ -695,61 +828,61 @@ export default {
if (this.canEatData && this.canEatData.id) {
if (this.canEatData.isAnswered || this.canEatData.myAnswer) {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "能不能吃",
componentContent: "查看问题解析"
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '能不能吃',
componentContent: '查看问题解析',
});
}
if (!this.canEatData.isAnswered && !this.canEatData.myAnswer) {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "能不能吃",
componentContent: "能吃"
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '能不能吃',
componentContent: '能吃',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "能不能吃",
componentContent: "少吃"
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '能不能吃',
componentContent: '少吃',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "能不能吃",
componentContent: "慎吃"
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '能不能吃',
componentContent: '慎吃',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "能不能吃",
componentContent: "禁吃"
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '能不能吃',
componentContent: '禁吃',
});
}
}
if (this.floatIcon?.imageUrl) {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "悬浮窗",
componentContent: "悬浮窗"
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '悬浮窗',
componentContent: '悬浮窗',
});
}
const componentContent = this.toolList.tools?.[this.currentIndex]?.title || '';
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "工具推荐",
componentContent: componentContent
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '工具推荐',
componentContent: componentContent,
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "首页banner",
componentContent: this.swiperList[0]?.title || ''
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '首页banner',
componentContent: this.swiperList[0]?.title || '',
});
const childrenInfoList = this.childrenInfoList;
......@@ -760,8 +893,8 @@ export default {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: item.desc
}
componentContent: item.desc,
},
});
});
this.qrNameList.forEach((item, index) => {
......@@ -771,20 +904,21 @@ export default {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '跳转工具',
componentContent: `${item}`
}
componentContent: `${item}`,
},
});
});
//动态添加专家团的首屏数据
this.exposureTracker.addExposureElements([{
this.exposureTracker.addExposureElements([
{
id: 'expertTeam',
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: '专家团tab切换-名医专家'
}
componentContent: '专家团tab切换-名医专家',
},
},
{
id: 'et_joingroup',
......@@ -792,24 +926,26 @@ export default {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: '专家团-进群咨询'
}
}, {
componentContent: '专家团-进群咨询',
},
},
{
id: 'et_more',
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: '专家团-查看更多'
}
}, {
componentContent: '专家团-查看更多',
},
},
{
id: 'childrenInfoList',
logParams: {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: '育儿智库'
}
componentContent: '育儿智库',
},
},
{
id: 'childrenInfoListMore',
......@@ -817,40 +953,39 @@ export default {
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '育儿智库',
componentContent: '育儿智库-more'
}
}
componentContent: '育儿智库-more',
},
},
]);
},
changeIndicatorDots(e) {
this.indicatorDots = !this.indicatorDots
this.indicatorDots = !this.indicatorDots;
},
changeAutoplay(e) {
this.autoplay = !this.autoplay
this.autoplay = !this.autoplay;
},
intervalChange(e) {
this.interval = e.target.value
this.interval = e.target.value;
},
durationChange(e) {
this.duration = e.target.value
this.duration = e.target.value;
},
jumpBannerHandler(item, index) {
console.log("item====", item)
console.log('item====', item);
md.sensorLogTake({
xcxClick: '首页-首屏页面点击',
pageName: '首页-首屏',
buttonName: `第${index + 1}张焦点图-入口`,
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "首页banner",
componentContent: item.title
xcxComponentClick: 'true',
pageName: '首页',
componentName: '首页banner',
componentContent: item.title,
});
if (item.videoUrl) {
this.currentVideoUrl = item.videoUrl.indexOf('http') === -1 ? this.$baseUrl + item.videoUrl : item.videoUrl;
this.currentVideoUrl =
item.videoUrl.indexOf('http') === -1 ? this.$baseUrl + item.videoUrl : item.videoUrl;
this.showVideo = true;
return;
}
......@@ -861,14 +996,14 @@ export default {
// 没有 link,预览图片
uni.previewImage({
urls: [item.url.indexOf('http') === -1 ? this.$baseUrl + item.url : item.url], // 预览当前图片
current: item.url.indexOf('http') === -1 ? this.$baseUrl + item.url : item.url // 当前显示的图片
current: item.url.indexOf('http') === -1 ? this.$baseUrl + item.url : item.url, // 当前显示的图片
});
}
},
previewImage(url) {
uni.previewImage({
urls: [url], // 预览当前图片
current: url // 当前显示的图片
current: url, // 当前显示的图片
});
},
jumpLinkWithLogin(link, evt) {
......@@ -904,9 +1039,9 @@ export default {
// 弹出视频
this.currentVideoUrl = videoUrl;
if (index === 1) {
this.videoHeight = "100vw";
this.videoHeight = '100vw';
} else {
this.videoHeight = "56vw";
this.videoHeight = '56vw';
}
this.showVideo = true;
return;
......@@ -952,14 +1087,14 @@ export default {
md.sensorLogTake({
xcxClick: `首页-二屏页面点击`,
pageName: `首页-二屏`,
buttonName: type == 1 ? '专家团副标题点击' : '专家团进群咨询按钮点击'
buttonName: type == 1 ? '专家团副标题点击' : '专家团进群咨询按钮点击',
});
if (type == 2) {
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "专家团",
componentContent: '专家团-进群咨询'
xcxComponentClick: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: '专家团-进群咨询',
});
}
if (_index === 3) {
......@@ -981,14 +1116,14 @@ export default {
goSearchHandler(e) {
md.sensorLog(e);
uni.navigateTo({
url: "/pages/search/search"
})
url: '/pages/search/search',
});
},
downloadHandler(imgurl) {
md.sensorLogTake({
xcxClick: `${this.qrNameList[this.popupIndex]}拉起半屏二维码入口页面点击`,
pageName: `${this.qrNameList[this.popupIndex]}拉起半屏二维码入口页面点击`,
buttonName: `下载二维码`
buttonName: `下载二维码`,
});
uni.downloadFile({
......@@ -1000,29 +1135,29 @@ export default {
success: (res) => {
uni.showToast({
title: '保存成功',
icon: 'success'
icon: 'success',
});
},
fail: (err) => {
uni.showToast({
title: '保存失败',
icon: 'none'
icon: 'none',
});
}
},
});
} else {
uni.showToast({
title: '下载失败',
icon: 'none'
icon: 'none',
});
}
},
fail: (err) => {
uni.showToast({
title: '下载失败',
icon: 'none'
icon: 'none',
});
}
},
});
},
closeVideo() {
......@@ -1043,17 +1178,11 @@ export default {
},
goCustomerHandler(e) {
md.sensorLog(e);
const {
memberId,
mobile,
openId,
unionId
} = this.homeStore.homeInfo;
const customerUrl =
`https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId}&mobile=${mobile}&openId=${openId}&unionId=${unionId}`;
const { memberId, mobile, openId, unionId } = this.homeStore.homeInfo;
const customerUrl = `https://intelcc-user.icsoc.net/?channelKey=45839e0505554f8c8aea3c7b6259b049&init=1&crmld=${memberId}&mobile=${mobile}&openId=${openId}&unionId=${unionId}`;
jump({
type: JumpType.H5,
url: customerUrl
url: customerUrl,
});
},
checkExposure(scrollTop) {
......@@ -1088,17 +1217,17 @@ export default {
// 添加埋点
const answerTexts = ['能吃', '少吃', '慎吃', '禁吃'];
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "能不能吃",
componentContent: answerTexts[answerIndex] || '能吃'
xcxComponentClick: 'true',
pageName: '首页',
componentName: '能不能吃',
componentContent: answerTexts[answerIndex] || '能吃',
});
// 添加登录检查
if (!this.homeStore.isLogin) {
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
url: '/pages/activity/register',
});
return;
}
......@@ -1106,7 +1235,7 @@ export default {
if (!this.canEatData || !this.canEatData.id) {
uni.showToast({
title: '数据异常,请稍后重试',
icon: 'none'
icon: 'none',
});
return;
}
......@@ -1114,7 +1243,7 @@ export default {
try {
const response = await fetchCanEatJoin({
id: this.canEatData.id,
answer: answerIndex
answer: answerIndex,
});
if (response.success && response.data) {
......@@ -1132,19 +1261,28 @@ export default {
myAnswer: userAnswer,
correctAnswer: correctAnswer,
correct: correctAnswerIndex, // 保存数字格式的正确答案
isCorrect: isCorrect
isCorrect: isCorrect,
};
// 如果答对了并且有奖励,显示奖励弹窗
if (isCorrect && response.data.reward && (response.data.reward.credits > 0 || response.data.reward.prizeName)) {
if (
isCorrect &&
response.data.reward &&
(response.data.reward.credits > 0 || response.data.reward.prizeName)
) {
this.showRewardPopup(response.data.reward);
} else {
// 其他情况显示解析弹窗
this.showAnswerResult({
this.showAnswerResult(
{
analysis: this.canEatData.analysis?.content || '暂无解析内容',
allResult: this.canEatData.analysis?.allResult || '25|25|25|25',
reward: response.data.reward || null
}, isCorrect, userAnswer, correctAnswer);
reward: response.data.reward || null,
},
isCorrect,
userAnswer,
correctAnswer
);
}
// 答题后刷新数据
......@@ -1152,14 +1290,14 @@ export default {
} else {
uni.showToast({
title: response.message || '答题失败,请稍后重试',
icon: 'none'
icon: 'none',
});
}
} catch (error) {
console.error('提交能不能吃答案异常:', error);
uni.showToast({
title: '网络异常,请稍后重试',
icon: 'none'
icon: 'none',
});
}
},
......@@ -1173,7 +1311,10 @@ export default {
let imageUrl = '';
if (rewardData.prizeImage) {
// 如果有奖品图片,使用奖品图片
imageUrl = rewardData.prizeImage.indexOf('http') === 0 ? rewardData.prizeImage : this.$baseUrl + rewardData.prizeImage;
imageUrl =
rewardData.prizeImage.indexOf('http') === 0
? rewardData.prizeImage
: this.$baseUrl + rewardData.prizeImage;
} else if (rewardData.credits && !rewardData.prizeName) {
// 如果只有积分奖励,使用金币图片
imageUrl = this.$baseUrl + 'homepage/Q3Res/goldCoin.png';
......@@ -1189,7 +1330,7 @@ export default {
this.goldCoinConfig = {
title: '恭喜你回答正确',
description: `获得${rewardText}`,
imageUrl: imageUrl
imageUrl: imageUrl,
};
// 显示金币动画
......@@ -1198,9 +1339,9 @@ export default {
// 添加金币动画模块曝光埋点
this.$nextTick(() => {
md.sensorPopLogTake({
xcxPopExposure: "true",
toolName: "能不能吃",
popName: "答题结果弹窗"
xcxPopExposure: 'true',
toolName: '能不能吃',
popName: '答题结果弹窗',
});
});
......@@ -1211,12 +1352,16 @@ export default {
setTimeout(() => {
this.showGoldCoinAnimation = false;
// 动效结束展示解析弹窗
this.showAnswerResult({
this.showAnswerResult(
{
analysis: currentCanEatData.analysis?.content || '暂无解析内容',
allResult: currentCanEatData.analysis?.allResult || '25|25|25|25',
reward: rewardData || null
}, true, currentCanEatData.myAnswer, currentCanEatData.correctAnswer);
reward: rewardData || null,
},
true,
currentCanEatData.myAnswer,
currentCanEatData.correctAnswer
);
}, 3000);
},
......@@ -1225,35 +1370,35 @@ export default {
// 根据奖品名称或类型返回对应的图片
const prizeImages = {
// 积分类奖品
'积分': this.$baseUrl + 'homepage/Q3Res/goldCoin.png',
'碳能量': this.$baseUrl + 'homepage/Q3Res/goldCoin.png',
积分: this.$baseUrl + 'homepage/Q3Res/goldCoin.png',
碳能量: this.$baseUrl + 'homepage/Q3Res/goldCoin.png',
// 优惠券类奖品
'优惠券': this.$baseUrl + 'homepage/Q3Res/coupon.png',
'代金券': this.$baseUrl + 'homepage/Q3Res/coupon.png',
'折扣券': this.$baseUrl + 'homepage/Q3Res/coupon.png',
优惠券: this.$baseUrl + 'homepage/Q3Res/coupon.png',
代金券: this.$baseUrl + 'homepage/Q3Res/coupon.png',
折扣券: this.$baseUrl + 'homepage/Q3Res/coupon.png',
// 实物奖品
'奶粉': this.$baseUrl + 'homepage/Q3Res/milkPowder.png',
'辅食': this.$baseUrl + 'homepage/Q3Res/babyFood.png',
'玩具': this.$baseUrl + 'homepage/Q3Res/toy.png',
'用品': this.$baseUrl + 'homepage/Q3Res/babyProduct.png',
奶粉: this.$baseUrl + 'homepage/Q3Res/milkPowder.png',
辅食: this.$baseUrl + 'homepage/Q3Res/babyFood.png',
玩具: this.$baseUrl + 'homepage/Q3Res/toy.png',
用品: this.$baseUrl + 'homepage/Q3Res/babyProduct.png',
// 虚拟奖品
'会员': this.$baseUrl + 'homepage/Q3Res/vip.png',
'体验': this.$baseUrl + 'homepage/Q3Res/experience.png',
会员: this.$baseUrl + 'homepage/Q3Res/vip.png',
体验: this.$baseUrl + 'homepage/Q3Res/experience.png',
// 默认奖品图片
'default': this.$baseUrl + 'homepage/Q3Res/gift.png'
default: this.$baseUrl + 'homepage/Q3Res/gift.png',
};
// 根据奖品类型匹配
if (prizeType) {
const typeImages = {
'CREDITS': this.$baseUrl + 'homepage/Q3Res/goldCoin.png',
'COUPON': this.$baseUrl + 'homepage/Q3Res/coupon.png',
'PHYSICAL': this.$baseUrl + 'homepage/Q3Res/gift.png',
'VIRTUAL': this.$baseUrl + 'homepage/Q3Res/vip.png'
CREDITS: this.$baseUrl + 'homepage/Q3Res/goldCoin.png',
COUPON: this.$baseUrl + 'homepage/Q3Res/coupon.png',
PHYSICAL: this.$baseUrl + 'homepage/Q3Res/gift.png',
VIRTUAL: this.$baseUrl + 'homepage/Q3Res/vip.png',
};
if (typeImages[prizeType]) {
return typeImages[prizeType];
......@@ -1282,8 +1427,8 @@ export default {
this.isAnswerCorrect = isCorrect;
this.currentQuestion = this.canEatData.title || '';
// 确保正确答案是文案而不是索引
this.correctAnswer = typeof correctAnswer === 'number' ?
['能吃', '少吃', '慎吃', '禁吃'][correctAnswer] : correctAnswer;
this.correctAnswer =
typeof correctAnswer === 'number' ? ['能吃', '少吃', '慎吃', '禁吃'][correctAnswer] : correctAnswer;
// 设置奖励信息
if (responseData.reward) {
......@@ -1318,30 +1463,36 @@ export default {
viewAnalysis() {
// 添加埋点
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "能不能吃",
componentContent: "查看问题解析"
xcxComponentClick: 'true',
pageName: '首页',
componentName: '能不能吃',
componentContent: '查看问题解析',
});
console.warn('查看解析数据:', this.canEatData);
if (this.canEatData && this.canEatData.myAnswer && this.canEatData.correct !== undefined) {
// 将正确答案从数字格式转换为文案格式
const correctAnswerText = { 0: '能吃', 1: '少吃', 2: '慎吃', 3: '禁吃' }[this.canEatData.correct] || '能吃';
const correctAnswerText =
{ 0: '能吃', 1: '少吃', 2: '慎吃', 3: '禁吃' }[this.canEatData.correct] || '能吃';
// 通过比较用户答案和正确答案判断答题正确性
const isCorrect = this.canEatData.correct == this.canEatData.myAnswer;
// 显示解析弹窗
this.showAnswerResult({
this.showAnswerResult(
{
analysis: this.canEatData.analysis?.content || '暂无解析内容',
allResult: this.canEatData.analysis?.allResult || '',
reward: this.canEatData.reward || null
}, isCorrect, this.canEatData.myAnswer, correctAnswerText);
reward: this.canEatData.reward || null,
},
isCorrect,
this.canEatData.myAnswer,
correctAnswerText
);
} else {
uni.showToast({
title: '暂无解析内容',
icon: 'none'
icon: 'none',
});
}
},
......@@ -1350,68 +1501,62 @@ export default {
this.currentIndex = e.detail.current;
const componentContent = this.toolList.tools?.[this.currentIndex]?.title || '';
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "工具推荐",
componentContent: componentContent
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '工具推荐',
componentContent: componentContent,
});
},
onBannerSwiperChange(e) {
this.bannerCurrentIndex = e.detail.current;
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "首页",
componentName: "首页banner",
componentContent: this.swiperList[e.detail.current].title
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '首页banner',
componentContent: this.swiperList[e.detail.current].title,
});
},
async handleToolClick(item) {
md.sensorLogTake({
xcxClick: "首页-二屏页面点击",
pageName: "首页-二屏",
buttonName: item.title + "工具点击",
xcxClick: '首页-二屏页面点击',
pageName: '首页-二屏',
buttonName: item.title + '工具点击',
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "工具推荐",
componentContent: item.title
xcxComponentClick: 'true',
pageName: '首页',
componentName: '工具推荐',
componentContent: item.title,
});
if (item.title === "医生问诊") {
if (item.title === '医生问诊') {
// if (!cfgStatus.value.isRegister) return;
const res = await getHealthField();
if (!res.success) {
uni.showToast({
title: "获取健康字段失败",
icon: "none",
title: '获取健康字段失败',
icon: 'none',
});
return;
}
const {
sign,
timestamp,
appId,
partnerUserId,
env
} = res.data;
const { sign, timestamp, appId, partnerUserId, env } = res.data;
jump({
type: JumpType.MINI,
url: "/pages/partner/redirect",
url: '/pages/partner/redirect',
extra: {
appId: "wx81ecfb5aa3fb512f",
appId: 'wx81ecfb5aa3fb512f',
envVersion: env,
extraData: {
sign, // 参考 4.请求参数
timestamp, // 参考 4.请求参数
appId, // 参考 4.请求参数
partnerUserId, // 参考 4.请求参数
targetApp: "/h5/partner/shining-like-a-start/landing-free-consult?sysType=CRF",
targetApp: '/h5/partner/shining-like-a-start/landing-free-consult?sysType=CRF',
},
},
});
......@@ -1425,18 +1570,18 @@ export default {
},
onSelEtTap(index) {
let str = index === 0 ? '名医专家' : (index === 1 ? '科研专家' : '权威机构')
let str = index === 0 ? '名医专家' : index === 1 ? '科研专家' : '权威机构';
md.sensorLogTake({
xcxClick: "首页-二屏页面点击",
pageName: "首页-二屏",
buttonName: str + "tab按钮点击",
xcxClick: '首页-二屏页面点击',
pageName: '首页-二屏',
buttonName: str + 'tab按钮点击',
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
xcxComponentExposure: "true",
pageName: "首页",
componentName: "专家团",
componentContent: '专家团tab切换-' + str
xcxComponentClick: 'true',
xcxComponentExposure: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: '专家团tab切换-' + str,
});
this.etTabSelIndex = index;
......@@ -1451,24 +1596,24 @@ export default {
str = '权威机构';
}
if (index === 1) {
str += '内容'
str += '内容';
} else {
str += '点击查看更多';
}
md.sensorLogTake({
xcxClick: "首页-二屏页面点击",
pageName: "首页-二屏",
buttonName: str + "-点击",
xcxClick: '首页-二屏页面点击',
pageName: '首页-二屏',
buttonName: str + '-点击',
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "专家团",
componentContent: str
xcxComponentClick: 'true',
pageName: '首页',
componentName: '专家团',
componentContent: str,
});
jump({
type: 1,
url: '/pages/expertTeamPage/expertTeamPage?tab=' + (this.etTabSelIndex + 1)
url: '/pages/expertTeamPage/expertTeamPage?tab=' + (this.etTabSelIndex + 1),
});
},
closeImagePopup() {
......@@ -1479,22 +1624,22 @@ export default {
imagePopupJump() {
md.sensorPopLogTake({
xcxPopClick: "true",
toolName: "首页",
popName: this.popupImageObj.title || "北纬47°鲜活溯源之旅",
buttonName: this.popupImageObj.btnName || "立即寻宝"
xcxPopClick: 'true',
toolName: '首页',
popName: this.popupImageObj.title || '北纬47°鲜活溯源之旅',
buttonName: this.popupImageObj.btnName || '立即寻宝',
});
jump({
type: this.popupImageObj.jumpType || this.popupImageObj.jumpExtra?.type,
url: this.popupImageObj.jumpUrl,
extra: this.popupImageObj.jumpExtra
extra: this.popupImageObj.jumpExtra,
});
},
showImagePopup() {
md.sensorPopLogTake({
xcxPopExposure: "true",
toolName: "首页",
popName: this.popupImageObj.title || "北纬47°鲜活溯源之旅"
xcxPopExposure: 'true',
toolName: '首页',
popName: this.popupImageObj.title || '北纬47°鲜活溯源之旅',
});
this.$refs.imagePopup.open('center');
// 设置图片弹窗为可见状态
......@@ -1568,24 +1713,27 @@ export default {
// 悬浮图片点击事件
onfloatIconClick() {
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "悬浮窗",
componentContent: "悬浮窗"
xcxComponentClick: 'true',
pageName: '首页',
componentName: '悬浮窗',
componentContent: '悬浮窗',
});
// 如果正在拖拽,则不触发点击事件
if (!this.isDragging) {
// 记录点击日志
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "首页",
componentName: "悬浮图片",
componentContent: "点击悬浮图片"
xcxComponentClick: 'true',
pageName: '首页',
componentName: '悬浮图片',
componentContent: '点击悬浮图片',
});
if (this.floatIcon.videoUrl) {
// 播放视频
this.currentVideoUrl = this.floatIcon.videoUrl.indexOf('http') === -1 ? this.$baseUrl + this.floatIcon.videoUrl : this.floatIcon.videoUrl;
this.currentVideoUrl =
this.floatIcon.videoUrl.indexOf('http') === -1
? this.$baseUrl + this.floatIcon.videoUrl
: this.floatIcon.videoUrl;
this.showVideo = true;
return;
} else if (this.floatIcon.link) {
......@@ -1593,9 +1741,9 @@ export default {
jump(this.floatIcon.link);
}
}
}
}
}
},
},
};
</script>
<style lang="less" scoped>
......@@ -1692,7 +1840,7 @@ export default {
width: 40rpx;
height: 16rpx;
border-radius: 8rpx;
background-color: #D3A358;
background-color: #d3a358;
}
}
}
......@@ -1866,7 +2014,6 @@ export default {
white-space: nowrap;
word-break: break-all;
max-width: 7em;
}
.tool_context {
......@@ -1884,12 +2031,10 @@ export default {
-webkit-box-orient: vertical;
line-height: 1.5;
max-height: 3em;
}
}
}
/* 自定义指示点样式 */
.custom-indicator {
width: 200rpx;
......@@ -2047,7 +2192,6 @@ export default {
height: 232rpx;
position: absolute;
z-index: 0;
}
.level {
......@@ -2094,7 +2238,6 @@ export default {
top: 0;
opacity: 0;
pointer-events: auto;
}
.cardbtnbg {
......@@ -2146,7 +2289,6 @@ export default {
.contentitem {
position: absolute;
}
}
.channelbox {
......@@ -2181,8 +2323,6 @@ export default {
}
}
.listbox {
display: flex;
margin-top: 20rpx;
......@@ -2262,12 +2402,9 @@ export default {
width: 46rpx;
height: 22rpx;
color: #fff;
}
}
.infodesc {
color: #999999;
font-size: 22rpx;
......@@ -2279,12 +2416,8 @@ export default {
overflow: hidden;
}
}
}
}
}
.channelscroll2 {
......@@ -2345,9 +2478,7 @@ export default {
}
}
.desc {
color: @color-black-deep;
font-size: 24rpx;
display: flex;
......@@ -2385,11 +2516,10 @@ export default {
align-items: flex-end;
justify-content: space-between;
.icon {}
.icon {
}
}
}
}
.popup-content {
......@@ -2421,7 +2551,6 @@ export default {
font-size: 36rpx;
color: @color-black-deep;
font-weight: bold;
}
.desc {
......@@ -2431,7 +2560,6 @@ export default {
font-size: 28rpx;
color: @color-black-medium;
font-weight: bold;
}
.qrcode {
......@@ -2583,9 +2711,9 @@ export default {
padding: 20rpx 0;
margin: 0 10rpx;
background-color: #fff;
border: 1px solid #B27C1E;
border: 1px solid #b27c1e;
border-radius: 30rpx;
color: #B27C1E;
color: #b27c1e;
font-size: 28rpx;
}
......@@ -2618,22 +2746,22 @@ export default {
}
.user-answer.correct {
background-color: #E8F5E8;
color: #4CAF50;
border-color: #4CAF50;
background-color: #e8f5e8;
color: #4caf50;
border-color: #4caf50;
}
.user-answer.incorrect {
background-color: #FFEBEE;
color: #F44336;
border-color: #F44336;
background-color: #ffebee;
color: #f44336;
border-color: #f44336;
}
.correct-answer {
width: 100%;
text-align: center;
padding: 20rpx 0;
background-color: #B27C1E;
background-color: #b27c1e;
color: #ffffff;
font-size: 28rpx;
border-radius: 30rpx;
......@@ -2641,7 +2769,7 @@ export default {
.analysis-link {
font-size: 28rpx;
color: #B27C1E;
color: #b27c1e;
margin-top: 10rpx;
display: flex;
align-items: center;
......@@ -2686,7 +2814,6 @@ export default {
mix-blend-mode: multiply;
}
.gold-coin-content {
text-align: center;
padding: 60rpx 40rpx;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<template>
<view class="my-container">
<view v-if="cfgStatus.showDetail" class="wheel-selector-fixed">
<WheelSelector :options="wheelOptions" :selectedIndex="wheelSelectedIndex"
:bgImg="$baseUrl + 'my/track/track.png'" :iconNormal="$baseUrl + 'my/track/icon_stage_nor.png'"
<WheelSelector
:options="wheelOptions"
:selectedIndex="wheelSelectedIndex"
:bgImg="$baseUrl + 'my/track/track.png'"
:iconNormal="$baseUrl + 'my/track/icon_stage_nor.png'"
:iconSelected="$baseUrl + 'my/track/icon_stage_sel.png'"
@update:selectedIndex="(val) => (wheelSelectedIndex = val)" @change="handleWheelChange" />
@update:selectedIndex="(val) => (wheelSelectedIndex = val)"
@change="handleWheelChange"
/>
</view>
<view class="bg-container"
<view
class="bg-container"
v-if="cfgStatus.isRegister"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '个人信息修改',
}" @click="handleUploadBackground">
<image class="bg-img" :src="localBackgroundImg || babyInfo?.content?.backgroundImg || $baseUrl + 'my/default_bg.png'
" mode="widthFix" lazy-load="false" binderror="" bindload="" />
}"
@click="handleUploadBackground"
>
<image
class="bg-img"
:src="localBackgroundImg || babyInfo?.content?.backgroundImg || $baseUrl + 'my/default_bg.png'"
mode="widthFix"
lazy-load="false"
binderror=""
bindload=""
/>
<image class="banner_cover" :src="$baseUrl + 'my/cover_white.png'" mode="aspectFill" />
</view>
......@@ -33,10 +47,13 @@
buttonName: '个人信息修改',
}"
open-type="chooseAvatar"
@chooseavatar="onChooseAvatar">
<image class="avatar" :src="localAvatarUrl || babyInfo?.content?.babyAvatar ||
$baseUrl + 'common/default_avatar.png'
" mode="widthFix" />
@chooseavatar="onChooseAvatar"
>
<image
class="avatar"
:src="localAvatarUrl || babyInfo?.content?.babyAvatar || $baseUrl + 'common/default_avatar.png'"
mode="widthFix"
/>
</button>
<view
v-else
......@@ -46,49 +63,76 @@
pageName: '我的页面',
buttonName: '个人信息修改',
}"
@click="handleAvatarClick">
<image class="avatar" :src="localAvatarUrl || babyInfo?.content?.babyAvatar ||
$baseUrl + 'common/default_avatar.png'
" mode="widthFix" />
@click="handleAvatarClick"
>
<image
class="avatar"
:src="localAvatarUrl || babyInfo?.content?.babyAvatar || $baseUrl + 'common/default_avatar.png'"
mode="widthFix"
/>
</view>
</view>
<button v-if="!cfgStatus.isRegister" type="primary" class="avatar-container" @click="clickRegisterShield" />
<image class="avatar-modify" :src="$baseUrl + 'my/icon_modify.png'" mode="aspectFit" lazy-load="false" />
<button
v-if="!cfgStatus.isRegister"
type="primary"
class="avatar-container"
@click="clickRegisterShield"
/>
<image
class="avatar-modify"
:src="$baseUrl + 'my/icon_modify.png'"
mode="aspectFit"
lazy-load="false"
/>
<view class="user-detail">
<view class="user-detail-nickname" :data-log="{
<view
class="user-detail-nickname"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '宝宝信息切换',
}">
}"
>
<text class="nickname" @click="handleEditProfile">{{
babyInfo?.babyStage === 0
? "备孕"
? '备孕'
: babyInfo?.babyStage === 1
? "孕中"
: babyInfo.babyName || "暂无昵称"
? '孕中'
: babyInfo.babyName || '暂无昵称'
}}</text>
<view class="user-detail-nickname-icon-wrapper" @click="handleChangeBaby">
<image class="user-detail-nickname-icon" :src="$baseUrl + 'registerLayer/icon_arrow_yellow.png'"
mode="aspectFit" />
<image
class="user-detail-nickname-icon"
:src="$baseUrl + 'registerLayer/icon_arrow_yellow.png'"
mode="aspectFit"
/>
</view>
</view>
<!-- 积分账户 -->
<view class="integral-account" @click="handleEditProfile">
<text class="integral-account-text"> 账号: </text>
<text class="integral-account-value">
{{ userStore.memberInfo?.mobile || '' }}</text>
<text class="integral-account-value"> {{ userStore.memberInfo?.mobile || '' }}</text>
</view>
<BabySwitcher v-if="showBabySwitcher" :show="showBabySwitcher" :babyList="babyInfo.allBabyBaseInfo || []"
:addIcon="$baseUrl + 'my/baby_add_btn.png'" @close="showBabySwitcher = false" @select="onSelectBaby"
@add="onAddBaby" />
<BabySwitcher
v-if="showBabySwitcher"
:show="showBabySwitcher"
:babyList="babyInfo.allBabyBaseInfo || []"
:addIcon="$baseUrl + 'my/baby_add_btn.png'"
@close="showBabySwitcher = false"
@select="onSelectBaby"
@add="onAddBaby"
/>
</view>
<view class="integralContainer" @click="handleIntegralClick">
<image class="integralIcon" src="https://course.feihe.com/momclub-picture/my/integralBg.png"
mode="aspectFit" />
<text class="integralText0">{{ points || "0" }}</text>
<image
class="integralIcon"
src="https://course.feihe.com/momclub-picture/my/integralBg.png"
mode="aspectFit"
/>
<text class="integralText0">{{ points || '0' }}</text>
<text class="integralText1">积分</text>
</view>
</view>
......@@ -102,35 +146,51 @@
</view>
<view class="desc-content">
<text class="desc-text">{{
<text class="desc-text"
>{{
wheelOptions[wheelSelectedIndex]?.desc.length > 46
? cfgStatus.openBabyCardDesc
? wheelOptions[wheelSelectedIndex]?.desc
: wheelOptions[wheelSelectedIndex]?.desc.slice(0, 46) + "..."
: wheelOptions[wheelSelectedIndex]?.desc.slice(0, 46) + '...'
: wheelOptions[wheelSelectedIndex]?.desc
}}
</text>
<text v-if="wheelOptions[wheelSelectedIndex]?.desc.length > 46" class="desc-more" @click="handleOpenClick">{{
cfgStatus.openBabyCardDesc ? "点击收起" : "点击展开" }}</text>
<text
v-if="wheelOptions[wheelSelectedIndex]?.desc.length > 46"
class="desc-more"
@click="handleOpenClick"
>{{ cfgStatus.openBabyCardDesc ? '点击收起' : '点击展开' }}</text
>
</view>
</view>
</view>
<!-- 添加宝宝信息模块 -->
<view class="add-baby-info-module"
v-if="cfgStatus.isRegister && (!babyInfo?.allBabyBaseInfo || babyInfo.allBabyBaseInfo.length === 0)">
<view
class="add-baby-info-module"
v-if="cfgStatus.isRegister && (!babyInfo?.allBabyBaseInfo || babyInfo.allBabyBaseInfo.length === 0)"
>
<image class="add-baby-info-bg" :src="$baseUrl + 'homepage/Q3Res/addBabyInfoBg2.png'"></image>
<view class="add-baby-info-btn-container">
<image class="add-baby-info-btn" :src="$baseUrl + 'homepage/Q3Res/addBabyInfoBtn2.png'"
@tap="handleAddBabyInfoClick"></image>
<image
class="add-baby-info-btn"
:src="$baseUrl + 'homepage/Q3Res/addBabyInfoBtn2.png'"
@tap="handleAddBabyInfoClick"
></image>
</view>
</view>
<!-- 完成任务模块 -->
<view class="task-module"
v-if="cfgStatus.isRegister && (babyInfo?.allBabyBaseInfo && babyInfo.allBabyBaseInfo.length > 0)">
<view
class="task-module"
v-if="cfgStatus.isRegister && babyInfo?.allBabyBaseInfo && babyInfo.allBabyBaseInfo.length > 0"
>
<image class="task-guide-bg" :src="$baseUrl + 'homepage/Q3Res/my_taskGuideBg.png'"></image>
<image class="task-do-btn" :src="$baseUrl + 'homepage/Q3Res/my_taskDoBtn.png'" @tap="handleTaskClick"></image>
<image
class="task-do-btn"
:src="$baseUrl + 'homepage/Q3Res/my_taskDoBtn.png'"
@tap="handleTaskClick"
></image>
</view>
<!-- 工具 -->
......@@ -139,11 +199,19 @@
<view class="tool-list">
<template v-for="item in toolList" :key="item.title">
<view v-if="!item.hidden" class="tool-item" @click="handleToolClick(item)">
<image class="tool-icon" :src="item.bgUrl?.includes('http') ? item.bgUrl : $baseUrl + item.bgUrl"
mode="aspectFit" />
<image
class="tool-icon"
:src="item.bgUrl?.includes('http') ? item.bgUrl : $baseUrl + item.bgUrl"
mode="aspectFit"
/>
<!-- || item.title == '产检提醒' || item.title == '喂养记录' || item.title == '生长测评' -->
<button v-if="(item.title == '医生问诊') && !cfgStatus.isRegister" class="tool-btn-register" type="primary"
open-type="getPhoneNumber" @getphonenumber="getRealtimePhoneNumber" />
<button
v-if="item.title == '医生问诊' && !cfgStatus.isRegister"
class="tool-btn-register"
type="primary"
open-type="getPhoneNumber"
@getphonenumber="getRealtimePhoneNumber"
/>
</view>
</template>
</view>
......@@ -151,50 +219,76 @@
<view class="vip-active-area" v-if="pageCfgStore?.contentCfg?.activeInfo?.length > 0">
<text class="vip-title">精彩活动</text>
<swiper class="vip-active-swiper" :indicator-dots="pageCfgStore?.contentCfg?.activeInfo?.length > 1"
:autoplay="true" :circular="true" indicator-color="#dfddd9" indicator-active-color="#b27c1e"
:indicator-top="32">
<swiper
class="vip-active-swiper"
:indicator-dots="pageCfgStore?.contentCfg?.activeInfo?.length > 1"
:autoplay="true"
:circular="true"
indicator-color="#dfddd9"
indicator-active-color="#b27c1e"
:indicator-top="32"
>
<swiper-item v-for="(item, index) in pageCfgStore?.contentCfg?.activeInfo" :key="index">
<image class="vip-active-img" :src="item?.bgUrl?.includes('http') ? item?.bgUrl : $baseUrl + `${item?.bgUrl}`"
mode="aspectFit" @click="handleVipActiveClick(index, item)" />
<image
class="vip-active-img"
:src="item?.bgUrl?.includes('http') ? item?.bgUrl : $baseUrl + `${item?.bgUrl}`"
mode="aspectFit"
@click="handleVipActiveClick(index, item)"
/>
</swiper-item>
</swiper>
</view>
<!-- 功能菜单 -->
<view class="menu-container">
<view class="menu-item" @click="navigateToWithLogin('/v3/orderList/orderList')" :data-log="{
<view
class="menu-item"
@click="navigateToWithLogin('/v3/orderList/orderList')"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '我的订单'
}">
buttonName: '我的订单',
}"
>
<image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_myOrder.png'" mode="aspectFit" />
<text class="menu-title">我的订单</text>
<image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" />
</view>
<view class="menu-item" @click="navigateToWithLogin('/v3/addressList/addressList')" :data-log="{
<view
class="menu-item"
@click="navigateToWithLogin('/v3/addressList/addressList')"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '收货地址管理'
}">
buttonName: '收货地址管理',
}"
>
<image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_address.png'" mode="aspectFit" />
<text class="menu-title">收货地址管理</text>
<image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" />
</view>
<view class="menu-item" @click="navigateToCouponWithLogin()" :data-log="{
<view
class="menu-item"
@click="navigateToCouponWithLogin()"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '我的优惠券'
}">
buttonName: '我的优惠券',
}"
>
<image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_myCupon.png'" mode="aspectFit" />
<text class="menu-title">我的优惠券</text>
<image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" />
</view>
<view class="menu-item" @click="navigateToWithLogin('/v3/more/index')" :data-log="{
<view
class="menu-item"
@click="navigateToWithLogin('/v3/more/index')"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '更多'
}">
buttonName: '更多',
}"
>
<image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_more.png'" mode="aspectFit" />
<text class="menu-title">更多</text>
<image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" />
......@@ -221,13 +315,11 @@
<!-- 生日弹窗 type 3 钻石、4 星光、5 星耀 -->
<!-- <popup-shengri v-if="isTip" type="3" @close="isTip = false"></popup-shengri> -->
<!-- 精选好卷弹窗 isUnlock // 是否解锁 商品兑换券 type 1 黄金、2 铂金、3 钻石、4 星光、5 星耀 -->
<!-- <popup-jingxuan v-if="isTip" type="1" isUnlock="true" @close="isTip = false"></popup-jingxuan> -->
<!-- 新人礼券弹窗 type 1 黄金、2 铂金、3 钻石、4 星光、5 星耀-->
<!-- <popup-xinren v-if="isTip" type="1" @close="isTip = false"></popup-xinren> -->
</template>
<style scoped>
......@@ -292,21 +384,21 @@
</style>
<script setup>
import { ref, onMounted, getCurrentInstance, computed, watch } from "vue";
import RegisterLayer from "../components/RegisterLayer.vue";
import BabySwitcher from "../components/BabySwitcher.vue";
import WheelSelector from "../components/WheelSelector.vue";
import { useUserStore } from "@/stores/user";
import { usePageCfgStore } from "@/stores/pageCfg";
import { jump, JumpType } from "@/utils";
import { getHealthField } from "@/api/common";
import { hideLoading, showLoading } from "../utils";
import md from "../md.js";
import { ref, onMounted, getCurrentInstance, computed, watch } from 'vue';
import RegisterLayer from '../components/RegisterLayer.vue';
import BabySwitcher from '../components/BabySwitcher.vue';
import WheelSelector from '../components/WheelSelector.vue';
import { useUserStore } from '@/stores/user';
import { usePageCfgStore } from '@/stores/pageCfg';
import { jump, JumpType } from '@/utils';
import { getHealthField } from '@/api/common';
import { hideLoading, showLoading } from '../utils';
import md from '../md.js';
import { onShow } from '@dcloudio/uni-app';
import { useIntegralStore } from "../stores/integral.js";
import { useGlobalStore } from "../stores/global.js";
import { uploadImage } from "../api/common.js";
import { saveBabyExtra } from "../api/user.js";
import { useIntegralStore } from '../stores/integral.js';
import { useGlobalStore } from '../stores/global.js';
import { uploadImage } from '../api/common.js';
import { saveBabyExtra } from '../api/user.js';
const { proxy } = getCurrentInstance();
const $baseUrl = proxy.$baseUrl;
......@@ -329,9 +421,11 @@ const babyInfo = computed(() => userStore?.babyInfo || {});
// 判断是否可以使用选择头像功能
const canChooseAvatar = computed(() => {
return cfgStatus.value.isRegister &&
return (
cfgStatus.value.isRegister &&
userStore.babyInfo?.allBabyBaseInfo &&
userStore.babyInfo?.allBabyBaseInfo?.length > 0;
userStore.babyInfo?.allBabyBaseInfo?.length > 0
);
});
const showRegisterLayer = ref(false);
......@@ -350,10 +444,10 @@ const localBackgroundImg = ref('');
const handleTaskClick = async () => {
// 添加点击埋点
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "做任务赚更多积分",
componentContent: "去做任务"
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '做任务赚更多积分',
componentContent: '去做任务',
});
// 检查登录状态
......@@ -361,7 +455,7 @@ const handleTaskClick = async () => {
// 未登录,跳转到登录注册页面
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
url: '/pages/activity/register',
});
return;
}
......@@ -369,32 +463,31 @@ const handleTaskClick = async () => {
// 已登录,正常执行任务逻辑
await integralStore.getSigninAndTaskInfo(false);
globalStore.showTaskPop(integralStore?.signinAndTaskInfo?.data?.taskTodo);
}
};
const handleHot = (e) => {
const type = e.currentTarget.dataset.type;
md.sensorLog(e);
console.log("handleHot", type);
console.log('handleHot', type);
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "查看协议",
componentContent: type === "member" ? "会员规则" : "隐私协议"
})
if (type === "member") {
navigateTo("/pages/webview/webview?type=MEMBER_URL");
} else if (type === "privacy") {
navigateTo("/pages/webview/webview?type=PRIVACY_URL");
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '查看协议',
componentContent: type === 'member' ? '会员规则' : '隐私协议',
});
if (type === 'member') {
navigateTo('/pages/webview/webview?type=MEMBER_URL');
} else if (type === 'privacy') {
navigateTo('/pages/webview/webview?type=PRIVACY_URL');
}
};
function clickRegisterShield() {
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
})
url: '/pages/activity/register',
});
}
// 页面跳转
......@@ -411,7 +504,7 @@ const navigateToCoupon = () => {
jump({
type: type,
url: url,
extra: extra
extra: extra,
});
};
......@@ -419,10 +512,10 @@ const navigateToCoupon = () => {
const navigateToCouponWithLogin = () => {
// 添加点击埋点
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "我的优惠券"
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '我的优惠券',
});
// 检查登录状态
......@@ -430,7 +523,7 @@ const navigateToCouponWithLogin = () => {
// 未登录,跳转到登录注册页面
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
url: '/pages/activity/register',
});
return;
}
......@@ -444,10 +537,10 @@ const navigateTo = (url) => {
url,
animationDuration: 0,
fail: (err) => {
console.error("页面跳转失败:", err);
console.error('页面跳转失败:', err);
uni.showToast({
title: "页面跳转失败",
icon: "none",
title: '页面跳转失败',
icon: 'none',
});
},
});
......@@ -470,10 +563,10 @@ const navigateToWithLogin = (url) => {
if (componentContent) {
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: componentContent
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: componentContent,
});
}
......@@ -482,7 +575,7 @@ const navigateToWithLogin = (url) => {
// 未登录,跳转到登录注册页面
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
url: '/pages/activity/register',
});
return;
}
......@@ -493,29 +586,29 @@ const navigateToWithLogin = (url) => {
const handleToolClick = async (item) => {
md.sensorLogTake({
xcxClick: "我的页面点击",
pageName: "我的页面",
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: item.title,
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "工具",
componentContent: item.title
})
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '工具',
componentContent: item.title,
});
// 跳转产检提醒页面判断
// let listData = userStore.babyInfo ? userStore.babyInfo.allBabyBaseInfo : []
if (item.title === "医生问诊") {
if (item.title === '医生问诊') {
if (!cfgStatus.value.isRegister) return;
const res = await getHealthField();
if (!res.success) {
uni.showToast({
title: "获取健康字段失败",
icon: "none",
title: '获取健康字段失败',
icon: 'none',
});
return;
}
......@@ -524,27 +617,25 @@ const handleToolClick = async (item) => {
jump({
type: JumpType.MINI,
url: "/pages/partner/redirect",
url: '/pages/partner/redirect',
extra: {
appId: "wx81ecfb5aa3fb512f",
appId: 'wx81ecfb5aa3fb512f',
envVersion: env,
extraData: {
sign, // 参考 4.请求参数
timestamp, // 参考 4.请求参数
appId, // 参考 4.请求参数
partnerUserId, // 参考 4.请求参数
targetApp:
"/h5/partner/shining-like-a-start/landing-free-consult?sysType=CRF",
targetApp: '/h5/partner/shining-like-a-start/landing-free-consult?sysType=CRF',
},
},
});
}
// 三个工具校验是否授权
else if (item.title === "生长测评" || item.title === "喂养记录" || item.title === "产检提醒") {
else if (item.title === '生长测评' || item.title === '喂养记录' || item.title === '产检提醒') {
// if (!cfgStatus.value.isRegister) return;
jump({ type: item.link.type, url: item.link.url });
}
else {
} else {
jump({ type: item.link.type, url: item.link.url });
// const extra = item.link.extra;
// if(extra && extra.babyId){
......@@ -557,97 +648,83 @@ const handleToolClick = async (item) => {
// 编辑个人资料
const handleEditProfile = (e) => {
if (!userStore.userInfo ||
JSON.stringify(userStore.userInfo) === "{}"
) {
if (!userStore.userInfo || JSON.stringify(userStore.userInfo) === '{}') {
return;
}
md.sensorLog(e);
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "资料编辑"
})
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '资料编辑',
});
// 检查登录状态
if (!cfgStatus.value.isRegister) {
// 未登录,跳转到登录注册页面
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
url: '/pages/activity/register',
});
return;
}
if(!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo("/pages/person/person?type=add");
if (!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo('/pages/person/person?type=add');
return;
}
const type = userStore.babyInfo?.allBabyBaseInfo?.length == 0 ? "add" : "edit";
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find(
(item) => item.selected
)?.id;
const type = userStore.babyInfo?.allBabyBaseInfo?.length == 0 ? 'add' : 'edit';
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected)?.id;
if (type === "edit") {
babyId.value = userStore.babyInfo?.allBabyBaseInfo.find(
(item) => item.selected
)?.id;
if (type === 'edit') {
babyId.value = userStore.babyInfo?.allBabyBaseInfo.find((item) => item.selected)?.id;
navigateTo(`/pages/person/person?type=${type}&id=${babyId.value}`);
} else {
navigateTo(`/pages/person/person?type=${type}`);
}
};
// 头像点击事件(当不满足选择头像条件时)
const handleAvatarClick = (e) => {
md.sensorLog(e);
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "资料编辑"
})
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '资料编辑',
});
// 检查登录状态
if (!cfgStatus.value.isRegister) {
// 未登录,跳转到登录注册页面
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
url: '/pages/activity/register',
});
return;
}
if(!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo("/pages/person/person?type=add");
if (!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo('/pages/person/person?type=add');
return;
}
};
// 选择头像
const onChooseAvatar = async (e) => {
showLoading('上传中...');
md.sensorLog(e);
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "资料编辑"
})
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '资料编辑',
});
try {
const fs = uni.getFileSystemManager();
const base64 =
"data:image/jpeg;base64," + fs.readFileSync(e.detail.avatarUrl, "base64");
const base64 = 'data:image/jpeg;base64,' + fs.readFileSync(e.detail.avatarUrl, 'base64');
const res = await uploadImage(base64);
if (res.success) {
......@@ -655,13 +732,10 @@ const onChooseAvatar = async (e) => {
localAvatarUrl.value = res.data.url;
// 获取当前选中的宝宝信息并更新到服务器
const selectedBaby = userStore.babyInfo?.allBabyBaseInfo?.find(
(item) => item.selected
);
const selectedBaby = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected);
console.log("selectedBaby-===", selectedBaby);
console.log('selectedBaby-===', selectedBaby);
if (selectedBaby) {
// const updateData = {
// id: selectedBaby.id,
// babyAvatar: res.data.url,
......@@ -669,11 +743,11 @@ const onChooseAvatar = async (e) => {
// const updateRes = await updateBabyInfo(updateData);
console.log("userStore.babyInfo?.content?.id====", userStore.babyInfo?.content);
console.log('userStore.babyInfo?.content?.id====', userStore.babyInfo?.content);
const updateData = {
id: userStore.babyInfo?.content?.id,
babyAvatar: res.data.url
}
babyAvatar: res.data.url,
};
const updateRes = await saveBabyExtra(updateData);
......@@ -684,32 +758,32 @@ const onChooseAvatar = async (e) => {
localAvatarUrl.value = '';
uni.showToast({
title: "头像更新成功",
icon: "success",
title: '头像更新成功',
icon: 'success',
});
} else {
uni.showToast({
title: updateRes.message || "更新失败",
icon: "none",
title: updateRes.message || '更新失败',
icon: 'none',
});
}
} else {
uni.showToast({
title: "未找到宝宝信息",
icon: "none",
title: '未找到宝宝信息',
icon: 'none',
});
}
} else {
uni.showToast({
title: res.message,
icon: "none",
icon: 'none',
});
}
} catch (error) {
console.error("头像选择失败:", error);
console.error('头像选择失败:', error);
uni.showToast({
title: "头像选择失败",
icon: "none",
title: '头像选择失败',
icon: 'none',
});
} finally {
hideLoading();
......@@ -717,7 +791,7 @@ const onChooseAvatar = async (e) => {
};
const onRegisterConfirm = async () => {
await pageCfgStore.fetchCfg();
await pageCfgStore.fetchCfg(globalStore.getPreviewScene('my'));
// 只调用一次initData,loadMemberInfo已在initData内部处理
initData();
showRegisterLayer.value = false;
......@@ -728,149 +802,146 @@ const onRegisterCancel = () => {
const handleWheelChange = (val) => {
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "月龄定位器",
componentContent: babyInfo.value.babyStage == 2
? "月龄滑动切换-" + val
: "孕周滑动切换-" + val
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '月龄定位器',
componentContent: babyInfo.value.babyStage == 2 ? '月龄滑动切换-' + val : '孕周滑动切换-' + val,
});
}
};
const initExposure = () => {
// 添加宝宝信息引导模块曝光埋点
if (cfgStatus.value.isRegister && (!babyInfo.value?.allBabyBaseInfo || babyInfo.value?.allBabyBaseInfo?.length === 0)) {
if (
cfgStatus.value.isRegister &&
(!babyInfo.value?.allBabyBaseInfo || babyInfo.value?.allBabyBaseInfo?.length === 0)
) {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "添加宝宝信息引导",
componentContent: "添加宝宝信息引导"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '添加宝宝信息引导',
componentContent: '添加宝宝信息引导',
});
}
// 添加做任务赚更多积分模块曝光埋点
if (!cfgStatus.value.isRegister || (babyInfo.value?.allBabyBaseInfo && babyInfo.value?.allBabyBaseInfo?.length > 0)) {
if (
!cfgStatus.value.isRegister ||
(babyInfo.value?.allBabyBaseInfo && babyInfo.value?.allBabyBaseInfo?.length > 0)
) {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "做任务赚更多积分",
componentContent: "去做任务"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '做任务赚更多积分',
componentContent: '去做任务',
});
}
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "资料编辑"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '资料编辑',
});
toolList.value.forEach((item, index) => {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "工具",
componentContent: item.title
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '工具',
componentContent: item.title,
});
});
if (pageCfgStore?.contentCfg?.activeInfo?.length > 0) {
pageCfgStore.contentCfg.activeInfo.forEach((item, index) => {
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "精彩活动",
componentContent: "精彩活动-" + item.title
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '精彩活动',
componentContent: '精彩活动-' + item.title,
});
});
}
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "查看协议",
componentContent: "会员规则"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '查看协议',
componentContent: '会员规则',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "查看协议",
componentContent: "隐私协议"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '查看协议',
componentContent: '隐私协议',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "月龄定位器",
componentContent: babyInfo.value.babyStage == 2 ? "月龄滑动切换" : "孕周滑动切换"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '月龄定位器',
componentContent: babyInfo.value.babyStage == 2 ? '月龄滑动切换' : '孕周滑动切换',
});
// 添加拓展工具菜单曝光埋点
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "我的订单"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '我的订单',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "收货地址管理"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '收货地址管理',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "我的优惠券"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '我的优惠券',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "更多"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '更多',
});
}
};
onShow(async () => {
console.log('onShow')
console.log('onShow');
await userStore.loadMemberInfo();
points.value = userStore.memberInfo?.points;
console.log('userStore.memberInfo=', userStore.memberInfo)
console.log('userStore.memberInfo=', userStore.memberInfo);
// 添加拓展工具菜单曝光埋点
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "我的订单"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '我的订单',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "收货地址管理"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '收货地址管理',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "我的优惠券"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '我的优惠券',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "拓展工具",
componentContent: "更多"
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '拓展工具',
componentContent: '更多',
});
console.warn("AAAAAAAA")
})
console.warn('AAAAAAAA');
});
// 获取用户信息
const initData = async () => {
......@@ -878,10 +949,7 @@ const initData = async () => {
await userStore.loadMemberInfo();
points.value = userStore.memberInfo?.points;
if (
userStore?.userInfo?.memberId &&
userStore?.userInfo?.memberId == "not_login"
) {
if (userStore?.userInfo?.memberId && userStore?.userInfo?.memberId == 'not_login') {
cfgStatus.value.isRegister = false;
cfgStatus.value.showDetail = false;
return;
......@@ -892,50 +960,44 @@ const initData = async () => {
// 已出生或孕中显示
cfgStatus.value.showDetail = __showDetail;
if (__showDetail) {
wheelOptions.value =
babyInfo.value.babyStage == 2
? pageCfgStore.wheelOptionsYL
: pageCfgStore.wheelOptionsYZ;
const index = wheelOptions.value.findIndex(
(item) => item.label == babyInfo.value.babyAge
);
babyInfo.value.babyStage == 2 ? pageCfgStore.wheelOptionsYL : pageCfgStore.wheelOptionsYZ;
const index = wheelOptions.value.findIndex((item) => item.label == babyInfo.value.babyAge);
wheelSelectedIndex.value = index > 0 ? index : 0;
}
};
const handleIntegralClick = () => {
md.sensorLogTake({
xcxClick: "我的页面-首屏页面点击",
pageName: "我的页面-首屏",
buttonName: "积分明细",
xcxClick: '我的页面-首屏页面点击',
pageName: '我的页面-首屏',
buttonName: '积分明细',
});
const urlStr = 'https://mom.feihe.com/member/mine/newPointDetail?crmId={crmid}&appCode=XMH';
const url = urlStr.replace("{crmid}", userStore.babyInfo?.memberId);
console.log('积分明细链接:==', url)
const url = urlStr.replace('{crmid}', userStore.babyInfo?.memberId);
console.log('积分明细链接:==', url);
jump({
type: 3,
url: url
})
}
url: url,
});
};
const getRealtimePhoneNumber = async (e) => {
console.log("获取手机号码", e);
console.log('获取手机号码', e);
if (e.detail.errMsg !== "getPhoneNumber:ok") {
if (e.detail.errMsg !== 'getPhoneNumber:ok') {
uni.showToast({
title: "请授权使用手机号",
icon: "none",
title: '请授权使用手机号',
icon: 'none',
});
return;
}
await userStore.phoneCallback(e.detail, async () => {
// 简化回调,避免重复调用接口
showLoading();
await pageCfgStore.fetchCfg();
await pageCfgStore.fetchCfg(globalStore.getPreviewScene('my'));
// 只调用一次initData,loadMemberInfo已在initData内部处理
initData();
hideLoading();
......@@ -949,31 +1011,28 @@ const handleChangeBaby = (e) => {
md.sensorLog(e);
md.sensorComponentLogTake({
xcxComponentClick: "true",
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "展开"
})
xcxComponentClick: 'true',
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '展开',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "新增"
})
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '新增',
});
md.sensorComponentLogTake({
xcxComponentExposure: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "状态切换"
})
xcxComponentExposure: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '状态切换',
});
showBabySwitcher.value = true;
};
async function onSelectBaby(baby) {
// 处理宝宝切换逻辑
showBabySwitcher.value = false;
......@@ -982,22 +1041,22 @@ async function onSelectBaby(baby) {
await userStore.changeBabySelected(baby.id);
hideLoading();
console.log("onSelectBaby", baby);
console.log('onSelectBaby', baby);
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "状态切换"
})
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '状态切换',
});
}
function handleAddBabyInfoClick() {
// 添加点击埋点
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "添加宝宝信息引导",
componentContent: "添加宝宝信息引导"
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '添加宝宝信息引导',
componentContent: '添加宝宝信息引导',
});
// 显示RegisterLayer弹窗
showRegisterLayer.value = true;
......@@ -1005,27 +1064,27 @@ function handleAddBabyInfoClick() {
function onAddBaby() {
md.sensorLogTake({
xcxClick: "我的页面点击",
pageName: "我的页面",
buttonName: "新增入口",
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '新增入口',
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "新增"
})
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '新增',
});
// 跳转到新增宝宝页面
showBabySwitcher.value = false;
navigateTo("/pages/person/person?type=add");
navigateTo('/pages/person/person?type=add');
}
const handleOpenClick = () => {
md.sensorLogTake({
xcxClick: "我的页面点击",
pageName: "我的页面",
buttonName: cfgStatus.value.openBabyCardDesc ? "收起" : "展开",
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: cfgStatus.value.openBabyCardDesc ? '收起' : '展开',
});
cfgStatus.value.openBabyCardDesc = !cfgStatus.value.openBabyCardDesc;
};
......@@ -1034,42 +1093,39 @@ const handleOpenClick = () => {
const handleUploadBackground = async (e) => {
md.sensorLog(e);
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "资料编辑",
componentContent: "资料编辑"
})
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '资料编辑',
componentContent: '资料编辑',
});
// 检查登录状态
if (!cfgStatus.value.isRegister) {
// 未登录,跳转到登录注册页面
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
url: '/pages/activity/register',
});
return;
}
if(!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo("/pages/person/person?type=add");
if (!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo('/pages/person/person?type=add');
return;
}
// 唤起图片选择器
uni.chooseImage({
count: 1,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: async (res) => {
showLoading('上传中...');
try {
const tempFilePath = res.tempFilePaths[0];
const fs = uni.getFileSystemManager();
const base64 =
"data:image/jpeg;base64," + fs.readFileSync(tempFilePath, "base64");
const base64 = 'data:image/jpeg;base64,' + fs.readFileSync(tempFilePath, 'base64');
const uploadRes = await uploadImage(base64);
......@@ -1078,9 +1134,7 @@ const handleUploadBackground = async (e) => {
localBackgroundImg.value = uploadRes.data.url;
// 获取当前选中的宝宝信息并更新到服务器
const selectedBaby = userStore.babyInfo?.allBabyBaseInfo?.find(
(item) => item.selected
);
const selectedBaby = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected);
if (selectedBaby) {
// const updateData = {
......@@ -1089,11 +1143,11 @@ const handleUploadBackground = async (e) => {
// };
// const updateRes = await updateBabyInfo(updateData);
console.log("userStore.babyInfo?.content?.id====", userStore.babyInfo);
console.log('userStore.babyInfo?.content?.id====', userStore.babyInfo);
const updateData = {
id:userStore.babyInfo?.content?.id,
backgroundImg: uploadRes.data.url
}
id: userStore.babyInfo?.content?.id,
backgroundImg: uploadRes.data.url,
};
const updateRes = await saveBabyExtra(updateData);
......@@ -1104,71 +1158,66 @@ const handleUploadBackground = async (e) => {
localBackgroundImg.value = '';
uni.showToast({
title: "背景更新成功",
icon: "success",
title: '背景更新成功',
icon: 'success',
});
} else {
uni.showToast({
title: updateRes.message || "更新失败",
icon: "none",
title: updateRes.message || '更新失败',
icon: 'none',
});
}
} else {
uni.showToast({
title: "未找到宝宝信息",
icon: "none",
title: '未找到宝宝信息',
icon: 'none',
});
}
} else {
uni.showToast({
title: uploadRes.message || "上传失败",
icon: "none",
title: uploadRes.message || '上传失败',
icon: 'none',
});
}
} catch (error) {
console.error("背景图片上传失败:", error);
console.error('背景图片上传失败:', error);
uni.showToast({
title: "背景图片上传失败",
icon: "none",
title: '背景图片上传失败',
icon: 'none',
});
} finally {
hideLoading();
}
},
fail: (err) => {
console.error("选择图片失败:", err);
console.error('选择图片失败:', err);
uni.showToast({
title: "选择图片失败",
icon: "none",
title: '选择图片失败',
icon: 'none',
});
}
},
});
};
// 页面加载
onMounted(async () => {
md.sensorLogTake({
xcxPage: "我的页面浏览",
pageName: "我的页面",
xcxPage: '我的页面浏览',
pageName: '我的页面',
});
showLoading();
await userStore.loadMemberInfo();
points.value = userStore.memberInfo?.points;
await pageCfgStore.fetchCfg();
await pageCfgStore.fetchCfg(globalStore.getPreviewScene('my'));
console.log("pageCfgStore.contentCfg====", pageCfgStore.contentCfg);
console.log('pageCfgStore.contentCfg====', pageCfgStore.contentCfg);
initData();
initExposure();
hideLoading();
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find(
(item) => item.selected
)?.id;
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected)?.id;
// const a = {
// "bgUrl": "my/shengzhangTools.png",
......@@ -1206,17 +1255,18 @@ onMounted(async () => {
});
watch([() => userStore.userInfo, () => userStore.babyInfo], () => {
console.log("userInfo/babyInfo变化", userStore.userInfo, userStore.babyInfo);
console.log('userInfo/babyInfo变化', userStore.userInfo, userStore.babyInfo);
initData();
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find(
(item) => item.selected
)?.id;
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected)?.id;
});
watch(() => userStore.memberInfo, () => {
console.log('userStore.memberInfo变化', userStore.memberInfo)
watch(
() => userStore.memberInfo,
() => {
console.log('userStore.memberInfo变化', userStore.memberInfo);
points.value = userStore.memberInfo?.points;
})
}
);
//会员活动点击事件
const handleVipActiveClick = (index, item) => {
......@@ -1231,16 +1281,16 @@ const handleVipActiveClick = (index, item) => {
}
md.sensorLogTake({
xcxClick: "我的页面点击",
pageName: "我的页面",
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: buttonName,
});
md.sensorComponentLogTake({
xcxComponentClick: "true",
pageName: "我的页面",
componentName: "精彩活动",
componentContent: "精彩活动-" + item.title
})
xcxComponentClick: 'true',
pageName: '我的页面',
componentName: '精彩活动',
componentContent: '精彩活动-' + item.title,
});
const url = item?.link.url;
const type = item?.link.type;
const extra = item?.link.extra;
......@@ -1248,15 +1298,15 @@ const handleVipActiveClick = (index, item) => {
jump({
type: type,
url: url,
extra: extra
})
}
extra: extra,
});
};
// 定义页面配置
defineExpose({});
</script>
<style lang="less" scoped>
@import "@/common.less";
@import '@/common.less';
.my-container {
min-height: 100vh;
......@@ -1422,10 +1472,8 @@ defineExpose({});
color: #1d1e25;
}
}
}
.integralContainer {
position: absolute;
top: 0rpx;
......@@ -1458,7 +1506,6 @@ defineExpose({});
text-align: center;
right: 0rpx;
top: 81rpx;
}
}
......
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