lex-xin 2 năm trước cách đây
mục cha
commit
0ad344d7ca

BIN
src/common/images/music_cert.png


BIN
src/common/images/teacher_cert.png


+ 111 - 98
src/teacher/open-live/index.module.less

@@ -19,118 +19,131 @@
       }
     }
   }
+}
 
-  .openBtn {
-    background-color: #fff;
-    color: #ff4347;
-    padding: 0 15px;
-    font-size: 14px;
-  }
-
-  .open-teacher-info {
-    margin: 60px 14px 0;
-    width: auto;
-    background-color: transparent;
-    padding: 0;
-    .userLogo {
-      width: 56px;
-      height: 56px;
-      border-radius: 50%;
-      overflow: hidden;
-    }
-    :global {
-      .van-cell__value {
-        display: flex;
-        align-items: center;
-        justify-content: space-between;
-      }
-    }
-
-    .teacher-info {
-      display: flex;
-      align-items: flex-start;
-      justify-content: center;
-      flex-direction: column;
-      padding-left: 8px;
-      .teacher-name {
-        font-weight: 500;
-        color: #1a1a1a;
-        line-height: 1.2;
-        font-size: 20px;
-        padding-top: 5px;
-        padding-bottom: 5px;
-      }
-      .level {
-        line-height: 1.2;
-      }
-    }
+.openBtn {
+  background-color: #fff;
+  color: #ff4347;
+  padding: 0 15px;
+  font-size: 14px;
+}
 
-    .teacher-desc {
+.open-teacher-info {
+  margin: 60px 14px 0;
+  width: auto;
+  background-color: transparent;
+  padding: 0;
+  .userLogo {
+    width: 56px;
+    height: 56px;
+    border-radius: 50%;
+    overflow: hidden;
+  }
+  :global {
+    .van-cell__value {
       display: flex;
       align-items: center;
-      .teacherItem {
-        padding-left: 8px;
-        text-align: center;
-        min-width: 58px;
-        .title {
-          font-size: 17px;
-          font-weight: 500;
-          color: #000000;
-          line-height: 24px;
-        }
-        .content {
-          font-size: 12px;
-          font-weight: 400;
-          color: #666666;
-          line-height: 28px;
-        }
-      }
+      justify-content: space-between;
     }
   }
+}
 
-  .open-tips {
-    margin: 12px 14px 0;
-    padding: 0 10px;
+.teacher-info {
+  display: flex;
+  align-items: flex-start;
+  justify-content: center;
+  flex-direction: column;
+  padding-left: 8px;
+  .teacher-name {
     display: flex;
     align-items: center;
-    background: #ffffff;
-    border-radius: 10px;
-    font-size: 13px;
-    color: #ff9e5a;
-    line-height: 22px;
-    height: 36px;
-    p {
-      padding-left: 5px;
+    font-weight: 500;
+    color: #1a1a1a;
+    line-height: 1.2;
+    font-size: 20px;
+    padding-top: 5px;
+    padding-bottom: 5px;
+  }
+  .level {
+    line-height: 1.2;
+  }
+}
+.cert {
+  margin-left: 5px;
+  height: 24px;
+}
+
+.teacher-desc {
+  display: flex;
+  padding: 22px 14px;
+  .teacherItem {
+    padding-right: 8px;
+    margin-right: 8px;
+    text-align: center;
+    min-width: 58px;
+    display: flex;
+    align-items: center;
+    &:first-child {
+      border-right: 1px solid #d3d3d3;
+    }
+    .title {
+      font-size: 17px;
+      font-weight: 500;
+      color: #000000;
+      line-height: 1;
     }
+    .content {
+      font-size: 14px;
+      font-weight: 400;
+      color: #333;
+      line-height: 1;
+      padding-right: 5px;
+    }
+  }
+}
+
+.open-tips {
+  margin: 0 14px;
+  padding: 0 10px;
+  display: flex;
+  align-items: center;
+  background: #ffffff;
+  border-radius: 10px;
+  font-size: 13px;
+  color: #ff9e5a;
+  line-height: 22px;
+  height: 36px;
+  p {
+    padding-left: 5px;
   }
+}
 
-  .open-content {
-    border-radius: 10px;
-    margin: 12px 14px 40px;
-    background-color: #fff;
-    padding: 12px;
-    position: relative;
+.open-content {
+  border-radius: 10px;
+  margin: 12px 14px 40px;
+  background-color: #fff;
+  padding: 12px;
+  position: relative;
 
-    h2 {
-      font-size: 16px;
-      padding: 8px 0;
-      font-weight: 600;
-      color: #333333;
-      line-height: 1.5;
-    }
+  h2 {
+    font-size: 16px;
+    padding: 8px 0;
+    font-weight: 600;
+    color: #333333;
+    line-height: 1.5;
+  }
 
-    .cert-text {
-      font-size: 13px;
-      line-height: 1.3;
-      padding-bottom: 12px;
-      color: #999999;
-    }
+  .cert-text {
+    font-size: 13px;
+    line-height: 1.3;
+    padding-bottom: 12px;
+    color: #999999;
+  }
 
-    .cert-img {
-      border-radius: 5px;
-      overflow: hidden;
-      line-height: 0;
-      margin-bottom: 8px;
-    }
+  .cert-img {
+    border-radius: 5px;
+    overflow: hidden;
+    line-height: 0;
+    margin-bottom: 8px;
   }
 }

+ 29 - 13
src/teacher/open-live/index.tsx

@@ -9,6 +9,8 @@ import banner1 from './images/1.png'
 import banner2 from './images/2.png'
 import banner3 from './images/3.png'
 import iconTeacher from '@common/images/icon_teacher.png'
+import musicCert from '@common/images/music_cert.png'
+import teacherCert from '@common/images/teacher_cert.png'
 
 import request from '@/helpers/request'
 import ColResult from '@/components/col-result'
@@ -110,7 +112,20 @@ export default defineComponent({
               }}
             >
               <div class={styles['teacher-info']}>
-                <div class={styles['teacher-name']}>{this.users?.username}</div>
+                <div class={styles['teacher-name']}>
+                  {this.users?.username || `游客${this.users?.userId}`}
+
+                  {this.users?.entryFlag === 1 && (
+                    <Image
+                      class={styles.cert}
+                      src={teacherCert}
+                      fit="contain"
+                    />
+                  )}
+                  {this.users?.musicianFlag === 1 && (
+                    <Image class={styles.cert} src={musicCert} fit="contain" />
+                  )}
+                </div>
                 <div class={styles.level}>
                   <Rate
                     modelValue={this.users?.starGrade}
@@ -122,21 +137,22 @@ export default defineComponent({
                   />
                 </div>
               </div>
-              <div class={styles['teacher-desc']}>
-                <div class={styles.teacherItem}>
-                  <div class={styles.title}>
-                    {this.users?.fansNum}/{this.fansNum}
-                  </div>
-                  <div class={styles.content}>粉丝</div>
+            </Cell>
+
+            <div class={styles['teacher-desc']}>
+              <div class={[styles.teacherItem]}>
+                <div class={styles.content}>粉丝</div>
+                <div class={styles.title}>
+                  {this.users?.fansNum}/{this.fansNum}
                 </div>
-                <div class={styles.teacherItem} style={{ textAlign: 'right' }}>
-                  <div class={styles.title}>
-                    {this.users?.expTime}/{this.overClassNum}
-                  </div>
-                  <div class={styles.content}>已上课时</div>
+              </div>
+              <div class={styles.teacherItem} style={{ textAlign: 'right' }}>
+                <div class={styles.content}>已上课时</div>
+                <div class={styles.title}>
+                  {this.users?.expTime}/{this.overClassNum}
                 </div>
               </div>
-            </Cell>
+            </div>
 
             {!this.users.liveFlag ? (
               <div class={styles['open-tips']}>

+ 31 - 10
src/teacher/practice-class/model/timer.tsx

@@ -45,7 +45,16 @@ export default defineComponent({
     return {
       timerList: [],
       list: [] as any,
-      weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
+      weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
+      weekType: [
+        'monday',
+        'tuesday',
+        'wednesday',
+        'thursday',
+        'friday',
+        'saturday',
+        'sunday'
+      ]
     }
   },
   mounted() {
@@ -61,6 +70,7 @@ export default defineComponent({
       const end = dayjs(endTime, 'HH:mm')
 
       const timerList: any = []
+      // 生成一天的时间段
       while (start.add(space, 'minute').isSameOrBefore(dayjs(end))) {
         const item = {
           startTime: start.format('HH:mm'),
@@ -73,6 +83,7 @@ export default defineComponent({
         start = start.add(space, 'minute')
       }
       const list: any = []
+      // 生成一周的时间段
       timerList.forEach((item: any) => {
         const weekList: any = []
         for (let i = 0; i < 7; i++) {
@@ -82,6 +93,24 @@ export default defineComponent({
         }
         list.push(weekList)
       })
+
+      const tempList = this._initData(list)
+      return tempList
+    },
+    _initData(list: Array<any>) {
+      // 回显数据
+      const weekType = this.weekType
+      const timerObject = this.timerObject
+      list.forEach((item: any) => {
+        item.forEach((slot: any, slotIndex: number) => {
+          const dayList = timerObject[weekType[slotIndex]]
+          const startTime = dayjs(slot.startTime, 'HH:mm').format('HH:mm:ss')
+          const isExist = dayList?.some(
+            (course: any) => course.startTime === startTime
+          )
+          isExist && (slot.status = true)
+        })
+      })
       return list
     },
     btnStatus(index: number, type: 'row' | 'col') {
@@ -121,15 +150,7 @@ export default defineComponent({
         saturday: [],
         sunday: []
       }
-      const weekType = [
-        'monday',
-        'tuesday',
-        'wednesday',
-        'thursday',
-        'friday',
-        'saturday',
-        'sunday'
-      ]
+      const weekType = this.weekType
       let status = false
       list.forEach((item: any, i: number) => {
         item.forEach((times: any, j: number) => {

+ 2 - 1
src/teacher/practice-class/practice-setting.tsx

@@ -182,7 +182,7 @@ export default defineComponent({
       let subjectPriceList = [...this.form.subjectPrice]
       tempItem.forEach((item: any) => {
         const index = subjectPriceList.findIndex(
-          (subject: any) => subject.id === item
+          (subject: any) => subject.subjectId === item
         )
         if (index === -1) {
           subjectPriceList.push({
@@ -333,6 +333,7 @@ export default defineComponent({
                     }
                   ]}
                   formatter={this.onFormatter}
+                  maxlength={8}
                   placeholder={`请选择声部陪练价格`}
                   v-slots={{
                     button: () => <span>元</span>