lex 3 years ago
parent
commit
3b27e54110

+ 16 - 15
src/student/teacher-dependent/model/teacher-header.tsx

@@ -66,27 +66,28 @@ export default defineComponent({
               center
               v-slots={{
                 icon: () => (
-                  <div style={{ position: 'relative', lineHeight: 0 }}>
+                  <div
+                    style={{ position: 'relative', lineHeight: 0 }}
+                    onClick={() => {
+                      // 判断是否在直播中
+                      if (this.userInfo.liveing === 1) {
+                        postMessage({
+                          api: 'joinLiveRoom',
+                          content: {
+                            roomId: this.userInfo.roomUid,
+                            teacherId: this.userInfo.userId
+                          }
+                        })
+                      }
+                    }}
+                  >
                     <Image
                       class={styles.userLogo}
                       src={this.userInfo.heardUrl || iconTeacher}
                       fit="cover"
                     />
                     {this.userInfo.liveing === 1 && (
-                      <p
-                        class={styles.liveTag}
-                        onClick={() => {
-                          postMessage({
-                            api: 'joinLiveRoom',
-                            content: {
-                              roomId: this.userInfo.roomUid,
-                              teacherId: this.userInfo.userId
-                            }
-                          })
-                        }}
-                      >
-                        直播中
-                      </p>
+                      <p class={styles.liveTag}>直播中</p>
                     )}
                   </div>
                 )

+ 18 - 8
src/student/teacher-dependent/teacher-home.tsx

@@ -8,6 +8,7 @@ import Live from './components/live'
 import VideoList from './components/video'
 import Music from './components/music'
 import request from '@/helpers/request'
+import { listenerMessage } from '@/helpers/native-message'
 import { useEventListener, useWindowScroll } from '@vueuse/core'
 import TeacherHeader from './model/teacher-header'
 import { useRect } from '@vant/use'
@@ -34,14 +35,11 @@ export default defineComponent({
   },
   async created() {},
   async mounted() {
-    try {
-      const res = await request.get('/api-student/teacher/queryTeacherHome', {
-        params: {
-          userId: this.teacherId
-        }
-      })
-      this.userInfo = res.data
-    } catch {}
+    this.getTeacherDetail()
+    // 监听页面返回
+    listenerMessage('webViewOnResume', () => {
+      this.getTeacherDetail()
+    })
     useEventListener(document, 'scroll', evt => {
       const { y } = useWindowScroll()
       if (y.value > 45) {
@@ -51,6 +49,18 @@ export default defineComponent({
       }
     })
   },
+  methods: {
+    async getTeacherDetail() {
+      try {
+        const res = await request.get('/api-student/teacher/queryTeacherHome', {
+          params: {
+            userId: this.teacherId
+          }
+        })
+        this.userInfo = res.data
+      } catch {}
+    }
+  },
   render() {
     return (
       <div class={styles['teacher-record']}>

+ 2 - 2
src/student/trade/tradeOrder.ts

@@ -82,9 +82,9 @@ export const formatOrderDetail = async (item: any) => {
           tempList = {
             orderType: item.goodType,
             goodName: item.goodName,
-            id: res.id,
+            id: item.id,
             title: memberType[res.period] || '',
-            price: res.salePrice,
+            price: res.salePrice || item.actualPrice,
             startTime: dayjs(res.startTime).format('YYYY-MM-DD'),
             endTime: dayjs(res.endTime).format('YYYY-MM-DD')
           }