Просмотр исходного кода

Merge branch 'main' of http://39.106.91.179:3000/hunter/designer-hub into main

purui 2 месяцев назад
Родитель
Сommit
6dc76e9e8d

+ 1 - 0
packages/app/src/components/moment-item.vue

@@ -58,6 +58,7 @@ const dictLabelChange = (dictArr:any, value:any) => {
 }
 
 onMounted(async () => {
+  console.log(features.value,"features")
   if (
     props.options.circleType === '1' &&
     props.options.bannerUrls?.length === 1 &&

+ 31 - 33
packages/app/src/composables/analysis.ts

@@ -2,7 +2,6 @@ import { createBrowseHistory, createBrowseRecord } from '@/core/libs/requests'
 import { useUserStore } from '@/store'
 import { storeToRefs } from 'pinia'
 import dayjs from 'dayjs'
-
 export enum AnalysisEventType {
   LaunchApp = 4,
   /**
@@ -12,40 +11,38 @@ export enum AnalysisEventType {
   /**
    * 浏览页面
    */
-  ViewPage = 3,
+  ViewPage = 6,
 }
 export const useAnalysis = (automatic: boolean, isApp = false) => {
   const userStore = useUserStore()
   const { userInfo, isLogined } = storeToRefs(userStore)
   const viewDuration = ref(0)
-  const viewStartAt = ref<Date>()
+  const viewStartAt = ref<Date | null>(null);
   const option = ref<Record<string, any>>({})
 
-  const report = async (type) => {
-    if (!isLogined.value) return
-    const duration = automatic
-      ? (viewDuration.value = dayjs().diff(viewStartAt.value, 'second'))
-      : 0
+  const report = async (type: AnalysisEventType, duration: number) => {
+    if (!isLogined.value) return;
 
-    await createBrowseRecord({
-      stylistId: userInfo.value.userId,
-      bizType: type,
-      duration,
-      ...option.value,
-    })
-    viewDuration.value = 0
-    viewStartAt.value = undefined
-    option.value = {}
-  }
+    try {
+      await createBrowseRecord({
+        stylistId: userInfo.value.userId,
+        bizType: type,
+        duration,
+        ...option.value,
+      });
+    } catch (error) {
+      console.error('Failed to report:', error);
+    } finally {
+      option.value = {};
+    }
+  };
 
   onLaunch(async () => {
-    // if (automatic && isLogined) {
-    //   await createBrowseRecord({
-    //     stylistId: userInfo.value.userId,
-    //     bizType: AnalysisEventType.LaunchApp,
-    //     duration: 1,
-    //   })
-    // }
+    if (automatic) {
+      if (isApp) {
+        await report(AnalysisEventType.LaunchApp,0)
+      }
+    }
   })
   onLoad(() => {
     console.log('analysis')
@@ -60,16 +57,17 @@ export const useAnalysis = (automatic: boolean, isApp = false) => {
     }
   })
   onHide(async () => {
-    if (automatic) {
-      if (isApp) {
-        await report(AnalysisEventType.LaunchApp)
-      }
+    if (automatic && viewStartAt.value) {
+      const duration = dayjs().diff(viewStartAt.value, 'second');
+      console.log(`本次使用时长:${duration} 秒`);
+      await report(AnalysisEventType.ViewPage, duration);
     }
-  })
+  });
+
   onUnload(async () => {
-    if (automatic) {
-      await report(AnalysisEventType.ViewPage)
-    }
+    // if (automatic) {
+    //   await report(AnalysisEventType.ViewPage)
+    // }
   })
   return { option, report }
 }

+ 60 - 0
packages/merchant/src/pages/agent/designer/archives/activity/index.vue

@@ -0,0 +1,60 @@
+<route lang="json">
+{ "style": { "navigationBarTitleText": "数据明细", "navigationBarBackgroundColor": "#fff" } }
+</route>
+<script setup lang="ts">
+import {getDesignerEvents} from "@/core/libs/agent-requests";
+
+
+import PageHelperEvo from '@/components/page-helper-evo.vue'
+import dayjs from "dayjs";
+const type = ref()
+const subType = ref()
+const userId = ref()
+const query = computed(() => ({ userId: userId.value, type:type.value,subType:subType.value }))
+onLoad((query) => {
+  type.value = query?.type || '';       // 获取 type 参数
+  subType.value = query?.subType || ''; // 获取 subType 参数
+  userId.value = query?.userId || '';
+})
+</script>
+
+<template>
+  <div class="flex-grow flex flex-col">
+    <div class="mt-4 bg-white flex-grow">
+  <PageHelperEvo
+    ref="pageHelperRef"
+    :request="getDesignerEvents"
+    :query="query"
+    class="flex-grow"
+  >
+    <template #default="{ source }">
+      <div class="flex flex-col gap-4 p-8.75">
+        <template v-for="(it, index) in source?.list" :key="index">
+          <div>
+            <div
+                class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed"
+            >
+              {{ it.name }}
+            </div>
+            <div class="flex items-center justify-between">
+              <div
+                  class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-relaxed"
+              >
+                参加日期:
+                {{ dayjs(it.applyTime).format('YYYY/MM/DD') }}
+              </div>
+            </div>
+            <div class="w-full h-.2 bg-[#f4f4f4] my-4"></div>
+          </div>
+
+        </template>
+      </div>
+    </template>
+  </PageHelperEvo>
+    </div>
+  </div>
+</template>
+
+<style scoped lang="scss">
+
+</style>

+ 5 - 4
packages/merchant/src/pages/agent/designer/archives/index.vue

@@ -252,14 +252,14 @@ onShow(async () => {
 </script>
 <template>
   <div class="flex-grow flex flex-col">
-    <div class="mx--3.5 fixed left-4 w-full bg-white z-10">
+    <div class="mx--3.5 fixed left-4 w-full bg-white z-10 ">
       <wd-tabs v-model="tab" :swipeable="true" :slidable-num="4" >
         <template v-for="(it, index) in tabs" :key="index">
           <wd-tab :title="it.label" :name="it.value" ></wd-tab>
         </template>
       </wd-tabs>
     </div>
-    <div class="flex flex-col flex-grow gap-5">
+    <div class="flex flex-col flex-grow gap-5  mt-3">
       <template v-if="tab === 'basic'">
         <div class="bg-white mt-4 flex flex-col gap-5 p-4">
           <template
@@ -537,13 +537,14 @@ onShow(async () => {
                   </template>
                   <template v-else>
                     <div class="py-4">
+
                       <SectionHeading
                         :title="item.label"
-                        :end-text="item.value"
+                        :end-text="`${item.value}次`"
                         :path="
                           index === list.length - 1
                             ? `/pages/agent/designer/archives/activity/others/index?id=${id}`
-                            : ''
+                            : item.value > 0 ? `/pages/agent/designer/archives/activity/index?userId=${id}&type=${item.type}&subType=${item.subType}` : ''
                         "
                       ></SectionHeading>
                     </div>