浏览代码

添加rvfp

lex 2 年之前
父节点
当前提交
882d417fa4

+ 9 - 0
src/student/teacher-dependent/model/teacher-header.module.less

@@ -202,3 +202,12 @@
   padding: 2px 0;
   width: 82%;
 }
+
+.teacherName {
+  display: inline-block;
+  flex: 1;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  max-width: 100px;
+}

+ 89 - 21
src/student/teacher-dependent/teacher-follow.tsx

@@ -1,4 +1,4 @@
-import { Cell, Dialog, Icon, Image, List, Rate, Toast } from 'vant'
+import { Cell, Dialog, Icon, Image, List, Rate, Sticky, Toast } from 'vant'
 import { defineComponent } from 'vue'
 import styles from './model/teacher-header.module.less'
 import iconTeacher from '@common/images/icon_teacher.png'
@@ -7,6 +7,7 @@ import teacherCert from '@common/images/teacher_cert.png'
 import request from '@/helpers/request'
 import ColResult from '@/components/col-result'
 import { postMessage } from '@/helpers/native-message'
+import ColSearch from '@/components/col-search'
 export const getAssetsHomeFile = (fileName: string) => {
   const path = `./images/${fileName}`
   const modules = import.meta.globEager('./images/*')
@@ -25,6 +26,7 @@ export default defineComponent({
       loading: false,
       finished: false,
       params: {
+        username: '',
         page: 1,
         rows: 20
       }
@@ -38,6 +40,10 @@ export default defineComponent({
       const subjectList = subject.split(',')
       return subjectList || []
     },
+    onSearch(val: string) {
+      this.params.username = val
+      this.onSort()
+    },
     onSort() {
       this.params.page = 1
       this.list = []
@@ -48,7 +54,7 @@ export default defineComponent({
     },
     async getList() {
       try {
-        let params = this.params
+        const params = this.params
         const res = await request.post('/api-student/student/queryMyFollow', {
           data: {
             ...params
@@ -87,11 +93,40 @@ export default defineComponent({
           }, 1000)
         } catch {}
       })
+    },
+    // 检验是否有对应徽章
+    checkBadge(type: string, item: any) {
+      // tag : 老师点亮图标
+      // STYLE:个人风采
+      // VIDEO:视频课
+      // LIVE:直播课,
+      // MUSIC:曲目 逗号隔开
+      let status = false
+      switch (type) {
+        case 'STYLE':
+        case 'VIDEO':
+        case 'LIVE':
+        case 'MUSIC':
+          if (item.tag) {
+            status = item.tag.indexOf(type) > -1
+          }
+          break
+        case 'VIP':
+          status = item.isVip > 0
+          break
+        default:
+          status = false
+          break
+      }
+      return status
     }
   },
   render() {
     return (
       <div class={styles.teacherFollow}>
+        <Sticky position="top" offsetTop={0}>
+          <ColSearch onSearch={this.onSearch} />
+        </Sticky>
         {this.dataShow ? (
           <List
             class={styles.liveList}
@@ -101,7 +136,18 @@ export default defineComponent({
             finishedText="没有更多了"
           >
             {this.list.map((item: any) => (
-              <div class={[styles.headerCount, styles.headerFollow]}>
+              <div
+                class={[styles.headerCount, styles.headerFollow]}
+                onClick={(e: MouseEvent) => {
+                  e.stopPropagation()
+                  this.$router.push({
+                    path: '/teacherHome',
+                    query: {
+                      teacherId: item.userId
+                    }
+                  })
+                }}
+              >
                 <Cell
                   class={styles['open-teacher-info']}
                   border={false}
@@ -117,7 +163,8 @@ export default defineComponent({
                         {item.liveFlag === 1 && (
                           <p
                             class={styles.liveTag}
-                            onClick={() => {
+                            onClick={(e: MouseEvent) => {
+                              e.stopPropagation()
                               postMessage({
                                 api: 'joinLiveRoom',
                                 content: {
@@ -137,7 +184,8 @@ export default defineComponent({
                         name="like"
                         color="#FF6363"
                         size={18}
-                        onClick={() => {
+                        onClick={(e: MouseEvent) => {
+                          e.stopPropagation()
                           this.onUnLike(item)
                         }}
                       />
@@ -147,31 +195,51 @@ export default defineComponent({
                   <div class={styles['teacher-info']}>
                     <div class={styles['teacher-name']}>
                       <div class={styles.teacherCert}>
-                        <span style={{ display: 'inline-block' }}>
+                        {/* flex: 1; white-space: nowrap; overflow: hidden;
+                        text-overflow: ellipsis; max-width: 100px; */}
+                        <span class={styles.teacherName}>
                           {item.userName || `游客${item.userId || ''}`}
                         </span>
                         <Image
                           class={styles.iconVip}
                           src={
-                            item.entryFlag === 1
+                            this.checkBadge('VIP', item.teacher)
                               ? getAssetsHomeFile('vip_active.png')
                               : getAssetsHomeFile('vip_default.png')
                           }
                         />
-                        {/* {item.entryFlag === 1 && (
-                          <Image
-                            class={styles.cert}
-                            src={teacherCert}
-                            // fit="contain"
-                          />
-                        )}
-                        {item.musicianFlag === 1 && (
-                          <Image
-                            class={styles.cert}
-                            src={musicCert}
-                            // fit="contain"
-                          />
-                        )} */}
+                        <Image
+                          class={styles.iconOther}
+                          src={
+                            this.checkBadge('STYLE', item.teacher)
+                              ? getAssetsHomeFile('cert_active.png')
+                              : getAssetsHomeFile('cert_default.png')
+                          }
+                        />
+                        <Image
+                          class={styles.iconOther}
+                          src={
+                            this.checkBadge('VIDEO', item.teacher)
+                              ? getAssetsHomeFile('video_active.png')
+                              : getAssetsHomeFile('video_default.png')
+                          }
+                        />
+                        <Image
+                          class={styles.iconOther}
+                          src={
+                            this.checkBadge('LIVE', item.teacher)
+                              ? getAssetsHomeFile('live_active.png')
+                              : getAssetsHomeFile('live_default.png')
+                          }
+                        />
+                        <Image
+                          class={styles.iconOther}
+                          src={
+                            this.checkBadge('MUSIC', item.teacher)
+                              ? getAssetsHomeFile('music_active.png')
+                              : getAssetsHomeFile('music_default.png')
+                          }
+                        />
                       </div>
                     </div>
                     <div class={styles.level}>

+ 46 - 46
src/teacher/music/upload/index.tsx

@@ -418,7 +418,7 @@ export default defineComponent({
                 }}
               />
             </ColField>
-            {/* <ColField required title="播放类型" border={false}>
+            <ColField required title="播放类型" border={false}>
               <RadioGroup
                 class={styles['radio-group']}
                 modelValue={this.audioType}
@@ -436,7 +436,7 @@ export default defineComponent({
                   )
                 })}
               </RadioGroup>
-            </ColField> */}
+            </ColField>
             {this.audioType === 'MP3' ? (
               <>
                 <ColField required title="是否带节拍器" border={false}>
@@ -485,6 +485,50 @@ export default defineComponent({
                     }}
                   />
                 </ColField>
+                {this.backgroundMp3s.map((item, index) => (
+                  <ColField
+                    required
+                    border={false}
+                    title={(item.track || '') + '原音文件'}
+                    // @ts-ignore
+                    vSlots={{
+                      right: () =>
+                        this.backgroundMp3s.length > 1 ? (
+                          <Button
+                            onClick={() => this.removeBackground(index)}
+                            style={{ border: 'none' }}
+                            icon="cross"
+                          ></Button>
+                        ) : null
+                    }}
+                  >
+                    <Field
+                      name="url"
+                      modelValue={this.bgmp3Url}
+                      // @ts-ignore
+                      vSlots={{
+                        input: () =>
+                          browserInfo.isApp ? (
+                            <Button
+                              icon={UploadIcon}
+                              class={styles.upbtn}
+                              onClick={this.naiveBGMp3File}
+                              loading={this.bgmp3Loading}
+                            >
+                              {this.bgmp3Url
+                                ? this.fileName(this.bgmp3Url)
+                                : '上传文件'}
+                            </Button>
+                          ) : (
+                            <Upload
+                              onUpdate:modelValue={val => (this.bgmp3Url = val)}
+                              accept=".mp3"
+                            />
+                          )
+                      }}
+                    />
+                  </ColField>
+                ))}
               </>
             ) : (
               <ColField border={false} required title="MIDI文件">
@@ -516,50 +560,6 @@ export default defineComponent({
                 />
               </ColField>
             )}
-            {this.backgroundMp3s.map((item, index) => (
-              <ColField
-                required
-                border={false}
-                title={(item.track || '') + '原音文件'}
-                // @ts-ignore
-                vSlots={{
-                  right: () =>
-                    this.backgroundMp3s.length > 1 ? (
-                      <Button
-                        onClick={() => this.removeBackground(index)}
-                        style={{ border: 'none' }}
-                        icon="cross"
-                      ></Button>
-                    ) : null
-                }}
-              >
-                <Field
-                  name="url"
-                  modelValue={this.bgmp3Url}
-                  // @ts-ignore
-                  vSlots={{
-                    input: () =>
-                      browserInfo.isApp ? (
-                        <Button
-                          icon={UploadIcon}
-                          class={styles.upbtn}
-                          onClick={this.naiveBGMp3File}
-                          loading={this.bgmp3Loading}
-                        >
-                          {this.bgmp3Url
-                            ? this.fileName(this.bgmp3Url)
-                            : '上传文件'}
-                        </Button>
-                      ) : (
-                        <Upload
-                          onUpdate:modelValue={val => (this.bgmp3Url = val)}
-                          accept=".mp3"
-                        />
-                      )
-                  }}
-                />
-              </ColField>
-            ))}
           </ColFieldGroup>
           <ColFieldGroup class={styles.area}>
             <ColField required title="曲目名称">