Commit f401f413 authored by tao.huang's avatar tao.huang

feat: 埋点

parent 73871a9c
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
class="banner_upload" class="banner_upload"
:src="$baseUrl + 'person/customer.png'" :src="$baseUrl + 'person/customer.png'"
mode="aspectFit" mode="aspectFit"
:data-log="{
xcxClick: '我的页面-信息修改页点击',
pageName: '我的页面-信息修改页',
buttonName: '上传背景',
}"
@click="handleUploadBackground" @click="handleUploadBackground"
/> />
...@@ -225,6 +230,7 @@ import { uploadImage } from "../../api/common.js"; ...@@ -225,6 +230,7 @@ import { uploadImage } from "../../api/common.js";
import { showLoading, hideLoading } from "../../utils/index.js"; import { showLoading, hideLoading } from "../../utils/index.js";
import { updateBabyInfo, getGestationalWeeks } from "../../api/user.js"; import { updateBabyInfo, getGestationalWeeks } from "../../api/user.js";
import { usePageCfgStore } from "../../stores/pageCfg"; import { usePageCfgStore } from "../../stores/pageCfg";
import md from "../../md.js";
const userStore = useUserStore(); const userStore = useUserStore();
const pageType = ref("add"); const pageType = ref("add");
...@@ -505,6 +511,12 @@ const onRadioChange = (e, name) => { ...@@ -505,6 +511,12 @@ const onRadioChange = (e, name) => {
formData.value[name] = e.detail.value; formData.value[name] = e.detail.value;
}; };
const onSubmit = async (e) => { const onSubmit = async (e) => {
md.sensorLogTake({
xcxClick: "我的页面-信息修改页点击",
pageName: "我的页面-信息修改页",
buttonName: "保存",
});
// 获取当前阶段需要校验的字段 // 获取当前阶段需要校验的字段
const fieldsToValidate = FormMap[formData.value.babyStage].filter( const fieldsToValidate = FormMap[formData.value.babyStage].filter(
(field) => field !== "babyStage" (field) => field !== "babyStage"
...@@ -588,6 +600,12 @@ const handleReturn = () => { ...@@ -588,6 +600,12 @@ const handleReturn = () => {
}; };
const handleFormBottomBtn = () => { const handleFormBottomBtn = () => {
md.sensorLogTake({
xcxClick: "我的页面-信息修改页点击",
pageName: "我的页面-信息修改页",
buttonName: pageStatus.value.formStatus == 1 ? "收起" : "展开",
});
pageStatus.value.formStatus = pageStatus.value.formStatus == 1 ? 2 : 1; pageStatus.value.formStatus = pageStatus.value.formStatus == 1 ? 2 : 1;
}; };
...@@ -607,6 +625,7 @@ const onChooseAvatar = async (e) => { ...@@ -607,6 +625,7 @@ const onChooseAvatar = async (e) => {
}; };
const handleUploadBackground = async (e) => { const handleUploadBackground = async (e) => {
md.sensorLog(e);
// 唤起图片选择器 // 唤起图片选择器
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
...@@ -720,6 +739,11 @@ const initData = () => { ...@@ -720,6 +739,11 @@ const initData = () => {
}; };
onMounted(() => { onMounted(() => {
md.sensorLogTake({
xcxPage: "宝宝信息页面浏览",
pageName: "我的页面-信息修改页",
});
initData(); initData();
}); });
......
...@@ -10,7 +10,15 @@ ...@@ -10,7 +10,15 @@
@update:selectedIndex="(val) => (wheelSelectedIndex = val)" @update:selectedIndex="(val) => (wheelSelectedIndex = val)"
/> />
</view> </view>
<view class="bg-container" @click="handleEditProfile"> <view
class="bg-container"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '个人信息修改',
}"
@click="handleEditProfile"
>
<image <image
class="bg-img" class="bg-img"
:src=" :src="
...@@ -42,7 +50,15 @@ ...@@ -42,7 +50,15 @@
:style="{ 'min-height': cfgStatus.showDetail ? '343rpx' : '180rpx' }" :style="{ 'min-height': cfgStatus.showDetail ? '343rpx' : '180rpx' }"
> >
<view class="user-header"> <view class="user-header">
<view class="avatar-container" @click="handleEditProfile"> <view
class="avatar-container"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '个人信息修改',
}"
@click="handleEditProfile"
>
<image <image
class="avatar" class="avatar"
:src=" :src="
...@@ -60,7 +76,15 @@ ...@@ -60,7 +76,15 @@
/> />
<view class="user-detail"> <view class="user-detail">
<view class="user-detail-nickname" @click="handleChangeBaby"> <view
class="user-detail-nickname"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '宝宝信息切换',
}"
@click="handleChangeBaby"
>
<text class="nickname">{{ <text class="nickname">{{
babyInfo?.babyStage === 0 babyInfo?.babyStage === 0
? "备孕" ? "备孕"
...@@ -115,7 +139,7 @@ ...@@ -115,7 +139,7 @@
<text <text
v-if="wheelOptions[wheelSelectedIndex]?.desc.length > 46" v-if="wheelOptions[wheelSelectedIndex]?.desc.length > 46"
class="desc-more" class="desc-more"
@click="cfgStatus.openBabyCardDesc = !cfgStatus.openBabyCardDesc" @click="handleOpenClick"
>{{ cfgStatus.openBabyCardDesc ? "点击收起" : "点击展开" }}</text >{{ cfgStatus.openBabyCardDesc ? "点击收起" : "点击展开" }}</text
> >
</view> </view>
...@@ -150,8 +174,26 @@ ...@@ -150,8 +174,26 @@
<!-- 协议 --> <!-- 协议 -->
<view class="protocol-container"> <view class="protocol-container">
<image :src="$baseUrl + 'my/protocol.png'" mode="aspectFit" /> <image :src="$baseUrl + 'my/protocol.png'" mode="aspectFit" />
<view class="hot-member" @click="handleHot" data-type="member"></view> <view
<view class="hot-privacy" @click="handleHot" data-type="privacy"></view> class="hot-member"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '会员规则',
}"
@click="handleHot"
data-type="member"
></view>
<view
class="hot-privacy"
:data-log="{
xcxClick: '我的页面点击',
pageName: '我的页面',
buttonName: '隐私协议',
}"
@click="handleHot"
data-type="privacy"
></view>
</view> </view>
<RegisterLayer v-model="showRegisterLayer" @confirm="onRegisterConfirm" /> <RegisterLayer v-model="showRegisterLayer" @confirm="onRegisterConfirm" />
</view> </view>
...@@ -167,6 +209,7 @@ import { usePageCfgStore } from "@/stores/pageCfg"; ...@@ -167,6 +209,7 @@ 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";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const $baseUrl = proxy.$baseUrl; const $baseUrl = proxy.$baseUrl;
...@@ -191,6 +234,7 @@ const showBabySwitcher = ref(false); ...@@ -191,6 +234,7 @@ const showBabySwitcher = ref(false);
const handleHot = (e) => { const handleHot = (e) => {
const type = e.currentTarget.dataset.type; const type = e.currentTarget.dataset.type;
md.sensorLog(e);
console.log("handleHot", type); console.log("handleHot", type);
...@@ -217,6 +261,12 @@ const navigateTo = (url) => { ...@@ -217,6 +261,12 @@ const navigateTo = (url) => {
}; };
const handleToolClick = async (item) => { const handleToolClick = async (item) => {
md.sensorLogTake({
xcxClick: "我的页面点击",
pageName: "我的页面",
buttonName: item.title,
});
if (item.title === "医生问诊") { if (item.title === "医生问诊") {
if (!cfgStatus.value.isRegister) return; if (!cfgStatus.value.isRegister) return;
...@@ -254,11 +304,17 @@ const handleToolClick = async (item) => { ...@@ -254,11 +304,17 @@ const handleToolClick = async (item) => {
}; };
// 编辑个人资料 // 编辑个人资料
const handleEditProfile = () => { const handleEditProfile = (e) => {
if (!cfgStatus.value.isRegister || !userStore.userInfo || JSON.stringify(userStore.userInfo) === "{}") { if (
!cfgStatus.value.isRegister ||
!userStore.userInfo ||
JSON.stringify(userStore.userInfo) === "{}"
) {
return; return;
} }
md.sensorLog(e);
const type = const type =
userStore.babyInfo?.allBabyBaseInfo?.length == 0 ? "add" : "edit"; userStore.babyInfo?.allBabyBaseInfo?.length == 0 ? "add" : "edit";
const babyId = userStore.babyInfo?.allBabyBaseInfo.find( const babyId = userStore.babyInfo?.allBabyBaseInfo.find(
...@@ -320,10 +376,13 @@ const getRealtimePhoneNumber = async (e) => { ...@@ -320,10 +376,13 @@ const getRealtimePhoneNumber = async (e) => {
}); });
}; };
const handleChangeBaby = () => { const handleChangeBaby = (e) => {
if (!cfgStatus.value.isRegister) { if (!cfgStatus.value.isRegister) {
return; return;
} }
md.sensorLog(e);
showBabySwitcher.value = true; showBabySwitcher.value = true;
}; };
...@@ -339,13 +398,32 @@ async function onSelectBaby(baby) { ...@@ -339,13 +398,32 @@ async function onSelectBaby(baby) {
} }
function onAddBaby() { function onAddBaby() {
md.sensorLogTake({
xcxClick: "我的页面点击",
pageName: "我的页面",
buttonName: "新增入口",
});
// 跳转到新增宝宝页面 // 跳转到新增宝宝页面
showBabySwitcher.value = false; showBabySwitcher.value = false;
navigateTo("/pages/person/person?type=add"); navigateTo("/pages/person/person?type=add");
} }
const handleOpenClick = () => {
md.sensorLogTake({
xcxClick: "我的页面点击",
pageName: "我的页面",
buttonName: cfgStatus.value.openBabyCardDesc ? "收起" : "展开",
});
cfgStatus.value.openBabyCardDesc = !cfgStatus.value.openBabyCardDesc;
};
// 页面加载 // 页面加载
onMounted(async () => { onMounted(async () => {
md.sensorLogTake({
xcxPage: "我的页面浏览",
pageName: "我的页面",
});
showLoading(); showLoading();
await pageCfgStore.fetchCfg(); await pageCfgStore.fetchCfg();
initData(); initData();
......
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