Browse Source

修改显示

lex 8 months ago
parent
commit
3aeb380964

+ 2 - 6
src/business-components/user-detail/index.tsx

@@ -151,13 +151,9 @@ export default defineComponent({
                   >
                     /{this.userInfo.lessonNum}课时
                   </span>
-                  {this.showBuy && this.userInfo.payType === 'PAY' && (
+                  {this.showBuy && (
                     <div class={styles.buyNum}>
-                      {this.userInfo.buyNum}人已
-                      {this.userInfo.lessonPrice <= 0 &&
-                      this.userInfo.auditVersion === 0
-                        ? '领取'
-                        : '购买'}
+                      {this.userInfo.buyNum}人已学习
                     </div>
                   )}
                 </div>

+ 2 - 1
src/components/col-video/index.tsx

@@ -446,7 +446,8 @@ export default defineComponent({
                   </p>
                 ) : (
                   <p class={styles.tips}>
-                    若需完整观看,请下载酷乐秀领取或购买
+                    {/* 若需完整观看,请下载酷乐秀领取或购买 */}
+                    试看结束
                   </p>
                 )}
                 {state.platformType === 'STUDENT' && (

+ 109 - 110
src/student/live-class/live-item.tsx

@@ -1,110 +1,109 @@
-import { defineComponent, PropType } from 'vue'
-import { Image, CellGroup, Cell, Icon } from 'vant'
-import styles from './live-item.module.less'
-import dayjs from 'dayjs'
-
-import iconSuccess from '@common/images/icon_success.png'
-import iconTeacher from '@common/images/icon_teacher.png'
-
-interface IProps {
-  backgroundPic: string
-  courseGroupId: number
-  courseGroupName: string
-  courseNum: string
-  courseStartTime: number
-  coursePrice: number
-  teacherName: string
-  teacherId: number
-  avatar?: string
-  studentCount: number
-  existBuy: number
-  subjectName: string
-}
-
-export default defineComponent({
-  name: 'liveItem',
-  props: {
-    onClick: {
-      type: Function,
-      default: (item?: any) => {}
-    },
-    liveInfo: {
-      type: Object as PropType<IProps>,
-      default: {}
-    }
-  },
-  render() {
-    console.log(this.liveInfo, 121212)
-    return (
-      <Cell
-        center
-        border={false}
-        class={styles.liveItem}
-        onClick={() => this.onClick(this.liveInfo)}
-        v-slots={{
-          icon: () => (
-            <div style={{ position: 'relative' }}>
-              <Image
-                class={styles.liCover}
-                fit="cover"
-                src={this.liveInfo.backgroundPic}
-              />
-              <span class={styles.subjectName}>
-                {this.liveInfo.subjectName}
-              </span>
-            </div>
-          ),
-          title: () => (
-            <div>
-              <div class={[styles.liTitle, 'van-ellipsis']}>
-                {this.liveInfo.courseGroupName}
-              </div>
-              <div class={styles.liUserInfo}>
-                <p class={styles.liteachername}>
-                  {/* 老师: */}
-                  <Image
-                    src={this.liveInfo.avatar || iconTeacher}
-                    class={styles.liteacherIcon}
-                  />
-                  {this.liveInfo.teacherName ||
-                    `游客${this.liveInfo.teacherId}`}
-                </p>
-                <p>
-                  开课时间:
-                  {dayjs(this.liveInfo.courseStartTime).format(
-                    'MM月DD日 HH:mm'
-                  )}
-                </p>
-              </div>
-              <div class={styles.liPrice}>
-                <p>
-                  {this.liveInfo.coursePrice > 0 && (
-                    <span class={styles.price}>
-                      <i>¥</i>
-                      {this.liveInfo.coursePrice}
-                    </span>
-                  )}
-
-                  <span class={styles.classNum}>
-                    {this.liveInfo.courseNum}课时
-                  </span>
-                </p>
-                {this.liveInfo.existBuy === 1 && (
-                  <span class={styles.buyNum}>
-                    {/* <Icon name={iconSuccess} size="15" /> */}
-                    已购买
-                  </span>
-                )}
-                {/* : ( 
-                <span class={styles.num}>
-                   {this.liveInfo.studentCount}人已购买 
-                </span>
-                ) */}
-              </div>
-            </div>
-          )
-        }}
-      />
-    )
-  }
-})
+import { defineComponent, PropType } from 'vue'
+import { Image, CellGroup, Cell, Icon } from 'vant'
+import styles from './live-item.module.less'
+import dayjs from 'dayjs'
+
+import iconSuccess from '@common/images/icon_success.png'
+import iconTeacher from '@common/images/icon_teacher.png'
+
+interface IProps {
+  backgroundPic: string
+  courseGroupId: number
+  courseGroupName: string
+  courseNum: string
+  courseStartTime: number
+  coursePrice: number
+  teacherName: string
+  teacherId: number
+  avatar?: string
+  studentCount: number
+  existBuy: number
+  subjectName: string
+}
+
+export default defineComponent({
+  name: 'liveItem',
+  props: {
+    onClick: {
+      type: Function,
+      default: (item?: any) => {}
+    },
+    liveInfo: {
+      type: Object as PropType<IProps>,
+      default: {}
+    }
+  },
+  render() {
+    return (
+      <Cell
+        center
+        border={false}
+        class={styles.liveItem}
+        onClick={() => this.onClick(this.liveInfo)}
+        v-slots={{
+          icon: () => (
+            <div style={{ position: 'relative' }}>
+              <Image
+                class={styles.liCover}
+                fit="cover"
+                src={this.liveInfo.backgroundPic}
+              />
+              <span class={styles.subjectName}>
+                {this.liveInfo.subjectName}
+              </span>
+            </div>
+          ),
+          title: () => (
+            <div>
+              <div class={[styles.liTitle, 'van-ellipsis']}>
+                {this.liveInfo.courseGroupName}
+              </div>
+              <div class={styles.liUserInfo}>
+                <p class={styles.liteachername}>
+                  {/* 老师: */}
+                  <Image
+                    src={this.liveInfo.avatar || iconTeacher}
+                    class={styles.liteacherIcon}
+                  />
+                  {this.liveInfo.teacherName ||
+                    `游客${this.liveInfo.teacherId}`}
+                </p>
+                <p>
+                  开课时间:
+                  {dayjs(this.liveInfo.courseStartTime).format(
+                    'MM月DD日 HH:mm'
+                  )}
+                </p>
+              </div>
+              <div class={styles.liPrice}>
+                <p>
+                  {this.liveInfo.coursePrice > 0 && (
+                    <span class={styles.price}>
+                      <i>¥</i>
+                      {this.liveInfo.coursePrice}
+                    </span>
+                  )}
+
+                  <span class={styles.classNum}>
+                    {this.liveInfo.courseNum}课时
+                  </span>
+                </p>
+                {this.liveInfo.existBuy === 1 && (
+                  <span class={styles.buyNum}>
+                    {/* <Icon name={iconSuccess} size="15" /> */}
+                    已学习
+                  </span>
+                )}
+                {/* : (
+                <span class={styles.num}>
+                   {this.liveInfo.studentCount}人已学习
+                </span>
+                ) */}
+              </div>
+            </div>
+          )
+        }}
+      />
+    )
+  }
+})

+ 195 - 195
src/student/teacher-dependent/components/live.tsx

@@ -1,195 +1,195 @@
-import ColResult from '@/components/col-result'
-import { Cell, CellGroup, List, Image, Icon } from 'vant'
-import { defineComponent } from 'vue'
-import styles from './live.module.less'
-
-import iconTimer from '@common/images/icon_timer2.png'
-import iconTeacher from '@common/images/icon_teacher.png'
-import iconSuccess from '@common/images/icon_success.png'
-import request from '@/helpers/request'
-import dayjs from 'dayjs'
-import { state } from '@/state'
-
-export default defineComponent({
-  name: 'live',
-  data() {
-    const query = this.$route.query
-    return {
-      list: [],
-      dataShow: true, // 判断是否有数据
-      loading: false,
-      finished: false,
-      params: {
-        teacherId: query.teacherId,
-        groupStatus: 'APPLY',
-        page: 1,
-        rows: 20
-      }
-    }
-  },
-  mounted() {
-    this.getList()
-  },
-  methods: {
-    formatTime(time: string) {
-      let timeStr = dayjs(time || new Date())
-      const weekStr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
-      // console.log(timeStr.day())
-
-      return timeStr.format('YYYY-MM-DD') + `(${weekStr[timeStr.day()]})`
-    },
-    async getList() {
-      try {
-        const params: any = {
-          ...this.params
-        }
-        if (state.version) {
-          params.version = state.version || '' // 处理ios审核版本
-          params.platform = 'ios-student'
-        }
-        const res = await request.post(
-          '/api-student/courseGroup/queryPageCourseGroup',
-          {
-            data: {
-              ...params
-            }
-          }
-        )
-        this.loading = false
-        const result = res.data || {}
-        // 处理重复请求数据
-        if (this.list.length > 0 && result.pageNo === 1) {
-          return
-        }
-        this.list = this.list.concat(result.rows || [])
-        this.finished = result.pageNo >= result.totalPage
-        this.params.page = result.pageNo + 1
-        this.dataShow = this.list.length > 0
-      } catch {
-        this.dataShow = false
-        this.finished = true
-      }
-    },
-    onDetail(item: any) {
-      this.$router.push({
-        path: '/liveDetail',
-        query: {
-          groupId: item.courseGroupId
-        }
-      })
-    }
-  },
-  render() {
-    return (
-      <>
-        {this.dataShow ? (
-          <List
-            class={styles.liveList}
-            v-model:loading={this.loading}
-            immediateCheck={false}
-            finished={this.finished}
-            finishedText="没有更多了"
-          >
-            {this.list.map((item: any) => (
-              <CellGroup
-                class={styles.liveGroup}
-                border={false}
-                onClick={() => this.onDetail(item)}
-              >
-                <Cell
-                  style={{ paddingTop: '19px', paddingBottom: '19px' }}
-                  v-slots={{
-                    icon: () => (
-                      <div style={{ position: 'relative', lineHeight: '0' }}>
-                        <Image
-                          class={styles.liCover}
-                          src={item.backgroundPic}
-                          fit="cover"
-                        />
-                        <span class={styles.subjectName}>
-                          {item?.subjectName}
-                        </span>
-                      </div>
-                    ),
-                    title: () => (
-                      <div class={styles.liContent}>
-                        <div class={[styles.liTitle, 'van-ellipsis']}>
-                          {item.courseGroupName}
-                        </div>
-                        {/* <div class={styles.liUserInfo}>
-                          <div class={[styles.userInfo, 'van-hairline--right']}>
-                            <Image
-                              class={styles.avatar}
-                              fit="cover"
-                              src={item.avatar || iconTeacher}
-                            />
-                            <p>
-                              老师:
-                              {item.teacherName || `游客${item.teacherId}`}
-                            </p>
-                          </div>
-                        </div> */}
-                        <div class={styles.price}>
-                          {item.coursePrice > 0 && (
-                            <>
-                              <span class={styles.priceNum}>
-                                <i>¥</i>
-                                {(this as any).$filters.moneyFormat(
-                                  item.coursePrice
-                                )}
-                              </span>
-                            </>
-                          )}
-                          <span class={styles.label}>
-                            {item.coursePrice > 0 && '/'}
-                            {item.courseNum}课时
-                          </span>
-                        </div>
-                      </div>
-                    )
-                  }}
-                />
-                <Cell
-                  titleStyle={{ color: '#666666', fontSize: '13px' }}
-                  v-slots={{
-                    title: () => (
-                      <span class={styles.timerString}>
-                        {this.formatTime(item.salesStartDate)}
-                      </span>
-                    ),
-                    default: () => (
-                      <div>
-                        {item.existBuy === 1 ? (
-                          <span class={styles.buyNum}>已购买</span>
-                        ) : (
-                          <span class={styles.num}>
-                            {item.studentCount}人已购买
-                          </span>
-                        )}
-                      </div>
-                    )
-                  }}
-                />
-              </CellGroup>
-            ))}
-          </List>
-        ) : (
-          <ColResult btnStatus={false} classImgSize="SMALL" tips="暂无直播课" />
-        )}
-      </>
-    )
-
-    {
-      /* <List
-v-model:loading={this.loading}
-finished={this.finished}
-finishedText="没有更多了"
-onLoad={this.getList}
->
-{this.buyUserList.map(item => (
-  <UserList class="mb12" users={item} />
-))}
-</List> */
-    }
-  }
-})
+import ColResult from '@/components/col-result'
+import { Cell, CellGroup, List, Image, Icon } from 'vant'
+import { defineComponent } from 'vue'
+import styles from './live.module.less'
+
+import iconTimer from '@common/images/icon_timer2.png'
+import iconTeacher from '@common/images/icon_teacher.png'
+import iconSuccess from '@common/images/icon_success.png'
+import request from '@/helpers/request'
+import dayjs from 'dayjs'
+import { state } from '@/state'
+
+export default defineComponent({
+  name: 'live',
+  data() {
+    const query = this.$route.query
+    return {
+      list: [],
+      dataShow: true, // 判断是否有数据
+      loading: false,
+      finished: false,
+      params: {
+        teacherId: query.teacherId,
+        groupStatus: 'APPLY',
+        page: 1,
+        rows: 20
+      }
+    }
+  },
+  mounted() {
+    this.getList()
+  },
+  methods: {
+    formatTime(time: string) {
+      const timeStr = dayjs(time || new Date())
+      const weekStr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
+      // console.log(timeStr.day())
+
+      return timeStr.format('YYYY-MM-DD') + `(${weekStr[timeStr.day()]})`
+    },
+    async getList() {
+      try {
+        const params: any = {
+          ...this.params
+        }
+        if (state.version) {
+          params.version = state.version || '' // 处理ios审核版本
+          params.platform = 'ios-student'
+        }
+        const res = await request.post(
+          '/api-student/courseGroup/queryPageCourseGroup',
+          {
+            data: {
+              ...params
+            }
+          }
+        )
+        this.loading = false
+        const result = res.data || {}
+        // 处理重复请求数据
+        if (this.list.length > 0 && result.pageNo === 1) {
+          return
+        }
+        this.list = this.list.concat(result.rows || [])
+        this.finished = result.pageNo >= result.totalPage
+        this.params.page = result.pageNo + 1
+        this.dataShow = this.list.length > 0
+      } catch {
+        this.dataShow = false
+        this.finished = true
+      }
+    },
+    onDetail(item: any) {
+      this.$router.push({
+        path: '/liveDetail',
+        query: {
+          groupId: item.courseGroupId
+        }
+      })
+    }
+  },
+  render() {
+    return (
+      <>
+        {this.dataShow ? (
+          <List
+            class={styles.liveList}
+            v-model:loading={this.loading}
+            immediateCheck={false}
+            finished={this.finished}
+            finishedText="没有更多了"
+          >
+            {this.list.map((item: any) => (
+              <CellGroup
+                class={styles.liveGroup}
+                border={false}
+                onClick={() => this.onDetail(item)}
+              >
+                <Cell
+                  style={{ paddingTop: '19px', paddingBottom: '19px' }}
+                  v-slots={{
+                    icon: () => (
+                      <div style={{ position: 'relative', lineHeight: '0' }}>
+                        <Image
+                          class={styles.liCover}
+                          src={item.backgroundPic}
+                          fit="cover"
+                        />
+                        <span class={styles.subjectName}>
+                          {item?.subjectName}
+                        </span>
+                      </div>
+                    ),
+                    title: () => (
+                      <div class={styles.liContent}>
+                        <div class={[styles.liTitle, 'van-ellipsis']}>
+                          {item.courseGroupName}
+                        </div>
+                        {/* <div class={styles.liUserInfo}>
+                          <div class={[styles.userInfo, 'van-hairline--right']}>
+                            <Image
+                              class={styles.avatar}
+                              fit="cover"
+                              src={item.avatar || iconTeacher}
+                            />
+                            <p>
+                              老师:
+                              {item.teacherName || `游客${item.teacherId}`}
+                            </p>
+                          </div>
+                        </div> */}
+                        <div class={styles.price}>
+                          {item.coursePrice > 0 && (
+                            <>
+                              <span class={styles.priceNum}>
+                                <i>¥</i>
+                                {(this as any).$filters.moneyFormat(
+                                  item.coursePrice
+                                )}
+                              </span>
+                            </>
+                          )}
+                          <span class={styles.label}>
+                            {item.coursePrice > 0 && '/'}
+                            {item.courseNum}课时
+                          </span>
+                        </div>
+                      </div>
+                    )
+                  }}
+                />
+                <Cell
+                  titleStyle={{ color: '#666666', fontSize: '13px' }}
+                  v-slots={{
+                    title: () => (
+                      <span class={styles.timerString}>
+                        {this.formatTime(item.salesStartDate)}
+                      </span>
+                    ),
+                    default: () => (
+                      <div>
+                        {item.existBuy === 1 ? (
+                          <span class={styles.buyNum}>已学习</span>
+                        ) : (
+                          <span class={styles.num}>
+                            {item.studentCount}人已学习
+                          </span>
+                        )}
+                      </div>
+                    )
+                  }}
+                />
+              </CellGroup>
+            ))}
+          </List>
+        ) : (
+          <ColResult btnStatus={false} classImgSize="SMALL" tips="暂无直播课" />
+        )}
+      </>
+    )
+
+    {
+      /* <List
+v-model:loading={this.loading}
+finished={this.finished}
+finishedText="没有更多了"
+onLoad={this.getList}
+>
+{this.buyUserList.map(item => (
+  <UserList class="mb12" users={item} />
+))}
+</List> */
+    }
+  }
+})

+ 1 - 1
src/student/video-class/video-class-detail.tsx

@@ -114,7 +114,7 @@ export default defineComponent({
         const userInfo = state.user.data as any
         const alreadyBuy =
           result.lessonGroup.payType === 'VIP'
-            ? userInfo.isVip
+            ? result.alreadyBuy || userInfo.isVip
               ? true
               : false
             : result.alreadyBuy

+ 1 - 1
src/student/video-class/video-detail.tsx

@@ -68,7 +68,7 @@ export default defineComponent({
         const userInfo = state.user.data as any
         const alreadyBuy =
           lessonGroup.payType === 'VIP'
-            ? userInfo.isVip
+            ? result.alreadyBuy || userInfo.isVip
               ? true
               : false
             : result.alreadyBuy

+ 1 - 8
src/student/video-class/video-item.tsx

@@ -84,14 +84,7 @@ export default defineComponent({
             <span class={styles.label}>/{item?.lessonCount}课时</span>
           </div>
 
-          {item?.payType !== 'VIP' && (
-            <div class={styles.viUserNum}>
-              {item?.countStudent}人已
-              {item?.lessonPrice <= 0 && item.auditVersion === 0
-                ? '领取'
-                : '购买'}
-            </div>
-          )}
+          <div class={styles.viUserNum}>{item?.countStudent}人已学习</div>
         </div>
       </div>
     )

+ 9 - 2
src/teacher/video-class/video-class-detail.tsx

@@ -84,11 +84,18 @@ export default defineComponent({
       this.useRelationType = result.lessonGroup.relationType
       this.lessonPrice = result.lessonGroup.lessonPrice
       this.payType = result.lessonGroup.payType
-      this.alreadyBuy = result.alreadyBuy
+      const userInfo = state.user.data as any
+      const alreadyBuy =
+        result.lessonGroup.payType === 'VIP'
+          ? result.alreadyBuy || userInfo.isVip
+            ? true
+            : false
+          : result.alreadyBuy
+      this.alreadyBuy = alreadyBuy
       this.detailList = result.detailList || []
 
       if (state.user.data?.userId !== result.lessonGroup.teacherId) {
-        this.trySee = !result.alreadyBuy
+        this.trySee = !alreadyBuy
       }
 
       this.detailList.forEach((item: any, index: number) => {

+ 10 - 1
src/teacher/video-class/video-detail.tsx

@@ -51,6 +51,14 @@ export default defineComponent({
       if (state.platformType === 'TEACHER') {
         this.myself = !result.myself
       }
+
+      const userInfo = state.user.data as any
+      const alreadyBuy =
+        result.lessonGroup.payType === 'VIP'
+          ? result.alreadyBuy || userInfo.isVip
+            ? true
+            : false
+          : result.alreadyBuy
       this.userInfo = {
         id: result.lessonGroup.teacherId,
         username: result.lessonGroup.username,
@@ -68,7 +76,7 @@ export default defineComponent({
         auditVersion: result.lessonGroup.auditVersion,
         isDegree: result.degreeFlag ? true : false,
         isTeacher: result.teacherFlag ? true : false,
-        alreadyBuy: result.alreadyBuy
+        alreadyBuy: alreadyBuy
       }
 
       this.shelvesFlag = result.lessonGroup.shelvesFlag
@@ -332,6 +340,7 @@ export default defineComponent({
                 coursePrice: this.userInfo.lessonPrice,
                 teacherName: this.userInfo.username,
                 teacherId: this.userInfo.id,
+                payType: this.userInfo.payType,
                 avatar: this.userInfo.headUrl,
                 studentCount: this.userInfo.buyNum,
                 existBuy: 0,

+ 19 - 9
src/views/live-class/live-item.tsx

@@ -14,6 +14,7 @@ interface IProps {
   courseNum: string
   courseStartTime?: number
   coursePrice: number
+  payType?: string
   teacherName: string
   teacherId: number
   avatar?: string
@@ -108,14 +109,22 @@ export default defineComponent({
               </div>
               <div class={styles.liPrice}>
                 <p>
-                  {this.liveInfo.coursePrice > 0 && (
-                    <span class={styles.price}>
-                      <i>¥</i>
-                      {this.liveInfo.coursePrice}
+                  {this.liveInfo.payType === 'VIP' ? (
+                    <span class={styles.price} style={{ color: '#C76E21' }}>
+                      会员
                     </span>
-                  )}
-                  {this.liveInfo.coursePrice == 0 && (
-                    <span class={styles.price}>免费</span>
+                  ) : (
+                    <>
+                      {this.liveInfo.coursePrice > 0 && (
+                        <span class={styles.price}>
+                          <i>¥</i>
+                          {this.liveInfo.coursePrice}
+                        </span>
+                      )}
+                      {this.liveInfo.coursePrice == 0 && (
+                        <span class={styles.price}>免费</span>
+                      )}
+                    </>
                   )}
 
                   <span class={styles.classNum}>
@@ -124,12 +133,13 @@ export default defineComponent({
                 </p>
                 {this.liveInfo.existBuy === 1 && (
                   <span class={styles.buyNum}>
-                    {this.liveInfo.coursePrice == 0 ? '已领取' : '已购买'}
+                    {/* {this.liveInfo.coursePrice == 0 ? '已学习' : '已购买'} */}
+                    已学习
                   </span>
                 )}
                 {/* : (
                 <span class={styles.num}>
-                   {this.liveInfo.studentCount}人已购买
+                   {this.liveInfo.studentCount}人已学习
                 </span>
                 ) */}
               </div>