skyblued před 2 roky
rodič
revize
852d8e9e74

+ 24 - 14
src/student/leaderboard/index.module.less

@@ -31,6 +31,8 @@
   padding: 12px;
   box-sizing: border-box;
   overflow-y: auto;
+}
+.tabContent.hasUser {
   padding-bottom: 80px;
 }
 .itemContent {
@@ -53,6 +55,7 @@
   }
   .center {
     display: flex;
+    align-items: center;
   }
   .right {
     margin-left: auto;
@@ -61,6 +64,7 @@
       font-size: 14px;
       font-weight: 600;
       color: #fa6400;
+      margin-bottom: 4px;
     }
     .time {
       font-size: 12px;
@@ -76,21 +80,27 @@
   }
   .user {
     margin-left: 6px;
+    .userContent{
+      display: flex;
+      align-items: center;
+      margin-bottom: 4px;
+    }
     .name {
-      font-size: 14px;
+      font-size: 15px;
       color: #333;
-      margin-bottom: 2px;
+      margin-right: 6px;
     }
     .tag {
-      display: flex;
-      & > span {
-        font-size: 12px;
-        background-color: #ffe2b2;
-        color: #ff8c00;
-        border-radius: 2px;
-        margin-right: 4px;
-        padding: 1px 2px;
-      }
+      font-size: 12px;
+      background-color: #ffe2b2;
+      color: #ff8c00;
+      border-radius: 4px;
+      margin-right: 4px;
+      padding: 1px 2px;
+    }
+    .times{
+      font-size: 12px;
+      color: #999;
     }
   }
 }
