Browse Source

更新优化

lex-xin 3 years ago
parent
commit
121ddfc69a

+ 4 - 2
src/business-components/calendar/index.module.less

@@ -48,7 +48,7 @@
         width: 38px;
         height: 45px;
         background: #2dc7aa;
-        content: '';
+        content: ' ';
         opacity: 0.12;
         transform: translate(-50%, -50%);
         border-radius: 2px;
@@ -65,7 +65,9 @@
         color: #ff6363;
       }
     }
-    .van-calendar__day.full::after {
+    .van-calendar__day.full::after,
+    .van-calendar__day--disabled.full::after {
+      display: inline-block !important;
       background-color: #ffd7a6;
     }
     // 禁用不显示背景

+ 2 - 0
src/business-components/calendar/index.tsx

@@ -107,6 +107,7 @@ export default defineComponent({
       if (dateObj && dateObj.fullCourse) {
         date.bottomInfo = '满'
         date.className = 'full'
+        date.type = 'disabled'
       }
       date.type = date.type === 'selected' ? '' : date.type
       return date
@@ -168,6 +169,7 @@ export default defineComponent({
       this._dayChange(tempDate.toDate())
     },
     onDateSelect(date: any) {
+      console.log(date)
       // 选择日历上某一个日期
       this.selectDays = [...this.selectList] // 初始化用户选中的值
       this._dayChange(date)

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

@@ -57,8 +57,8 @@ export default defineComponent({
       //   'download ' ,  // 显示一个下载按钮,其中包含指向当前源或您在选项中指定的自定义 URL 的链接
       //   'fullscreen' ,  // 切换全屏
       // ] ;
-      // 'current-time',
       let controls = [
+        'current-time',
         'play-large',
         'play',
         'progress',

+ 5 - 1
src/student/layout/auth.tsx

@@ -42,7 +42,11 @@ export default defineComponent({
           setLogin(res.data)
         } catch (e: any) {
           const message = e.message
-          if (message.indexOf('430') !== -1) {
+          console.log(message, message.indexOf('430'))
+          if (
+            message.indexOf('430') === -1 &&
+            message.indexOf('authentication') === -1
+          ) {
             setLoginError()
           } else {
             setLogout()

+ 75 - 26
src/student/teacher-dependent/components/practice.tsx

@@ -1,4 +1,3 @@
-import ColProtocol from '@/components/col-protocol'
 import Calendar from '@/business-components/calendar'
 import request from '@/helpers/request'
 import { state } from '@/state'
@@ -18,6 +17,7 @@ import {
 import { defineComponent } from 'vue'
 import { getWeekCh } from '@/helpers/utils'
 import styles from './practice.module.less'
+import { orderStatus } from '@/views/order-detail/orderStatus'
 
 export default defineComponent({
   name: 'practice',
@@ -31,7 +31,6 @@ export default defineComponent({
     const query = this.$route.query
     return {
       teacherId: query.teacherId,
-      agreeStatus: false,
       teacherSubjectList: [],
       subjectStatus: false,
       subjectInfo: {
@@ -79,6 +78,8 @@ export default defineComponent({
       this.teacherSubjectList = result
 
       this.getList()
+
+      this.onBuy(true)
     } catch {}
   },
   computed: {
@@ -111,11 +112,6 @@ export default defineComponent({
         return
       }
 
-      if (!this.agreeStatus) {
-        Toast('请先阅读并同意《酷乐秀平台服务协议》')
-        return
-      }
-
       if (this.selectCourseList.length < this.courseNum) {
         this.selectStatus = true
         return
@@ -253,7 +249,7 @@ export default defineComponent({
     async onReset() {
       // 是否有锁课状态 或 是锁课类型的
       if (this.coursePlanStatus || this.selectType === 'enough') {
-        await this._unLookCourse()
+        // await this._unLookCourse()
       } else if (this.selectType === 'noEnough') {
         this.selectStatus = false
       }
@@ -264,19 +260,80 @@ export default defineComponent({
       await this._lookCourse(() => {
         if (status) {
           this.selectStatus = false
+
+          console.log(this.selectCourseList, 'this.selectCourseList')
+
+          this.onBuy()
+        }
+      })
+    },
+    async onBuy(goTo?: boolean) {
+      try {
+        const res = await request.post(
+          '/api-student/userOrder/getPendingOrder',
+          {
+            data: {
+              goodType: 'PRACTICE',
+              bizId: this.teacherId
+            }
+          }
+        )
+        console.log(res, res.data)
+        orderStatus.orderType = 'PRACTICE'
+        const subjectInfo = this.subjectInfo
+        const tempCourseList = [...this.selectCourseList]
+        tempCourseList.forEach((item: any) => {
+          item.classDate = dayjs(item.startTime).format('YYYY-MM-DD')
+        })
+        orderStatus.practiceInfo = {
+          courseGroupName: subjectInfo.subjectName + '陪练课',
+          courseIntroduce: subjectInfo.subjectName + '陪练课',
+          subjectId: subjectInfo.subjectId,
+          singleCourseMinutes: subjectInfo.courseMinutes,
+          courseNum: this.courseNum,
+          coursePrice: (this.courseNum * subjectInfo.subjectPrice).toFixed(2),
+          teacherName:
+            this.userInfo.username || `游客${this.userInfo.userId || ''}`,
+          teacherId: this.userInfo.userId,
+          starGrade: this.userInfo.starGrade,
+          avatar: this.userInfo.heardUrl,
+          classTime: tempCourseList
+        }
+        const result = res.data
+        if (result) {
+          Dialog.confirm({
+            title: '提示',
+            message: '您有一个未支付的订单,是否继续支付?',
+            confirmButtonColor: '#269a93',
+            cancelButtonText: '取消订单',
+            confirmButtonText: '继续支付'
+          })
+            .then(async () => {
+              orderStatus.orderInfo = {
+                orderNo: result.orderNo,
+                actualPrice: result.actualPrice,
+                payStatus: true
+              }
+              this.routerTo()
+            })
+            .catch(() => {
+              Dialog.close()
+              // 只用取消订单,不用做其它处理
+              this.cancelPayment(result.orderNo)
+            })
+        } else {
+          !goTo && this.routerTo()
+        }
+      } catch {}
+    },
+    routerTo() {
+      this.$router.push({
+        path: '/orderDetail',
+        query: {
+          orderType: 'PRACTICE'
         }
       })
     },
-    // routerTo() {
-    //   const live = this.live
-    //   this.$router.push({
-    //     path: '/orderDetail',
-    //     query: {
-    //       orderType: 'LIVE',
-    //       courseGroupId: live.courseGroupId
-    //     }
-    //   })
-    // },
     async cancelPayment(orderNo: string) {
       try {
         await request.post('/api-student/userOrder/orderCancel', {
@@ -377,14 +434,6 @@ export default defineComponent({
             }}
           ></Cell>
 
-          <div class={styles.protocol}>
-            <ColProtocol
-              v-model={this.agreeStatus}
-              showHeader
-              style={{ paddingLeft: 0, paddingRight: 0 }}
-            />
-          </div>
-
           <Popup show={this.selectStatus} class={styles.selectPopup}>
             <div class={styles.selectContainer}>
               <div class={styles.rTitle}>

+ 8 - 3
src/student/teacher-dependent/components/single.tsx

@@ -31,7 +31,7 @@ export default defineComponent({
       teacherId: query.teacherId,
       fansList: [],
       chatItem: {},
-      videoItem: {}
+      videoItem: {} as any
     }
   },
   async mounted() {
@@ -158,7 +158,12 @@ export default defineComponent({
         >
           <JoinChat
             item={this.chatItem}
-            onClose={() => (this.chatStatus = false)}
+            onClose={(id: number) => {
+              this.fansList.forEach((item: any) => {
+                item.id === id && (item.hasWaitAuditFlag = true)
+              })
+              this.chatStatus = false
+            }}
           />
         </Popup>
 
@@ -169,7 +174,7 @@ export default defineComponent({
           closeable
           onClose={() => (this.videoStatus = false)}
         >
-          <ColVideo />
+          <ColVideo playsinline src={this.videoItem?.videoUrl} />
         </Popup>
       </div>
     )

+ 6 - 3
src/student/teacher-dependent/model/join-chat.tsx

@@ -18,7 +18,7 @@ export default defineComponent({
     },
     onClose: {
       type: Function,
-      default: () => {}
+      default: (id: number) => {}
     }
   },
   data() {
@@ -36,7 +36,8 @@ export default defineComponent({
           }
         })
         Toast('申请成功')
-        this.onClose && this.onClose()
+
+        this.onClose && this.onClose(this.item.id)
       } catch {}
     }
   },
@@ -60,7 +61,9 @@ export default defineComponent({
               title: () => (
                 <div class={styles.fansTitle}>
                   <div class={styles.title}>{this.item.name}</div>
-                  <p class={['van-ellipsis', styles.introduce]}>{this.item.introduce}</p>
+                  <p class={['van-ellipsis', styles.introduce]}>
+                    {this.item.introduce}
+                  </p>
                 </div>
               )
             }}

+ 17 - 0
src/student/video-class/video-class-detail.module.less

@@ -1,13 +1,23 @@
 .video-class-detail {
+  min-height: 100vh;
   .cell {
+  }
+  .videoDesc {
+    background-color: #fff;
+    padding: 0 14px 16px;
     margin-bottom: 6px;
+    font-size: 14px;
+    line-height: 20px;
+    color: #7a7a7a;
   }
+
   .titleInfo {
     padding-left: 8px;
     font-size: 15px;
     font-weight: 500;
     color: #1a1a1a;
     flex: 1 auto;
+    max-width: 250px;
   }
   .label {
     font-size: 14px;
@@ -113,3 +123,10 @@
     }
   }
 }
+
+.messageContainer {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+}

+ 56 - 17
src/student/video-class/video-class-detail.tsx

@@ -25,7 +25,8 @@ export default defineComponent({
       message: '',
       navHeight: 0 as any,
       currentClassIndex: 1,
-      reload: false
+      reload: false,
+      videoContent: ''
     }
   },
   computed: {
@@ -53,38 +54,67 @@ export default defineComponent({
           this.srcUrl = item.videoUrl
           this.title = item.videoTitle
           this.currentClassIndex = index + 1
+          this.videoContent = item.videoContent
         }
       })
     } catch {}
+
+    this.getList()
   },
   methods: {
+    async getList() {
+      try {
+        const res = await request.post('/api-student/videoLesson/page', {
+          data: {
+            videoId: this.groupId
+          }
+        })
+        console.log(res)
+      } catch {}
+    },
     onPlay(item: any) {
       this.reload = true
       this.posterUrl = item.imgUrl
       this.srcUrl = item.videoUrl
       this.title = item.title
       this.currentClassIndex = item.index
+      this.videoContent = item.content
       setTimeout(() => {
         this.reload = false
       }, 0)
+    },
+    async onSubmit() {
+      try {
+        await request.post('/api-student/videoLesson/evaluate', {
+          data: {
+            isTeacher: 0,
+            videoId: this.groupId,
+            content: this.message,
+            studentId: state.user.data.userId
+          }
+        })
+      } catch {}
     }
   },
   render() {
     return (
       <div class={styles['video-class-detail']}>
-        <ColHeader
-          v-slots={{
-            content: () =>
-              !this.reload && (
-                <ColVideo src={this.srcUrl} poster={this.posterUrl} />
-              )
-          }}
-        />
+        <Sticky offsetTop={0} position="top">
+          <ColHeader
+            backIconColor="white"
+            v-slots={{
+              content: () =>
+                !this.reload && (
+                  <ColVideo src={this.srcUrl} poster={this.posterUrl} />
+                )
+            }}
+          />
+        </Sticky>
         <Cell
           border={false}
           class={styles.cell}
           title={this.title}
-          titleClass={styles.titleInfo}
+          titleClass={[styles.titleInfo, 'van-ellipsis']}
           v-slots={{
             icon: () => (
               <Icon
@@ -102,22 +132,25 @@ export default defineComponent({
             )
           }}
         ></Cell>
+        <div class={styles.videoDesc}>{this.videoContent}</div>
 
         <Tabs
           v-model:active={this.tabIndex}
           class={styles.infoField}
           color="var(--van-primary)"
+          sticky
+          offsetTop={210}
           lineWidth={20}
         >
           <Tab title="目录" name={1}>
             <div
               style={{
-                height: `calc(100vh - 320px - ${this.navHeight}px)`,
+                // height: `calc(100vh - 320px - ${this.navHeight}px)`,
                 overflowY: 'auto'
               }}
             >
               <SectionDetail title="课程列表" icon="courseList">
-                {this.detailList.map((item: any) => (
+                {this.detailList.map((item: any, index: number) => (
                   <CourseVideoItem
                     class={'mb12'}
                     detail={{
@@ -125,7 +158,8 @@ export default defineComponent({
                       title: item.videoTitle,
                       content: item.videoContent,
                       imgUrl: item.coverUrl,
-                      videoUrl: item.videoUrl
+                      videoUrl: item.videoUrl,
+                      index: index + 1
                     }}
                     onPlay={this.onPlay}
                   />
@@ -181,8 +215,10 @@ export default defineComponent({
           <Tab title="讨论" name={3}>
             <div
               style={{
-                height: `calc(100vh - 380px - ${this.navHeight}px)`,
-                overflowY: 'auto'
+                // height: `calc(100vh - 380px - ${this.navHeight}px)`,
+                overflowY: 'auto',
+                marginBottom:
+                  'calc(var(--van-cell-vertical-padding) * 2 + var( --van-cell-line-height))'
               }}
             >
               {[1, 2, 3].map((item: any) => (
@@ -211,7 +247,8 @@ export default defineComponent({
               ))}
             </div>
 
-            <Sticky offsetBottom={0} position="bottom">
+            {/* <Sticky offsetBottom={0} position="bottom"> */}
+            <div class={styles.messageContainer}>
               <Field
                 placeholder="快来讨论吧~"
                 v-model={this.message}
@@ -223,13 +260,15 @@ export default defineComponent({
                       style={{ padding: '0 20px' }}
                       size="small"
                       round
+                      onClick={this.onSubmit}
                     >
                       发布
                     </Button>
                   )
                 }}
               />
-            </Sticky>
+            </div>
+            {/* </Sticky> */}
           </Tab>
         </Tabs>
       </div>

+ 15 - 13
src/student/video-class/video-detail.tsx

@@ -149,19 +149,21 @@ export default defineComponent({
           ))}
         </SectionDetail>
 
-        <Sticky offsetBottom={0} position="bottom">
-          <div class={['btnGroup', styles.btnMore]}>
-            <Button
-              block
-              round
-              type="primary"
-              onClick={this.onBuy}
-              disabled={this.userInfo.alreadyBuy}
-            >
-              {this.userInfo.alreadyBuy ? '已购买' : '立即购买'}
-            </Button>
-          </div>
-        </Sticky>
+        {this.userInfo.id && (
+          <Sticky offsetBottom={0} position="bottom">
+            <div class={['btnGroup', styles.btnMore]}>
+              <Button
+                block
+                round
+                type="primary"
+                onClick={this.onBuy}
+                disabled={this.userInfo.alreadyBuy}
+              >
+                {this.userInfo.alreadyBuy ? '已购买' : '立即购买'}
+              </Button>
+            </div>
+          </Sticky>
+        )}
       </div>
     )
   }

+ 4 - 1
src/teacher/layout/auth.tsx

@@ -45,7 +45,10 @@ export default defineComponent({
         } catch (e: any) {
           const message = e.message
           console.log(message)
-          if (message.indexOf('430') !== -1) {
+          if (
+            message.indexOf('430') === -1 &&
+            message.indexOf('authentication') === -1
+          ) {
             setLoginError()
           } else {
             setLogout()

+ 5 - 0
src/teacher/open-live/index.module.less

@@ -71,6 +71,11 @@
 .cert {
   margin-left: 5px;
   height: 24px;
+  :global {
+    .van-image__img {
+      width: auto !important;
+    }
+  }
 }
 
 .teacher-desc {

+ 8 - 0
src/teacher/teacher-cert/index.tsx

@@ -33,10 +33,18 @@ export default defineComponent({
         return
       }
 
+      // teacherState.authStatus = false
+      // teacherState.active = 1
+
       if (teacherState.subjectList.length <= 0) {
         const res = await request.get('/api-teacher/subject/subjectSelect')
         teacherState.subjectList = res.data || []
       }
+
+      const teacherInfo = await request.get(
+        '/api-teacher/teacherAuthEntryRecord/getLastRecordByUserId'
+      )
+      console.log(teacherInfo)
     } catch {
       //
     }

+ 6 - 0
src/views/order-detail/index.tsx

@@ -20,6 +20,7 @@ import ColHeader from '@/components/col-header'
 import { state } from '@/state'
 import { orderStatus } from './orderStatus'
 import request from '@/helpers/request'
+import OrderPractice from './order-practice'
 
 export default defineComponent({
   name: 'order-detail',
@@ -68,6 +69,8 @@ export default defineComponent({
           result = await (this as any).$refs.orderVideo.onSubmit()
         } else if (this.$refs.orderLive && this.orderType == 'LIVE') {
           result = await (this as any).$refs.orderLive.onSubmit()
+        } else if (this.$refs.orderPractice && this.orderType == 'PRACTICE') {
+          result = await (this as any).$refs.orderPractice.onSubmit()
         }
         if (result) {
           orderStatus.orderInfo = {
@@ -90,6 +93,9 @@ export default defineComponent({
         {this.orderType === 'VIDEO' && (
           <OrderVideo ref="orderVideo" v-model={this.orderPrice} />
         )}
+        {this.orderType === 'PRACTICE' && (
+          <OrderPractice ref="orderPractice" v-model={this.orderPrice} />
+        )}
 
         <div class={styles.tips}>
           <h3>

+ 8 - 9
src/views/order-detail/order-practice/index.module.less

@@ -17,18 +17,17 @@
     }
   }
   .price {
-    font-size: 16px;
-    font-weight: 500;
-    color: #ff3535;
-    line-height: 20px;
-    i {
-      font-style: normal;
-      font-size: 14px;
+    font-size: 14px;
+    color: #999999;
+    span {
+      font-weight: 600;
+      color: #fa6400;
+      font-size: 16px;
     }
   }
   .userLogo {
-    width: 24px;
-    height: 24px;
+    width: 54px;
+    height: 54px;
     overflow: hidden;
     border-radius: 50%;
   }

+ 73 - 29
src/views/order-detail/order-practice/index.tsx

@@ -1,10 +1,11 @@
-import { Cell, CellGroup, Image } from 'vant'
+import { Cell, CellGroup, Image, Rate } from 'vant'
 import { defineComponent } from 'vue'
 import styles from './index.module.less'
 import { orderStatus } from '../orderStatus'
 
 import iconTeacher from '@common/images/icon_teacher.png'
 import request from '@/helpers/request'
+import item from '@/teacher/music/list/item'
 
 export default defineComponent({
   name: 'OrderPractice',
@@ -16,12 +17,42 @@ export default defineComponent({
   },
   computed: {
     coursePlan() {
-      const video = orderStatus.practiceInfo || {}
-      return video.courseInfo || []
+      const practice = orderStatus.practiceInfo || {}
+      console.log(practice.classTime)
+      return practice.classTime || []
+    },
+    bizContent() {
+      const {
+        courseGroupName,
+        courseIntroduce,
+        subjectId,
+        singleCourseMinutes,
+        courseNum,
+        coursePrice,
+        classTime
+      } = orderStatus.practiceInfo
+      let tempTime = classTime || []
+      let classCourse: any = []
+      tempTime.forEach((time: any) => {
+        classCourse.push({
+          classDate: time.classDate,
+          startTime: time.startTime,
+          endTime: time.endTime
+        })
+      })
+      return {
+        courseGroupName,
+        courseIntroduce,
+        subjectId,
+        singleCourseMinutes,
+        courseNum,
+        coursePrice,
+        classCourse
+      }
     }
   },
   mounted() {
-    const price = orderStatus.practiceInfo.coursePrice || 0
+    const price = Number(orderStatus.practiceInfo.coursePrice) || 0
     console.log(orderStatus.practiceInfo, 11212)
     this.$emit('update:modelValue', price)
   },
@@ -33,15 +64,14 @@ export default defineComponent({
           data: {
             orderName: '陪练课购买',
             orderDesc: '陪练课购买',
-            orderType: 'VIDEO',
+            orderType: 'PRACTICE',
             actualPrice: orderStatus.practiceInfo.coursePrice || 0,
             orderInfos: [
               {
-                goodType: 'VIDEO',
+                goodType: 'PRACTICE',
                 goodName: '陪练课购买',
                 bizContent: {
-                  videoLessonGroupId: orderStatus.practiceInfo.courseGroupId,
-                  payMoney: orderStatus.practiceInfo.coursePrice || 0
+                  ...this.bizContent
                 }
               }
             ]
@@ -57,39 +87,53 @@ export default defineComponent({
     return (
       <div class={styles.videoOrder}>
         <CellGroup border={false}>
-          <Cell titleClass={styles.title} title="课程名称" />
+          <Cell titleClass={styles.title} title="预约老师" />
           <Cell
-            title={orderStatus.practiceInfo.courseGroupName}
+            center
             v-slots={{
-              default: () => (
-                <span class={styles.price}>
-                  <i>¥</i>
-                  {(this as any).$filters.moneyFormat(
-                    orderStatus.practiceInfo.coursePrice
-                  )}
-                </span>
+              icon: () => (
+                <Image
+                  class={styles.userLogo}
+                  src={orderStatus.practiceInfo.avatar || iconTeacher}
+                />
+              ),
+              title: () => (
+                <div class={styles.titleName}>
+                  <p>{orderStatus.practiceInfo.teacherName}</p>
+                  <Rate
+                    iconPrefix="iconfont"
+                    color="#FFC459"
+                    void-icon="star_default"
+                    modelValue={orderStatus.practiceInfo.starGrade}
+                    icon="star_active"
+                    size={15}
+                  />
+                </div>
               )
             }}
           />
         </CellGroup>
-
         <CellGroup border={false}>
-          <Cell titleClass={styles.title} title="主讲老师" />
+          <Cell titleClass={styles.title} title="课程信息" />
           <Cell
-            class={styles.titleName}
-            title={orderStatus.practiceInfo.teacherName}
+            title={orderStatus.practiceInfo.courseGroupName}
             v-slots={{
-              icon: () => (
-                <Image
-                  class={styles.userLogo}
-                  src={orderStatus.practiceInfo.avatar || iconTeacher}
-                />
+              default: () => (
+                <div class={styles.price}>
+                  <span>
+                    ¥
+                    {(this as any).$filters.moneyFormat(
+                      orderStatus.practiceInfo.coursePrice
+                    )}
+                  </span>
+                  /{orderStatus.practiceInfo.singleCourseMinutes}分钟
+                </div>
               )
             }}
           />
         </CellGroup>
 
-        {/* <CellGroup border={false}>
+        <CellGroup border={false}>
           <Cell
             titleClass={styles.title}
             title="上课时间"
@@ -101,14 +145,14 @@ export default defineComponent({
                 <div>
                   {this.coursePlan.map((item: any) => (
                     <div class={styles.classItem}>
-                      <div class={styles.time}>{item.createTime}</div>
+                      <div class={styles.time}>{item.title}</div>
                     </div>
                   ))}
                 </div>
               )
             }}
           />
-        </CellGroup> */}
+        </CellGroup>
       </div>
       // 视频课
     )