Pārlūkot izejas kodu

Merge branch 'Leaderboard-8.30' into dev

skyblued 2 gadi atpakaļ
vecāks
revīzija
ed80ce175b
1 mainītis faili ar 15 papildinājumiem un 10 dzēšanām
  1. 15 10
      src/student/leaderboard/index.tsx

+ 15 - 10
src/student/leaderboard/index.tsx

@@ -1,5 +1,5 @@
 import { Button, Cell, Empty, Image, Tab, Tabs } from 'vant'
-import { computed, defineComponent, onMounted, reactive, ref } from 'vue'
+import { computed, defineComponent, nextTick, onMounted, reactive, ref } from 'vue'
 import styles from './index.module.less'
 import IconTrophy from './image/icon-trophy.png'
 import IconEmtry from './image/icon-emtry.png'
@@ -30,7 +30,7 @@ export default defineComponent({
     const getMusicList = async () => {
       try {
         const {
-          data: { activityMusicVoList, shareUrl }
+          data: { activityMusicVoList, shareUrl,subjectUrl }
         } = await request.post(
           `/api-student/open/activity/info/${route.query.id}`
         )
@@ -41,7 +41,7 @@ export default defineComponent({
             return n
           })
         }
-        img.value = shareUrl
+        img.value = subjectUrl
       } catch (error) {}
     }
     const getData = async () => {
@@ -66,7 +66,7 @@ export default defineComponent({
     }
     const img = ref()
     const imgShow = ref(false)
-    const imgHeight = ref(42)
+    const imgHeight = ref(100)
 
     const openActive = () => {
       router.back()
@@ -100,17 +100,23 @@ export default defineComponent({
         step
       }
     })
+    const imgRef = ref()
     return () => (
       <div class={styles.leaderboard}>
         <div class={styles.container}>
-          <div class={styles.headImg}>
+          <div class={styles.headImg} ref={imgRef}>
             <Image
               width="100%"
               fit="cover"
               src={img.value}
               onLoad={img => {
-                imgHeight.value = img.target.height
-                imgShow.value = true
+                nextTick(() => {
+                  imgShow.value = true
+                  imgHeight.value = imgRef.value?.offsetHeight || 100
+                })
+              }}
+              onError={(err) => {
+                console.log(err)
               }}
             />
           </div>
@@ -140,7 +146,6 @@ export default defineComponent({
 
                         {item.rankingList.map((n: any, index: number) => {
                           const t = (index + 1).toString().padStart(2, '0')
-                          const time = (n.joinDate + '').split(' ')[0]
                           return (
                             <div class={styles.item}>
                               <div class={styles.left}>
@@ -163,7 +168,7 @@ export default defineComponent({
                               </div>
                               <div class={styles.right}>
                                 <div class={styles.fraction}>{n.score}分</div>
-                                <div class={styles.time}>{time}</div>
+                                <div class={styles.time}>{n.joinDate}</div>
                               </div>
                             </div>
                           )
@@ -183,7 +188,7 @@ export default defineComponent({
             </Tabs>
           )}
           {user.value.userId && (
-            <div class={styles.activeUser}>
+            <div class={[styles.activeUser, 'van-safe-area-bottom']}>
               <Cell
                 center
                 title={user.value.username}