瀏覽代碼

Merge branch 'Leaderboard-8.30' into dev

skyblued 2 年之前
父節點
當前提交
da6b598990
共有 2 個文件被更改,包括 52 次插入50 次删除
  1. 3 0
      src/student/leaderboard/index.module.less
  2. 49 50
      src/student/leaderboard/index.tsx

+ 3 - 0
src/student/leaderboard/index.module.less

@@ -107,6 +107,9 @@
     .van-cell__title{
       font-weight: bold;
     }
+    .van-cell__label{
+      font-weight: 400;
+    }
     .van-cell__value {
       flex: initial;
       margin-left: 8px;

+ 49 - 50
src/student/leaderboard/index.tsx

@@ -1,5 +1,12 @@
 import { Button, Cell, Empty, Image, Tab, Tabs } from 'vant'
-import { computed, defineComponent, nextTick, 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'
@@ -25,23 +32,23 @@ export default defineComponent({
     const router = useRouter()
     const state = reactive({
       tabIndex: 0,
-      musicList: [] as IMusicItem[]
+      musicList: [] as IMusicItem[],
+      isSignup: false // 是否报名
     })
     const getMusicList = async () => {
       try {
-        const {
-          data: { activityMusicVoList, shareUrl,subjectUrl }
-        } = await request.post(
+        const { data } = await request.post(
           `/api-student/open/activity/info/${route.query.id}`
         )
-        if (Array.isArray(activityMusicVoList)) {
-          state.musicList = activityMusicVoList.map(n => {
+        if (Array.isArray(data.activityMusicVoList)) {
+          state.musicList = data.activityMusicVoList.map(n => {
             n.rankingList = []
             n.loaded = false
             return n
           })
         }
-        img.value = subjectUrl
+        img.value = data.subjectUrl
+        state.isSignup = data.join ? true : false
       } catch (error) {}
     }
     const getData = async () => {
@@ -115,7 +122,7 @@ export default defineComponent({
                   imgHeight.value = imgRef.value?.offsetHeight || 100
                 })
               }}
-              onError={(err) => {
+              onError={err => {
                 console.log(err)
               }}
             />
@@ -187,7 +194,25 @@ export default defineComponent({
               })}
             </Tabs>
           )}
-          {user.value.userId && (
+          {!state.isSignup ? (
+            <div class={[styles.activeUser, 'van-safe-area-bottom']}>
+              <Cell
+                center
+                title={user.value.username}
+                label="您尚未报名参赛"
+                v-slots={{
+                  icon: () => (
+                    <Image
+                      class={styles.avator}
+                      fit="cover"
+                      round
+                      src={user.value.heardUrl || IconAvator}
+                    />
+                  )
+                }}
+              />
+            </div>
+          ) : user.value.join ? (
             <div class={[styles.activeUser, 'van-safe-area-bottom']}>
               <Cell
                 center
@@ -202,53 +227,27 @@ export default defineComponent({
                     />
                   ),
                   label: () => {
-                    if (user.value.join) {
-                      if (user.value.isTop) {
-                        return (
-                          <div>
-                            您的评测已上榜! 当前排名
-                            <span style={{ color: '#FA6400' }}>
-                              {' '}
-                              {user.value.step}
-                            </span>
-                          </div>
-                        )
-                      } else {
-                        return (
-                          <div>
-                            您的评测暂未上榜,快去挑战吧!
-                            {/* <span style={{ color: '#FA6400' }} onClick={() => openActive()}></span> */}
-                            
-                          </div>
-                        )
-                      }
-                    } else {
-                      return <div>您尚未报名参赛</div>
-                    }
-                  },
-                  value: () => {
-                    if (user.value.join) {
+                    if (user.value.isTop) {
                       return (
-                        <span class={styles.num}>{user.value.score}分</span>
+                        <div>
+                          您的评测已上榜! 当前排名
+                          <span style={{ color: '#FA6400' }}>
+                            {' '}
+                            {user.value.step}
+                          </span>
+                        </div>
                       )
                     } else {
-                    //   return (
-                    //     <Button
-                    //       class={styles.btn}
-                    //       round
-                    //       size="small"
-                    //       type="primary"
-                    //       onClick={() => openActive()}
-                    //     >
-                    //       去挑战
-                    //     </Button>
-                    //   )
+                      return <div>您的评测暂未上榜,快去挑战吧!</div>
                     }
-                  }
+                  },
+                  value: () => (
+                    <span class={styles.num}>{user.value.score}分</span>
+                  )
                 }}
               />
             </div>
-          )}
+          ) : null}
         </div>
       </div>
     )