Bladeren bron

更新文件

lex-xin 2 jaren geleden
bovenliggende
commit
94096e4059

+ 1 - 1
src/business-components/user-detail/index.tsx

@@ -90,7 +90,7 @@ export default defineComponent({
               ),
               title: () => (
                 <div class={styles.name}>
-                  {this.userInfo.username || '游客' + this.userInfo.id}
+                  {this.userInfo.username || `游客${this.userInfo.id || ''}`}
                   {this.showType === 'TIME' ? (
                     <Tag
                       style={{ marginLeft: '8px' }}

+ 2 - 1
src/business-components/user-list/index.tsx

@@ -6,6 +6,7 @@ import defaultIcon from '@common/images/icon_teacher.png'
 
 interface UserType {
   avatar: string
+  userId?: number
   studentName: string
   createTime: string
 }
@@ -27,7 +28,7 @@ export default defineComponent({
             src={this.users.avatar || defaultIcon}
             fit="cover"
           />
-          {this.users.studentName}
+          {this.users.studentName || `游客${this.users.userId || ''}`}
         </div>
         <span class={styles['user-time']}>{this.users.createTime}</span>
       </div>

+ 16 - 2
src/components/col-popup/index.tsx

@@ -9,6 +9,10 @@ export default defineComponent({
       type: String,
       default: '100%'
     },
+    destroy: {
+      type: Boolean,
+      default: false
+    },
     modelValue: {
       type: Boolean,
       default: false
@@ -16,7 +20,8 @@ export default defineComponent({
   },
   data() {
     return {
-      popupShow: false
+      popupShow: false,
+      isDestroy: false
     }
   },
   watch: {
@@ -25,6 +30,8 @@ export default defineComponent({
     }
   },
   mounted() {
+    this.destroy && (this.isDestroy = false)
+
     window.addEventListener('hashchange', this.onHash, false)
   },
   unmounted() {
@@ -33,6 +40,7 @@ export default defineComponent({
   methods: {
     onHash() {
       this.$emit('update:modelValue', false)
+      this.isDestroy = false
     },
     onPopupClose(val: boolean) {
       this.$emit('update:modelValue', val)
@@ -41,6 +49,7 @@ export default defineComponent({
     hashState() {
       // 打开弹窗
       if (this.modelValue) {
+        this.isDestroy = false
         const splitUrl = window.location.hash.slice(1).split('?')
         const query = qs.parse(splitUrl[1])
         let times = 0
@@ -70,8 +79,13 @@ export default defineComponent({
         transitionAppear={true}
         position="bottom"
         style={{ height: this.height }}
+        onClosed={() => {
+          if (this.destroy) {
+            this.isDestroy = true
+          }
+        }}
       >
-        {this.$slots.default && this.$slots.default()}
+        {this.$slots.default && !this.isDestroy && this.$slots.default()}
       </Popup>
     )
   }

+ 1 - 1
src/components/col-protocol/index.module.less

@@ -25,7 +25,7 @@
       height: 15px;
       line-height: 15px;
       display: inline-block;
-      vertical-align: sub;
+      vertical-align: middle;
     }
     .van-checkbox__label {
       line-height: 15px;

+ 9 - 6
src/helpers/request.ts

@@ -33,12 +33,15 @@ let initRequest = false
 request.interceptors.request.use(
   (url, options: any) => {
     // openLoading();
-    Toast.loading({
-      message: '加载中...',
-      forbidClick: true,
-      loadingType: 'spinner',
-      duration: 0
-    })
+    if (!options.hideLoading) {
+      Toast.loading({
+        message: '加载中...',
+        forbidClick: true,
+        loadingType: 'spinner',
+        duration: 0
+      })
+    }
+
     initRequest = options.initRequest || false
     const Authorization = sessionStorage.getItem('Authorization') || ''
     const authHeaders: any = {}

+ 2 - 2
src/student/live-class/live-detail.tsx

@@ -33,7 +33,7 @@ export default defineComponent({
       const endTime = planList[0]?.endTime || new Date()
       return {
         headUrl: live.avatar,
-        username: live.teacherName,
+        username: live.teacherName || `游客${live.teacherId || ''}`,
         startTime:
           `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(startTime).format(
             'HH:mm'
@@ -87,7 +87,7 @@ export default defineComponent({
         courseGroupId: live.courseGroupId,
         courseGroupName: live.courseGroupName,
         coursePrice: live.coursePrice,
-        teacherName: live.teacherName,
+        teacherName: live.teacherName || `游客${live.teacherId || ''}`,
         teacherId: live.teacherId,
         avatar: live.avatar,
         courseInfo: this.courseInfo

+ 3 - 1
src/student/practice-class/practice-item.tsx

@@ -51,7 +51,9 @@ export default defineComponent({
             <div>
               <div class={[styles.piTitle, 'van-ellipsis']}>
                 <p class={styles.piNameSubject}>
-                  <span class={styles.piName}>{this.item.userName}</span>
+                  <span class={styles.piName}>
+                    {this.item.userName || `游客${this.item.teacherId || ''}`}
+                  </span>
                   {/* {this.subjectNameList.map(
                     (item: string, index: number) =>
                       index <= 1 && <span class={styles.subject}>{item}</span>

+ 2 - 1
src/student/teacher-dependent/teacher-home.tsx

@@ -90,7 +90,8 @@ export default defineComponent({
                     >
                       <div class={styles['teacher-info']}>
                         <div class={styles['teacher-name']}>
-                          {this.userInfo.username}
+                          {this.userInfo.username ||
+                            `游客${this.userInfo.userId || ''}`}
                         </div>
                         <p class={styles.piNameSubject}>
                           <span class={styles.subject}>

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

@@ -33,7 +33,7 @@ export default defineComponent({
       const lessonGroup = result.lessonGroup || {}
       this.userInfo = {
         alreadyBuy: result.alreadyBuy,
-        username: lessonGroup.username,
+        username: lessonGroup.username || `游客${lessonGroup.teacherId || ''}`,
         headUrl: lessonGroup.avatar,
         buyNum: lessonGroup.countStudent,
         id: lessonGroup.id,
@@ -64,7 +64,7 @@ export default defineComponent({
         courseGroupId: userInfo.id,
         courseGroupName: userInfo.lessonName,
         coursePrice: userInfo.lessonPrice,
-        teacherName: userInfo.username,
+        teacherName: userInfo.username || `游客${userInfo.teacherId || ''}`,
         teacherId: userInfo.teacherId,
         avatar: userInfo.avatar,
         courseInfo: this.detailList

+ 1 - 0
src/student/video-class/video-item.module.less

@@ -33,6 +33,7 @@
       height: 18px;
       border-radius: 50%;
       margin-right: 5px;
+      overflow: hidden;
     }
 
     .viUserName {

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

@@ -44,7 +44,7 @@ export default defineComponent({
               class={styles.viUserLogo}
             />
             <span class={[styles.viUserName, 'van-hairline--right']}>
-              {item?.userName}
+              {item?.userName || `游客${item?.teacherId || ''}`}
             </span>
             <span class={styles.viUserNum}>{item?.countStudent}人已购买</span>
           </div>

+ 1 - 0
src/styles/index.less

@@ -110,6 +110,7 @@
 
 body {
   background-color: #f6f8f9;
+  user-select: none;
 }
 
 .mb12 {

+ 8 - 10
src/teacher/live-class/create-components/course.tsx

@@ -186,16 +186,14 @@ export default defineComponent({
           </div>
         </Sticky>
 
-        <ColPopup v-model={this.subjectStatus}>
-          {this.subjectStatus && (
-            <SubjectModel
-              selectType="Radio"
-              single
-              subjectList={createState.subjectList}
-              choiceSubjectIds={this.choiceSubjectIds}
-              onChoice={this.onChoice}
-            />
-          )}
+        <ColPopup v-model={this.subjectStatus} destroy>
+          <SubjectModel
+            selectType="Radio"
+            single
+            subjectList={createState.subjectList}
+            choiceSubjectIds={this.choiceSubjectIds}
+            onChoice={this.onChoice}
+          />
         </ColPopup>
 
         <ActionSheet

+ 1 - 1
src/teacher/live-class/create-components/detail.tsx

@@ -23,7 +23,7 @@ export default defineComponent({
       const endTime = createState.live.coursePlanList[0].endTime
       return {
         headUrl: state.user.data?.headUrl,
-        username: state.user.data?.username,
+        username: state.user.data?.username || `游客${state.user.data?.id || ''}`,
         startTime:
           `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(startTime).format(
             'HH:mm'

+ 2 - 1
src/teacher/live-class/live-detail.tsx

@@ -32,7 +32,8 @@ export default defineComponent({
       const endTime = planList[0]?.endTime || new Date()
       return {
         headUrl: state.user.data?.headUrl,
-        username: state.user.data?.username,
+        username:
+          state.user.data?.username || `游客${state.user.data?.id || ''}`,
         startTime:
           `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(startTime).format(
             'HH:mm'

+ 2 - 0
src/teacher/practice-class/practice-setting.module.less

@@ -16,6 +16,7 @@
 .radio-group,
 .checkbox-group {
   display: flex;
+  flex-wrap: wrap;
   margin-top: 14px;
   .radio:first-child {
     :global {
@@ -64,6 +65,7 @@
 }
 
 .checkbox {
+  margin-bottom: 5px;
   :global {
     .van-checkbox__icon {
       display: none;

+ 9 - 11
src/teacher/practice-class/practice-setting.tsx

@@ -388,19 +388,17 @@ export default defineComponent({
           </div>
         </Sticky>
 
-        <ColPopup v-model={this.subjectStatus}>
-          {this.subjectStatus && (
-            <SubjectModel
-              max={5}
-              single
-              subjectList={this.subjectList}
-              choiceSubjectIds={this.choiceSubjectId}
-              onChoice={this.onChoice}
-            />
-          )}
+        <ColPopup v-model={this.subjectStatus} destroy>
+          <SubjectModel
+            max={5}
+            single
+            subjectList={this.subjectList}
+            choiceSubjectIds={this.choiceSubjectId}
+            onChoice={this.onChoice}
+          />
         </ColPopup>
 
-        <ColPopup v-model={this.timerStatus}>
+        <ColPopup v-model={this.timerStatus} destroy>
           <Timer
             onChoice={this.onChoiceTimer}
             timerObject={this.timerObject}

+ 6 - 8
src/teacher/teacher-cert/cert-two.tsx

@@ -138,14 +138,12 @@ export default defineComponent({
           </ColField>
         </ColFieldGroup>
 
-        <ColPopup v-model={this.subjectStatus}>
-          {this.subjectStatus && (
-            <SubjectModel
-              subjectList={this.subjectList}
-              choiceSubjectIds={this.choiceSubjectIds}
-              onChoice={this.onChoice}
-            />
-          )}
+        <ColPopup v-model={this.subjectStatus} destroy>
+          <SubjectModel
+            subjectList={this.subjectList}
+            choiceSubjectIds={this.choiceSubjectIds}
+            onChoice={this.onChoice}
+          />
         </ColPopup>
       </div>
     )

+ 8 - 10
src/teacher/video-class/class-info.tsx

@@ -283,16 +283,14 @@ export default defineComponent({
           </div>
         </Sticky>
 
-        <ColPopup v-model={this.subjectStatus}>
-          {this.subjectStatus && (
-            <SubjectModel
-              selectType="Radio"
-              single
-              subjectList={createState.subjectList}
-              choiceSubjectIds={this.choiceSubjectIds}
-              onChoice={this.onChoice}
-            />
-          )}
+        <ColPopup v-model={this.subjectStatus} destroy>
+          <SubjectModel
+            selectType="Radio"
+            single
+            subjectList={createState.subjectList}
+            choiceSubjectIds={this.choiceSubjectIds}
+            onChoice={this.onChoice}
+          />
         </ColPopup>
       </Form>
     )

+ 1 - 1
src/teacher/video-class/create-submit.tsx

@@ -16,7 +16,7 @@ export default defineComponent({
       const videoDetail = createState.lessonGroup
       const users = state.user.data || {}
       return {
-        username: users.username,
+        username: users.username || `游客${users.id || ''}`,
         headUrl: users.headUrl,
         lessonName: videoDetail.lessonName,
         buyNum: 0,

+ 3 - 4
src/teacher/video-class/video-detail.tsx

@@ -39,15 +39,16 @@ export default defineComponent({
       const result = res.data || {}
       const users = state.user.data || {}
       this.userInfo = {
-        username: users.username,
+        username: users.username || `游客${users.id || ''}`,
         headUrl: users.headUrl,
-        buyNum: 0,
+        buyNum: result.lessonGroup.countStudent,
         lessonNum: result.lessonGroup.lessonCount,
         lessonName: result.lessonGroup.lessonName,
         lessonDesc: result.lessonGroup.lessonDesc,
         lessonPrice: result.lessonGroup.lessonPrice,
         lessonCoverUrl: result.lessonGroup.lessonCoverUrl
       }
+
       this.detailList = result.detailList || []
 
       this.getList()
@@ -71,8 +72,6 @@ export default defineComponent({
         this.finished = result.pageNo >= result.totalPage
         this.params.page = result.pageNo + 1
         this.dataShow = this.buyUserList.length > 0
-
-        this.userInfo.buyNum = result.totalCount || 0
       } catch {}
     },
     onPlay(detail: any) {

+ 14 - 1
src/views/order-detail/index.module.less

@@ -1,8 +1,10 @@
 .order-detail {
   position: relative;
   padding: 14px 14px 0;
+  overflow: hidden;
 
   .tips {
+    margin-bottom: 120px;
     background-color: white;
     border-radius: 8px;
     padding: var(--van-cell-vertical-padding) var(--van-cell-horizontal-padding);
@@ -31,11 +33,22 @@
       border-radius: 6px 6px 0 0;
     }
   }
-  .btnGroup {
+
+  .paymentInfo {
     position: fixed;
     bottom: 0;
     left: 0;
     right: 0;
+  }
+  .protocol {
+    padding: 0 14px;
+    background-color: #f6f8f9;
+  }
+  .btnGroup {
+    // position: fixed;
+    // bottom: 0;
+    // left: 0;
+    // right: 0;
     background-color: #fff;
     display: flex;
     align-items: center;

+ 26 - 22
src/views/order-detail/index.tsx

@@ -95,31 +95,35 @@ export default defineComponent({
           </p>
         </div>
 
-        <ColProtocol
-          v-model={this.agreeStatus}
-          showHeader
-          style={{ paddingLeft: 0, paddingRight: 0 }}
-        />
-        <div class={styles.btnGroup}>
-          <div class={styles.priceSection}>
-            支付金额:
-            <div class={styles.price}>
-              <span class={styles.priceUnit}>¥</span>
-              <span class={styles.priceNum}>
-                {(this as any).$filters.moneyFormat(this.orderPrice)}
-              </span>
+        <div class={styles.paymentInfo}>
+          <div class={styles.protocol}>
+            <ColProtocol
+              v-model={this.agreeStatus}
+              showHeader
+              style={{ paddingLeft: 0, paddingRight: 0 }}
+            />
+          </div>
+
+          <div class={styles.btnGroup}>
+            <div class={styles.priceSection}>
+              支付金额:
+              <div class={styles.price}>
+                <span class={styles.priceUnit}>¥</span>
+                <span class={styles.priceNum}>
+                  {(this as any).$filters.moneyFormat(this.orderPrice)}
+                </span>
+              </div>
             </div>
+            <Button
+              type="primary"
+              round
+              class={styles.btn}
+              onClick={this.onSubmit}
+            >
+              立即支付
+            </Button>
           </div>
-          <Button
-            type="primary"
-            round
-            class={styles.btn}
-            onClick={this.onSubmit}
-          >
-            立即支付
-          </Button>
         </div>
-
         <ColPopup v-model={this.popupShow}>
           <UserAuth onSuccess={this.onAuthSuccess} />
         </ColPopup>

+ 5 - 0
src/views/order-detail/order-video/index.module.less

@@ -10,6 +10,11 @@
     color: #333333;
     line-height: 24px;
     padding-left: 8px;
+    :global {
+      .van-cell__title {
+        padding-left: 5px;
+      }
+    }
   }
   .price {
     font-size: 16px;

+ 1 - 1
src/views/order-detail/order-video/index.tsx

@@ -59,7 +59,7 @@ export default defineComponent({
         <CellGroup border={false}>
           <Cell titleClass={styles.title} title="课程名称" />
           <Cell
-            title="大号基础演奏"
+            title={orderStatus.videoInfo.courseGroupName}
             v-slots={{
               default: () => (
                 <span class={styles.price}>

+ 21 - 3
src/views/trade/trade-detail.tsx

@@ -45,7 +45,9 @@ export default defineComponent({
         }
       },
       result: {} as any,
-      loading: true
+      loading: true,
+      timerOut: null as any,
+      timer: 3
     }
   },
   computed: {
@@ -62,13 +64,29 @@ export default defineComponent({
       this.loading = true
       this.orderNo && (await this.getOrder())
       this.loading = false
+
+      this.interval()
     }, 0)
   },
+  unmounted() {
+    clearInterval(this.timerOut)
+  },
   methods: {
-    async getOrder() {
+    interval() {
+      let countTime = 0
+      this.timerOut = setInterval(async () => {
+        countTime === 25 && clearInterval(this.timerOut)
+        await this.getOrder(true)
+        countTime++
+      }, 5000)
+    },
+    async getOrder(status?: true) {
       try {
         const res = await request.get(
-          `/api-student/userOrder/detailByOrderNo/${this.orderNo}`
+          `/api-student/userOrder/detailByOrderNo/${this.orderNo}`,
+          {
+            hideLoading: status
+          }
         )
         this.result = res.data
         // WAIT_PAY 待支付 PAYING 支付中 PAID 已付款 CLOSE 已关闭 FAIL 支付失败