lex-xin 4 months ago
parent
commit
6a339f16c5

+ 7 - 0
src/student/live-class/live-detail.tsx

@@ -18,6 +18,7 @@ import { state } from '@/state'
 import { browser } from '@/helpers/utils'
 import { tradeOrder } from '../trade/tradeOrder'
 import TheSticky from '@/components/the-sticky'
+import { useStatisticTracking } from '@/helpers/hooks'
 interface IProps {
   courseTime: string
   coursePlan: string
@@ -126,6 +127,12 @@ export default defineComponent({
     } else {
       this.shareUrl = `${location.origin}/teacher/#/shareLive?recomUserId=${state.user.data?.userId}&groupId=${this.groupId}&userType=${state.platformType}&p=tenant`
     }
+
+    /** 埋点 */
+    useStatisticTracking({
+      objectType: "GROUP",
+      objectId: this.groupId as any
+    })
   },
   methods: {
     async _init() {

+ 7 - 0
src/student/video-class/video-detail.tsx

@@ -17,6 +17,7 @@ import { setLogin, state } from '@/state'
 import { browser } from '@/helpers/utils'
 import { usePageVisibility } from '@vant/use'
 import TheSticky from '@/components/the-sticky'
+import { useStatisticTracking } from '@/helpers/hooks'
 export default defineComponent({
   name: 'VideoDetail',
   data() {
@@ -51,6 +52,12 @@ export default defineComponent({
     } else {
       this.shareUrl = `${location.origin}/teacher#/shareVideo?recomUserId=${state.user.data?.userId}&groupId=${this.params.groupId}&userType=${state.platformType}&p=tenant`
     }
+
+    /** 埋点 */
+    useStatisticTracking({
+      objectType: "GROUP",
+      objectId: this.params.groupId as any
+    })
   },
   methods: {
     async _init() {

+ 9 - 8
src/teacher/statistics/home-statistics-detail/buy-item/index.tsx

@@ -2,7 +2,8 @@ import { defineComponent } from 'vue'
 import styles from './index.module.less'
 import { Cell, CellGroup } from 'vant'
 import iconTimer from '@/common/images/icon_timer2.png'
-import iconMoney from '../../images/icon-money.png'
+import icon_student from '@/common/images/icon_student.png'
+import { moneyFormat } from '@/helpers/utils'
 
 export default defineComponent({
   name: 'teacher-item',
@@ -19,31 +20,31 @@ export default defineComponent({
   setup(props) {
     return () => (
       <CellGroup border={false}>
-        {props.list.map((item, index) => (
+        {props.list.map((item: any) => (
           <Cell class={styles.cell} center>
             {{
               title: () => (
                 <div class={styles.top}>
                   <div class={styles.timer}>
                     <img src={iconTimer} />
-                    <span>购买时间:2024-10-30 15:23</span>
+                    <span>购买时间:{item.orderTime}</span>
                   </div>
                   <div class={styles.userInfo}>
-                    <span class={styles.name}>张涵宇张涵宇张涵宇</span>
-                    <img src={iconMoney} />
+                    <span class={styles.name}>{item.userName}</span>
+                    <img src={item.userAvatar || icon_student} />
                   </div>
                 </div>
               ),
               label: () => (
                 <div class={styles.content}>
-                  <img class={[styles.cover, props.isSquare && styles.cover1]} />
+                  <img class={[styles.cover, props.isSquare && styles.cover1]} src={item.bizCover} />
                   <div class={styles.info}>
-                    <div class={styles.iTitle}>著名大号大师严琦带你去走近带你去走近带你去走近音</div>
+                    <div class={styles.iTitle}>{item.bizName}</div>
                     <div class={styles.iPrice}>
                       <span>预计收入</span>
                       <span class={styles.price}>
                         <i>¥</i>
-                        560.00
+                        {moneyFormat(item.amount || 0)}
                       </span>
                     </div>
                   </div>

+ 1 - 1
src/teacher/statistics/home-statistics-detail/index.module.less

@@ -25,7 +25,7 @@
       background: #2dc7aa;
       border-radius: 2px;
     }
-    .van-tabs__content {
+    .van-tabs__content, .van-tab__panel {
       height: calc(100vh - var(--van-tabs-line-height) - var(--header-height, 0));
       overflow-x: hidden;
       overflow-y: auto;

+ 1 - 1
src/teacher/statistics/home-statistics-detail/index.tsx

@@ -14,7 +14,7 @@ export default defineComponent({
           <ColHeader border={false} background="transparent" />
         </TheSticky>
 
-        <Tabs class={styles.tabs} swipeable>
+        <Tabs class={styles.tabs}>
           <Tab title="VIP定制课" name="VIP_COURSE">
             <List type="VIP_COURSE" />
           </Tab>

+ 8 - 1
src/teacher/statistics/home-statistics-detail/list/index.module.less

@@ -6,7 +6,14 @@
   background: #ffffff;
   border-radius: 10px;
   margin: 12px 14px 0;
-  overflow: hidden;
+  // overflow: hidden;
+  :global {
+    .van-list__loading,
+    .van-list__finished-text,
+    .van-list__error-text {
+      width: 100%;
+    }
+  }
   .incomeTitle {
     display: flex;
     align-items: center;

+ 9 - 3
src/teacher/statistics/home-statistics-detail/list/index.tsx

@@ -1,13 +1,13 @@
 import { defineComponent, PropType, ref } from 'vue'
 import styles from './index.module.less'
-import { CellGroup, List, Sticky } from 'vant'
+import { CellGroup, List } from 'vant'
 import iconMoney from '../../images/icon-money.png'
 import ColResult from '@/components/col-result'
 import Echats from '../echats'
 import TeacherItem from '../teacher-item'
 import BuyItem from '../buy-item'
 import request from '@/helpers/request'
-import { getTimeRange, TIME_TYPE } from '../../home-statistics'
+import { getTimeRange } from '../../home-statistics'
 import { moneyFormat } from '@/helpers/utils'
 
 export default defineComponent({
@@ -129,10 +129,14 @@ export default defineComponent({
     }
 
     const getList = async () => {
+      console.log(state.loading, state)
+      // if (state.loading || state.finished) return; // 如果正在加载或者已加载完,则返回
+      state.loading = true
       try {
         const { data } = await request.post(
           '/api-teacher/home/teacherIncomeList',
           {
+            hideLoading: false,
             data: {
               ...timeRange.value,
               type: props.type,
@@ -141,17 +145,18 @@ export default defineComponent({
           }
         )
 
-        state.loading = false
         state.statInfo = data.statInfo || 0
         tableList.value = tableList.value.concat(data.rows || [])
 
         state.finished = data.pageNo >= data.totalPage
+
         state.params.page = data.pageNo + 1
         dataShow.value = tableList.value.length > 0
       } catch {
         dataShow.value = false
         state.finished = true
       }
+      state.loading = false
     }
 
     getSysConfig()
@@ -195,6 +200,7 @@ export default defineComponent({
               v-model:loading={state.loading}
               finished={state.finished}
               finishedText=" "
+              immediateCheck={false}
               onLoad={getList}
             >
               <CellGroup border={false}>

+ 9 - 11
src/teacher/statistics/home-statistics-detail/teacher-item/index.tsx

@@ -2,8 +2,8 @@ import { defineComponent } from 'vue'
 import styles from './index.module.less'
 import { Cell, CellGroup } from 'vant'
 import iconTimer from '@/common/images/icon_timer2.png'
-import iconMoney from '../../images/icon-money.png'
-import ColResult from '@/components/col-result'
+import icon_student from '@/common/images/icon_student.png'
+import { moneyFormat } from '@/helpers/utils'
 
 export default defineComponent({
   name: 'teacher-item',
@@ -16,36 +16,34 @@ export default defineComponent({
   setup(props) {
     return () => (
       <CellGroup border={false}>
-        {props.list.map((item, index) => (
+        {props.list.map((item: any, index) => (
           <Cell class={styles.cell} center>
             {{
               title: () => (
                 <div class={styles.timer}>
                   <img src={iconTimer} />
-                  <span>购买时间:2024-10-30 15:23</span>
+                  <span>购买时间:{item.orderTime}</span>
                 </div>
               ),
               label: () => (
                 <div class={styles.content}>
                   <div class={styles.userInfo}>
-                    <img src={iconMoney} />
+                    <img src={item.userAvatar || icon_student} />
                     <div class={styles.item}>
-                      <span class={styles.name}>
-                        {index === 0 ? '张涵宇张涵宇张涵宇' : '张涵宇'}
-                      </span>
-                      <span class={styles.subjects}>长笛</span>
+                      <span class={styles.name}>{item.userName}</span>
+                      {item.subjectName && <span class={styles.subjects}>{item.subjectName}</span>}
                     </div>
                   </div>
                   <div class={styles.item} style={{ alignItems: 'center' }}>
                     <span class={styles.name}>课时数</span>
                     <span class={styles.classNum}>
-                      12 <i>节</i>
+                      {item.bizQuantity} <i>节</i>
                     </span>
                   </div>
                   <div class={styles.item} style={{ alignItems: 'flex-end' }}>
                     <span class={styles.name}>预计收入</span>
                     <span class={styles.classPrice}>
-                      <i>¥</i> 560.00
+                      <i>¥</i> {moneyFormat(item.amount || 0)}
                     </span>
                   </div>
                 </div>

+ 1 - 1
src/teacher/statistics/home-statistics/index.module.less

@@ -3,7 +3,7 @@
   box-shadow: 0px 2px 10px 0px rgba(229, 229, 229, 0.1);
   border-radius: 10px;
   padding: 12px;
-  margin: 0 14px;
+  // margin: 0 14px;
 }
 
 .homeHead {

+ 6 - 1
src/teacher/statistics/home-statistics/index.tsx

@@ -40,7 +40,7 @@ import { CanvasRenderer } from 'echarts/renderers'
 import { format } from 'path'
 import request from '@/helpers/request'
 import dayjs from 'dayjs'
-import { postMessage } from '@/helpers/native-message'
+import { listenerMessage, postMessage } from '@/helpers/native-message'
 import { browser } from '@/helpers/utils'
 import { useRouter } from 'vue-router'
 
@@ -314,6 +314,11 @@ export default defineComponent({
         router.push({ path: '/home-statistics-detail' })
       }
     }
+
+    // 监听页面返回
+    listenerMessage('webViewOnResume', () => {
+      getDetail()
+    })
     return () => (
       <div class={styles.homeStatistics} ref={homeStatisticsRef}>
         <div class={styles.homeHead}>

+ 12 - 2
src/views/music/music-detail/index.tsx

@@ -59,6 +59,7 @@ import Download from './download'
 import { getInstrumentName } from '@/constant/instruments'
 import { svgtopng } from '@/tenant/music/music-detail/formatSvgToImg'
 import { useThrottleFn } from '@vueuse/core'
+import { useStatisticTracking } from '@/helpers/hooks'
 // import {
 //   formatXML,
 //   getCustomInfo,
@@ -301,18 +302,27 @@ export default defineComponent({
           staffData.instrumentId = instrumentId
         }
       }
-      
+
       const subjectIds = state.user.data?.subjectId
       if(subjectIds) {
         const subjectId = subjectIds.split(',')[0]
         staffData.subjectId = subjectId
       }
-        
+
       postMessage({
         api: 'setStatusBarTextColor',
         content: { statusBarTextColor: true }
       })
       await FetchList()
+
+      if(state.platformType === "STUDENT") {
+        /** 埋点 */
+        useStatisticTracking({
+          objectType: "GROUP",
+          objectId: route.query.id as any
+        })
+      }
+
       const { height } = useRect(headers as any)
       const footer = useRect(footers as any)
       heightInfo.value = height + footer.height