Commit 0bc86cfd authored by spc's avatar spc

Merge branch 'dev' of http://gitlab.dui88.com/fh/20250528_FHQ1 into dev

parents a416a38b fa6e7c38
import requestModule from './request.js'; import requestModule from './request.js';
const { const { api } = requestModule;
api
} = requestModule;
export const fetchBrandJSON = (type = 'brand_V1') => api.get('/c/front/content', { type });
export const fetchBrandJSON = () => api.get('/c/front/content',{type:'brand_V1'});
\ No newline at end of file
import requestModule from './request.js'; import requestModule from './request.js';
const { const { api } = requestModule;
api
} = requestModule;
/** /**
* 获取首页信息 * 获取首页信息
...@@ -9,11 +7,9 @@ const { ...@@ -9,11 +7,9 @@ const {
*/ */
export const fetchHomeInfo = () => api.get('/c/user/index'); export const fetchHomeInfo = () => api.get('/c/user/index');
export const fetchCanEatIndex = () => api.get('/c/eat/index'); export const fetchCanEatIndex = () => api.get('/c/eat/index');
export const fetchCanEatJoin = (data) => api.post('/c/eat/join', data); 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' }); export const fetchGameActConfigJSON = () => api.get('/c/front/content', { type: 'gameActConfig' });
import requestModule from './request.js'; import requestModule from './request.js';
const { const { api } = requestModule;
api
} = requestModule;
/** /**
* 获取积分信息 * 获取积分信息
* @returns * @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'); ...@@ -35,7 +33,7 @@ export const getResourceList = () => api.get('/c/resource/list');
export const getSigninAndTaskInfoJSON = () => api.get('/c/activity/todo/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'); export const getSeckillList = () => api.get('/c/seckill/list');
...@@ -43,7 +41,7 @@ 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 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'); export const queryTodoResultJSON = (activityId) => api.get('/c/activity/todo/queryTodoResult');
...@@ -52,16 +50,18 @@ export const queryTodoResultJSON = (activityId) => api.get('/c/activity/todo/que ...@@ -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 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) =>
invitationCode, api.post('/c/activity/origin_invite/assist', {
wxUnionId invitationCode,
}); wxUnionId,
});
//获取邀请记录列表接口 //获取邀请记录列表接口
export const getInvitationListJSON = () => api.get('/c/activity/origin_invite/invitationList'); 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) =>
unionId, api.post('/c/api/activity/originInviteBind', {
shareCode unionId,
}); shareCode,
});
import requestModule from './request.js'; import requestModule from './request.js';
const { const { api } = requestModule;
api
} = requestModule;
/** /**
* 获取用户信息 * 获取用户信息
...@@ -22,9 +20,10 @@ export const getGestationalWeeks = (dueDate) => api.get('/c/user/calGestationalW ...@@ -22,9 +20,10 @@ export const getGestationalWeeks = (dueDate) => api.get('/c/user/calGestationalW
* @param {*} code * @param {*} code
* @returns * @returns
*/ */
export const autoLoginByCode = (code) => api.get('/c/login/autologin', { export const autoLoginByCode = (code) =>
code, api.get('/c/login/autologin', {
}); code,
});
/** /**
* 手机号授权,调用微信手机号快速验证组件,获取encryptedData、iv、code * 手机号授权,调用微信手机号快速验证组件,获取encryptedData、iv、code
...@@ -46,18 +45,13 @@ export const fetchMemberInfo = () => api.get('/c/user/memberInfo'); ...@@ -46,18 +45,13 @@ export const fetchMemberInfo = () => api.get('/c/user/memberInfo');
*/ */
export const updateBabyInfo = (data) => api.post('/c/user/saveBaby', data); 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*/ /** 查询用户是否参与生育补贴和鹤礼2.0*/
export const checkParticipation = (data) => api.get('/c/fertility/index', data); export const checkParticipation = (data) => api.get('/c/fertility/index', data);
export const doTerminate = () => api.post('/c/user/terminate'); export const doTerminate = () => api.post('/c/user/terminate');
/** /**
* 获取积分兑换记录列表(分页) * 获取积分兑换记录列表(分页)
* @param {Object} params - 请求参数 * @param {Object} params - 请求参数
...@@ -66,12 +60,10 @@ export const doTerminate = () => api.post('/c/user/terminate'); ...@@ -66,12 +60,10 @@ export const doTerminate = () => api.post('/c/user/terminate');
*/ */
export const getExchangeList = (params = {}) => api.get('/c/user/exchange/list', { params }); export const getExchangeList = (params = {}) => api.get('/c/user/exchange/list', { params });
/** /**
* *
* @param {orderNo} data * @param {orderNo} data
* @returns * @returns
*/ */
export const getOrderDetail = (data) => api.get('/c/order/detail', data); export const getOrderDetail = (data) => api.get('/c/order/detail', data);
...@@ -80,4 +72,4 @@ export const getOrderDetail = (data) => api.get('/c/order/detail', data); ...@@ -80,4 +72,4 @@ export const getOrderDetail = (data) => api.get('/c/order/detail', data);
* @param {Object} data - 宝宝额外信息 * @param {Object} data - 宝宝额外信息
* @returns {Promise} 接口响应 * @returns {Promise} 接口响应
*/ */
export const saveBabyExtra = (data) => api.post('/c/user/saveBabyExtra', data); export const saveBabyExtra = (data) => api.post('/c/user/saveBabyExtra', data);
\ No newline at end of file
...@@ -102,9 +102,9 @@ ...@@ -102,9 +102,9 @@
<image class="platinumbtn" :src="`${$baseUrl}${BABY_CLASS_IMAGES.PLATINUM.BTN}`" mode="aspectFit" <image class="platinumbtn" :src="`${$baseUrl}${BABY_CLASS_IMAGES.PLATINUM.BTN}`" mode="aspectFit"
@click="jump('platinum')"></image> @click="jump('platinum')"></image>
<!-- <image class="platinumdesc" :src="`${$baseUrl}${BABY_CLASS_IMAGES.PLATINUM.DESC}`" mode="aspectFit"></image> --> <!-- <image class="platinumdesc" :src="`${$baseUrl}${BABY_CLASS_IMAGES.PLATINUM.DESC}`" mode="aspectFit"></image> -->
<view class="platinumdesc" :style="{ color: getColor() }"> <!-- <view class="platinumdesc" :style="{ color: getColor() }">
<!-- 5类课程:产检,⼉童疫苗,婴幼⼉护理,⼩⼉发热,⼩⼉7种常⻅病的治疗⽅法和⽤药原则 --> 5类课程:产检,⼉童疫苗,婴幼⼉护理,⼩⼉发热,⼩⼉7种常⻅病的治疗⽅法和⽤药原则
</view> </view> -->
</view> </view>
</view> </view>
...@@ -207,7 +207,7 @@ const jump = (level) => { ...@@ -207,7 +207,7 @@ const jump = (level) => {
<style lang="less" scoped> <style lang="less" scoped>
.babyclass { .babyclass {
width: 686rpx; width: 686rpx;
height: 773rpx; height: 663rpx;
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
right: 0rpx; right: 0rpx;
...@@ -216,14 +216,14 @@ const jump = (level) => { ...@@ -216,14 +216,14 @@ const jump = (level) => {
.diamond { .diamond {
width: 686rpx; width: 686rpx;
height: 753rpx; height: 643rpx;
left: 10rpx; left: 10rpx;
top: 10rpx; top: 10rpx;
position: absolute; position: absolute;
.diamondbg { .diamondbg {
width: 686rpx; width: 686rpx;
height: 763rpx; height: 653rpx;
left: -10rpx; left: -10rpx;
top: -10rpx; top: -10rpx;
position: absolute; position: absolute;
...@@ -308,14 +308,14 @@ const jump = (level) => { ...@@ -308,14 +308,14 @@ const jump = (level) => {
.starshine { .starshine {
width: 686rpx; width: 686rpx;
height: 753rpx; height: 643rpx;
left: 10rpx; left: 10rpx;
top: 10rpx; top: 10rpx;
position: absolute; position: absolute;
.starshinebg { .starshinebg {
width: 686rpx; width: 686rpx;
height: 763rpx; height: 653rpx;
left: -10rpx; left: -10rpx;
top: -10rpx; top: -10rpx;
border-radius: 45rpx; border-radius: 45rpx;
...@@ -400,14 +400,14 @@ const jump = (level) => { ...@@ -400,14 +400,14 @@ const jump = (level) => {
.starlight { .starlight {
width: 686rpx; width: 686rpx;
height: 753rpx; height: 643rpx;
left: 10rpx; left: 10rpx;
top: 10rpx; top: 10rpx;
position: absolute; position: absolute;
.starlightbg { .starlightbg {
width: 686rpx; width: 686rpx;
height: 763rpx; height: 653rpx;
left: -10rpx; left: -10rpx;
top: -10rpx; top: -10rpx;
border-radius: 45rpx; border-radius: 45rpx;
...@@ -492,14 +492,14 @@ const jump = (level) => { ...@@ -492,14 +492,14 @@ const jump = (level) => {
.gold { .gold {
width: 686rpx; width: 686rpx;
height: 753rpx; height: 643rpx;
left: 10rpx; left: 10rpx;
top: 10rpx; top: 10rpx;
position: absolute; position: absolute;
.goldipsbg { .goldipsbg {
width: 686rpx; width: 686rpx;
height: 763rpx; height: 653rpx;
left: -10rpx; left: -10rpx;
top: -10rpx; top: -10rpx;
position: absolute; position: absolute;
...@@ -584,14 +584,14 @@ const jump = (level) => { ...@@ -584,14 +584,14 @@ const jump = (level) => {
.platinum { .platinum {
width: 635rpx; width: 635rpx;
height: 753rpx; height: 643rpx;
left: 10rpx; left: 10rpx;
top: 10rpx; top: 10rpx;
position: absolute; position: absolute;
.platinumbg { .platinumbg {
width: 686rpx; width: 686rpx;
height: 763rpx; height: 653rpx;
left: -10rpx; left: -10rpx;
top: -10rpx; top: -10rpx;
border-radius: 45rpx; border-radius: 45rpx;
......
...@@ -4,14 +4,25 @@ ...@@ -4,14 +4,25 @@
<Brand v-if="globalStore.curTabIndex == 1 && !globalStore.isWxFriendCircle" :scroll-top="scrollTop" /> <Brand v-if="globalStore.curTabIndex == 1 && !globalStore.isWxFriendCircle" :scroll-top="scrollTop" />
<Integral v-if="globalStore.curTabIndex == 2 && !globalStore.isWxFriendCircle" :scrollTop="scrollTop" /> <Integral v-if="globalStore.curTabIndex == 2 && !globalStore.isWxFriendCircle" :scrollTop="scrollTop" />
<My v-if="globalStore.curTabIndex == 3 && !globalStore.isWxFriendCircle" /> <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" /> <WxFriendCircleSimplePage v-if="globalStore.isWxFriendCircle" />
<!-- 邀请奖品弹窗 --> <!-- 邀请奖品弹窗 -->
<InvitePrizePanel :visible="globalStore.isShowInvitePrizePanel" :inviteCount="globalStore.inviteCount" <InvitePrizePanel
:prizeName="globalStore.prizeName" :prizeImage="globalStore.prizeImage" :prizeType="globalStore.prizeType" :visible="globalStore.isShowInvitePrizePanel"
:memberId="globalStore.memberId" @close="handleCloseInvitePrizePanel" @record="handleInvitePrizePanelRecord" :inviteCount="globalStore.inviteCount"
@prize="handleInvitePrizePanelPrize" /> :prizeName="globalStore.prizeName"
:prizeImage="globalStore.prizeImage"
:prizeType="globalStore.prizeType"
:memberId="globalStore.memberId"
@close="handleCloseInvitePrizePanel"
@record="handleInvitePrizePanelRecord"
@prize="handleInvitePrizePanelPrize"
/>
<!-- 任务完成弹窗 --> <!-- 任务完成弹窗 -->
<!-- <TaskComplete <!-- <TaskComplete
...@@ -23,43 +34,73 @@ ...@@ -23,43 +34,73 @@
/> --> /> -->
<!-- 任务弹窗 --> <!-- 任务弹窗 -->
<TaskPop :visible="globalStore.isShowTaskPop" :taskTodo="globalStore.taskTodo" @close="handleCloseTaskPop" <TaskPop
@taskClick="handleTaskClick" /> :visible="globalStore.isShowTaskPop"
:taskTodo="globalStore.taskTodo"
@close="handleCloseTaskPop"
@taskClick="handleTaskClick"
/>
<!-- 任务完成提示弹窗 --> <!-- 任务完成提示弹窗 -->
<TaskCompleteTips :visible="globalStore.isShowTaskComplete" :points="globalStore.taskCompletePoints" <TaskCompleteTips
:taskTitle="globalStore.taskCompleteTitle" @close="handleCloseTaskCompleteTips" /> :visible="globalStore.isShowTaskComplete"
:points="globalStore.taskCompletePoints"
:taskTitle="globalStore.taskCompleteTitle"
@close="handleCloseTaskCompleteTips"
/>
<!-- 任务信息弹窗 --> <!-- 任务信息弹窗 -->
<TaskPerson :visible="globalStore.isShowTaskPerson" @close="handleCloseTaskPerson" <TaskPerson
@submit="handleTaskPersonSubmit" /> :visible="globalStore.isShowTaskPerson"
@close="handleCloseTaskPerson"
@submit="handleTaskPersonSubmit"
/>
<!-- 公众号弹窗 --> <!-- 公众号弹窗 -->
<GongzhonghaoPop :visible="showGongzhonghaoPop" :title="gongzhonghaoTitle" :description="gongzhonghaoDescription" <GongzhonghaoPop
:qrCodeUrl="gongzhonghaoQrCodeUrl" @close="handleCloseGongzhonghaoPop" @download="handleDownloadQrCode" /> :visible="showGongzhonghaoPop"
:title="gongzhonghaoTitle"
:description="gongzhonghaoDescription"
:qrCodeUrl="gongzhonghaoQrCodeUrl"
@close="handleCloseGongzhonghaoPop"
@download="handleDownloadQrCode"
/>
<!-- 视频弹窗 --> <!-- 视频弹窗 -->
<view v-if="showVideo" class="video-popup1"> <view v-if="showVideo" class="video-popup1">
<video :src="currentVideoUrl" controls autoplay :style="{ width: videoWidth + 'px', height: videoHeight + 'px' }" <video
@loadedmetadata="onVideoLoadedMeta" @play="onVideoPlay"></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 class="close-btn-bottom" @tap="closeVideo">×</view>
</view> </view>
<button
<button v-if="isBackApp" class="back-app" open-type="launchApp" app-parameter="wechat" v-if="isBackApp"
@binderror="handleLaunchAppError" :style="{ class="back-app"
open-type="launchApp"
app-parameter="wechat"
@binderror="handleLaunchAppError"
:style="{
backgroundImage: `url(${$baseUrl}homepage/backAppBtn.png)`, backgroundImage: `url(${$baseUrl}homepage/backAppBtn.png)`,
}"> }"
>
<!-- <text class="back-text">返回app</text> --> <!-- <text class="back-text">返回app</text> -->
</button> </button>
<!-- 悬浮授权手机号模块 --> <!-- 悬浮授权手机号模块 -->
<view class="auth-phone-module" v-if="!userStore.memberInfo?.mobile"> <view class="auth-phone-module" v-if="!userStore.memberInfo?.mobile">
<image class="auth-phone-bg" :src="$baseUrl + 'homepage/Q3Res/accessBg3.png'"></image> <image class="auth-phone-bg" :src="$baseUrl + 'homepage/Q3Res/accessBg3.png'"></image>
<view class="auth-phone-btn-container"> <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> </image>
</view> </view>
</view> </view>
...@@ -67,26 +108,26 @@ ...@@ -67,26 +108,26 @@
</template> </template>
<script setup> <script setup>
import { ref, getCurrentInstance, onMounted, nextTick } from "vue"; import { ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline, onPageScroll, onShow } from "@dcloudio/uni-app"; import { onLoad, onShareAppMessage, onShareTimeline, onPageScroll, onShow } from '@dcloudio/uni-app';
import TabBar from "@/components/TabBar.vue"; import TabBar from '@/components/TabBar.vue';
import Home from "@/views/Home.vue"; import Home from '@/views/Home.vue';
import Brand from "@/views/Brand.vue"; import Brand from '@/views/Brand.vue';
import Integral from "@/views/Integral.vue"; import Integral from '@/views/Integral.vue';
import My from "@/views/My.vue"; import My from '@/views/My.vue';
import md from '@/md'; import md from '@/md';
import WxFriendCircleSimplePage from "@/components/WxFriendCircleSimplePage.vue"; import WxFriendCircleSimplePage from '@/components/WxFriendCircleSimplePage.vue';
import InvitePrizePanel from "@/components/integralArea/InvitePrizePanel.vue"; import InvitePrizePanel from '@/components/integralArea/InvitePrizePanel.vue';
// import TaskComplete from "@/components/qiandao/TaskComplete.vue"; // import TaskComplete from "@/components/qiandao/TaskComplete.vue";
import TaskPop from "@/components/renwu/TaskPop.vue"; import TaskPop from '@/components/renwu/TaskPop.vue';
import TaskPerson from "@/components/renwu/TaskPerson.vue"; import TaskPerson from '@/components/renwu/TaskPerson.vue';
import TaskCompleteTips from '@/components/renwu/TaskCompleteTips.vue'; import TaskCompleteTips from '@/components/renwu/TaskCompleteTips.vue';
import { useGlobalStore } from "@/stores/global.js"; import { useGlobalStore } from '@/stores/global.js';
import { useUserStore } from "@/stores/user.js"; import { useUserStore } from '@/stores/user.js';
import { jump, JumpType } from "../../utils"; import { jump, JumpType } from '../../utils';
import { taskCompleteJSON } from "../../api/integral"; import { taskCompleteJSON } from '../../api/integral';
import { useIntegralStore } from "@/stores/integral"; import { useIntegralStore } from '@/stores/integral';
import GongzhonghaoPop from "@/components/renwu/GongzhonghaoPop.vue"; import GongzhonghaoPop from '@/components/renwu/GongzhonghaoPop.vue';
const globalStore = useGlobalStore(); const globalStore = useGlobalStore();
const userStore = useUserStore(); const userStore = useUserStore();
...@@ -98,23 +139,22 @@ const isBackApp = ref(false); ...@@ -98,23 +139,22 @@ const isBackApp = ref(false);
const taskId = ref(0); const taskId = ref(0);
const shareOptions = { const shareOptions = {
0: { 0: {
title: "8000万中国妈妈信赖的育儿品牌", title: '8000万中国妈妈信赖的育儿品牌',
path: "/pages/index/index?pageType=home", path: '/pages/index/index?pageType=home',
imageUrl: $baseUrl + "share/share_home0901.jpg", imageUrl: $baseUrl + 'share/share_home0901.jpg',
}, },
1: { 1: {
title: "飞鹤提供家庭营养一站式解决方案", title: '飞鹤提供家庭营养一站式解决方案',
path: "/pages/index/index?pageType=brand", path: '/pages/index/index?pageType=brand',
imageUrl: $baseUrl + "share/share_brand.png", imageUrl: $baseUrl + 'share/share_brand.png',
}, },
2: { 2: {
title: "超凡吸收!更多妈妈推荐的奶粉", title: '超凡吸收!更多妈妈推荐的奶粉',
path: "/pages/index/index?pageType=integral", path: '/pages/index/index?pageType=integral',
imageUrl: $baseUrl + "share/share_integral.png", imageUrl: $baseUrl + 'share/share_integral.png',
}, },
}; };
// 公众号弹窗参数 // 公众号弹窗参数
const showGongzhonghaoPop = ref(false); const showGongzhonghaoPop = ref(false);
...@@ -128,7 +168,6 @@ const currentVideoUrl = ref(''); ...@@ -128,7 +168,6 @@ const currentVideoUrl = ref('');
const videoWidth = ref(375); const videoWidth = ref(375);
const videoHeight = ref(210); const videoHeight = ref(210);
// 处理返回APP失败的情况 // 处理返回APP失败的情况
const handleLaunchAppError = (e) => { const handleLaunchAppError = (e) => {
console.error('返回APP失败:', e.detail.errMsg); console.error('返回APP失败:', e.detail.errMsg);
...@@ -142,7 +181,7 @@ const handleLaunchAppError = (e) => { ...@@ -142,7 +181,7 @@ const handleLaunchAppError = (e) => {
uni.showToast({ uni.showToast({
title: errorMessage, title: errorMessage,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); });
}; };
...@@ -152,10 +191,10 @@ function handleTabClick({ index }) { ...@@ -152,10 +191,10 @@ function handleTabClick({ index }) {
if (!userStore.memberInfo?.mobile) { if (!userStore.memberInfo?.mobile) {
nextTick(() => { nextTick(() => {
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: `${['首页', '品牌', '积分', '我的'][index]}`, pageName: `${['首页', '品牌', '积分', '我的'][index]}`,
componentName: "去授权手机号引导", componentName: '去授权手机号引导',
componentContent: "去授权手机号引导" componentContent: '去授权手机号引导',
}); });
}); });
} }
...@@ -164,17 +203,16 @@ function handleTabClick({ index }) { ...@@ -164,17 +203,16 @@ function handleTabClick({ index }) {
// 处理授权手机号按钮点击 // 处理授权手机号按钮点击
const handleAuthPhoneClick = () => { const handleAuthPhoneClick = () => {
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: `${['首页', '品牌', '积分', '我的'][globalStore.curTabIndex]}`, pageName: `${['首页', '品牌', '积分', '我的'][globalStore.curTabIndex]}`,
componentName: "去授权手机号引导", componentName: '去授权手机号引导',
componentContent: "去授权手机号引导" componentContent: '去授权手机号引导',
}); });
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: "/pages/activity/register", url: '/pages/activity/register',
}) });
} };
// 检查任务结果并更新全局状态 // 检查任务结果并更新全局状态
const checkAndUpdateTaskResult = async () => { const checkAndUpdateTaskResult = async () => {
...@@ -212,7 +250,6 @@ onMounted(async () => { ...@@ -212,7 +250,6 @@ onMounted(async () => {
globalStore.prizeType = unclaimedPrize?.prizeType; globalStore.prizeType = unclaimedPrize?.prizeType;
globalStore.memberId = res.data?.memberId; globalStore.memberId = res.data?.memberId;
} }
} }
console.log('邀请活动首页数据:', res); console.log('邀请活动首页数据:', res);
}); });
...@@ -223,7 +260,6 @@ const handleCloseTaskCompleteTips = async () => { ...@@ -223,7 +260,6 @@ const handleCloseTaskCompleteTips = async () => {
await checkAndUpdateTaskResult(); await checkAndUpdateTaskResult();
}; };
// 完成任务并显示完成提示 // 完成任务并显示完成提示
const handleTaskComplete = async (taskIdParam) => { const handleTaskComplete = async (taskIdParam) => {
taskId.value = 0; taskId.value = 0;
...@@ -243,15 +279,13 @@ onShow(async () => { ...@@ -243,15 +279,13 @@ onShow(async () => {
if (!userStore.memberInfo?.mobile) { if (!userStore.memberInfo?.mobile) {
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: `${['首页', '品牌', '积分', '我的'][globalStore.curTabIndex]}`, pageName: `${['首页', '品牌', '积分', '我的'][globalStore.curTabIndex]}`,
componentName: "去授权手机号引导", componentName: '去授权手机号引导',
componentContent: "去授权手机号引导" componentContent: '去授权手机号引导',
}); });
} }
//完成了浏览任务 //完成了浏览任务
if (taskId.value > 0) { if (taskId.value > 0) {
await handleTaskComplete(taskId.value); await handleTaskComplete(taskId.value);
...@@ -259,9 +293,9 @@ onShow(async () => { ...@@ -259,9 +293,9 @@ onShow(async () => {
}); });
onLoad((options) => { onLoad((options) => {
const optionsSync = wx.getEnterOptionsSync() const optionsSync = wx.getEnterOptionsSync();
if (optionsSync.scene == '1154') { if (optionsSync.scene == '1154') {
globalStore.setIsWxFriendCircle(true) globalStore.setIsWxFriendCircle(true);
} }
// 加载会员信息,确保能正确判断手机号授权状态 // 加载会员信息,确保能正确判断手机号授权状态
...@@ -274,19 +308,32 @@ onLoad((options) => { ...@@ -274,19 +308,32 @@ onLoad((options) => {
isBackApp.value = false; 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) { if (options.pageType) {
switch (options.pageType) { switch (options.pageType) {
case "home": case 'home':
globalStore.setCurTabIndex(0); globalStore.setCurTabIndex(0);
break; break;
case "brand": case 'brand':
globalStore.setCurTabIndex(1); globalStore.setCurTabIndex(1);
break; break;
case "integral": case 'integral':
globalStore.setCurTabIndex(2); globalStore.setCurTabIndex(2);
break; break;
case "my": case 'my':
globalStore.setCurTabIndex(3); globalStore.setCurTabIndex(3);
break; break;
} }
...@@ -314,9 +361,6 @@ onPageScroll((e) => { ...@@ -314,9 +361,6 @@ onPageScroll((e) => {
// } // }
// }); // });
// 邀请奖品弹窗相关方法 // 邀请奖品弹窗相关方法
// const handleInviteClick = () => { // const handleInviteClick = () => {
// console.log('邀请按钮点击,显示奖品弹窗'); // console.log('邀请按钮点击,显示奖品弹窗');
...@@ -344,7 +388,8 @@ const handleCloseTaskComplete = () => { ...@@ -344,7 +388,8 @@ const handleCloseTaskComplete = () => {
globalStore.isShowTaskComplete = false; globalStore.isShowTaskComplete = false;
}; };
const handleAcceptTaskComplete = () => {//当前未用到 const handleAcceptTaskComplete = () => {
//当前未用到
// console.log('接受任务完成奖励'); // console.log('接受任务完成奖励');
// globalStore.isShowTaskComplete = false; // globalStore.isShowTaskComplete = false;
// 这里可以添加接受奖励后的逻辑 // 这里可以添加接受奖励后的逻辑
...@@ -355,7 +400,6 @@ const handleCloseTaskPop = () => { ...@@ -355,7 +400,6 @@ const handleCloseTaskPop = () => {
globalStore.closeTaskPop(); globalStore.closeTaskPop();
}; };
//去完成按钮,完成任务 //去完成按钮,完成任务
const handleTaskClick = async (data) => { const handleTaskClick = async (data) => {
console.log('任务点击:', data); console.log('任务点击:', data);
...@@ -364,7 +408,7 @@ const handleTaskClick = async (data) => { ...@@ -364,7 +408,7 @@ const handleTaskClick = async (data) => {
if (!data.task) { if (!data.task) {
uni.showToast({ uni.showToast({
title: '任务不存在', title: '任务不存在',
icon: 'none' icon: 'none',
}); });
return; return;
} }
...@@ -377,7 +421,7 @@ const handleTaskClick = async (data) => { ...@@ -377,7 +421,7 @@ const handleTaskClick = async (data) => {
globalStore.showTaskPerson(); // 延迟显示TaskPerson globalStore.showTaskPerson(); // 延迟显示TaskPerson
}, 100); }, 100);
break; break;
case 'BROWSE_PAGE'://浏览商城 case 'BROWSE_PAGE': //浏览商城
globalStore.closeTaskPop(); globalStore.closeTaskPop();
taskId.value = data?.task?.id; taskId.value = data?.task?.id;
// 这里可以设置任务ID用于后续完成检测 // 这里可以设置任务ID用于后续完成检测
...@@ -391,58 +435,57 @@ const handleTaskClick = async (data) => { ...@@ -391,58 +435,57 @@ const handleTaskClick = async (data) => {
jump({ jump({
type: JumpType.MINI, type: JumpType.MINI,
url: url, 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') { } else if (extra1.type == 'PAGE' || extra1.type == 'MINI_APP') {
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: extra1.url url: extra1.url,
}); });
} else if (extra1.type == 'MINI_APP_THIRD') { } else if (extra1.type == 'MINI_APP_THIRD') {
jump({ jump({
type: JumpType.MINI, type: JumpType.MINI,
url: extra1.url, 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') { } else if (extra1.type == 'SELF_GOODS') {
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: `/v3/goodDetail/goodDetail?gid=${extra1.value}` url: `/v3/goodDetail/goodDetail?gid=${extra1.value}`,
}); });
} else { } else {
jump({ jump({
type: JumpType.H5, type: JumpType.H5,
url: extra1.url url: extra1.url,
}); });
} }
// console.log('extra66666:', extra1); // console.log('extra66666:', extra1);
break; break;
case 'FirstOrder'://完成首单优选消费 case 'FirstOrder': //完成首单优选消费
const extra2 = JSON.parse(data?.task?.taskTodoExtra?.extra); const extra2 = JSON.parse(data?.task?.taskTodoExtra?.extra);
console.log('extra666661111:', extra2); console.log('extra666661111:', extra2);
jump({ jump({
type: JumpType.MINI, type: JumpType.MINI,
url: 'subPackages/xmhMainProcess/member/index?entrySource=xmh_wechatmp_points_recgoodsbot', 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; break;
case 'EXCHANGE_GOODS'://消费商品 case 'EXCHANGE_GOODS': //消费商品
const extra3 = JSON.parse(data?.task?.taskTodoExtra?.extra); const extra3 = JSON.parse(data?.task?.taskTodoExtra?.extra);
if (extra3.length > 0) { 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); url = url.replace('{productId}', extra3[0].itemId).replace('{skuId}', extra3[0].skuId);
jump({ jump({
type: JumpType.MINI, type: JumpType.MINI,
url: url, url: url,
extra: { envVersion: "release", appId: "wx4205ec55b793245e", embedded: true } extra: { envVersion: 'release', appId: 'wx4205ec55b793245e', embedded: true },
}) });
} }
break; break;
case 'FollowWx'://关注公众号 case 'FollowWx': //关注公众号
globalStore.closeTaskPop(); // 先关闭TaskPop globalStore.closeTaskPop(); // 先关闭TaskPop
setTimeout(() => { setTimeout(() => {
// 设置公众号弹窗参数 // 设置公众号弹窗参数
...@@ -452,7 +495,7 @@ const handleTaskClick = async (data) => { ...@@ -452,7 +495,7 @@ const handleTaskClick = async (data) => {
showGongzhonghaoPop.value = true; // 延迟显示公众号弹窗 showGongzhonghaoPop.value = true; // 延迟显示公众号弹窗
}, 100); }, 100);
break; break;
case 'AddQw'://添加企业微信 case 'AddQw': //添加企业微信
globalStore.closeTaskPop(); // 先关闭TaskPop globalStore.closeTaskPop(); // 先关闭TaskPop
setTimeout(() => { setTimeout(() => {
// 设置公众号弹窗参数 // 设置公众号弹窗参数
...@@ -462,17 +505,17 @@ const handleTaskClick = async (data) => { ...@@ -462,17 +505,17 @@ const handleTaskClick = async (data) => {
showGongzhonghaoPop.value = true; // 延迟显示企业微信弹窗 showGongzhonghaoPop.value = true; // 延迟显示企业微信弹窗
}, 100); }, 100);
break; break;
case 'Register'://注册会员 case 'Register': //注册会员
// 这里可以处理注册逻辑 // 这里可以处理注册逻辑
uni.showToast({ uni.showToast({
title: '请先注册会员', title: '请先注册会员',
icon: 'none' icon: 'none',
}); });
break; break;
default: default:
uni.showToast({ uni.showToast({
title: '任务类型不支持', title: '任务类型不支持',
icon: 'none' icon: 'none',
}); });
break; break;
} }
...@@ -486,7 +529,7 @@ const handleCloseTaskPerson = () => { ...@@ -486,7 +529,7 @@ const handleCloseTaskPerson = () => {
// 关闭公众号弹窗 // 关闭公众号弹窗
const handleCloseGongzhonghaoPop = () => { const handleCloseGongzhonghaoPop = () => {
showGongzhonghaoPop.value = false; showGongzhonghaoPop.value = false;
} };
// 处理下载二维码 // 处理下载二维码
const handleDownloadQrCode = (title) => { const handleDownloadQrCode = (title) => {
...@@ -496,7 +539,7 @@ const handleDownloadQrCode = (title) => { ...@@ -496,7 +539,7 @@ const handleDownloadQrCode = (title) => {
md.sensorLogTake({ md.sensorLogTake({
xcxClick: `${title}拉起半屏二维码入口页面点击`, xcxClick: `${title}拉起半屏二维码入口页面点击`,
pageName: `${title}拉起半屏二维码入口页面点击`, pageName: `${title}拉起半屏二维码入口页面点击`,
buttonName: `下载二维码` buttonName: `下载二维码`,
}); });
if (title === '公众号') { if (title === '公众号') {
...@@ -506,9 +549,10 @@ const handleDownloadQrCode = (title) => { ...@@ -506,9 +549,10 @@ const handleDownloadQrCode = (title) => {
const courseUrl = 'https://course.feihe.com/momclub-picture/homepage/qrcode_qw.png'; const courseUrl = 'https://course.feihe.com/momclub-picture/homepage/qrcode_qw.png';
downloadQrCode(courseUrl); downloadQrCode(courseUrl);
} }
} };
const downloadQrCode = (imgurl) => {//现在二维码图片 const downloadQrCode = (imgurl) => {
//现在二维码图片
uni.downloadFile({ uni.downloadFile({
url: imgurl, url: imgurl,
success: (downloadRes) => { success: (downloadRes) => {
...@@ -518,31 +562,31 @@ const downloadQrCode = (imgurl) => {//现在二维码图片 ...@@ -518,31 +562,31 @@ const downloadQrCode = (imgurl) => {//现在二维码图片
success: (res) => { success: (res) => {
uni.showToast({ uni.showToast({
title: '保存成功', title: '保存成功',
icon: 'success' icon: 'success',
}); });
}, },
fail: (err) => { fail: (err) => {
uni.showToast({ uni.showToast({
title: '保存失败', title: '保存失败',
icon: 'none' icon: 'none',
}); });
} },
}); });
} else { } else {
uni.showToast({ uni.showToast({
title: '下载失败', title: '下载失败',
icon: 'none' icon: 'none',
}); });
} }
}, },
fail: (err) => { fail: (err) => {
uni.showToast({ uni.showToast({
title: '下载失败', title: '下载失败',
icon: 'none' icon: 'none',
}); });
} },
}); });
} };
const handleTaskPersonSubmit = (formData) => { const handleTaskPersonSubmit = (formData) => {
console.log('任务信息提交:', formData); console.log('任务信息提交:', formData);
...@@ -550,13 +594,12 @@ const handleTaskPersonSubmit = (formData) => { ...@@ -550,13 +594,12 @@ const handleTaskPersonSubmit = (formData) => {
// 可以显示成功提示 // 可以显示成功提示
uni.showToast({ uni.showToast({
title: '信息提交成功', title: '信息提交成功',
icon: 'success' icon: 'success',
}); });
}; };
// 视频弹窗相关方法 // 视频弹窗相关方法
const closeVideo = async () => { const closeVideo = async () => {
//完成了浏览任务 //完成了浏览任务
if (taskId.value > 0) { if (taskId.value > 0) {
await handleTaskComplete(taskId.value); await handleTaskComplete(taskId.value);
...@@ -571,7 +614,7 @@ const onVideoLoadedMeta = (e) => { ...@@ -571,7 +614,7 @@ const onVideoLoadedMeta = (e) => {
const pageWidth = uni.upx2px(750); const pageWidth = uni.upx2px(750);
const ratio = height / width; const ratio = height / width;
videoWidth.value = pageWidth; videoWidth.value = pageWidth;
videoHeight.value = pageWidth;// pageWidth * ratio; videoHeight.value = pageWidth; // pageWidth * ratio;
}; };
const onVideoPlay = () => { const onVideoPlay = () => {
...@@ -589,13 +632,11 @@ const onVideoPlay = () => { ...@@ -589,13 +632,11 @@ const onVideoPlay = () => {
} }
} }
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
// .back-app{ // .back-app{
...@@ -716,4 +757,4 @@ const onVideoPlay = () => { ...@@ -716,4 +757,4 @@ const onVideoPlay = () => {
text-align: center; text-align: center;
z-index: 10001; z-index: 10001;
} }
</style> </style>
\ No newline at end of file
import { import { defineStore } from 'pinia';
defineStore
} from 'pinia';
const cuk = uni.getStorageSync('cuk') const cuk = uni.getStorageSync('cuk');
const openId = uni.getStorageSync('openId') const openId = uni.getStorageSync('openId');
const unionId = uni.getStorageSync('unionId') const unionId = uni.getStorageSync('unionId');
export const useGlobalStore = defineStore('global', { export const useGlobalStore = defineStore('global', {
state: () => { state: () => {
return { return {
cuk: cuk, // 用户登录后获取的凭证,调用接口时headers中携带 cuk: cuk, // 用户登录后获取的凭证,调用接口时headers中携带
curTabIndex: 0, // 当前Tab索引 curTabIndex: 0, // 当前Tab索引
isWxFriendCircle:false, isWxFriendCircle: false,
isShowLoading: false, isShowLoading: false,
openId: openId, openId: openId,
unionId: unionId, unionId: unionId,
baseUrl: '', baseUrl: '',
isShowInvitePrizePanel: false, // 是否显示邀请奖品弹窗 isShowInvitePrizePanel: false, // 是否显示邀请奖品弹窗
isShowTaskComplete: false, // 是否显示任务完成弹窗 isShowTaskComplete: false, // 是否显示任务完成弹窗
taskCompletePoints: 100, // 任务完成获得的积分 taskCompletePoints: 100, // 任务完成获得的积分
taskCompleteTitle: 'xxx', // 任务完成的任务名称 taskCompleteTitle: 'xxx', // 任务完成的任务名称
isShowTaskPop: false, // 是否显示任务弹窗 isShowTaskPop: false, // 是否显示任务弹窗
isShowTaskPerson: false, // 是否显示任务信息弹窗 isShowTaskPerson: false, // 是否显示任务信息弹窗
taskTodo: [], // 任务数据 taskTodo: [], // 任务数据
invateUseType: '', // 邀请用户类型 invateUseType: '', // 邀请用户类型
}; previewScene: {}, // 预览场景
}, };
actions: { },
setBaseUrl(url){ actions: {
this.baseUrl = url setBaseUrl(url) {
}, this.baseUrl = url;
/** },
* 设置用户cuk /**
* @param {Object} cuk * 设置用户cuk
*/ * @param {Object} cuk
setCuk(cuk,openId,unionId) { */
this.cuk = cuk; setCuk(cuk, openId, unionId) {
this.openId = openId; this.cuk = cuk;
this.unionId = unionId; this.openId = openId;
uni.setStorageSync('openId', openId); this.unionId = unionId;
uni.setStorageSync('unionId', unionId); uni.setStorageSync('openId', openId);
uni.setStorageSync('cuk', cuk); uni.setStorageSync('unionId', unionId);
}, uni.setStorageSync('cuk', cuk);
/** },
* 设置当前Tab索引 /**
* @param {number} index * 设置当前Tab索引
*/ * @param {number} index
setCurTabIndex(index) { */
this.curTabIndex = index; setCurTabIndex(index) {
}, this.curTabIndex = index;
},
/**
* 设置当前是否是小程序朋友圈单页环境
* @param {boolean} v
*/
setIsWxFriendCircle(v){
this.isWxFriendCircle = v
},
setIsShowLoading(v){
this.isShowLoading = v
},
/**
* 显示任务完成弹窗
* @param {number} points 获得的积分
* @param {string} taskTitle 任务名称
*/
showTaskComplete(points = 100, taskTitle = 'xxx') {
this.taskCompletePoints = points;
this.taskCompleteTitle = taskTitle;
this.isShowTaskComplete = true;
},
/**
* 显示任务弹窗
* @param {Array} taskTodo 任务数据
*/
showTaskPop(taskTodo = []) {
this.taskTodo = taskTodo;
this.isShowTaskPop = true;
},
/**
* 关闭任务弹窗
*/
closeTaskPop() {
this.isShowTaskPop = false;
},
/**
* 显示任务信息弹窗
*/
showTaskPerson() {
this.isShowTaskPerson = true;
},
/**
* 关闭任务信息弹窗
*/
closeTaskPerson() {
this.isShowTaskPerson = false;
},
/** /**
* 清除认证信息(注销时使用) * 设置当前是否是小程序朋友圈单页环境
*/ * @param {boolean} v
// clearAuthData() { */
// this.cuk = null; setIsWxFriendCircle(v) {
// this.openId = null; this.isWxFriendCircle = v;
// this.unionId = null; },
// // 清除本地存储 setIsShowLoading(v) {
// uni.removeStorageSync('cuk'); this.isShowLoading = v;
// uni.removeStorageSync('openId'); },
// uni.removeStorageSync('unionId');
// }, /**
}, * 显示任务完成弹窗
}); * @param {number} points 获得的积分
\ No newline at end of file * @param {string} taskTitle 任务名称
*/
showTaskComplete(points = 100, taskTitle = 'xxx') {
this.taskCompletePoints = points;
this.taskCompleteTitle = taskTitle;
this.isShowTaskComplete = true;
},
/**
* 显示任务弹窗
* @param {Array} taskTodo 任务数据
*/
showTaskPop(taskTodo = []) {
this.taskTodo = taskTodo;
this.isShowTaskPop = true;
},
/**
* 关闭任务弹窗
*/
closeTaskPop() {
this.isShowTaskPop = false;
},
/**
* 显示任务信息弹窗
*/
showTaskPerson() {
this.isShowTaskPerson = true;
},
/**
* 关闭任务信息弹窗
*/
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];
},
/**
* 清除认证信息(注销时使用)
*/
// clearAuthData() {
// this.cuk = null;
// this.openId = null;
// this.unionId = null;
// // 清除本地存储
// uni.removeStorageSync('cuk');
// uni.removeStorageSync('openId');
// uni.removeStorageSync('unionId');
// },
},
});
import { defineStore } from "pinia"; import { defineStore } from 'pinia';
import { getSigninAndTaskInfoJSON, checkInJSON, getSeckillList, getPointsBenefitCouponJSON, queryTodoResultJSON, getOriginInviteHomeJSON, assistInviteJSON, getInvitationListJSON, originInviteBindJSON } from "../api/integral"; import {
getSigninAndTaskInfoJSON,
checkInJSON,
getSeckillList,
getPointsBenefitCouponJSON,
queryTodoResultJSON,
getOriginInviteHomeJSON,
assistInviteJSON,
getInvitationListJSON,
originInviteBindJSON,
} from '../api/integral';
import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json'; import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json';
import checkInMock from '../mock/checkIndata.json'; import checkInMock from '../mock/checkIndata.json';
import pointsBenefitCouponMock from '../mock/pointsBenefitCoupon.json'; import pointsBenefitCouponMock from '../mock/pointsBenefitCoupon.json';
...@@ -7,7 +17,7 @@ import queryTodoResultMock from '../mock/queryTodoResult.json'; ...@@ -7,7 +17,7 @@ import queryTodoResultMock from '../mock/queryTodoResult.json';
import originInviteHomeMock from '../mock/originInviteHome.json'; import originInviteHomeMock from '../mock/originInviteHome.json';
import assistInviteMock from '../mock/assistInvite.json'; import assistInviteMock from '../mock/assistInvite.json';
import invitationListMock from '../mock/invitationList.json'; import invitationListMock from '../mock/invitationList.json';
export const useIntegralStore = defineStore("integral", { export const useIntegralStore = defineStore('integral', {
state: () => { state: () => {
return { return {
_signinAndTaskInfo: null, _signinAndTaskInfo: null,
...@@ -23,122 +33,139 @@ export const useIntegralStore = defineStore("integral", { ...@@ -23,122 +33,139 @@ export const useIntegralStore = defineStore("integral", {
}, },
actions: { actions: {
async getSigninAndTaskInfo(isdebug = false) { async getSigninAndTaskInfo(isdebug = false) {
if(isdebug) { if (isdebug) {
this._signinAndTaskInfo = signinAndTaskInfoMock; this._signinAndTaskInfo = signinAndTaskInfoMock;
return signinAndTaskInfoMock; return signinAndTaskInfoMock;
}else{ } else {
const res = await getSigninAndTaskInfoJSON(); const res = await getSigninAndTaskInfoJSON();
this._signinAndTaskInfo = res; this._signinAndTaskInfo = res;
return res; return res;
} }
}, },
async checkIn(activityId,isdebug = false) { async checkIn(activityId, isdebug = false) {
// if(isdebug) { // if(isdebug) {
// this._checkInData = checkInMock; // 存储到state中 // this._checkInData = checkInMock; // 存储到state中
// return checkInMock; // return checkInMock;
// }else{ // }else{
const res = await checkInJSON(activityId); const res = await checkInJSON(activityId);
this._checkInData = res; // 存储到state中 this._checkInData = res; // 存储到state中
return res; return res;
// } // }
}, },
async getSeckillData(isdebug = false) { async getSeckillData(isdebug = false) {
// if(isdebug) { // if(isdebug) {
// // 使用模拟数据结构 // // 使用模拟数据结构
// const mockSeckillData = { // const mockSeckillData = {
// sessions: [ // sessions: [
// { // {
// id: 1, // id: 1,
// status: 'ongoing', // status: 'ongoing',
// countdown: '01:58:59', // countdown: '01:58:59',
// timeTags: ['正在秒杀', '18:00开始', '20:00结束'], // timeTags: ['正在秒杀', '18:00开始', '20:00结束'],
// goods: [ // goods: [
// { // {
// id: 'good1', // id: 'good1',
// name: '商品名称商品名称商称商品名称商称商品名称商称商品名称商品...', // name: '商品名称商品名称商称商品名称商称商品名称商称商品名称商品...',
// points: 100, // points: 100,
// originalPoints: 500, // originalPoints: 500,
// image: '' // image: ''
// } // }
// ] // ]
// } // }
// ] // ]
// }; // };
// this._seckillData = mockSeckillData; // this._seckillData = mockSeckillData;
// return mockSeckillData; // return mockSeckillData;
// } else { // } else {
const res = await getSeckillList(); const res = await getSeckillList();
this._seckillData = res; this._seckillData = res;
return res; return res;
// } // }
}, },
async getPointsBenefitCoupon(isdebug = false) { async getPointsBenefitCoupon(type) {
// if(isdebug) { // if(isdebug) {
// this._pointsBenefitCoupon = pointsBenefitCouponMock; // this._pointsBenefitCoupon = pointsBenefitCouponMock;
// return pointsBenefitCouponMock; // return pointsBenefitCouponMock;
// }else{ // }else{
const res = await getPointsBenefitCouponJSON(); const res = await getPointsBenefitCouponJSON(type);
this._pointsBenefitCoupon = res; this._pointsBenefitCoupon = res;
return res; return res;
// } // }
}, },
async queryTodoResultServer(isdebug = false) { async queryTodoResultServer(isdebug = false) {
if(isdebug) { if (isdebug) {
this._queryTodoResult = queryTodoResultMock; this._queryTodoResult = queryTodoResultMock;
return queryTodoResultMock; return queryTodoResultMock;
}else{ } else {
const res = await queryTodoResultJSON(); const res = await queryTodoResultJSON();
this._queryTodoResult = res; this._queryTodoResult = res;
return res; return res;
} }
}, },
async getOriginInviteHome(isdebug = false) { async getOriginInviteHome(isdebug = false) {
if(isdebug) { if (isdebug) {
this._originInviteHome = originInviteHomeMock; this._originInviteHome = originInviteHomeMock;
return originInviteHomeMock; return originInviteHomeMock;
}else{ } else {
const res = await getOriginInviteHomeJSON(); const res = await getOriginInviteHomeJSON();
this._originInviteHome = res; this._originInviteHome = res;
return res; return res;
} }
}, },
async assistInvite(invitationCode, wxUnionId, isdebug = false) { async assistInvite(invitationCode, wxUnionId, isdebug = false) {
if(isdebug) { if (isdebug) {
this._assistInviteData = assistInviteMock; this._assistInviteData = assistInviteMock;
return assistInviteMock; return assistInviteMock;
}else{ } else {
const res = await assistInviteJSON(invitationCode, wxUnionId); const res = await assistInviteJSON(invitationCode, wxUnionId);
this._assistInviteData = res; this._assistInviteData = res;
return res; return res;
} }
}, },
async getInvitationList(isdebug = false) { async getInvitationList(isdebug = false) {
if(isdebug) { if (isdebug) {
this._invitationList = invitationListMock; this._invitationList = invitationListMock;
return invitationListMock; return invitationListMock;
}else{ } else {
const res = await getInvitationListJSON(); const res = await getInvitationListJSON();
this._invitationList = res; this._invitationList = res;
return res; return res;
} }
}, },
async originInviteBind(unionId, shareCode, isdebug = false) { async originInviteBind(unionId, shareCode, isdebug = false) {
const res = await originInviteBindJSON(unionId, shareCode); const res = await originInviteBindJSON(unionId, shareCode);
this._originInviteBindData = res; this._originInviteBindData = res;
return res; return res;
}, },
}, },
getters: { getters: {
signinAndTaskInfo : (state) => {return state._signinAndTaskInfo; }, signinAndTaskInfo: (state) => {
checkInData : (state) => {return state._checkInData; }, return state._signinAndTaskInfo;
seckillData : (state) => {return state._seckillData; }, },
pointsBenefitCoupon : (state) => {return state._pointsBenefitCoupon; }, checkInData: (state) => {
queryTodoResult : (state) => {return state._queryTodoResult; }, return state._checkInData;
originInviteHome : (state) => {return state._originInviteHome; }, },
assistInviteData : (state) => {return state._assistInviteData; }, seckillData: (state) => {
invitationList : (state) => {return state._invitationList; }, return state._seckillData;
originInviteBindData : (state) => {return state._originInviteBindData; }, },
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;
},
}, },
}); });
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<template> <template>
<view class="brand-container"> <view class="brand-container">
<view class="content"> <view class="content">
<swiper id="firstScreen" class="swiper banner" :current="swiperIndex" @animationfinish="intervalChange" <swiper
circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration" id="firstScreen"
:indicator-color="indicatorColor" :indicator-active-color="indicatoractiveColor"> class="swiper banner"
<swiper-item v-for="(item, index) in swiperList" :key="index"> :current="swiperIndex"
<view class="swiper-item banneritem"> @animationfinish="intervalChange"
<image :data-log="{ circular
xcxClick: '品牌故事-首屏页面点击', :indicator-dots="indicatorDots"
pageName: '品牌故事-首屏页面', :autoplay="autoplay"
buttonName: `背景图-${swiperNameList[index]}` :interval="interval"
}" :data-comlog="{ :duration="duration"
xcxComponentClick: 'true', :indicator-color="indicatorColor"
pageName: '品牌故事页', :indicator-active-color="indicatoractiveColor"
componentName: '品牌故事页banner', >
componentContent: item.title || '' <swiper-item v-for="(item, index) in swiperList" :key="index">
}" :data-link="item.link" @tap="jumpLink(item.link, item.videoUrl, $event)" class="b-img" <view class="swiper-item banneritem">
:src="item?.url?.indexOf('http') === 0 ? item.url : $baseUrl + item.url"> <image
</image> :data-log="{
</view> xcxClick: '品牌故事-首屏页面点击',
</swiper-item> pageName: '品牌故事-首屏页面',
buttonName: `背景图-${swiperNameList[index]}`,
</swiper> }"
<view class="swiperbox"> :data-comlog="{
<view class="iconbox"> xcxComponentClick: 'true',
<!-- <image :data-log="{ pageName: '品牌故事页',
componentName: '品牌故事页banner',
componentContent: item.title || '',
}"
:data-link="item.link"
@tap="jumpLink(item.link, item.videoUrl, $event)"
class="b-img"
:src="item?.url?.indexOf('http') === 0 ? item.url : $baseUrl + item.url"
>
</image>
</view>
</swiper-item>
</swiper>
<view class="swiperbox">
<view class="iconbox">
<!-- <image :data-log="{
xcxClick: '品牌故事-首屏页面点击', xcxClick: '品牌故事-首屏页面点击',
pageName: '品牌故事-首屏页面', pageName: '品牌故事-首屏页面',
buttonName: `按钮-${swiperNameList[index]}` buttonName: `按钮-${swiperNameList[index]}`
}" @tap="jumpSwiper(index, $event)" class="icon" }" @tap="jumpSwiper(index, $event)" class="icon"
:src="swiperIndex === index ? $baseUrl + icon.activeUrl : $baseUrl + icon.baseUrl" :src="swiperIndex === index ? $baseUrl + icon.activeUrl : $baseUrl + icon.baseUrl"
v-for="(icon, index) in swiperIconList" :key="index"></image> --> v-for="(icon, index) in swiperIconList" :key="index"></image> -->
<image :src="$baseUrl + 'brandpage/indicatorDotsBg.png'" class="indicatorDotsBg"></image> <image :src="$baseUrl + 'brandpage/indicatorDotsBg.png'" class="indicatorDotsBg"></image>
<view class="indicatorDots"> <view class="indicatorDots">
<template class="dotbox" v-for="(item, index) in swiperIconList" :key="index"> <template class="dotbox" v-for="(item, index) in swiperIconList" :key="index">
<view class="dot" :class="swiperIndex === index ? 'dot-active' : 'dot-normal'"> <view class="dot" :class="swiperIndex === index ? 'dot-active' : 'dot-normal'"> </view>
</view> </template>
</template> <text class="dotText">{{
<text class="dotText">{{ swiperIconList[swiperIndex]?.text.length > 7 ? swiperIconList[swiperIndex]?.text.length > 7
swiperIconList[swiperIndex]?.text.substring(0, 7) + '...' : ? swiperIconList[swiperIndex]?.text.substring(0, 7) + '...'
swiperIconList[swiperIndex]?.text }}</text> : swiperIconList[swiperIndex]?.text
</view> }}</text>
</view> </view>
</view> </view>
<view class="swiper-mask"> </view>
<image class="swiper-mask-img" :src="$baseUrl + 'homepage/home_format_v2.png'"></image> <view class="swiper-mask">
</view> <image class="swiper-mask-img" :src="$baseUrl + 'homepage/home_format_v2.png'"></image>
<view class="videoposterbox" </view>
v-if="video1Channel.videoUrl || (video1Channel.finderUserName && video1Channel.feedId)"> <view
<video v-if="video1Channel.videoUrl" ref="brandVideo1Ref" id="brandVideo1" class="videoposter" class="videoposterbox"
:src="video1Channel.videoUrl?.indexOf('http') === 0 ? video1Channel.videoUrl : $baseUrl + video1Channel.videoUrl" v-if="video1Channel.videoUrl || (video1Channel.finderUserName && video1Channel.feedId)"
:autoplay="false" :data-log="{ >
xcxClick: '品牌故事-次屏页面点击', <video
pageName: '品牌故事-首屏页面', v-if="video1Channel.videoUrl"
buttonName: '腰部品牌Video' ref="brandVideo1Ref"
}" :poster="video1Channel.posterUrl?.indexOf('http') === 0 ? video1Channel.posterUrl : $baseUrl + video1Channel.posterUrl" id="brandVideo1"
object-fit="cover" @loadedmetadata="onVideoLoadedMeta" @play="onVideo1Play" class="videoposter"
@ended="onVideo1Ended"></video> :src="
<image v-else :data-log="{ video1Channel.videoUrl?.indexOf('http') === 0
xcxClick: '品牌故事-次屏页面点击', ? video1Channel.videoUrl
pageName: '品牌故事-首屏页面', : $baseUrl + video1Channel.videoUrl
buttonName: '腰部品牌Video' "
}" :data-comlog="{ :autoplay="false"
xcxComponentClick: 'true', :data-log="{
pageName: '品牌故事页', xcxClick: '品牌故事-次屏页面点击',
componentName: '品牌故事视频', pageName: '品牌故事-首屏页面',
componentContent: video1Channel.title || '' buttonName: '腰部品牌Video',
}" @tap="openChannel(video1Channel, $event)" class="videoposter" }"
:src="video1Channel.posterUrl?.indexOf('http') === 0 ? video1Channel.posterUrl : $baseUrl + video1Channel.posterUrl"> :poster="
</image> video1Channel.posterUrl?.indexOf('http') === 0
? video1Channel.posterUrl
<view class="videoposterboxtitle" v-if="showVideo1Title">{{ video1Channel.title || "" }}</view> : $baseUrl + video1Channel.posterUrl
"
</view> object-fit="cover"
<view id="secondScreen" class="productcontai" @loadedmetadata="onVideoLoadedMeta"
v-if="productTabList.length > 0 && productInfoList.length > 0"> @play="onVideo1Play"
<text class="maintitle">{{ erqiPeizhi.title1 }}</text> @ended="onVideo1Ended"
<scroll-view class="listbox" scroll-x="true" show-scrollbar="false" ></video>
:scroll-into-view="'tab-' + channelTabIndex" :scroll-with-animation="true"> <image
<view class="tab-container"> v-else
<view @tap="channelTabHandler(index, $event)" :data-log="{ :data-log="{
xcxClick: '品牌故事-次屏页面点击', xcxClick: '品牌故事-次屏页面点击',
pageName: '品牌故事-次屏页面', pageName: '品牌故事-首屏页面',
buttonName: `${item}` buttonName: '腰部品牌Video',
}" :data-comlog="{ }"
xcxComponentClick: 'true', :data-comlog="{
pageName: '品牌故事页', xcxComponentClick: 'true',
componentName: '飞鹤产品家族', pageName: '品牌故事页',
componentContent: '产品家族切换分类-' + item componentName: '品牌故事视频',
}" :class="channelTabIndex === index ? 'tabitem tabActive' : 'tabitem'" v-for="(item, index) in productTabList" componentContent: video1Channel.title || '',
:key="index" :id="'tab-' + index"> }"
{{ item }} @tap="openChannel(video1Channel, $event)"
</view> class="videoposter"
</view> :src="
</scroll-view> video1Channel.posterUrl?.indexOf('http') === 0
<scroll-view v-if="productInfoList.length > 0" class="productbox" scroll-x="true" ? video1Channel.posterUrl
show-scrollbar="false"> : $baseUrl + video1Channel.posterUrl
<view class="product-grid"> "
<view class="product-row"> >
<view class="infobox" :key="'top-' + index" </image>
v-for="(infoItem, index) in productInfoList[channelTabIndex].filter((item, i) => i % 2 === 0)"
:style="{ <view class="videoposterboxtitle" v-if="showVideo1Title">{{ video1Channel.title || '' }}</view>
background: `url(${$baseUrl}brandpage/infoBoxBg.png) no-repeat center/contain` </view>
}" :data-log="{ <!-- 产品家族 -->
xcxClick: '品牌故事-次屏页面点击', <view
pageName: '品牌故事-次屏页面', id="secondScreen"
buttonName: `${productTabList[channelTabIndex] + '中的' + infoItem.title}+'商品'` class="productcontai"
}" :data-comlog="{ v-if="productTabList.length > 0 && productInfoList.length > 0"
xcxComponentClick: 'true', >
pageName: '品牌故事页', <text class="maintitle">{{ erqiPeizhi.title1 }}</text>
componentName: '飞鹤产品家族', <!-- tab容器 -->
componentContent: '产品家族商品-' + infoItem.desc <scroll-view
}" @tap="jumpProduct(infoItem, $event)"> class="listbox"
<view class="flexbox"> scroll-x="true"
<view class="infotitle"> show-scrollbar="false"
{{ infoItem.title }} :scroll-into-view="'tab-' + channelTabIndex"
</view> :scroll-with-animation="true"
<image class="infoimg" >
:src="infoItem.bgUrl?.indexOf('http') === 0 ? infoItem.bgUrl : $baseUrl + infoItem.bgUrl"> <view class="tab-container">
</image> <view
</view> @tap="channelTabHandler(index, $event)"
<view class="infodesc">{{ infoItem.desc }}</view> :data-log="{
</view> xcxClick: '品牌故事-次屏页面点击',
</view> pageName: '品牌故事-次屏页面',
<view class="product-row"> buttonName: `${item}`,
<view class="infobox" :key="'bottom-' + index" }"
v-for="(infoItem, index) in productInfoList[channelTabIndex].filter((item, i) => i % 2 === 1)" :data-comlog="{
:style="{ xcxComponentClick: 'true',
background: `url(${$baseUrl}brandpage/infoBoxBg.png) no-repeat center/contain` pageName: '品牌故事页',
}" :data-log="{ componentName: '飞鹤产品家族',
xcxClick: '品牌故事-次屏页面点击', componentContent: '产品家族切换分类-' + item,
pageName: '品牌故事-次屏页面', }"
buttonName: `${productTabList[channelTabIndex] + '中的' + infoItem.title}+'商品'` :class="channelTabIndex === index ? 'tabitem tabActive' : 'tabitem'"
}" :data-comlog="{ v-for="(item, index) in productTabList"
xcxComponentClick: 'true', :key="index"
pageName: '品牌故事页', :id="'tab-' + index"
componentName: '飞鹤产品家族', >
componentContent: '产品家族商品-' + infoItem.desc {{ item }}
}" @tap="jumpProduct(infoItem, $event)"> </view>
<view class="flexbox"> </view>
<view class="infotitle"> </scroll-view>
{{ infoItem.title }} <!-- 内容 -->
</view> <scroll-view
<image class="infoimg" v-if="productInfoList.length > 0"
:src="infoItem.bgUrl?.indexOf('http') === 0 ? infoItem.bgUrl : $baseUrl + infoItem.bgUrl"> class="productbox"
</image> scroll-x="true"
</view> show-scrollbar="false"
<view class="infodesc">{{ infoItem.desc }}</view> >
</view> <view class="product-grid">
</view> <view class="product-row">
</view> <view
</scroll-view> class="infobox"
:key="'top-' + index"
v-for="(infoItem, index) in productInfoList[channelTabIndex].filter((item, i) => i % 2 === 0)"
:style="{
</view> background: `url(${$baseUrl}brandpage/infoBoxBg.png) no-repeat center/contain`,
}"
<view class="videoposterbox" :data-log="{
v-if="video2Channel.videoUrl || (video2Channel.finderUserName && video2Channel.feedId)"> xcxClick: '品牌故事-次屏页面点击',
<video v-if="video2Channel.videoUrl" ref="brandVideo2Ref" id="brandVideo2" class="videoposter" pageName: '品牌故事-次屏页面',
:src="video2Channel.videoUrl?.indexOf('http') === 0 ? video2Channel.videoUrl : $baseUrl + video2Channel.videoUrl" buttonName: `${productTabList[channelTabIndex] + '中的' + infoItem.title}+'商品'`,
:autoplay="false" object-fit="cover" @loadedmetadata="onVideoLoadedMeta" @play="onVideo2Play" }"
:poster="video2Channel.posterUrl?.indexOf('http') === 0 ? video2Channel.posterUrl : $baseUrl + video2Channel.posterUrl" :data-comlog="{
@ended="onVideo2Ended"></video> xcxComponentClick: 'true',
<image v-else class="videoposter" :data-comlog="{ pageName: '品牌故事页',
xcxComponentClick: 'true', componentName: '飞鹤产品家族',
pageName: '品牌故事页', componentContent: '产品家族商品-' + infoItem.desc,
componentName: '品牌故事视频', }"
componentContent: video2Channel.title || '' @tap="jumpProduct(infoItem, $event)"
}" @tap="openChannel(video2Channel, $event)" >
:src="video2Channel.posterUrl?.indexOf('http') === 0 ? video2Channel.posterUrl : $baseUrl + video2Channel.posterUrl"> <view class="flexbox">
</image> <view class="infotitle">
<view class="videoposterboxtitle" v-if="showVideo2Title">{{ video2Channel.title || "" }}</view> {{ infoItem.title }}
</view> </view>
<view id="thirdScreen" class="ipbox" v-if="erqiPeizhi.appId1 && erqiPeizhi.appId2" <image
:style="{ background: `url(${$baseUrl}brandpage/hexiaofeiBg.png) no-repeat center/contain` }"> class="infoimg"
<!-- <store-product appid="wx1ad0903b95889ea1" product-id="10000239570622" custom-content="true"> --> :src="infoItem.bgUrl?.indexOf('http') === 0 ? infoItem.bgUrl : $baseUrl + infoItem.bgUrl"
<image :data-log="{ >
xcxClick: '品牌故事-三屏页面点击', </image>
pageName: '品牌故事-三屏页面', </view>
buttonName: `全家形象` <view class="infodesc">{{ infoItem.desc }}</view>
}" class="iphexiaofei" @tap="jumpLink(erqiPeizhi.link, erqiPeizhi.videoUrl, $event)" </view>
:src="erqiPeizhi.iphexiaofeiUrl"> </view>
</image> <view class="product-row">
<!-- </store-product> --> <view
<view class="ipcard"> class="infobox"
<view class="title"> :key="'bottom-' + index"
{{ erqiPeizhi.title2 }} v-for="(infoItem, index) in productInfoList[channelTabIndex].filter((item, i) => i % 2 === 1)"
<!-- <view class="t1">鹤小飞一家</view> --> :style="{
</view> background: `url(${$baseUrl}brandpage/infoBoxBg.png) no-repeat center/contain`,
<view class="desc"> }"
{{ ipDesc }} :data-log="{
</view> xcxClick: '品牌故事-次屏页面点击',
<view class="ipflex"> pageName: '品牌故事-次屏页面',
<view class="ipbg ip1" id="ip1" @tap="ipTapEvent(1, $event)"> buttonName: `${productTabList[channelTabIndex] + '中的' + infoItem.title}+'商品'`,
<store-product :appid="erqiPeizhi.appId1" :product-id="erqiPeizhi.productId1" }"
custom-content="true"> :data-comlog="{
<image :data-log="{ xcxComponentClick: 'true',
xcxClick: '品牌故事-三屏页面点击', pageName: '品牌故事页',
pageName: '品牌故事-三屏页面', componentName: '飞鹤产品家族',
buttonName: `${hexiaofeiNameList[0]}` componentContent: '产品家族商品-' + infoItem.desc,
}" :src="erqiPeizhi.ipImg1?.indexOf('http') === 0 ? erqiPeizhi.ipImg1 : $baseUrl + erqiPeizhi.ipImg1" }"
class="ip1"> @tap="jumpProduct(infoItem, $event)"
</image> >
</store-product> <view class="flexbox">
</view> <view class="infotitle">
{{ infoItem.title }}
<view class="ipright"> </view>
<view class="ipbg ip2" id="ip2" @tap="ipTapEvent(2, $event)"> <image
<store-product :appid="erqiPeizhi.appId2" :product-id="erqiPeizhi.productId2" class="infoimg"
custom-content="true"> :src="infoItem.bgUrl?.indexOf('http') === 0 ? infoItem.bgUrl : $baseUrl + infoItem.bgUrl"
<image :data-log="{ >
xcxClick: '品牌故事-三屏页面点击', </image>
pageName: '品牌故事-三屏页面', </view>
buttonName: `${hexiaofeiNameList[1]}` <view class="infodesc">{{ infoItem.desc }}</view>
}" :src="erqiPeizhi.ipImg2?.indexOf('http') === 0 ? erqiPeizhi.ipImg2 : $baseUrl + erqiPeizhi.ipImg2"> </view>
</image> </view>
</store-product> </view>
</view> </scroll-view>
<view style="display: flex;justify-content: space-between;margin-top: 20rpx;"> </view>
<view class="ipbg ip3" id="ip3" @tap="ipTapEvent(3, $event)"> <!-- 视频 -->
<image :data-log="{ <view
xcxClick: '品牌故事-三屏页面点击', class="videoposterbox"
pageName: '品牌故事-三屏页面', v-if="video2Channel.videoUrl || (video2Channel.finderUserName && video2Channel.feedId)"
buttonName: `${hexiaofeiNameList[2]}` >
}" @tap="showPopup(0, $event)" <video
:src="erqiPeizhi.ipImg3?.indexOf('http') === 0 ? erqiPeizhi.ipImg3 : $baseUrl + erqiPeizhi.ipImg3"> v-if="video2Channel.videoUrl"
</image> ref="brandVideo2Ref"
id="brandVideo2"
</view> class="videoposter"
<view class="ipbg ip4" id="ip4" @tap="ipTapEvent(4, $event)"> :src="
<image :data-log="{ video2Channel.videoUrl?.indexOf('http') === 0
xcxClick: '品牌故事-三屏页面点击', ? video2Channel.videoUrl
pageName: '品牌故事-三屏页面', : $baseUrl + video2Channel.videoUrl
buttonName: `${hexiaofeiNameList[3]}` "
}" @tap="showPopup(2, $event)" :autoplay="false"
:src="erqiPeizhi.ipImg4?.indexOf('http') === 0 ? erqiPeizhi.ipImg4 : $baseUrl + erqiPeizhi.ipImg4"> object-fit="cover"
</image> @loadedmetadata="onVideoLoadedMeta"
</view> @play="onVideo2Play"
</view> :poster="
video2Channel.posterUrl?.indexOf('http') === 0
</view> ? video2Channel.posterUrl
: $baseUrl + video2Channel.posterUrl
</view> "
</view> @ended="onVideo2Ended"
</view> ></video>
<view v-if="esgInfoList.length > 0" class="esgbox"> <image
<text class="maintitle">{{ erqiPeizhi.title3 }}</text> v-else
<!-- <text class="subtitle">关注祖国下一代的营养、教育和陪伴</text> --> class="videoposter"
<view class="channelscroll"> :data-comlog="{
<view class="box"> xcxComponentClick: 'true',
<view class="infobox" :key="index" v-for="(infoItem, index) in esgInfoList" pageName: '品牌故事页',
:id="'esg' + (index + 1)" componentName: '品牌故事视频',
:style="{ background: `url(${$baseUrl}brandpage/esgItemBg.png) no-repeat center/505rpx 638rpx` }" componentContent: video2Channel.title || '',
:data-log="{ }"
xcxClick: `品牌故事-三屏页面点击`, @tap="openChannel(video2Channel, $event)"
pageName: `品牌故事-三屏页面ESG点击`, :src="
buttonName: `${index + 1}-${infoItem.desc}` video2Channel.posterUrl?.indexOf('http') === 0
}" :data-comlog="{ ? video2Channel.posterUrl
xcxComponentClick: 'true', : $baseUrl + video2Channel.posterUrl
pageName: '品牌故事页', "
componentName: '飞鹤ESG', >
componentContent: infoItem.desc </image>
}" @tap="jumpLink(infoItem.link, infoItem.videoUrl, $event)"> <view class="videoposterboxtitle" v-if="showVideo2Title">{{ video2Channel.title || '' }}</view>
<image class="infoimg imgRaduis" </view>
:src="infoItem.bgUrl?.indexOf('http') === 0 ? infoItem.bgUrl : $baseUrl + infoItem.bgUrl"> <!-- 鹤小飞一家 -->
</image> <view
<view class="infotitle">{{ infoItem.desc }}</view> id="thirdScreen"
<view class="infodesc">{{ infoItem.desc2 }}</view> class="ipbox"
v-if="erqiPeizhi.appId1 && erqiPeizhi.appId2"
</view> :style="{ background: `url(${$baseUrl}brandpage/hexiaofeiBg.png) no-repeat center/contain` }"
</view> >
<!-- <store-product appid="wx1ad0903b95889ea1" product-id="10000239570622" custom-content="true"> -->
</view> <image
</view> :data-log="{
</view> xcxClick: '品牌故事-三屏页面点击',
pageName: '品牌故事-三屏页面',
<view> buttonName: `全家形象`,
<!-- 普通弹窗 --> }"
<uni-popup :is-mask-click="false" :safe-area="false" ref="popup" background-color="#fff" class="iphexiaofei"
border-radius="48rpx"> @tap="jumpLink(erqiPeizhi.link, erqiPeizhi.videoUrl, $event)"
<view v-if="qrInfoObj !== null" class="popup-content"> :src="erqiPeizhi.iphexiaofeiUrl"
<image class="btnclose" @tap="closePop" :src="$baseUrl + 'homepage/btnclose.png'"></image> >
<view class="title"> </image>
{{ qrInfoObj.title }} <!-- </store-product> -->
</view> <view class="ipcard">
<rich-text class="desc" :nodes="qrInfoObj.desc"> <!-- 标题 -->
<view class="title">{{ erqiPeizhi.title2 }}</view>
</rich-text> <!-- 描述 -->
<image :show-menu-by-longpress="true" class="qrcode" :src="$baseUrl + qrInfoObj.qrUrl"></image> <view class="desc">{{ ipDesc }}</view>
<image @tap="downloadHandler($baseUrl + qrInfoObj.qrUrl)" class="btndownload" <!-- 商品 -->
:src="$baseUrl + 'homepage/btn_download.png'"></image> <view class="ipflex">
</view> <!-- 竖版商品 -->
<view v-else class="popup-content" style="height: 899rpx;"> <view class="ipbg ip1" id="ip1" @tap="ipTapEvent(1, $event)">
<image class="xingmahui" :src="$baseUrl + 'brandpage/hexiaofei.png'"></image> <store-product
<image class="btnclose" @tap="closePop" :src="$baseUrl + 'homepage/btnclose.png'"></image> :appid="erqiPeizhi.appId1"
</view> :product-id="erqiPeizhi.productId1"
</uni-popup> custom-content="true"
</view> class="store-product-container"
<view v-if="showVideo" class="video-popup"> >
<video :src="currentVideoUrl" controls autoplay <view class="ipcontainer">
:style="{ width: videoWidth + 'px', height: videoHeight + 'px' }" @loadedmetadata="onVideoLoadedMeta" <image
@play="onVideoPlay"></video> :data-log="{
<view class="close-btn-bottom" @tap="closeVideo">×</view> xcxClick: '品牌故事-三屏页面点击',
</view> pageName: '品牌故事-三屏页面',
</view> buttonName: `${hexiaofeiNameList[0]}`,
}"
:src="
erqiPeizhi.ipImg1?.indexOf('http') === 0
? erqiPeizhi.ipImg1
: $baseUrl + erqiPeizhi.ipImg1
"
class="ip1"
>
</image>
<view class="ipcontext">
<view class="ipcontext-desc">{{ erqiPeizhi.ipDesc1 || '' }}</view>
<view class="ipcontext-title">{{ erqiPeizhi.ipTitle1 || '' }}</view>
</view>
</view>
</store-product>
</view>
<view class="ipright">
<!-- 横版商品 -->
<view class="ipbg ip2" id="ip2" @tap="ipTapEvent(2, $event)">
<store-product
: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: '品牌故事-三屏页面点击',
pageName: '品牌故事-三屏页面',
buttonName: `${hexiaofeiNameList[1]}`,
}"
:src="
erqiPeizhi.ipImg2?.indexOf('http') === 0
? erqiPeizhi.ipImg2
: $baseUrl + erqiPeizhi.ipImg2
"
>
</image>
</view>
</store-product>
</view>
<view style="display: flex; justify-content: space-between; margin-top: 20rpx">
<!-- 视频号 -->
<view class="ipbg ip3" id="ip3" @tap="ipTapEvent(3, $event)">
<image
:data-log="{
xcxClick: '品牌故事-三屏页面点击',
pageName: '品牌故事-三屏页面',
buttonName: `${hexiaofeiNameList[2]}`,
}"
@tap="showPopup(0, $event)"
:src="
erqiPeizhi.ipImg3?.indexOf('http') === 0
? erqiPeizhi.ipImg3
: $baseUrl + erqiPeizhi.ipImg3
"
>
</image>
</view>
<!-- 小红书 -->
<view class="ipbg ip4" id="ip4" @tap="ipTapEvent(4, $event)">
<image
:data-log="{
xcxClick: '品牌故事-三屏页面点击',
pageName: '品牌故事-三屏页面',
buttonName: `${hexiaofeiNameList[3]}`,
}"
@tap="showPopup(2, $event)"
:src="
erqiPeizhi.ipImg4?.indexOf('http') === 0
? erqiPeizhi.ipImg4
: $baseUrl + erqiPeizhi.ipImg4
"
>
</image>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-if="esgInfoList.length > 0" class="esgbox">
<text class="maintitle">{{ erqiPeizhi.title3 }}</text>
<!-- <text class="subtitle">关注祖国下一代的营养、教育和陪伴</text> -->
<view class="channelscroll">
<view class="box">
<view
class="infobox"
:key="index"
v-for="(infoItem, index) in esgInfoList"
:id="'esg' + (index + 1)"
:style="{
background: `url(${$baseUrl}brandpage/esgItemBg.png) no-repeat center/505rpx 638rpx`,
}"
:data-log="{
xcxClick: `品牌故事-三屏页面点击`,
pageName: `品牌故事-三屏页面ESG点击`,
buttonName: `${index + 1}-${infoItem.desc}`,
}"
:data-comlog="{
xcxComponentClick: 'true',
pageName: '品牌故事页',
componentName: '飞鹤ESG',
componentContent: infoItem.desc,
}"
@tap="jumpLink(infoItem.link, infoItem.videoUrl, $event)"
>
<image
class="infoimg imgRaduis"
:src="infoItem.bgUrl?.indexOf('http') === 0 ? infoItem.bgUrl : $baseUrl + infoItem.bgUrl"
>
</image>
<view class="infotitle">{{ infoItem.desc }}</view>
<view class="infodesc">{{ infoItem.desc2 }}</view>
</view>
</view>
</view>
</view>
</view>
<view>
<!-- 普通弹窗 -->
<uni-popup
:is-mask-click="false"
:safe-area="false"
ref="popup"
background-color="#fff"
border-radius="48rpx"
>
<view v-if="qrInfoObj !== null" class="popup-content">
<image class="btnclose" @tap="closePop" :src="$baseUrl + 'homepage/btnclose.png'"></image>
<view class="title">
{{ qrInfoObj.title }}
</view>
<rich-text class="desc" :nodes="qrInfoObj.desc"> </rich-text>
<image :show-menu-by-longpress="true" class="qrcode" :src="$baseUrl + qrInfoObj.qrUrl"></image>
<image
@tap="downloadHandler($baseUrl + qrInfoObj.qrUrl)"
class="btndownload"
:src="$baseUrl + 'homepage/btn_download.png'"
></image>
</view>
<view v-else class="popup-content" style="height: 899rpx">
<image class="xingmahui" :src="$baseUrl + 'brandpage/hexiaofei.png'"></image>
<image class="btnclose" @tap="closePop" :src="$baseUrl + 'homepage/btnclose.png'"></image>
</view>
</uni-popup>
</view>
<view v-if="showVideo" class="video-popup">
<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>
</view>
</template> </template>
<script> <script>
import { fetchBrandJSON } from '../api/brand'; import { fetchBrandJSON } from '../api/brand';
import { jump, JumpType } from '../utils'; import { jump, JumpType } from '../utils';
import md from '../md'; import md from '../md';
import ExposureTracker from '../utils/exposure'; import ExposureTracker from '../utils/exposure';
import { useGlobalStore } from '@/stores/global.js';
const globalStore = useGlobalStore();
// 定义需要曝光检测的元素配置 // 定义需要曝光检测的元素配置
const EXPOSURE_CONFIGS = [ const EXPOSURE_CONFIGS = [
{ {
id: 'firstScreen', id: 'firstScreen',
logParams: { logParams: {
xcxPage: '品牌故事-首屏页面浏览', xcxPage: '品牌故事-首屏页面浏览',
pageName: '品牌故事-首屏页面' pageName: '品牌故事-首屏页面',
} },
}, },
// 可以添加更多需要曝光检测的元素配置 // 可以添加更多需要曝光检测的元素配置
{ {
id: 'secondScreen', id: 'secondScreen',
logParams: { logParams: {
xcxPage: '品牌故事-首屏页面浏览', xcxPage: '品牌故事-首屏页面浏览',
pageName: '品牌故事-次屏页面' pageName: '品牌故事-次屏页面',
} },
}, },
{ {
id: 'thirdScreen', id: 'thirdScreen',
logParams: { logParams: {
xcxPage: '品牌故事-首屏页面浏览', xcxPage: '品牌故事-首屏页面浏览',
pageName: '品牌故事-三屏页面' pageName: '品牌故事-三屏页面',
} },
} },
]; ];
export default { export default {
beforeDestroy() { beforeDestroy() {
if (this.exposureTracker) { if (this.exposureTracker) {
this.exposureTracker.resetAllExposure(); this.exposureTracker.resetAllExposure();
} }
this.stopAllVideos(); this.stopAllVideos();
}, },
deactivated() { deactivated() {
if (this.exposureTracker) { if (this.exposureTracker) {
this.exposureTracker.resetAllExposure(); this.exposureTracker.resetAllExposure();
} }
this.stopAllVideos(); this.stopAllVideos();
}, },
props: { props: {
scrollTop: { scrollTop: {
type: Number, type: Number,
default: 0 default: 0,
} },
}, },
watch: { watch: {
scrollTop: { scrollTop: {
handler(newVal) { handler(newVal) {
this.checkExposure(newVal); this.checkExposure(newVal);
} },
} },
}, },
data() { data() {
return { return {
popType: 'bottom', popType: 'bottom',
swiperList: [], swiperList: [],
erqiPeizhi: {}, erqiPeizhi: {},
indicatorDots: false, indicatorDots: false,
autoplay: true, autoplay: true,
interval: 4000, interval: 4000,
duration: 500, duration: 500,
indicatoractiveColor: "#a6a0a1", indicatoractiveColor: '#a6a0a1',
indicatorColor: "rgba(255, 255, 255, 1)", indicatorColor: 'rgba(255, 255, 255, 1)',
channelTabIndex: 0, channelTabIndex: 0,
productTabList: [], productTabList: [],
productInfoList: [], productInfoList: [],
swiperIconList: [], swiperIconList: [],
swiperIndex: 0, swiperIndex: 0,
ipDesc: '', ipDesc: '',
esgInfoList: [], esgInfoList: [],
qrInfoList: [], qrInfoList: [],
qrInfoObj: null, qrInfoObj: null,
popupIndex: 0, popupIndex: 0,
showVideo: false, showVideo: false,
testVideoUrl: '', testVideoUrl: '',
channel: {}, channel: {},
videoWidth: 375, videoWidth: 375,
videoHeight: 210, videoHeight: 210,
swiperNameList: ["北纬47°入口", "自有牧场入口", "工厂预约入口"], swiperNameList: ['北纬47°入口', '自有牧场入口', '工厂预约入口'],
hexiaofeiNameList: ["主要竖屏商品", "主要横屏商品", "视频号", "小红书"], hexiaofeiNameList: ['主要竖屏商品', '主要横屏商品', '视频号', '小红书'],
exposureTracker: null, exposureTracker: null,
video1Channel: {}, video1Channel: {},
video2Channel: {}, video2Channel: {},
currentPlayingVideo: null, // 当前正在播放的视频标识 currentPlayingVideo: null, // 当前正在播放的视频标识
videoContexts: {}, // 存储视频上下文,使用id作为key videoContexts: {}, // 存储视频上下文,使用id作为key
ipExStr: ['鹤小飞商品', '鹤小飞商品', '鹤小飞', '鹤小飞'], ipExStr: ['鹤小飞商品', '鹤小飞商品', '鹤小飞', '鹤小飞'],
showVideo1Title: true, // 控制视频1标题显示 showVideo1Title: true, // 控制视频1标题显示
showVideo2Title: true, // 控制视频2标题显示 showVideo2Title: true, // 控制视频2标题显示
} };
}, },
mounted() { mounted() {
this.initBrandInfo();
this.initBrandInfo();
// 初始化视频上下文
// 初始化视频上下文 this.initVideoContexts();
this.initVideoContexts();
// 初始化曝光检测工具
// 初始化曝光检测工具 this.exposureTracker = new ExposureTracker(this);
this.exposureTracker = new ExposureTracker(this); this.exposureTracker.addExposureElements(EXPOSURE_CONFIGS);
this.exposureTracker.addExposureElements(EXPOSURE_CONFIGS);
// 初始检查曝光
// 初始检查曝光 this.$nextTick(() => {
this.$nextTick(() => { this.checkExposure(this.scrollTop);
this.checkExposure(this.scrollTop); });
}); },
}, methods: {
methods: { async initBrandInfo() {
async initBrandInfo() { const { data } = await fetchBrandJSON(globalStore.getPreviewScene('brand'));
const { data } = await fetchBrandJSON(); if (data) {
if (data) { this.swiperList = data.swiperList || [
this.swiperList = data.swiperList || [{ {
"title": "默认图", title: '默认图',
"url": this.$baseUrl + "homepage/brandSwiperDefaultBg.png" url: this.$baseUrl + 'homepage/brandSwiperDefaultBg.png',
}]; },
this.erqiPeizhi = data.erqiPeizhi; ];
this.productTabList = data.productTabList || []; this.erqiPeizhi = data.erqiPeizhi;
this.productInfoList = data.product || []; this.productTabList = data.productTabList || [];
this.esgInfoList = data.esgInfoList[0] || []; this.productInfoList = data.product || [];
this.qrInfoList = data.qrInfoList; this.esgInfoList = data.esgInfoList[0] || [];
this.ipDesc = data.ipDesc; this.qrInfoList = data.qrInfoList;
this.swiperIconList = data.swiperIconList || [{ this.ipDesc = data.ipDesc;
activeUrl: this.$baseUrl + "homepage/brandSwiperDefaultBg.png", this.swiperIconList = data.swiperIconList || [
baseUrl: this.$baseUrl + "homepage/brandSwiperDefaultBg.png", {
text: "默认图" activeUrl: this.$baseUrl + 'homepage/brandSwiperDefaultBg.png',
}]; baseUrl: this.$baseUrl + 'homepage/brandSwiperDefaultBg.png',
this.testVideoUrl = data.videoUrl; text: '默认图',
if (data.videoUrl.indexOf('http') === -1) { },
data.videoUrl = this.$baseUrl + data.videoUrl; ];
} this.testVideoUrl = data.videoUrl;
this.currentVideoUrl = data.videoUrl; if (data.videoUrl.indexOf('http') === -1) {
this.video1Channel = data.video1Channel; data.videoUrl = this.$baseUrl + data.videoUrl;
this.video2Channel = data.video2Channel; }
this.initExposure(); this.currentVideoUrl = data.videoUrl;
} this.video1Channel = data.video1Channel;
}, this.video2Channel = data.video2Channel;
initExposure() { this.initExposure();
md.sensorComponentLogTake({ }
xcxComponentExposure: "true", },
pageName: "品牌故事页", initExposure() {
componentName: "品牌故事页banner", md.sensorComponentLogTake({
componentContent: this.swiperList[0]?.title || '' xcxComponentExposure: 'true',
}); pageName: '品牌故事页',
this.productTabList.forEach((item, index) => { componentName: '品牌故事页banner',
md.sensorComponentLogTake({ componentContent: this.swiperList[0]?.title || '',
xcxComponentExposure: "true", });
pageName: "品牌故事页", this.productTabList.forEach((item, index) => {
componentName: "飞鹤产品家族", md.sensorComponentLogTake({
componentContent: "产品家族切换分类-" + item xcxComponentExposure: 'true',
}); pageName: '品牌故事页',
}) componentName: '飞鹤产品家族',
if (this.productInfoList.length > 0 && this.productInfoList[0]?.length > 0) { componentContent: '产品家族切换分类-' + item,
this.productInfoList[0]?.forEach((item, index) => { });
md.sensorComponentLogTake({ });
xcxComponentExposure: "true", if (this.productInfoList.length > 0 && this.productInfoList[0]?.length > 0) {
pageName: "品牌故事页", this.productInfoList[0]?.forEach((item, index) => {
componentName: "飞鹤产品家族", md.sensorComponentLogTake({
componentContent: "产品家族商品-" + item.shareTitle xcxComponentExposure: 'true',
}); pageName: '品牌故事页',
}) componentName: '飞鹤产品家族',
} componentContent: '产品家族商品-' + item.shareTitle,
this.ipExStr.forEach((item, index) => { });
this.exposureTracker.addExposureElement({ });
id: 'ip' + (index + 1), }
logParams: { this.ipExStr.forEach((item, index) => {
xcxComponentExposure: "true", this.exposureTracker.addExposureElement({
pageName: "品牌故事页", id: 'ip' + (index + 1),
componentName: "鹤小飞", logParams: {
componentContent: item + '-' + this.erqiPeizhi['ipTitle' + (index + 1)] xcxComponentExposure: 'true',
} pageName: '品牌故事页',
}) componentName: '鹤小飞',
}) componentContent: item + '-' + this.erqiPeizhi['ipTitle' + (index + 1)],
this.esgInfoList.forEach((item, index) => { },
this.exposureTracker.addExposureElement({ });
id: 'esg' + (index + 1), });
logParams: { this.esgInfoList.forEach((item, index) => {
xcxComponentExposure: "true", this.exposureTracker.addExposureElement({
pageName: "品牌故事页", id: 'esg' + (index + 1),
componentName: "飞鹤ESG", logParams: {
componentContent: item.desc xcxComponentExposure: 'true',
} pageName: '品牌故事页',
}) componentName: '飞鹤ESG',
}) componentContent: item.desc,
this.exposureTracker.addExposureElements([ },
{ });
id: 'brandVideo1', });
logParams: { this.exposureTracker.addExposureElements([
xcxComponentExposure: 'true', {
pageName: '品牌故事页', id: 'brandVideo1',
componentName: '品牌故事视频', logParams: {
componentContent: this.video1Channel.title || '' xcxComponentExposure: 'true',
} pageName: '品牌故事页',
}, componentName: '品牌故事视频',
{ componentContent: this.video1Channel.title || '',
id: 'brandVideo2', },
logParams: { },
xcxComponentExposure: 'true', {
pageName: '品牌故事页', id: 'brandVideo2',
componentName: '品牌故事视频', logParams: {
componentContent: this.video2Channel.title || '' xcxComponentExposure: 'true',
} pageName: '品牌故事页',
} componentName: '品牌故事视频',
]) componentContent: this.video2Channel.title || '',
},
},
}, ]);
ipTapEvent(index, evt) { },
md.sensorComponentLogTake({ ipTapEvent(index, evt) {
xcxComponentClick: "true", md.sensorComponentLogTake({
pageName: "品牌故事页", xcxComponentClick: 'true',
componentName: "鹤小飞", pageName: '品牌故事页',
componentContent: this.ipExStr[index] + '-' + this.erqiPeizhi['ipTitle' + index] componentName: '鹤小飞',
}); componentContent: this.ipExStr[index] + '-' + this.erqiPeizhi['ipTitle' + index],
});
}, },
intervalChange(e) { intervalChange(e) {
this.swiperIndex = e.target.current; this.swiperIndex = e.target.current;
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "品牌故事页", pageName: '品牌故事页',
componentName: "品牌故事页banner", componentName: '品牌故事页banner',
componentContent: this.swiperList[e.target.current]?.title || '' componentContent: this.swiperList[e.target.current]?.title || '',
}); });
}, },
jumpSwiper(_index, evt) {//点indicator切换图片 jumpSwiper(_index, evt) {
if (evt) { //点indicator切换图片
md.sensorLog(evt); if (evt) {
} md.sensorLog(evt);
this.swiperIndex = _index; }
}, this.swiperIndex = _index;
},
jumpLink(_link, videoUrl, evt) {
jumpLink(_link, videoUrl, evt) {
console.log('jumpLink1111111:', _link, videoUrl); console.log('jumpLink1111111:', _link, videoUrl);
if (evt) { if (evt) {
md.sensorLog(evt); md.sensorLog(evt);
if (evt.currentTarget.dataset.comlog) { if (evt.currentTarget.dataset.comlog) {
md.sensorComponentLogTake(evt.currentTarget.dataset.comlog); md.sensorComponentLogTake(evt.currentTarget.dataset.comlog);
} }
} }
// console.log(_link) // console.log(_link)
// uni.navigateTo({ // uni.navigateTo({
// url: "/pages/product/product?id=1-1" // url: "/pages/product/product?id=1-1"
// }) // })
if (videoUrl) { if (videoUrl) {
// 弹出视频 // 弹出视频
this.currentVideoUrl = videoUrl; this.currentVideoUrl = videoUrl;
this.showVideo = true; this.showVideo = true;
return; return;
// 视频弹窗出现后,video标签的autoplay会自动播放 // 视频弹窗出现后,video标签的autoplay会自动播放
} else if (_link) { } else if (_link) {
// 其他跳转逻辑 // 其他跳转逻辑
jump(_link); jump(_link);
} }
}, },
jumpProduct(item, evt) { jumpProduct(item, evt) {
if (evt) { if (evt) {
md.sensorLog(evt); md.sensorLog(evt);
if (evt.currentTarget.dataset.comlog) { if (evt.currentTarget.dataset.comlog) {
md.sensorComponentLogTake(evt.currentTarget.dataset.comlog); md.sensorComponentLogTake(evt.currentTarget.dataset.comlog);
} }
} }
const { productId, skuId, contentImg, contentImgLen, shareTitle, shareImg, title, link, entrySource } = item; const { productId, skuId, contentImg, contentImgLen, shareTitle, shareImg, title, link, entrySource } =
const tabName = this.productTabList[this.channelTabIndex]; item;
const tabName = this.productTabList[this.channelTabIndex];
if (productId && skuId && entrySource) {
const url = `subPackages/shopMainProcess/product/index?productId=${productId}&skuId=${skuId}&entrySource=${entrySource}`; if (productId && skuId && entrySource) {
const type = JumpType.MINI; const url = `subPackages/shopMainProcess/product/index?productId=${productId}&skuId=${skuId}&entrySource=${entrySource}`;
const extra = { const type = JumpType.MINI;
appId: 'wx4205ec55b793245e', //星妈优选小程序 const extra = {
extraData: {}, appId: 'wx4205ec55b793245e', //星妈优选小程序
envVersion: 'release', extraData: {},
embedded: true, envVersion: 'release',
}; embedded: true,
};
jump({
type: type, jump({
url: url, type: type,
extra: extra url: url,
}) extra: extra,
} else { });
jump(link) } else {
// console.warn("/pages/product/product?productId=" + productId + "&skuId=" + skuId + "&contentImg=" + contentImg + "&contentImgLen=" + contentImgLen + "&shareTitle=" + shareTitle + "&shareImg=" + shareImg + "&tabName=" + tabName + "&title=" + title) jump(link);
// uni.navigateTo({ // console.warn("/pages/product/product?productId=" + productId + "&skuId=" + skuId + "&contentImg=" + contentImg + "&contentImgLen=" + contentImgLen + "&shareTitle=" + shareTitle + "&shareImg=" + shareImg + "&tabName=" + tabName + "&title=" + title)
// url: "/pages/product/product?productId=" + productId + "&skuId=" + skuId + "&contentImg=" + contentImg + "&contentImgLen=" + contentImgLen + "&shareTitle=" + shareTitle + "&shareImg=" + shareImg + "&tabName=" + tabName + "&title=" + title // uni.navigateTo({
// }) // url: "/pages/product/product?productId=" + productId + "&skuId=" + skuId + "&contentImg=" + contentImg + "&contentImgLen=" + contentImgLen + "&shareTitle=" + shareTitle + "&shareImg=" + shareImg + "&tabName=" + tabName + "&title=" + title
} // })
}, }
channelTabHandler(_index, evt) { },
if (evt) { channelTabHandler(_index, evt) {
md.sensorLog(evt); if (evt) {
if (evt.currentTarget.dataset.comlog) { md.sensorLog(evt);
md.sensorComponentLogTake(evt.currentTarget.dataset.comlog); if (evt.currentTarget.dataset.comlog) {
this.productInfoList[_index]?.forEach((item, index) => { md.sensorComponentLogTake(evt.currentTarget.dataset.comlog);
md.sensorComponentLogTake({ this.productInfoList[_index]?.forEach((item, index) => {
xcxComponentExposure: "true", md.sensorComponentLogTake({
pageName: "品牌故事页", xcxComponentExposure: 'true',
componentName: "飞鹤产品家族", pageName: '品牌故事页',
componentContent: "产品家族商品-" + item.shareTitle componentName: '飞鹤产品家族',
}); componentContent: '产品家族商品-' + item.shareTitle,
}) });
} });
} }
this.channelTabIndex = _index; }
this.channelTabIndex = _index;
// 自动滚动到选中的tab
this.$nextTick(() => { // 自动滚动到选中的tab
const scrollView = uni.createSelectorQuery().select('.listbox'); this.$nextTick(() => {
if (scrollView) { const scrollView = uni.createSelectorQuery().select('.listbox');
scrollView.scrollOffset((res) => { if (scrollView) {
// 这里可以添加额外的滚动逻辑 scrollView
}).exec(); .scrollOffset((res) => {
} // 这里可以添加额外的滚动逻辑
}); })
}, .exec();
showPopup(_index, evt) { }
if (evt) { });
md.sensorLog(evt); },
} showPopup(_index, evt) {
this.popupIndex = _index; if (evt) {
if (_index < 2) { md.sensorLog(evt);
this.qrInfoObj = this.qrInfoList[_index]; }
md.sensorLogTake({ this.popupIndex = _index;
xcxPage: `品牌故事-鹤小飞家族${this.qrInfoObj.title}二维码半屏`, if (_index < 2) {
pageName: `品牌故事-鹤小飞家族${this.qrInfoObj.title}二维码半屏`, this.qrInfoObj = this.qrInfoList[_index];
}); md.sensorLogTake({
} else { xcxPage: `品牌故事-鹤小飞家族${this.qrInfoObj.title}二维码半屏`,
this.qrInfoObj = null; pageName: `品牌故事-鹤小飞家族${this.qrInfoObj.title}二维码半屏`,
md.sensorLogTake({ });
xcxPage: `品牌故事-鹤小飞家族小红书二维码半屏`, } else {
pageName: `品牌故事-鹤小飞家族小红书二维码半屏`, this.qrInfoObj = null;
}); md.sensorLogTake({
} xcxPage: `品牌故事-鹤小飞家族小红书二维码半屏`,
pageName: `品牌故事-鹤小飞家族小红书二维码半屏`,
this.$refs.popup.open(this.popType); });
}, }
closePop() {
this.$refs.popup.close(); this.$refs.popup.open(this.popType);
}, },
downloadHandler(imgurl) { closePop() {
md.sensorLogTake({ this.$refs.popup.close();
xcxClick: `品牌故事-鹤小飞家族${this.qrInfoObj.title}二维码半屏`, },
pageName: `品牌故事-鹤小飞家族${this.qrInfoObj.title}二维码半屏`, downloadHandler(imgurl) {
buttonName: `下载二维码` md.sensorLogTake({
}); xcxClick: `品牌故事-鹤小飞家族${this.qrInfoObj.title}二维码半屏`,
uni.downloadFile({ pageName: `品牌故事-鹤小飞家族${this.qrInfoObj.title}二维码半屏`,
url: imgurl, buttonName: `下载二维码`,
success: (downloadRes) => { });
if (downloadRes.statusCode === 200) { uni.downloadFile({
uni.saveImageToPhotosAlbum({ url: imgurl,
filePath: downloadRes.tempFilePath, success: (downloadRes) => {
success: (res) => { if (downloadRes.statusCode === 200) {
uni.showToast({ uni.saveImageToPhotosAlbum({
title: '保存成功', filePath: downloadRes.tempFilePath,
icon: 'success' success: (res) => {
}); uni.showToast({
}, title: '保存成功',
fail: (err) => { icon: 'success',
uni.showToast({ });
title: '保存失败', },
icon: 'none' fail: (err) => {
}); uni.showToast({
} title: '保存失败',
}); icon: 'none',
} else { });
uni.showToast({ },
title: '下载失败', });
icon: 'none' } else {
}); uni.showToast({
} title: '下载失败',
}, icon: 'none',
fail: (err) => { });
uni.showToast({ }
title: '下载失败', },
icon: 'none' fail: (err) => {
}); uni.showToast({
} title: '下载失败',
}); icon: 'none',
}, });
showVideoHandler() { },
this.currentVideoUrl = this.testVideoUrl; });
this.showVideo = true; },
}, showVideoHandler() {
this.currentVideoUrl = this.testVideoUrl;
closeVideo() { this.showVideo = true;
this.showVideo = false; },
this.currentVideoUrl = '';
// 如果弹窗视频是当前播放的视频,清除播放状态 closeVideo() {
if (this.currentPlayingVideo === 'popupVideo') { this.showVideo = false;
this.currentPlayingVideo = null; this.currentVideoUrl = '';
} // 如果弹窗视频是当前播放的视频,清除播放状态
}, if (this.currentPlayingVideo === 'popupVideo') {
openChannel(videoChannel, evt) { this.currentPlayingVideo = null;
if (evt) { }
md.sensorLog(evt); },
if (evt.currentTarget.dataset.comlog) { openChannel(videoChannel, evt) {
md.sensorComponentLogTake(evt.currentTarget.dataset.comlog); if (evt) {
} md.sensorLog(evt);
} if (evt.currentTarget.dataset.comlog) {
const finderUserName = videoChannel.finderUserName; md.sensorComponentLogTake(evt.currentTarget.dataset.comlog);
const feedId = videoChannel.feedId; }
uni.openChannelsActivity({ }
finderUserName, const finderUserName = videoChannel.finderUserName;
feedId, const feedId = videoChannel.feedId;
success: res => { uni.openChannelsActivity({
console.log('跳转成功', res); finderUserName,
}, feedId,
fail: err => { success: (res) => {
console.log('跳转失败', err); console.log('跳转成功', res);
} },
}); fail: (err) => {
}, console.log('跳转失败', err);
previewImage(url) { },
uni.previewImage({ });
urls: [url], // 预览当前图片 },
current: url // 当前显示的图片 previewImage(url) {
}); uni.previewImage({
}, urls: [url], // 预览当前图片
onVideoLoadedMeta(e) { current: url, // 当前显示的图片
const { width, height } = e.detail; });
const pageWidth = uni.upx2px(750); },
const ratio = height / width; onVideoLoadedMeta(e) {
this.videoWidth = pageWidth; const { width, height } = e.detail;
this.videoHeight = pageWidth;// pageWidth * ratio; const pageWidth = uni.upx2px(750);
}, const ratio = height / width;
checkExposure(scrollTop) { this.videoWidth = pageWidth;
if (this.exposureTracker) { this.videoHeight = pageWidth; // pageWidth * ratio;
this.exposureTracker.checkExposure(scrollTop); },
} checkExposure(scrollTop) {
}, if (this.exposureTracker) {
resetExposure() { this.exposureTracker.checkExposure(scrollTop);
if (this.exposureTracker) { }
this.exposureTracker.resetAllExposure(); },
} resetExposure() {
}, if (this.exposureTracker) {
// 初始化视频上下文 this.exposureTracker.resetAllExposure();
initVideoContexts() { }
this.$nextTick(() => { },
const videoIds = ['brandVideo1', 'brandVideo2']; // 初始化视频上下文
initVideoContexts() {
videoIds.forEach(id => { this.$nextTick(() => {
try { const videoIds = ['brandVideo1', 'brandVideo2'];
// 使用id创建视频上下文
this.videoContexts[id] = uni.createVideoContext(id, this); videoIds.forEach((id) => {
console.log('视频上下文已创建:', id); try {
} catch (error) { // 使用id创建视频上下文
console.error('创建视频上下文失败:', id, error); this.videoContexts[id] = uni.createVideoContext(id, this);
} console.log('视频上下文已创建:', id);
}); } catch (error) {
}); console.error('创建视频上下文失败:', id, error);
}, }
onVideoPlay() { });
console.log('视频播放'); });
this.handleVideoPlay('brandVideo1'); },
this.handleVideoPlay('brandVideo2'); onVideoPlay() {
}, console.log('视频播放');
// 视频1播放事件 this.handleVideoPlay('brandVideo1');
onVideo1Play() { this.handleVideoPlay('brandVideo2');
const evt = { },
currentTarget: { // 视频1播放事件
dataset: { onVideo1Play() {
log: { const evt = {
xcxClick: '品牌故事-次屏页面点击', currentTarget: {
pageName: '品牌故事-首屏页面', dataset: {
buttonName: '腰部品牌Video' log: {
} xcxClick: '品牌故事-次屏页面点击',
} pageName: '品牌故事-首屏页面',
} buttonName: '腰部品牌Video',
} },
md.sensorLog(evt); },
md.sensorComponentLogTake({ },
xcxComponentClick: 'true', };
pageName: '品牌故事页', md.sensorLog(evt);
componentName: '品牌故事视频', md.sensorComponentLogTake({
componentContent: this.video1Channel.title || '' xcxComponentClick: 'true',
}); pageName: '品牌故事页',
console.log('视频1开始播放'); componentName: '品牌故事视频',
this.showVideo1Title = false; // 隐藏标题 componentContent: this.video1Channel.title || '',
this.handleVideoPlay('brandVideo1'); });
}, console.log('视频1开始播放');
// 视频2播放事件 this.showVideo1Title = false; // 隐藏标题
onVideo2Play() { this.handleVideoPlay('brandVideo1');
const evt = { },
currentTarget: { // 视频2播放事件
dataset: { onVideo2Play() {
log: { const evt = {
xcxClick: '小程序页面点击事件', currentTarget: {
pageName: '品牌故事-次屏页面', dataset: {
buttonName: '视频' log: {
} xcxClick: '小程序页面点击事件',
} pageName: '品牌故事-次屏页面',
} buttonName: '视频',
} },
md.sensorLog(evt); },
md.sensorComponentLogTake({ },
xcxComponentClick: 'true', };
pageName: '品牌故事页', md.sensorLog(evt);
componentName: '品牌故事视频', md.sensorComponentLogTake({
componentContent: this.video2Channel.title || '' xcxComponentClick: 'true',
}); pageName: '品牌故事页',
console.log('视频2开始播放'); componentName: '品牌故事视频',
this.showVideo2Title = false; // 隐藏标题 componentContent: this.video2Channel.title || '',
this.handleVideoPlay('brandVideo2'); });
}, console.log('视频2开始播放');
this.showVideo2Title = false; // 隐藏标题
// 视频1播放结束事件 this.handleVideoPlay('brandVideo2');
onVideo1Ended() { },
console.log('视频1播放结束');
this.showVideo1Title = true; // 显示标题 // 视频1播放结束事件
// 恢复展示海报(自动生效,因为video组件播放结束后会显示poster) onVideo1Ended() {
if (this.currentPlayingVideo === 'brandVideo1') { console.log('视频1播放结束');
this.currentPlayingVideo = null; this.showVideo1Title = true; // 显示标题
} // 恢复展示海报(自动生效,因为video组件播放结束后会显示poster)
// 重置视频src来进行初始化 if (this.currentPlayingVideo === 'brandVideo1') {
const videoId = 'brandVideo1'; this.currentPlayingVideo = null;
if (this.videoContexts[videoId]) { }
try { // 重置视频src来进行初始化
// 保存原始URL const videoId = 'brandVideo1';
const originalUrl = this.video1Channel.videoUrl; if (this.videoContexts[videoId]) {
// 先设置为空字符串来重置 try {
this.videoContexts[videoId].src = ''; // 保存原始URL
// 延迟一小段时间后恢复原始URL,以确保重置生效 const originalUrl = this.video1Channel.videoUrl;
setTimeout(() => { // 先设置为空字符串来重置
if (this.videoContexts[videoId]) { this.videoContexts[videoId].src = '';
this.videoContexts[videoId].src = originalUrl.indexOf('http') === 0 ? originalUrl : this.$baseUrl + originalUrl; // 延迟一小段时间后恢复原始URL,以确保重置生效
} setTimeout(() => {
}, 100); if (this.videoContexts[videoId]) {
console.log('视频1已重置初始化'); this.videoContexts[videoId].src =
} catch (error) { originalUrl.indexOf('http') === 0 ? originalUrl : this.$baseUrl + originalUrl;
console.error('重置视频1失败:', error); }
} }, 100);
} console.log('视频1已重置初始化');
}, } catch (error) {
console.error('重置视频1失败:', error);
// 视频2播放结束事件 }
onVideo2Ended() { }
console.log('视频2播放结束'); },
this.showVideo2Title = true; // 显示标题
// 恢复展示海报(自动生效,因为video组件播放结束后会显示poster) // 视频2播放结束事件
if (this.currentPlayingVideo === 'brandVideo2') { onVideo2Ended() {
this.currentPlayingVideo = null; console.log('视频2播放结束');
} this.showVideo2Title = true; // 显示标题
// 重置视频src来进行初始化 // 恢复展示海报(自动生效,因为video组件播放结束后会显示poster)
const videoId = 'brandVideo2'; if (this.currentPlayingVideo === 'brandVideo2') {
if (this.videoContexts[videoId]) { this.currentPlayingVideo = null;
console.warn('视频上下文已存在:', videoId); }
try { // 重置视频src来进行初始化
// 保存原始URL const videoId = 'brandVideo2';
const originalUrl = this.video2Channel.videoUrl; if (this.videoContexts[videoId]) {
// 先设置为空字符串来重置 console.warn('视频上下文已存在:', videoId);
this.videoContexts[videoId].src = ''; try {
// 延迟一小段时间后恢复原始URL,以确保重置生效 // 保存原始URL
// setTimeout(() => { const originalUrl = this.video2Channel.videoUrl;
// if (this.videoContexts[videoId]) { // 先设置为空字符串来重置
// this.videoContexts[videoId].src = originalUrl.indexOf('http') === 0 ? originalUrl : this.$baseUrl + originalUrl; this.videoContexts[videoId].src = '';
// } // 延迟一小段时间后恢复原始URL,以确保重置生效
// }, 100); // setTimeout(() => {
console.log('视频2已重置初始化'); // if (this.videoContexts[videoId]) {
} catch (error) { // this.videoContexts[videoId].src = originalUrl.indexOf('http') === 0 ? originalUrl : this.$baseUrl + originalUrl;
console.error('重置视频2失败:', error); // }
} // }, 100);
} console.log('视频2已重置初始化');
}, } catch (error) {
console.error('重置视频2失败:', error);
// 处理视频播放(互斥逻辑) }
handleVideoPlay(videoId) { }
console.log('处理视频播放:', videoId, '当前播放视频:', this.currentPlayingVideo); },
// 如果有其他视频正在播放,先暂停它
if (this.currentPlayingVideo && this.currentPlayingVideo !== videoId) { // 处理视频播放(互斥逻辑)
console.log('暂停其他视频:', this.currentPlayingVideo); handleVideoPlay(videoId) {
this.stopVideo(this.currentPlayingVideo); console.log('处理视频播放:', videoId, '当前播放视频:', this.currentPlayingVideo);
} // 如果有其他视频正在播放,先暂停它
// 设置当前播放的视频 if (this.currentPlayingVideo && this.currentPlayingVideo !== videoId) {
this.currentPlayingVideo = videoId; console.log('暂停其他视频:', this.currentPlayingVideo);
}, this.stopVideo(this.currentPlayingVideo);
// 处理视频暂停 }
handleVideoPause(videoId) { // 设置当前播放的视频
console.log('处理视频暂停:', videoId, '当前播放视频:', this.currentPlayingVideo); this.currentPlayingVideo = videoId;
// 如果暂停的视频是当前播放的视频,清除播放状态 },
if (this.currentPlayingVideo === videoId) { // 处理视频暂停
this.currentPlayingVideo = null; handleVideoPause(videoId) {
} console.log('处理视频暂停:', videoId, '当前播放视频:', this.currentPlayingVideo);
}, // 如果暂停的视频是当前播放的视频,清除播放状态
// 暂停指定的视频 if (this.currentPlayingVideo === videoId) {
stopVideo(videoId) { this.currentPlayingVideo = null;
console.log('尝试暂停视频:', videoId); }
// 如果上下文不存在,尝试创建 },
if (!this.videoContexts[videoId]) { // 暂停指定的视频
try { stopVideo(videoId) {
this.videoContexts[videoId] = uni.createVideoContext(videoId, this); console.log('尝试暂停视频:', videoId);
console.log('延迟创建视频上下文:', videoId); // 如果上下文不存在,尝试创建
} catch (error) { if (!this.videoContexts[videoId]) {
console.error('延迟创建视频上下文失败:', videoId, error); try {
return; this.videoContexts[videoId] = uni.createVideoContext(videoId, this);
} console.log('延迟创建视频上下文:', videoId);
} } catch (error) {
console.error('延迟创建视频上下文失败:', videoId, error);
if (this.videoContexts[videoId]) { return;
try { }
this.videoContexts[videoId].pause(); }
console.log('视频已暂停 (通过上下文):', videoId);
} catch (error) { if (this.videoContexts[videoId]) {
console.error('暂停视频失败 (通过上下文):', videoId, error); try {
} this.videoContexts[videoId].pause();
} console.log('视频已暂停 (通过上下文):', videoId);
}, } catch (error) {
// 暂停所有视频 console.error('暂停视频失败 (通过上下文):', videoId, error);
stopAllVideos() { }
console.log('暂停所有视频'); }
const videoIds = ['brandVideo1', 'brandVideo2']; },
videoIds.forEach(id => { // 暂停所有视频
this.stopVideo(id); stopAllVideos() {
}); console.log('暂停所有视频');
this.currentPlayingVideo = null; const videoIds = ['brandVideo1', 'brandVideo2'];
}, videoIds.forEach((id) => {
//跳转微店 this.stopVideo(id);
// 商品ID });
// 10000239356280 this.currentPlayingVideo = null;
// 商品ID },
// 10000239570622 //跳转微店
// 商品ID
} // 10000239356280
} // 商品ID
// 10000239570622
},
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import '@/common.less'; @import '@/common.less';
.brand-container { .brand-container {
background-color: #fff; background-color: #fff;
.content { .content {
padding-bottom: 200rpx; padding-bottom: 200rpx;
.banner { .banner {
height: 1250rpx; height: 1250rpx;
.banneritem { .banneritem {
width: 750rpx; width: 750rpx;
height: 1250rpx; height: 1250rpx;
.b-img { .b-img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
} }
.swiperbox { .swiperbox {
position: absolute; position: absolute;
top: 1002rpx; top: 1002rpx;
width: 196rpx; width: 196rpx;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
.iconbox { .iconbox {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
position: relative; position: relative;
.icon { .icon {
width: 200rpx; width: 200rpx;
height: 200rpx; height: 200rpx;
} }
.indicatorDotsBg { .indicatorDotsBg {
position: absolute; position: absolute;
width: 196rpx; width: 196rpx;
height: 77rpx; height: 77rpx;
} }
.indicatorDots { .indicatorDots {
// margin-left: 19rpx; // margin-left: 19rpx;
margin-top: 21rpx; margin-top: 21rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 196rpx; width: 196rpx;
height: 10rpx; height: 10rpx;
position: relative; position: relative;
.dot { .dot {
// transition: all 0.3s ease; // transition: all 0.3s ease;
cursor: pointer; cursor: pointer;
} }
.dot-active { .dot-active {
width: 26rpx; width: 26rpx;
height: 10rpx; height: 10rpx;
border-radius: 5rpx; border-radius: 5rpx;
background-color: #ffffff; background-color: #ffffff;
margin-right: 5rpx; margin-right: 5rpx;
margin-left: 5rpx; margin-left: 5rpx;
} }
.dot-normal { .dot-normal {
width: 10rpx; width: 10rpx;
height: 10rpx; height: 10rpx;
border-radius: 5rpx; border-radius: 5rpx;
margin-right: 5rpx; margin-right: 5rpx;
margin-left: 5rpx; margin-left: 5rpx;
background-color: rgba(255, 255, 255, 0.6); background-color: rgba(255, 255, 255, 0.6);
} }
.dotText { .dotText {
margin-top: 56rpx; margin-top: 56rpx;
position: absolute; position: absolute;
font-size: 17rpx; font-size: 17rpx;
color: #fff; color: #fff;
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
width: 196rpx; width: 196rpx;
// top: 50%; // top: 50%;
// transform: translateY(-50%); // transform: translateY(-50%);
pointer-events: none; pointer-events: none;
} }
} }
} }
}
} .swiper-mask {
position: absolute;
.swiper-mask { left: 0;
position: absolute; width: 750rpx;
left: 0; height: 192rpx;
width: 750rpx; z-index: 1;
height: 192rpx; top: 1061rpx;
z-index: 1; pointer-events: none;
top: 1061rpx;
pointer-events: none; .swiper-mask-img {
width: 100%;
.swiper-mask-img { height: 100%;
width: 100%; }
height: 100%; }
}
} .videoposterbox {
width: 640rpx;
.videoposterbox { height: 360rpx;
width: 640rpx; margin-left: 55rpx;
height: 360rpx; margin-top: 32rpx;
margin-left: 55rpx; overflow: hidden;
margin-top: 32rpx; border-radius: 24rpx;
overflow: hidden;
border-radius: 24rpx; .videoposter {
width: 100%;
.videoposter { height: 100%;
width: 100%; border-radius: 24rpx;
height: 100%; object-fit: cover;
border-radius: 24rpx; }
object-fit: cover;
} .videoposterboxtitle {
font-size: 28rpx;
.videoposterboxtitle { color: #ffffff;
font-size: 28rpx; font-weight: 500;
color: #ffffff; margin-left: 20rpx;
font-weight: 500; line-height: 1.4;
margin-left: 20rpx; margin-top: -56rpx;
line-height: 1.4; z-index: 0;
margin-top: -56rpx; position: relative;
z-index: 0; // padding: 8rpx 16rpx;
position: relative; // background-color: rgba(0, 0, 0, 0.5);
// padding: 8rpx 16rpx; border-radius: 8rpx;
// background-color: rgba(0, 0, 0, 0.5); width: 476rpx;
border-radius: 8rpx; white-space: nowrap;
width: 476rpx; overflow: hidden;
white-space: nowrap; text-overflow: ellipsis;
overflow: hidden; }
text-overflow: ellipsis; }
}
.productcontai {
} margin-top: 32rpx;
margin-left: 32rpx;
.maintitle {
.productcontai { color: @color-black-deep;
margin-top: 32rpx; font-size: 38rpx;
margin-left: 32rpx; font-weight: bold;
display: block;
.maintitle { margin-left: 5rpx;
color: @color-black-deep; }
font-size: 38rpx;
font-weight: bold; .subtitle {
display: block; color: @color-black-deep;
margin-left: 5rpx; font-size: 24rpx;
} margin-top: 10rpx;
margin-left: 5rpx;
.subtitle { }
color: @color-black-deep;
font-size: 24rpx; .listbox {
margin-top: 10rpx; margin-top: 15rpx;
margin-left: 5rpx; width: 686rpx;
} white-space: nowrap;
.listbox { .tab-container {
margin-top: 15rpx; display: flex;
width: 686rpx; align-items: center;
white-space: nowrap; padding: 0 20rpx;
min-width: 100%;
.tab-container {
display: flex; .tabitem {
align-items: center; color: @color-black-deep;
padding: 0 20rpx; background-color: #e9edf1;
min-width: 100%; padding: 15rpx 20rpx;
font-size: 22rpx;
.tabitem { margin-right: 15rpx;
color: @color-black-deep; border-radius: 30rpx;
background-color: #e9edf1; flex-shrink: 0;
padding: 15rpx 20rpx; white-space: nowrap;
font-size: 22rpx; transition: all 0.3s ease;
margin-right: 15rpx; cursor: pointer;
border-radius: 30rpx;
flex-shrink: 0; &:last-child {
white-space: nowrap; margin-right: 0;
transition: all 0.3s ease; }
cursor: pointer;
&:active {
&:last-child { transform: scale(0.95);
margin-right: 0; }
} }
&:active { .tabActive {
transform: scale(0.95); color: white;
} background-color: @color-gold-main;
} box-shadow: 0 2rpx 8rpx rgba(211, 163, 88, 0.3);
}
.tabActive { }
color: white; }
background-color: @color-gold-main;
box-shadow: 0 2rpx 8rpx rgba(211, 163, 88, 0.3); .productbox {
} width: 686rpx;
} height: 545rpx;
} overflow-x: auto;
margin-top: 30rpx;
.productbox {
width: 686rpx; .product-grid {
height: 545rpx; display: flex;
overflow-x: auto; flex-direction: column;
margin-top: 30rpx; height: 100%;
width: max-content;
.product-grid {
display: flex; .product-row {
flex-direction: column; display: flex;
height: 100%; flex-direction: row;
width: max-content; height: 50%;
align-items: center;
.product-row { margin-bottom: 20rpx;
display: flex;
flex-direction: row; &:last-child {
height: 50%; margin-bottom: 0;
align-items: center; }
margin-bottom: 20rpx;
.infobox {
&:last-child { margin-right: 20rpx;
margin-bottom: 0; flex-shrink: 0;
}
&:last-child {
.infobox { margin-right: 0;
margin-right: 20rpx; }
flex-shrink: 0; }
}
&:last-child { }
margin-right: 0;
} .infobox {
} width: 273rpx;
} height: 263rpx;
} background-color: white;
border-radius: 24rpx;
.infobox { // margin-top: 32rpx;
width: 273rpx;
height: 263rpx; .flexbox {
background-color: white; display: flex;
border-radius: 24rpx; margin-top: 25rpx;
// margin-top: 32rpx; align-items: center;
justify-content: center;
.flexbox {
display: flex; .infotitle {
margin-top: 25rpx; font-size: 36rpx;
align-items: center; font-weight: 400;
justify-content: center; width: 100rpx;
color: @color-black-deep;
.infotitle { margin-left: 15rpx; //一点偏移量
font-size: 36rpx; text-align: center;
font-weight: 400; }
width: 100rpx;
color: @color-black-deep; .infoimg {
margin-left: 15rpx; //一点偏移量 width: 150rpx;
text-align: center; height: 150rpx;
}
} }
.infoimg { .infodesc {
width: 150rpx; display: flex;
height: 150rpx; justify-content: center;
} align-items: center;
} font-size: 24rpx;
color: @color-black-deep;
.infodesc { width: 273rpx;
display: flex; text-align: center;
justify-content: center; height: 90rpx;
align-items: center; white-space: pre-wrap;
font-size: 24rpx; }
color: @color-black-deep; }
width: 273rpx; }
text-align: center; }
height: 90rpx;
white-space: pre-wrap; .ipbox {
width: 674rpx;
} height: 922rpx;
} position: relative;
left: 36rpx;
} border-radius: 24rpx;
background-color: white;
top: 50rpx;
.iphexiaofei {
} width: 374rpx;
height: 298rpx;
.ipbox { position: absolute;
width: 674rpx; top: 15rpx;
height: 922rpx; left: 165rpx;
position: relative; }
left: 36rpx;
border-radius: 24rpx; .ipcard {
background-color: white; position: absolute;
top: 50rpx; padding: 15rpx;
top: 313rpx;
.iphexiaofei { .title {
width: 374rpx; display: flex;
height: 298rpx; font-size: 36rpx;
position: absolute; color: @color-black-deep;
top: 15rpx; font-weight: bold;
left: 165rpx;
} .t1 {
color: @color-black-deep;
.ipcard { }
position: absolute; }
padding: 15rpx;
top: 313rpx; .desc {
margin-top: 20rpx;
.title { white-space: pre-wrap;
display: flex; font-size: 24rpx;
font-size: 36rpx; color: @color-black-deep;
color: @color-black-deep; }
font-weight: bold;
.ipcontainer {
.t1 { position: relative;
color: @color-black-deep; .ipcontext {
} display: flex;
} flex-direction: column;
align-items: center;
.desc { justify-content: flex-start;
margin-top: 20rpx; font-size: 20rpx;
white-space: pre-wrap; text-align: center;
font-size: 24rpx; .ipcontext-desc,
color: @color-black-deep; .ipcontext-title {
} width: 100%;
overflow: hidden;
.ipflex { text-overflow: ellipsis;
display: flex; white-space: nowrap;
justify-content: space-between; }
margin-top: 30rpx; .ipcontext-title {
color: @color-gold-main;
.ipbg { }
border-radius: 24rpx; }
background-color: @color-gray-light; }
display: flex;
justify-content: center; .ipflex {
align-items: center; display: flex;
} justify-content: space-between;
margin-top: 30rpx;
.ip1 {
width: 288rpx; .ipbg {
height: 380rpx; border-radius: 24rpx;
overflow: hidden; background-color: @color-gray-light;
display: flex;
image { justify-content: center;
width: 288*0.8rpx; align-items: center;
height: 380*0.8rpx; .store-product-container {
} display: flex;
justify-content: center;
} align-items: center;
}
.ip2 { }
width: 342rpx;
height: 201rpx; .ip1 {
width: 288rpx;
image { height: 380rpx;
width: 342*0.75rpx; overflow: hidden;
height: 201*0.75rpx; .ipcontainer {
} display: flex;
} flex-direction: column;
align-items: center;
.ip3 { justify-content: flex-start;
width: 160rpx; width: 268rpx;
height: 160rpx; .ipcontext {
width: 100%;
image { margin-top: 6rpx;
width: 70rpx; }
height: 97rpx; }
}
} image {
width: 213rpx;
.ip4 { height: 172rpx;
width: 160rpx; }
height: 160rpx; }
image { .ip2 {
width: 88rpx; width: 342rpx;
height: 92rpx; height: 201rpx;
} .ipcontainer {
} height: 172rpx;
} width: 322rpx;
display: flex;
} flex-direction: row;
align-items: center;
justify-content: space-between;
.ipcontext {
// width: 210rpx;
} flex: 1;
}
.esgbox { }
margin-top: 128rpx;
margin-left: 32rpx; image {
width: 162 * 0.75rpx;
.maintitle { height: 172 * 0.75rpx;
color: @color-black-deep; }
font-size: 38rpx; }
font-weight: bold;
display: block; .ip3 {
margin-left: 5rpx; width: 160rpx;
} height: 160rpx;
.subtitle { image {
color: @color-black-deep; width: 70rpx;
font-size: 24rpx; height: 97rpx;
margin-top: 10rpx; }
margin-left: 5rpx; }
}
.ip4 {
.listbox { width: 160rpx;
display: flex; height: 160rpx;
margin-top: 10rpx;
image {
width: 88rpx;
.tabitem { height: 92rpx;
color: @color-black-deep; }
background-color: #e9edf1; }
padding: 15rpx; }
font-size: 22rpx; }
margin-right: 15rpx; }
border-radius: 30rpx;
} .esgbox {
margin-top: 128rpx;
.tabActive { margin-left: 32rpx;
color: white;
background-color: @color-gold-main; .maintitle {
} color: @color-black-deep;
} font-size: 38rpx;
font-weight: bold;
.channelscroll { display: block;
width: 718rpx; margin-left: 5rpx;
overflow-x: scroll; }
margin-top: 32rpx;
.subtitle {
// margin-left: -32rpx; color: @color-black-deep;
.box { font-size: 24rpx;
display: flex; margin-top: 10rpx;
margin-left: 5rpx;
.infobox { }
margin-left: 0rpx;
margin-right: 30rpx; .listbox {
width: 503rpx; display: flex;
height: 638rpx; margin-top: 10rpx;
.infoimg { .tabitem {
width: 500rpx; color: @color-black-deep;
height: 400rpx; background-color: #e9edf1;
} padding: 15rpx;
font-size: 22rpx;
.imgRaduis { margin-right: 15rpx;
border-radius: 24rpx 24rpx 0 0; border-radius: 30rpx;
} }
.infotitle { .tabActive {
color: @color-gold-main; color: white;
font-size: 32rpx; background-color: @color-gold-main;
text-align: left; }
font-weight: bold; }
margin-top: 10rpx;
margin-left: 20rpx; .channelscroll {
} width: 718rpx;
overflow-x: scroll;
.infodesc { margin-top: 32rpx;
font-size: 24rpx;
color: black; // margin-left: -32rpx;
margin-top: 10rpx; .box {
padding-right: 40rpx; display: flex;
margin-left: 20rpx;
} .infobox {
} margin-left: 0rpx;
} margin-right: 30rpx;
width: 503rpx;
} height: 638rpx;
.infoimg {
} width: 500rpx;
height: 400rpx;
}
}
.imgRaduis {
.popup-content { border-radius: 24rpx 24rpx 0 0;
width: 750rpx; }
height: 812rpx;
border-top-left-radius: 48rpx; .infotitle {
border-top-right-radius: 48rpx; color: @color-gold-main;
position: relative; font-size: 32rpx;
text-align: left;
.btnclose { font-weight: bold;
width: 70rpx; margin-top: 10rpx;
height: 70rpx; margin-left: 20rpx;
position: absolute; }
top: 36rpx;
right: 32rpx; .infodesc {
} font-size: 24rpx;
color: black;
.xingmahui { margin-top: 10rpx;
width: 750rpx; padding-right: 40rpx;
height: 100%; margin-left: 20rpx;
position: absolute; }
bottom: 0; }
} }
}
.title { }
position: absolute; }
top: 47rpx;
left: 32rpx; .popup-content {
font-size: 36rpx; width: 750rpx;
color: @color-black-deep; height: 812rpx;
font-weight: bold; border-top-left-radius: 48rpx;
border-top-right-radius: 48rpx;
} position: relative;
.desc { .btnclose {
position: absolute; width: 70rpx;
top: 108rpx; height: 70rpx;
left: 32rpx; position: absolute;
font-size: 28rpx; top: 36rpx;
color: @color-black-medium; right: 32rpx;
font-weight: bold; }
} .xingmahui {
width: 750rpx;
.qrcode { height: 100%;
width: 340rpx; position: absolute;
height: 340rpx; bottom: 0;
position: absolute; }
top: 220rpx;
left: 205rpx; .title {
} position: absolute;
top: 47rpx;
.btndownload { left: 32rpx;
width: 286rpx; font-size: 36rpx;
height: 89rpx; color: @color-black-deep;
position: absolute; font-weight: bold;
top: 630rpx; }
left: 232rpx;
} .desc {
} position: absolute;
top: 108rpx;
.video-popup { left: 32rpx;
position: fixed; font-size: 28rpx;
left: 0; color: @color-black-medium;
top: 0; font-weight: bold;
right: 0; }
bottom: 0;
background: rgba(0, 0, 0, 0.7); .qrcode {
display: flex; width: 340rpx;
flex-direction: column; height: 340rpx;
align-items: center; position: absolute;
justify-content: center; top: 220rpx;
z-index: 9999; left: 205rpx;
} }
.close-btn-bottom { .btndownload {
margin: 32rpx auto 0 auto; width: 286rpx;
width: 64rpx; height: 89rpx;
height: 64rpx; position: absolute;
border-radius: 50%; top: 630rpx;
background: rgba(0, 0, 0, 0.5); left: 232rpx;
color: #fff; }
font-size: 44rpx; }
line-height: 64rpx;
text-align: center; .video-popup {
z-index: 10001; position: fixed;
display: flex; left: 0;
align-items: center; top: 0;
justify-content: center; right: 0;
} bottom: 0;
background: rgba(0, 0, 0, 0.7);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 9999;
}
.close-btn-bottom {
margin: 32rpx auto 0 auto;
width: 64rpx;
height: 64rpx;
border-radius: 50%;
background: rgba(0, 0, 0, 0.5);
color: #fff;
font-size: 44rpx;
line-height: 64rpx;
text-align: center;
z-index: 10001;
display: flex;
align-items: center;
justify-content: center;
}
} }
</style> </style>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<template> <template>
<view class="my-container"> <view class="my-container">
<view v-if="cfgStatus.showDetail" class="wheel-selector-fixed"> <view v-if="cfgStatus.showDetail" class="wheel-selector-fixed">
<WheelSelector :options="wheelOptions" :selectedIndex="wheelSelectedIndex" <WheelSelector
:bgImg="$baseUrl + 'my/track/track.png'" :iconNormal="$baseUrl + 'my/track/icon_stage_nor.png'" :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'" :iconSelected="$baseUrl + 'my/track/icon_stage_sel.png'"
@update:selectedIndex="(val) => (wheelSelectedIndex = val)" @change="handleWheelChange" /> @update:selectedIndex="(val) => (wheelSelectedIndex = val)"
@change="handleWheelChange"
/>
</view> </view>
<view class="bg-container" <view
v-if="cfgStatus.isRegister" class="bg-container"
v-if="cfgStatus.isRegister"
:data-log="{ :data-log="{
xcxClick: '我的页面点击', xcxClick: '我的页面点击',
pageName: '我的页面', pageName: '我的页面',
buttonName: '个人信息修改', buttonName: '个人信息修改',
}" @click="handleUploadBackground"> }"
<image class="bg-img" :src="localBackgroundImg || babyInfo?.content?.backgroundImg || $baseUrl + 'my/default_bg.png' @click="handleUploadBackground"
" mode="widthFix" lazy-load="false" binderror="" bindload="" /> >
<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" /> <image class="banner_cover" :src="$baseUrl + 'my/cover_white.png'" mode="aspectFill" />
</view> </view>
...@@ -24,71 +38,101 @@ ...@@ -24,71 +38,101 @@
<view class="user-info" :style="{ 'min-height': cfgStatus.showDetail ? '343rpx' : '168rpx' }"> <view class="user-info" :style="{ 'min-height': cfgStatus.showDetail ? '343rpx' : '168rpx' }">
<view class="user-header"> <view class="user-header">
<view class="avatar-container"> <view class="avatar-container">
<button <button
v-if="canChooseAvatar" v-if="canChooseAvatar"
class="avatar-wrapper" class="avatar-wrapper"
:data-log="{ :data-log="{
xcxClick: '我的页面点击', xcxClick: '我的页面点击',
pageName: '我的页面', pageName: '我的页面',
buttonName: '个人信息修改', buttonName: '个人信息修改',
}" }"
open-type="chooseAvatar" open-type="chooseAvatar"
@chooseavatar="onChooseAvatar"> @chooseavatar="onChooseAvatar"
<image class="avatar" :src="localAvatarUrl || babyInfo?.content?.babyAvatar || >
$baseUrl + 'common/default_avatar.png' <image
" mode="widthFix" /> class="avatar"
:src="localAvatarUrl || babyInfo?.content?.babyAvatar || $baseUrl + 'common/default_avatar.png'"
mode="widthFix"
/>
</button> </button>
<view <view
v-else v-else
class="avatar-wrapper" class="avatar-wrapper"
:data-log="{ :data-log="{
xcxClick: '我的页面点击', xcxClick: '我的页面点击',
pageName: '我的页面', pageName: '我的页面',
buttonName: '个人信息修改', buttonName: '个人信息修改',
}" }"
@click="handleAvatarClick"> @click="handleAvatarClick"
<image class="avatar" :src="localAvatarUrl || babyInfo?.content?.babyAvatar || >
$baseUrl + 'common/default_avatar.png' <image
" mode="widthFix" /> class="avatar"
:src="localAvatarUrl || babyInfo?.content?.babyAvatar || $baseUrl + 'common/default_avatar.png'"
mode="widthFix"
/>
</view> </view>
</view> </view>
<button v-if="!cfgStatus.isRegister" type="primary" class="avatar-container" @click="clickRegisterShield" /> <button
<image class="avatar-modify" :src="$baseUrl + 'my/icon_modify.png'" mode="aspectFit" lazy-load="false" /> 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">
<view class="user-detail-nickname" :data-log="{ <view
xcxClick: '我的页面点击', class="user-detail-nickname"
pageName: '我的页面', :data-log="{
buttonName: '宝宝信息切换', xcxClick: '我的页面点击',
}"> pageName: '我的页面',
buttonName: '宝宝信息切换',
}"
>
<text class="nickname" @click="handleEditProfile">{{ <text class="nickname" @click="handleEditProfile">{{
babyInfo?.babyStage === 0 babyInfo?.babyStage === 0
? "备孕" ? '备孕'
: babyInfo?.babyStage === 1 : babyInfo?.babyStage === 1
? "孕中" ? '孕中'
: babyInfo.babyName || "暂无昵称" : babyInfo.babyName || '暂无昵称'
}}</text> }}</text>
<view class="user-detail-nickname-icon-wrapper" @click="handleChangeBaby"> <view class="user-detail-nickname-icon-wrapper" @click="handleChangeBaby">
<image class="user-detail-nickname-icon" :src="$baseUrl + 'registerLayer/icon_arrow_yellow.png'" <image
mode="aspectFit" /> class="user-detail-nickname-icon"
:src="$baseUrl + 'registerLayer/icon_arrow_yellow.png'"
mode="aspectFit"
/>
</view> </view>
</view> </view>
<!-- 积分账户 --> <!-- 积分账户 -->
<view class="integral-account" @click="handleEditProfile"> <view class="integral-account" @click="handleEditProfile">
<text class="integral-account-text"> 账号: </text> <text class="integral-account-text"> 账号: </text>
<text class="integral-account-value"> <text class="integral-account-value"> {{ userStore.memberInfo?.mobile || '' }}</text>
{{ userStore.memberInfo?.mobile || '' }}</text>
</view> </view>
<BabySwitcher v-if="showBabySwitcher" :show="showBabySwitcher" :babyList="babyInfo.allBabyBaseInfo || []" <BabySwitcher
:addIcon="$baseUrl + 'my/baby_add_btn.png'" @close="showBabySwitcher = false" @select="onSelectBaby" v-if="showBabySwitcher"
@add="onAddBaby" /> :show="showBabySwitcher"
:babyList="babyInfo.allBabyBaseInfo || []"
:addIcon="$baseUrl + 'my/baby_add_btn.png'"
@close="showBabySwitcher = false"
@select="onSelectBaby"
@add="onAddBaby"
/>
</view> </view>
<view class="integralContainer" @click="handleIntegralClick"> <view class="integralContainer" @click="handleIntegralClick">
<image class="integralIcon" src="https://course.feihe.com/momclub-picture/my/integralBg.png" <image
mode="aspectFit" /> class="integralIcon"
<text class="integralText0">{{ points || "0" }}</text> src="https://course.feihe.com/momclub-picture/my/integralBg.png"
mode="aspectFit"
/>
<text class="integralText0">{{ points || '0' }}</text>
<text class="integralText1">积分</text> <text class="integralText1">积分</text>
</view> </view>
</view> </view>
...@@ -102,35 +146,51 @@ ...@@ -102,35 +146,51 @@
</view> </view>
<view class="desc-content"> <view class="desc-content">
<text class="desc-text">{{ <text class="desc-text"
wheelOptions[wheelSelectedIndex]?.desc.length > 46 >{{
? cfgStatus.openBabyCardDesc wheelOptions[wheelSelectedIndex]?.desc.length > 46
? wheelOptions[wheelSelectedIndex]?.desc ? cfgStatus.openBabyCardDesc
: wheelOptions[wheelSelectedIndex]?.desc.slice(0, 46) + "..." ? wheelOptions[wheelSelectedIndex]?.desc
: wheelOptions[wheelSelectedIndex]?.desc : wheelOptions[wheelSelectedIndex]?.desc.slice(0, 46) + '...'
}} : wheelOptions[wheelSelectedIndex]?.desc
}}
</text> </text>
<text v-if="wheelOptions[wheelSelectedIndex]?.desc.length > 46" class="desc-more" @click="handleOpenClick">{{ <text
cfgStatus.openBabyCardDesc ? "点击收起" : "点击展开" }}</text> v-if="wheelOptions[wheelSelectedIndex]?.desc.length > 46"
class="desc-more"
@click="handleOpenClick"
>{{ cfgStatus.openBabyCardDesc ? '点击收起' : '点击展开' }}</text
>
</view> </view>
</view> </view>
</view> </view>
<!-- 添加宝宝信息模块 --> <!-- 添加宝宝信息模块 -->
<view class="add-baby-info-module" <view
v-if="cfgStatus.isRegister && (!babyInfo?.allBabyBaseInfo || babyInfo.allBabyBaseInfo.length === 0)"> 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> <image class="add-baby-info-bg" :src="$baseUrl + 'homepage/Q3Res/addBabyInfoBg2.png'"></image>
<view class="add-baby-info-btn-container"> <view class="add-baby-info-btn-container">
<image class="add-baby-info-btn" :src="$baseUrl + 'homepage/Q3Res/addBabyInfoBtn2.png'" <image
@tap="handleAddBabyInfoClick"></image> class="add-baby-info-btn"
:src="$baseUrl + 'homepage/Q3Res/addBabyInfoBtn2.png'"
@tap="handleAddBabyInfoClick"
></image>
</view> </view>
</view> </view>
<!-- 完成任务模块 --> <!-- 完成任务模块 -->
<view class="task-module" <view
v-if="cfgStatus.isRegister && (babyInfo?.allBabyBaseInfo && babyInfo.allBabyBaseInfo.length > 0)"> 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-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> </view>
<!-- 工具 --> <!-- 工具 -->
...@@ -139,11 +199,19 @@ ...@@ -139,11 +199,19 @@
<view class="tool-list"> <view class="tool-list">
<template v-for="item in toolList" :key="item.title"> <template v-for="item in toolList" :key="item.title">
<view v-if="!item.hidden" class="tool-item" @click="handleToolClick(item)"> <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" <image
mode="aspectFit" /> class="tool-icon"
:src="item.bgUrl?.includes('http') ? item.bgUrl : $baseUrl + item.bgUrl"
mode="aspectFit"
/>
<!-- || item.title == '产检提醒' || item.title == '喂养记录' || item.title == '生长测评' --> <!-- || item.title == '产检提醒' || item.title == '喂养记录' || item.title == '生长测评' -->
<button v-if="(item.title == '医生问诊') && !cfgStatus.isRegister" class="tool-btn-register" type="primary" <button
open-type="getPhoneNumber" @getphonenumber="getRealtimePhoneNumber" /> v-if="item.title == '医生问诊' && !cfgStatus.isRegister"
class="tool-btn-register"
type="primary"
open-type="getPhoneNumber"
@getphonenumber="getRealtimePhoneNumber"
/>
</view> </view>
</template> </template>
</view> </view>
...@@ -151,50 +219,76 @@ ...@@ -151,50 +219,76 @@
<view class="vip-active-area" v-if="pageCfgStore?.contentCfg?.activeInfo?.length > 0"> <view class="vip-active-area" v-if="pageCfgStore?.contentCfg?.activeInfo?.length > 0">
<text class="vip-title">精彩活动</text> <text class="vip-title">精彩活动</text>
<swiper class="vip-active-swiper" :indicator-dots="pageCfgStore?.contentCfg?.activeInfo?.length > 1" <swiper
:autoplay="true" :circular="true" indicator-color="#dfddd9" indicator-active-color="#b27c1e" class="vip-active-swiper"
:indicator-top="32"> :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"> <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}`" <image
mode="aspectFit" @click="handleVipActiveClick(index, item)" /> class="vip-active-img"
:src="item?.bgUrl?.includes('http') ? item?.bgUrl : $baseUrl + `${item?.bgUrl}`"
mode="aspectFit"
@click="handleVipActiveClick(index, item)"
/>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
<!-- 功能菜单 --> <!-- 功能菜单 -->
<view class="menu-container"> <view class="menu-container">
<view class="menu-item" @click="navigateToWithLogin('/v3/orderList/orderList')" :data-log="{ <view
xcxClick: '我的页面点击', class="menu-item"
pageName: '我的页面', @click="navigateToWithLogin('/v3/orderList/orderList')"
buttonName: '我的订单' :data-log="{
}"> xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '我的订单',
}"
>
<image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_myOrder.png'" mode="aspectFit" /> <image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_myOrder.png'" mode="aspectFit" />
<text class="menu-title">我的订单</text> <text class="menu-title">我的订单</text>
<image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" /> <image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" />
</view> </view>
<view class="menu-item" @click="navigateToWithLogin('/v3/addressList/addressList')" :data-log="{ <view
xcxClick: '我的页面点击', class="menu-item"
pageName: '我的页面', @click="navigateToWithLogin('/v3/addressList/addressList')"
buttonName: '收货地址管理' :data-log="{
}"> xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '收货地址管理',
}"
>
<image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_address.png'" mode="aspectFit" /> <image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_address.png'" mode="aspectFit" />
<text class="menu-title">收货地址管理</text> <text class="menu-title">收货地址管理</text>
<image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" /> <image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" />
</view> </view>
<view class="menu-item" @click="navigateToCouponWithLogin()" :data-log="{ <view
xcxClick: '我的页面点击', class="menu-item"
pageName: '我的页面', @click="navigateToCouponWithLogin()"
buttonName: '我的优惠券' :data-log="{
}"> xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '我的优惠券',
}"
>
<image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_myCupon.png'" mode="aspectFit" /> <image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_myCupon.png'" mode="aspectFit" />
<text class="menu-title">我的优惠券</text> <text class="menu-title">我的优惠券</text>
<image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" /> <image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" />
</view> </view>
<view class="menu-item" @click="navigateToWithLogin('/v3/more/index')" :data-log="{ <view
xcxClick: '我的页面点击', class="menu-item"
pageName: '我的页面', @click="navigateToWithLogin('/v3/more/index')"
buttonName: '更多' :data-log="{
}"> xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '更多',
}"
>
<image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_more.png'" mode="aspectFit" /> <image class="menu-icon" :src="$baseUrl + 'homepage/Q3Res/myIcon_more.png'" mode="aspectFit" />
<text class="menu-title">更多</text> <text class="menu-title">更多</text>
<image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" /> <image class="menu-arrow" :src="$baseUrl + 'homepage/Q3Res/rightArrowBtn.png'" mode="aspectFit" />
...@@ -221,13 +315,11 @@ ...@@ -221,13 +315,11 @@
<!-- 生日弹窗 type 3 钻石、4 星光、5 星耀 --> <!-- 生日弹窗 type 3 钻石、4 星光、5 星耀 -->
<!-- <popup-shengri v-if="isTip" type="3" @close="isTip = false"></popup-shengri> --> <!-- <popup-shengri v-if="isTip" type="3" @close="isTip = false"></popup-shengri> -->
<!-- 精选好卷弹窗 isUnlock // 是否解锁 商品兑换券 type 1 黄金、2 铂金、3 钻石、4 星光、5 星耀 --> <!-- 精选好卷弹窗 isUnlock // 是否解锁 商品兑换券 type 1 黄金、2 铂金、3 钻石、4 星光、5 星耀 -->
<!-- <popup-jingxuan v-if="isTip" type="1" isUnlock="true" @close="isTip = false"></popup-jingxuan> --> <!-- <popup-jingxuan v-if="isTip" type="1" isUnlock="true" @close="isTip = false"></popup-jingxuan> -->
<!-- 新人礼券弹窗 type 1 黄金、2 铂金、3 钻石、4 星光、5 星耀--> <!-- 新人礼券弹窗 type 1 黄金、2 铂金、3 钻石、4 星光、5 星耀-->
<!-- <popup-xinren v-if="isTip" type="1" @close="isTip = false"></popup-xinren> --> <!-- <popup-xinren v-if="isTip" type="1" @close="isTip = false"></popup-xinren> -->
</template> </template>
<style scoped> <style scoped>
...@@ -292,21 +384,21 @@ ...@@ -292,21 +384,21 @@
</style> </style>
<script setup> <script setup>
import { ref, onMounted, getCurrentInstance, computed, watch } from "vue"; import { ref, onMounted, getCurrentInstance, computed, watch } from 'vue';
import RegisterLayer from "../components/RegisterLayer.vue"; import RegisterLayer from '../components/RegisterLayer.vue';
import BabySwitcher from "../components/BabySwitcher.vue"; import BabySwitcher from '../components/BabySwitcher.vue';
import WheelSelector from "../components/WheelSelector.vue"; import WheelSelector from '../components/WheelSelector.vue';
import { useUserStore } from "@/stores/user"; import { useUserStore } from '@/stores/user';
import { usePageCfgStore } from "@/stores/pageCfg"; import { usePageCfgStore } from '@/stores/pageCfg';
import { jump, JumpType } from "@/utils"; import { jump, JumpType } from '@/utils';
import { getHealthField } from "@/api/common"; import { getHealthField } from '@/api/common';
import { hideLoading, showLoading } from "../utils"; import { hideLoading, showLoading } from '../utils';
import md from "../md.js"; import md from '../md.js';
import { onShow } from '@dcloudio/uni-app'; import { onShow } from '@dcloudio/uni-app';
import { useIntegralStore } from "../stores/integral.js"; import { useIntegralStore } from '../stores/integral.js';
import { useGlobalStore } from "../stores/global.js"; import { useGlobalStore } from '../stores/global.js';
import { uploadImage } from "../api/common.js"; import { uploadImage } from '../api/common.js';
import { saveBabyExtra } from "../api/user.js"; import { saveBabyExtra } from '../api/user.js';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const $baseUrl = proxy.$baseUrl; const $baseUrl = proxy.$baseUrl;
...@@ -329,9 +421,11 @@ const babyInfo = computed(() => userStore?.babyInfo || {}); ...@@ -329,9 +421,11 @@ const babyInfo = computed(() => userStore?.babyInfo || {});
// 判断是否可以使用选择头像功能 // 判断是否可以使用选择头像功能
const canChooseAvatar = computed(() => { const canChooseAvatar = computed(() => {
return cfgStatus.value.isRegister && return (
userStore.babyInfo?.allBabyBaseInfo && cfgStatus.value.isRegister &&
userStore.babyInfo?.allBabyBaseInfo?.length > 0; userStore.babyInfo?.allBabyBaseInfo &&
userStore.babyInfo?.allBabyBaseInfo?.length > 0
);
}); });
const showRegisterLayer = ref(false); const showRegisterLayer = ref(false);
...@@ -350,10 +444,10 @@ const localBackgroundImg = ref(''); ...@@ -350,10 +444,10 @@ const localBackgroundImg = ref('');
const handleTaskClick = async () => { const handleTaskClick = async () => {
// 添加点击埋点 // 添加点击埋点
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "做任务赚更多积分", componentName: '做任务赚更多积分',
componentContent: "去做任务" componentContent: '去做任务',
}); });
// 检查登录状态 // 检查登录状态
...@@ -361,7 +455,7 @@ const handleTaskClick = async () => { ...@@ -361,7 +455,7 @@ const handleTaskClick = async () => {
// 未登录,跳转到登录注册页面 // 未登录,跳转到登录注册页面
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: "/pages/activity/register", url: '/pages/activity/register',
}); });
return; return;
} }
...@@ -369,32 +463,31 @@ const handleTaskClick = async () => { ...@@ -369,32 +463,31 @@ const handleTaskClick = async () => {
// 已登录,正常执行任务逻辑 // 已登录,正常执行任务逻辑
await integralStore.getSigninAndTaskInfo(false); await integralStore.getSigninAndTaskInfo(false);
globalStore.showTaskPop(integralStore?.signinAndTaskInfo?.data?.taskTodo); globalStore.showTaskPop(integralStore?.signinAndTaskInfo?.data?.taskTodo);
} };
const handleHot = (e) => { const handleHot = (e) => {
const type = e.currentTarget.dataset.type; const type = e.currentTarget.dataset.type;
md.sensorLog(e); md.sensorLog(e);
console.log("handleHot", type); console.log('handleHot', type);
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "查看协议", componentName: '查看协议',
componentContent: type === "member" ? "会员规则" : "隐私协议" componentContent: type === 'member' ? '会员规则' : '隐私协议',
}) });
if (type === "member") { if (type === 'member') {
navigateTo('/pages/webview/webview?type=MEMBER_URL');
navigateTo("/pages/webview/webview?type=MEMBER_URL"); } else if (type === 'privacy') {
} else if (type === "privacy") { navigateTo('/pages/webview/webview?type=PRIVACY_URL');
navigateTo("/pages/webview/webview?type=PRIVACY_URL");
} }
}; };
function clickRegisterShield() { function clickRegisterShield() {
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: "/pages/activity/register", url: '/pages/activity/register',
}) });
} }
// 页面跳转 // 页面跳转
...@@ -402,7 +495,7 @@ const navigateToCoupon = () => { ...@@ -402,7 +495,7 @@ const navigateToCoupon = () => {
const url = 'subPackages/shopMainProcess/coupons/couponList'; const url = 'subPackages/shopMainProcess/coupons/couponList';
const type = JumpType.MINI; const type = JumpType.MINI;
const extra = { const extra = {
appId: 'wx4205ec55b793245e', //星妈优选小程序 appId: 'wx4205ec55b793245e', //星妈优选小程序
extraData: {}, extraData: {},
envVersion: 'release', envVersion: 'release',
embedded: true, embedded: true,
...@@ -411,7 +504,7 @@ const navigateToCoupon = () => { ...@@ -411,7 +504,7 @@ const navigateToCoupon = () => {
jump({ jump({
type: type, type: type,
url: url, url: url,
extra: extra extra: extra,
}); });
}; };
...@@ -419,10 +512,10 @@ const navigateToCoupon = () => { ...@@ -419,10 +512,10 @@ const navigateToCoupon = () => {
const navigateToCouponWithLogin = () => { const navigateToCouponWithLogin = () => {
// 添加点击埋点 // 添加点击埋点
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "我的优惠券" componentContent: '我的优惠券',
}); });
// 检查登录状态 // 检查登录状态
...@@ -430,7 +523,7 @@ const navigateToCouponWithLogin = () => { ...@@ -430,7 +523,7 @@ const navigateToCouponWithLogin = () => {
// 未登录,跳转到登录注册页面 // 未登录,跳转到登录注册页面
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: "/pages/activity/register", url: '/pages/activity/register',
}); });
return; return;
} }
...@@ -444,10 +537,10 @@ const navigateTo = (url) => { ...@@ -444,10 +537,10 @@ const navigateTo = (url) => {
url, url,
animationDuration: 0, animationDuration: 0,
fail: (err) => { fail: (err) => {
console.error("页面跳转失败:", err); console.error('页面跳转失败:', err);
uni.showToast({ uni.showToast({
title: "页面跳转失败", title: '页面跳转失败',
icon: "none", icon: 'none',
}); });
}, },
}); });
...@@ -470,10 +563,10 @@ const navigateToWithLogin = (url) => { ...@@ -470,10 +563,10 @@ const navigateToWithLogin = (url) => {
if (componentContent) { if (componentContent) {
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: componentContent componentContent: componentContent,
}); });
} }
...@@ -482,7 +575,7 @@ const navigateToWithLogin = (url) => { ...@@ -482,7 +575,7 @@ const navigateToWithLogin = (url) => {
// 未登录,跳转到登录注册页面 // 未登录,跳转到登录注册页面
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: "/pages/activity/register", url: '/pages/activity/register',
}); });
return; return;
} }
...@@ -493,29 +586,29 @@ const navigateToWithLogin = (url) => { ...@@ -493,29 +586,29 @@ const navigateToWithLogin = (url) => {
const handleToolClick = async (item) => { const handleToolClick = async (item) => {
md.sensorLogTake({ md.sensorLogTake({
xcxClick: "我的页面点击", xcxClick: '我的页面点击',
pageName: "我的页面", pageName: '我的页面',
buttonName: item.title, buttonName: item.title,
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "工具", componentName: '工具',
componentContent: item.title componentContent: item.title,
}) });
// 跳转产检提醒页面判断 // 跳转产检提醒页面判断
// let listData = userStore.babyInfo ? userStore.babyInfo.allBabyBaseInfo : [] // let listData = userStore.babyInfo ? userStore.babyInfo.allBabyBaseInfo : []
if (item.title === "医生问诊") { if (item.title === '医生问诊') {
if (!cfgStatus.value.isRegister) return; if (!cfgStatus.value.isRegister) return;
const res = await getHealthField(); const res = await getHealthField();
if (!res.success) { if (!res.success) {
uni.showToast({ uni.showToast({
title: "获取健康字段失败", title: '获取健康字段失败',
icon: "none", icon: 'none',
}); });
return; return;
} }
...@@ -524,27 +617,25 @@ const handleToolClick = async (item) => { ...@@ -524,27 +617,25 @@ const handleToolClick = async (item) => {
jump({ jump({
type: JumpType.MINI, type: JumpType.MINI,
url: "/pages/partner/redirect", url: '/pages/partner/redirect',
extra: { extra: {
appId: "wx81ecfb5aa3fb512f", appId: 'wx81ecfb5aa3fb512f',
envVersion: env, envVersion: env,
extraData: { extraData: {
sign, // 参考 4.请求参数 sign, // 参考 4.请求参数
timestamp, // 参考 4.请求参数 timestamp, // 参考 4.请求参数
appId, // 参考 4.请求参数 appId, // 参考 4.请求参数
partnerUserId, // 参考 4.请求参数 partnerUserId, // 参考 4.请求参数
targetApp: targetApp: '/h5/partner/shining-like-a-start/landing-free-consult?sysType=CRF',
"/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; // if (!cfgStatus.value.isRegister) return;
jump({ type: item.link.type, url: item.link.url }); jump({ type: item.link.type, url: item.link.url });
} } else {
else {
jump({ type: item.link.type, url: item.link.url }); jump({ type: item.link.type, url: item.link.url });
// const extra = item.link.extra; // const extra = item.link.extra;
// if(extra && extra.babyId){ // if(extra && extra.babyId){
...@@ -557,159 +648,142 @@ const handleToolClick = async (item) => { ...@@ -557,159 +648,142 @@ const handleToolClick = async (item) => {
// 编辑个人资料 // 编辑个人资料
const handleEditProfile = (e) => { const handleEditProfile = (e) => {
if (!userStore.userInfo || JSON.stringify(userStore.userInfo) === '{}') {
if (!userStore.userInfo ||
JSON.stringify(userStore.userInfo) === "{}"
) {
return; return;
} }
md.sensorLog(e); md.sensorLog(e);
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "资料编辑" componentContent: '资料编辑',
}) });
// 检查登录状态 // 检查登录状态
if (!cfgStatus.value.isRegister) { if (!cfgStatus.value.isRegister) {
// 未登录,跳转到登录注册页面 // 未登录,跳转到登录注册页面
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: "/pages/activity/register", url: '/pages/activity/register',
}); });
return; return;
} }
if(!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) { if (!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo("/pages/person/person?type=add"); navigateTo('/pages/person/person?type=add');
return; return;
} }
const type = userStore.babyInfo?.allBabyBaseInfo?.length == 0 ? "add" : "edit"; const type = userStore.babyInfo?.allBabyBaseInfo?.length == 0 ? 'add' : 'edit';
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find( babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected)?.id;
(item) => item.selected
)?.id;
if (type === "edit") { if (type === 'edit') {
babyId.value = userStore.babyInfo?.allBabyBaseInfo.find( babyId.value = userStore.babyInfo?.allBabyBaseInfo.find((item) => item.selected)?.id;
(item) => item.selected
)?.id;
navigateTo(`/pages/person/person?type=${type}&id=${babyId.value}`); navigateTo(`/pages/person/person?type=${type}&id=${babyId.value}`);
} else { } else {
navigateTo(`/pages/person/person?type=${type}`); navigateTo(`/pages/person/person?type=${type}`);
} }
}; };
// 头像点击事件(当不满足选择头像条件时) // 头像点击事件(当不满足选择头像条件时)
const handleAvatarClick = (e) => { const handleAvatarClick = (e) => {
md.sensorLog(e); md.sensorLog(e);
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "资料编辑" componentContent: '资料编辑',
}) });
// 检查登录状态 // 检查登录状态
if (!cfgStatus.value.isRegister) { if (!cfgStatus.value.isRegister) {
// 未登录,跳转到登录注册页面 // 未登录,跳转到登录注册页面
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: "/pages/activity/register", url: '/pages/activity/register',
}); });
return; return;
} }
if(!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) { if (!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo("/pages/person/person?type=add"); navigateTo('/pages/person/person?type=add');
return; return;
} }
}; };
// 选择头像 // 选择头像
const onChooseAvatar = async (e) => { const onChooseAvatar = async (e) => {
showLoading('上传中...'); showLoading('上传中...');
md.sensorLog(e); md.sensorLog(e);
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "资料编辑" componentContent: '资料编辑',
}) });
try { try {
const fs = uni.getFileSystemManager(); const fs = uni.getFileSystemManager();
const base64 = const base64 = 'data:image/jpeg;base64,' + fs.readFileSync(e.detail.avatarUrl, 'base64');
"data:image/jpeg;base64," + fs.readFileSync(e.detail.avatarUrl, "base64");
const res = await uploadImage(base64); const res = await uploadImage(base64);
if (res.success) { if (res.success) {
// 立即更新本地显示的头像 // 立即更新本地显示的头像
localAvatarUrl.value = res.data.url; localAvatarUrl.value = res.data.url;
// 获取当前选中的宝宝信息并更新到服务器 // 获取当前选中的宝宝信息并更新到服务器
const selectedBaby = userStore.babyInfo?.allBabyBaseInfo?.find( const selectedBaby = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected);
(item) => item.selected
);
console.log("selectedBaby-===", selectedBaby);
if (selectedBaby) {
console.log('selectedBaby-===', selectedBaby);
if (selectedBaby) {
// const updateData = { // const updateData = {
// id: selectedBaby.id, // id: selectedBaby.id,
// babyAvatar: res.data.url, // babyAvatar: res.data.url,
// }; // };
// const updateRes = await updateBabyInfo(updateData); // 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 = { const updateData = {
id: userStore.babyInfo?.content?.id, id: userStore.babyInfo?.content?.id,
babyAvatar: res.data.url babyAvatar: res.data.url,
} };
const updateRes = await saveBabyExtra(updateData); const updateRes = await saveBabyExtra(updateData);
if (updateRes.success) { if (updateRes.success) {
// 刷新用户信息 // 刷新用户信息
await userStore.loadBabyInfo(); await userStore.loadBabyInfo();
// 清空本地临时头像,使用更新后的 babyInfo // 清空本地临时头像,使用更新后的 babyInfo
localAvatarUrl.value = ''; localAvatarUrl.value = '';
uni.showToast({ uni.showToast({
title: "头像更新成功", title: '头像更新成功',
icon: "success", icon: 'success',
}); });
} else { } else {
uni.showToast({ uni.showToast({
title: updateRes.message || "更新失败", title: updateRes.message || '更新失败',
icon: "none", icon: 'none',
}); });
} }
} else { } else {
uni.showToast({ uni.showToast({
title: "未找到宝宝信息", title: '未找到宝宝信息',
icon: "none", icon: 'none',
}); });
} }
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: "none", icon: 'none',
}); });
} }
} catch (error) { } catch (error) {
console.error("头像选择失败:", error); console.error('头像选择失败:', error);
uni.showToast({ uni.showToast({
title: "头像选择失败", title: '头像选择失败',
icon: "none", icon: 'none',
}); });
} finally { } finally {
hideLoading(); hideLoading();
...@@ -717,7 +791,7 @@ const onChooseAvatar = async (e) => { ...@@ -717,7 +791,7 @@ const onChooseAvatar = async (e) => {
}; };
const onRegisterConfirm = async () => { const onRegisterConfirm = async () => {
await pageCfgStore.fetchCfg(); await pageCfgStore.fetchCfg(globalStore.getPreviewScene('my'));
// 只调用一次initData,loadMemberInfo已在initData内部处理 // 只调用一次initData,loadMemberInfo已在initData内部处理
initData(); initData();
showRegisterLayer.value = false; showRegisterLayer.value = false;
...@@ -728,149 +802,146 @@ const onRegisterCancel = () => { ...@@ -728,149 +802,146 @@ const onRegisterCancel = () => {
const handleWheelChange = (val) => { const handleWheelChange = (val) => {
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "月龄定位器", componentName: '月龄定位器',
componentContent: babyInfo.value.babyStage == 2 componentContent: babyInfo.value.babyStage == 2 ? '月龄滑动切换-' + val : '孕周滑动切换-' + val,
? "月龄滑动切换-" + val
: "孕周滑动切换-" + val
}); });
} };
const initExposure = () => { 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({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "添加宝宝信息引导", componentName: '添加宝宝信息引导',
componentContent: "添加宝宝信息引导" 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({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "做任务赚更多积分", componentName: '做任务赚更多积分',
componentContent: "去做任务" componentContent: '去做任务',
}); });
} }
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "资料编辑" componentContent: '资料编辑',
}); });
toolList.value.forEach((item, index) => { toolList.value.forEach((item, index) => {
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "工具", componentName: '工具',
componentContent: item.title componentContent: item.title,
}); });
}); });
if (pageCfgStore?.contentCfg?.activeInfo?.length > 0) { if (pageCfgStore?.contentCfg?.activeInfo?.length > 0) {
pageCfgStore.contentCfg.activeInfo.forEach((item, index) => { pageCfgStore.contentCfg.activeInfo.forEach((item, index) => {
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "精彩活动", componentName: '精彩活动',
componentContent: "精彩活动-" + item.title componentContent: '精彩活动-' + item.title,
}); });
}); });
} }
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "查看协议", componentName: '查看协议',
componentContent: "会员规则" componentContent: '会员规则',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "查看协议", componentName: '查看协议',
componentContent: "隐私协议" componentContent: '隐私协议',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "月龄定位器", componentName: '月龄定位器',
componentContent: babyInfo.value.babyStage == 2 ? "月龄滑动切换" : "孕周滑动切换" componentContent: babyInfo.value.babyStage == 2 ? '月龄滑动切换' : '孕周滑动切换',
}); });
// 添加拓展工具菜单曝光埋点 // 添加拓展工具菜单曝光埋点
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "我的订单" componentContent: '我的订单',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "收货地址管理" componentContent: '收货地址管理',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "我的优惠券" componentContent: '我的优惠券',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "更多" componentContent: '更多',
}); });
};
}
onShow(async () => { onShow(async () => {
console.log('onShow') console.log('onShow');
await userStore.loadMemberInfo(); await userStore.loadMemberInfo();
points.value = userStore.memberInfo?.points; points.value = userStore.memberInfo?.points;
console.log('userStore.memberInfo=', userStore.memberInfo) console.log('userStore.memberInfo=', userStore.memberInfo);
// 添加拓展工具菜单曝光埋点 // 添加拓展工具菜单曝光埋点
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "我的订单" componentContent: '我的订单',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "收货地址管理" componentContent: '收货地址管理',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "我的优惠券" componentContent: '我的优惠券',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "拓展工具", componentName: '拓展工具',
componentContent: "更多" componentContent: '更多',
}); });
console.warn("AAAAAAAA") console.warn('AAAAAAAA');
}) });
// 获取用户信息 // 获取用户信息
const initData = async () => { const initData = async () => {
...@@ -878,10 +949,7 @@ const initData = async () => { ...@@ -878,10 +949,7 @@ const initData = async () => {
await userStore.loadMemberInfo(); await userStore.loadMemberInfo();
points.value = userStore.memberInfo?.points; points.value = userStore.memberInfo?.points;
if ( if (userStore?.userInfo?.memberId && userStore?.userInfo?.memberId == 'not_login') {
userStore?.userInfo?.memberId &&
userStore?.userInfo?.memberId == "not_login"
) {
cfgStatus.value.isRegister = false; cfgStatus.value.isRegister = false;
cfgStatus.value.showDetail = false; cfgStatus.value.showDetail = false;
return; return;
...@@ -892,50 +960,44 @@ const initData = async () => { ...@@ -892,50 +960,44 @@ const initData = async () => {
// 已出生或孕中显示 // 已出生或孕中显示
cfgStatus.value.showDetail = __showDetail; cfgStatus.value.showDetail = __showDetail;
if (__showDetail) { if (__showDetail) {
wheelOptions.value = wheelOptions.value =
babyInfo.value.babyStage == 2 babyInfo.value.babyStage == 2 ? pageCfgStore.wheelOptionsYL : pageCfgStore.wheelOptionsYZ;
? pageCfgStore.wheelOptionsYL const index = wheelOptions.value.findIndex((item) => item.label == babyInfo.value.babyAge);
: pageCfgStore.wheelOptionsYZ;
const index = wheelOptions.value.findIndex(
(item) => item.label == babyInfo.value.babyAge
);
wheelSelectedIndex.value = index > 0 ? index : 0; wheelSelectedIndex.value = index > 0 ? index : 0;
} }
}; };
const handleIntegralClick = () => { const handleIntegralClick = () => {
md.sensorLogTake({ md.sensorLogTake({
xcxClick: "我的页面-首屏页面点击", xcxClick: '我的页面-首屏页面点击',
pageName: "我的页面-首屏", pageName: '我的页面-首屏',
buttonName: "积分明细", buttonName: '积分明细',
}); });
const urlStr = 'https://mom.feihe.com/member/mine/newPointDetail?crmId={crmid}&appCode=XMH'; const urlStr = 'https://mom.feihe.com/member/mine/newPointDetail?crmId={crmid}&appCode=XMH';
const url = urlStr.replace("{crmid}", userStore.babyInfo?.memberId); const url = urlStr.replace('{crmid}', userStore.babyInfo?.memberId);
console.log('积分明细链接:==', url) console.log('积分明细链接:==', url);
jump({ jump({
type: 3, type: 3,
url: url url: url,
}) });
} };
const getRealtimePhoneNumber = async (e) => { const getRealtimePhoneNumber = async (e) => {
console.log("获取手机号码", e); console.log('获取手机号码', e);
if (e.detail.errMsg !== "getPhoneNumber:ok") { if (e.detail.errMsg !== 'getPhoneNumber:ok') {
uni.showToast({ uni.showToast({
title: "请授权使用手机号", title: '请授权使用手机号',
icon: "none", icon: 'none',
}); });
return; return;
} }
await userStore.phoneCallback(e.detail, async () => { await userStore.phoneCallback(e.detail, async () => {
// 简化回调,避免重复调用接口 // 简化回调,避免重复调用接口
showLoading(); showLoading();
await pageCfgStore.fetchCfg(); await pageCfgStore.fetchCfg(globalStore.getPreviewScene('my'));
// 只调用一次initData,loadMemberInfo已在initData内部处理 // 只调用一次initData,loadMemberInfo已在initData内部处理
initData(); initData();
hideLoading(); hideLoading();
...@@ -949,31 +1011,28 @@ const handleChangeBaby = (e) => { ...@@ -949,31 +1011,28 @@ const handleChangeBaby = (e) => {
md.sensorLog(e); md.sensorLog(e);
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "展开" componentContent: '展开',
}) });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "新增" componentContent: '新增',
}) });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentExposure: "true", xcxComponentExposure: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "状态切换" componentContent: '状态切换',
}) });
showBabySwitcher.value = true; showBabySwitcher.value = true;
}; };
async function onSelectBaby(baby) { async function onSelectBaby(baby) {
// 处理宝宝切换逻辑 // 处理宝宝切换逻辑
showBabySwitcher.value = false; showBabySwitcher.value = false;
...@@ -982,22 +1041,22 @@ async function onSelectBaby(baby) { ...@@ -982,22 +1041,22 @@ async function onSelectBaby(baby) {
await userStore.changeBabySelected(baby.id); await userStore.changeBabySelected(baby.id);
hideLoading(); hideLoading();
console.log("onSelectBaby", baby); console.log('onSelectBaby', baby);
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "状态切换" componentContent: '状态切换',
}) });
} }
function handleAddBabyInfoClick() { function handleAddBabyInfoClick() {
// 添加点击埋点 // 添加点击埋点
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "添加宝宝信息引导", componentName: '添加宝宝信息引导',
componentContent: "添加宝宝信息引导" componentContent: '添加宝宝信息引导',
}); });
// 显示RegisterLayer弹窗 // 显示RegisterLayer弹窗
showRegisterLayer.value = true; showRegisterLayer.value = true;
...@@ -1005,27 +1064,27 @@ function handleAddBabyInfoClick() { ...@@ -1005,27 +1064,27 @@ function handleAddBabyInfoClick() {
function onAddBaby() { function onAddBaby() {
md.sensorLogTake({ md.sensorLogTake({
xcxClick: "我的页面点击", xcxClick: '我的页面点击',
pageName: "我的页面", pageName: '我的页面',
buttonName: "新增入口", buttonName: '新增入口',
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "新增" componentContent: '新增',
}) });
// 跳转到新增宝宝页面 // 跳转到新增宝宝页面
showBabySwitcher.value = false; showBabySwitcher.value = false;
navigateTo("/pages/person/person?type=add"); navigateTo('/pages/person/person?type=add');
} }
const handleOpenClick = () => { const handleOpenClick = () => {
md.sensorLogTake({ md.sensorLogTake({
xcxClick: "我的页面点击", xcxClick: '我的页面点击',
pageName: "我的页面", pageName: '我的页面',
buttonName: cfgStatus.value.openBabyCardDesc ? "收起" : "展开", buttonName: cfgStatus.value.openBabyCardDesc ? '收起' : '展开',
}); });
cfgStatus.value.openBabyCardDesc = !cfgStatus.value.openBabyCardDesc; cfgStatus.value.openBabyCardDesc = !cfgStatus.value.openBabyCardDesc;
}; };
...@@ -1034,141 +1093,131 @@ const handleOpenClick = () => { ...@@ -1034,141 +1093,131 @@ const handleOpenClick = () => {
const handleUploadBackground = async (e) => { const handleUploadBackground = async (e) => {
md.sensorLog(e); md.sensorLog(e);
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "资料编辑", componentName: '资料编辑',
componentContent: "资料编辑" componentContent: '资料编辑',
}) });
// 检查登录状态 // 检查登录状态
if (!cfgStatus.value.isRegister) { if (!cfgStatus.value.isRegister) {
// 未登录,跳转到登录注册页面 // 未登录,跳转到登录注册页面
jump({ jump({
type: JumpType.INNER, type: JumpType.INNER,
url: "/pages/activity/register", url: '/pages/activity/register',
}); });
return; return;
} }
if(!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) { if (!userStore.babyInfo?.allBabyBaseInfo || userStore.babyInfo?.allBabyBaseInfo?.length === 0) {
navigateTo("/pages/person/person?type=add"); navigateTo('/pages/person/person?type=add');
return; return;
} }
// 唤起图片选择器 // 唤起图片选择器
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
sizeType: ["original", "compressed"], sizeType: ['original', 'compressed'],
sourceType: ["album", "camera"], sourceType: ['album', 'camera'],
success: async (res) => { success: async (res) => {
showLoading('上传中...'); showLoading('上传中...');
try { try {
const tempFilePath = res.tempFilePaths[0]; const tempFilePath = res.tempFilePaths[0];
const fs = uni.getFileSystemManager(); const fs = uni.getFileSystemManager();
const base64 = const base64 = 'data:image/jpeg;base64,' + fs.readFileSync(tempFilePath, 'base64');
"data:image/jpeg;base64," + fs.readFileSync(tempFilePath, "base64");
const uploadRes = await uploadImage(base64); const uploadRes = await uploadImage(base64);
if (uploadRes.success) { if (uploadRes.success) {
// 立即更新本地显示的背景图 // 立即更新本地显示的背景图
localBackgroundImg.value = uploadRes.data.url; localBackgroundImg.value = uploadRes.data.url;
// 获取当前选中的宝宝信息并更新到服务器 // 获取当前选中的宝宝信息并更新到服务器
const selectedBaby = userStore.babyInfo?.allBabyBaseInfo?.find( const selectedBaby = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected);
(item) => item.selected
);
if (selectedBaby) { if (selectedBaby) {
// const updateData = { // const updateData = {
// id: selectedBaby.id, // id: selectedBaby.id,
// backgroundImg: uploadRes.data.url, // backgroundImg: uploadRes.data.url,
// }; // };
// const updateRes = await updateBabyInfo(updateData); // const updateRes = await updateBabyInfo(updateData);
console.log("userStore.babyInfo?.content?.id====", userStore.babyInfo); console.log('userStore.babyInfo?.content?.id====', userStore.babyInfo);
const updateData = { const updateData = {
id:userStore.babyInfo?.content?.id, id: userStore.babyInfo?.content?.id,
backgroundImg: uploadRes.data.url backgroundImg: uploadRes.data.url,
} };
const updateRes = await saveBabyExtra(updateData); const updateRes = await saveBabyExtra(updateData);
if (updateRes.success) { if (updateRes.success) {
// 刷新用户信息 // 刷新用户信息
await userStore.loadBabyInfo(); await userStore.loadBabyInfo();
// 清空本地临时背景图,使用更新后的 babyInfo // 清空本地临时背景图,使用更新后的 babyInfo
localBackgroundImg.value = ''; localBackgroundImg.value = '';
uni.showToast({ uni.showToast({
title: "背景更新成功", title: '背景更新成功',
icon: "success", icon: 'success',
}); });
} else { } else {
uni.showToast({ uni.showToast({
title: updateRes.message || "更新失败", title: updateRes.message || '更新失败',
icon: "none", icon: 'none',
}); });
} }
} else { } else {
uni.showToast({ uni.showToast({
title: "未找到宝宝信息", title: '未找到宝宝信息',
icon: "none", icon: 'none',
}); });
} }
} else { } else {
uni.showToast({ uni.showToast({
title: uploadRes.message || "上传失败", title: uploadRes.message || '上传失败',
icon: "none", icon: 'none',
}); });
} }
} catch (error) { } catch (error) {
console.error("背景图片上传失败:", error); console.error('背景图片上传失败:', error);
uni.showToast({ uni.showToast({
title: "背景图片上传失败", title: '背景图片上传失败',
icon: "none", icon: 'none',
}); });
} finally { } finally {
hideLoading(); hideLoading();
} }
}, },
fail: (err) => { fail: (err) => {
console.error("选择图片失败:", err); console.error('选择图片失败:', err);
uni.showToast({ uni.showToast({
title: "选择图片失败", title: '选择图片失败',
icon: "none", icon: 'none',
}); });
} },
}); });
}; };
// 页面加载 // 页面加载
onMounted(async () => { onMounted(async () => {
md.sensorLogTake({ md.sensorLogTake({
xcxPage: "我的页面浏览", xcxPage: '我的页面浏览',
pageName: "我的页面", pageName: '我的页面',
}); });
showLoading(); showLoading();
await userStore.loadMemberInfo(); await userStore.loadMemberInfo();
points.value = userStore.memberInfo?.points; 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(); initData();
initExposure(); initExposure();
hideLoading(); hideLoading();
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected)?.id;
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find(
(item) => item.selected
)?.id;
// const a = { // const a = {
// "bgUrl": "my/shengzhangTools.png", // "bgUrl": "my/shengzhangTools.png",
...@@ -1206,17 +1255,18 @@ onMounted(async () => { ...@@ -1206,17 +1255,18 @@ onMounted(async () => {
}); });
watch([() => userStore.userInfo, () => userStore.babyInfo], () => { watch([() => userStore.userInfo, () => userStore.babyInfo], () => {
console.log("userInfo/babyInfo变化", userStore.userInfo, userStore.babyInfo); console.log('userInfo/babyInfo变化', userStore.userInfo, userStore.babyInfo);
initData(); initData();
babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find( babyId.value = userStore.babyInfo?.allBabyBaseInfo?.find((item) => item.selected)?.id;
(item) => item.selected
)?.id;
}); });
watch(() => userStore.memberInfo, () => { watch(
console.log('userStore.memberInfo变化', userStore.memberInfo) () => userStore.memberInfo,
points.value = userStore.memberInfo?.points; () => {
}) console.log('userStore.memberInfo变化', userStore.memberInfo);
points.value = userStore.memberInfo?.points;
}
);
//会员活动点击事件 //会员活动点击事件
const handleVipActiveClick = (index, item) => { const handleVipActiveClick = (index, item) => {
...@@ -1231,16 +1281,16 @@ const handleVipActiveClick = (index, item) => { ...@@ -1231,16 +1281,16 @@ const handleVipActiveClick = (index, item) => {
} }
md.sensorLogTake({ md.sensorLogTake({
xcxClick: "我的页面点击", xcxClick: '我的页面点击',
pageName: "我的页面", pageName: '我的页面',
buttonName: buttonName, buttonName: buttonName,
}); });
md.sensorComponentLogTake({ md.sensorComponentLogTake({
xcxComponentClick: "true", xcxComponentClick: 'true',
pageName: "我的页面", pageName: '我的页面',
componentName: "精彩活动", componentName: '精彩活动',
componentContent: "精彩活动-" + item.title componentContent: '精彩活动-' + item.title,
}) });
const url = item?.link.url; const url = item?.link.url;
const type = item?.link.type; const type = item?.link.type;
const extra = item?.link.extra; const extra = item?.link.extra;
...@@ -1248,15 +1298,15 @@ const handleVipActiveClick = (index, item) => { ...@@ -1248,15 +1298,15 @@ const handleVipActiveClick = (index, item) => {
jump({ jump({
type: type, type: type,
url: url, url: url,
extra: extra extra: extra,
}) });
} };
// 定义页面配置 // 定义页面配置
defineExpose({}); defineExpose({});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import "@/common.less"; @import '@/common.less';
.my-container { .my-container {
min-height: 100vh; min-height: 100vh;
...@@ -1422,10 +1472,8 @@ defineExpose({}); ...@@ -1422,10 +1472,8 @@ defineExpose({});
color: #1d1e25; color: #1d1e25;
} }
} }
} }
.integralContainer { .integralContainer {
position: absolute; position: absolute;
top: 0rpx; top: 0rpx;
...@@ -1458,7 +1506,6 @@ defineExpose({}); ...@@ -1458,7 +1506,6 @@ defineExpose({});
text-align: center; text-align: center;
right: 0rpx; right: 0rpx;
top: 81rpx; top: 81rpx;
} }
} }
...@@ -1687,4 +1734,4 @@ defineExpose({}); ...@@ -1687,4 +1734,4 @@ defineExpose({});
} }
} }
} }
</style> </style>
\ No newline at end of file
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