feat: card log
This commit is contained in:
@@ -73,3 +73,11 @@ export const getTipsList = async () => {
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const createTracking = async (data) => {
|
||||
return request({
|
||||
url: "/api/common/tracking/create",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -218,6 +218,7 @@ import {
|
||||
uploadImage,
|
||||
saveViewRequest,
|
||||
} from "@/utils/common.js";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
|
||||
@@ -488,6 +489,7 @@ const handleLogind = async () => {
|
||||
};
|
||||
|
||||
const onChooseAlbum = () => {
|
||||
trackRecord({ eventName: "avatar_choose_album", eventType: "click" });
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ["original", "compressed"],
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
@tap.stop="openBgmList"
|
||||
:class="{ playing: isBgmPlaying }"
|
||||
>
|
||||
<uni-icons type="headphones" size="20" color="#fff"></uni-icons>
|
||||
<text class="music-icon">{{ isBgmPlaying ? "🎵" : "🔇" }}</text>
|
||||
</view>
|
||||
<view class="premium-tag">
|
||||
<uni-icons type="info" size="12" color="#fff"></uni-icons>
|
||||
@@ -513,7 +513,7 @@ import {
|
||||
} from "@dcloudio/uni-app";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
import { saveRecordRequest, uploadImage } from "@/utils/common.js";
|
||||
import { saveRecordRequest, uploadImage, trackRecord } from "@/utils/common.js";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const loginPopupRef = ref(null);
|
||||
@@ -1205,6 +1205,11 @@ onShareTimeline(async () => {
|
||||
});
|
||||
|
||||
const selectGreeting = (text) => {
|
||||
trackRecord({
|
||||
eventName: "card_text_choose",
|
||||
eventType: "click",
|
||||
elementId: text?.id,
|
||||
});
|
||||
blessingText.value = text;
|
||||
};
|
||||
|
||||
@@ -1231,11 +1236,21 @@ const templates = ref([]);
|
||||
const currentTemplate = ref(templates.value[0]);
|
||||
|
||||
const applyTemplate = (tpl) => {
|
||||
trackRecord({
|
||||
eventName: "card_tpl_choose",
|
||||
eventType: "click",
|
||||
elementId: tpl?.id,
|
||||
});
|
||||
currentTemplate.value = tpl;
|
||||
closePanel();
|
||||
};
|
||||
|
||||
const selectTitle = (title) => {
|
||||
trackRecord({
|
||||
eventName: "card_title_choose",
|
||||
eventType: "click",
|
||||
elementId: title?.id,
|
||||
});
|
||||
if (currentTitle.value?.id === title?.id) {
|
||||
currentTitle.value = null;
|
||||
} else {
|
||||
|
||||
@@ -159,7 +159,7 @@ const userInfo = computed(() => ({
|
||||
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
|
||||
const isIos = false;
|
||||
const isIos = computed(() => uni.getSystemInfoSync().osName === "ios");
|
||||
|
||||
onMounted(() => {
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { getDeviceInfo } from "@/utils/system";
|
||||
import { saveRecord, viewRecord, createShareToken } from "@/api/system";
|
||||
import {
|
||||
saveRecord,
|
||||
viewRecord,
|
||||
createShareToken,
|
||||
createTracking,
|
||||
} from "@/api/system";
|
||||
|
||||
export const generateObjectId = (
|
||||
m = Math,
|
||||
@@ -101,3 +106,10 @@ export const getShareToken = async (scene, targetId = "") => {
|
||||
});
|
||||
return shareTokenRes?.shareToken || "";
|
||||
};
|
||||
|
||||
export const trackRecord = (event) => {
|
||||
createTracking({
|
||||
...event,
|
||||
page: getCurrentPages().pop()?.route,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -39,6 +39,10 @@ export const getLeftIconLeft = () => {
|
||||
// #endif
|
||||
};
|
||||
|
||||
export function getPlatform() {
|
||||
return getPlatformProvider().replace("mp-", "");
|
||||
}
|
||||
|
||||
export function getPlatformProvider() {
|
||||
const platform = process.env.UNI_PLATFORM;
|
||||
return platform || "mp-weixin";
|
||||
@@ -55,10 +59,6 @@ export function getPlatformProvider() {
|
||||
// return typeof tt !== 'undefined' ? 'toutiao' : 'weixin';
|
||||
}
|
||||
|
||||
export function getPlatform() {
|
||||
return getPlatformProvider().replace("mp-", "");
|
||||
}
|
||||
|
||||
export function getDeviceInfo() {
|
||||
const info = uni.getSystemInfoSync();
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user