@@ -105,10 +115,10 @@
   box-shadow: 0 -8px 12px #ebedf0;
   background-color: #fff;
   :global {
-    .van-cell__title{
+    .van-cell__title {
       font-weight: bold;
     }
-    .van-cell__label{
+    .van-cell__label {
       font-weight: 400;
     }
     .van-cell__value {
@@ -129,7 +139,7 @@
   }
   .num {
     font-size: 14px;
-    font-weight: 600px;
+    font-weight: bold;
     color: #fa6400;
   }
 }

+ 36 - 11
src/student/leaderboard/index.tsx

@@ -33,7 +33,8 @@ export default defineComponent({
     const state = reactive({
       tabIndex: 0,
       musicList: [] as IMusicItem[],
-      isSignup: false // 是否报名
+      isSignup: false, // 是否报名
+      isChallenge: false, // 是否挑战过
     })
     const getMusicList = async () => {
       try {
@@ -43,16 +44,15 @@ export default defineComponent({
         if (Array.isArray(data.activityMusicVoList)) {
           state.musicList = data.activityMusicVoList.map(n => {
             n.rankingList = []
-            n.loaded = false
             return n
           })
+          state.isChallenge = data.activityMusicVoList.filter(n => n.join).length ? true :false
         }
         img.value = data.subjectUrl
         state.isSignup = data.join ? true : false
       } catch (error) {}
     }
     const getData = async () => {
-      if (state.musicList[state.tabIndex].loaded) return
       try {
         const { data } = await request.get(
           '/api-student/open/activityEvaluationRecord/queryRankingList',
@@ -67,7 +67,6 @@ export default defineComponent({
         )
         if (Array.isArray(data.rankingList)) {
           state.musicList[state.tabIndex].rankingList = data.rankingList
-          state.musicList[state.tabIndex].loaded = true
         }
       } catch (error) {}
     }
@@ -141,7 +140,12 @@ export default defineComponent({
                 return (
                   <Tab title={item.musicSheetName}>
                     <div
-                      class={styles.tabContent}
+                      class={[
+                        styles.tabContent,
+                        state.isSignup && !user.value.join
+                          ? null
+                          : styles.hasUser
+                      ]}
                       style={{ height: `calc(100vh - ${imgHeight.value}px)` }}
                     >
                       <div class={styles.itemContent}>
@@ -160,22 +164,25 @@ export default defineComponent({
                               </div>
                               <div class={styles.center}>
                                 <Image
-                                  width="34px"
-                                  height="34px"
+                                  width="38px"
+                                  height="38px"
                                   fit="cover"
                                   round
                                   src={n.userAvatar || IconAvator}
                                 />
                                 <div class={styles.user}>
-                                  <div class={styles.name}>{n.username}</div>
-                                  <div class={styles.tag}>
-                                    <span>{n.userSubject}</span>
+                                  <div class={styles.userContent}>
+                                    <span class={styles.name}>{n.username}</span>
+                                    <span class={styles.tag}>
+                                      {n.userSubject}
+                                    </span>
                                   </div>
+                                  <div class={styles.times}>{n.joinDate}</div>
                                 </div>
                               </div>
                               <div class={styles.right}>
                                 <div class={styles.fraction}>{n.score}分</div>
-                                <div class={styles.time}>{n.joinDate}</div>
+                                <div class={styles.time}>第 {n.times} 次评测</div>
                               </div>
                             </div>
                           )
@@ -212,6 +219,24 @@ export default defineComponent({
                 }}
               />
             </div>
+          ) : !state.isChallenge ? (
+            <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

+ 19 - 11
src/teacher/leaderboard/index.module.less

@@ -52,6 +52,7 @@
   }
   .center {
     display: flex;
+    align-items: center;
   }
   .right {
     margin-left: auto;
@@ -60,6 +61,7 @@
       font-size: 14px;
       font-weight: 600;
       color: #fa6400;
+      margin-bottom: 4px;
     }
     .time {
       font-size: 12px;
@@ -75,21 +77,27 @@
   }
   .user {
     margin-left: 6px;
+    .userContent{
+      display: flex;
+      align-items: center;
+      margin-bottom: 4px;
+    }
     .name {
-      font-size: 14px;
+      font-size: 15px;
       color: #333;
-      margin-bottom: 2px;
+      margin-right: 6px;
     }
     .tag {
-      display: flex;
-      & > span {
-        font-size: 12px;
-        background-color: #ffe2b2;
-        color: #ff8c00;
-        border-radius: 2px;
-        margin-right: 4px;
-        padding: 1px 2px;
-      }
+      font-size: 12px;
+      background-color: #ffe2b2;
+      color: #ff8c00;
+      border-radius: 4px;
+      margin-right: 4px;
+      padding: 1px 2px;
+    }
+    .times{
+      font-size: 12px;
+      color: #999;
     }
   }
 }

+ 9 - 9
src/teacher/leaderboard/index.tsx

@@ -37,7 +37,6 @@ export default defineComponent({
         if (Array.isArray(activityMusicVoList)) {
           state.musicList = activityMusicVoList.map(n => {
             n.rankingList = []
-            n.loaded = false
             return n
           })
         }
@@ -45,7 +44,6 @@ export default defineComponent({
       } catch (error) {}
     }
     const getData = async () => {
-      if (state.musicList[state.tabIndex].loaded) return
       try {
         const { data } = await request.get(
           '/api-student/open/activityEvaluationRecord/queryRankingList',
@@ -60,7 +58,6 @@ export default defineComponent({
         )
         if (Array.isArray(data.rankingList)) {
           state.musicList[state.tabIndex].rankingList = data.rankingList
-          state.musicList[state.tabIndex].loaded = true
         }
       } catch (error) {}
     }
@@ -135,22 +132,25 @@ export default defineComponent({
                               </div>
                               <div class={styles.center}>
                                 <Image
-                                  width="34px"
-                                  height="34px"
+                                  width="38px"
+                                  height="38px"
                                   fit="cover"
                                   round
                                   src={n.userAvatar || IconAvator}
                                 />
                                 <div class={styles.user}>
-                                  <div class={styles.name}>{n.username}</div>
-                                  <div class={styles.tag}>
-                                    <span>{n.userSubject}</span>
+                                  <div class={styles.userContent}>
+                                    <span class={styles.name}>{n.username}</span>
+                                    <span class={styles.tag}>
+                                      {n.userSubject}
+                                    </span>
                                   </div>
+                                  <div class={styles.times}>{n.joinDate}</div>
                                 </div>
                               </div>
                               <div class={styles.right}>
                                 <div class={styles.fraction}>{n.score}分</div>
-                                <div class={styles.time}>{n.joinDate}</div>
+                                <div class={styles.time}>第 {n.times} 次评测</div>
                               </div>
                             </div>
                           )