Bläddra i källkod

学生端分享

skyblued 2 år sedan
förälder
incheckning
be0c62a44e

+ 1 - 1
src/components/col-share/share-item.tsx

@@ -111,7 +111,7 @@ export default defineComponent({
                 <p class={styles.name}>{this.getString}</p>
                 <p class={styles.titleTips}>
                   <span>{state.user.data.username}</span>
-                  酷乐秀入驻老师
+                  { state.platformType == 'TEACHER' ? " 酷乐秀入驻老师" : " 为您推荐"}
                 </p>
               </div>
             )

+ 8 - 8
src/router/routes-common.ts

@@ -204,14 +204,6 @@ export const router = [
     meta: {
       title: '优惠券'
     }
-  },
-  {
-    path: '/contactus',
-    name: 'contactus',
-    component: () => import('@/views/contactus/index'),
-    meta: {
-      title: '联系我们'
-    }
   }
 ]
 
@@ -282,5 +274,13 @@ export const rootRouter = [
     meta: {
       title: '乐理详情'
     }
+  },
+  {
+    path: '/contactus',
+    name: 'contactus',
+    component: () => import('@/views/contactus/index'),
+    meta: {
+      title: '联系我们'
+    }
   }
 ]

+ 8 - 0
src/student/live-class/live-detail.module.less

@@ -49,4 +49,12 @@
       }
     }
   }
+  .shareCourse {
+    margin: 0;
+    padding: 8px;
+    background: #fff;
+    :global(.itemTitle) {
+      max-width: 110px !important;
+    }
+  }
 }

+ 53 - 3
src/student/live-class/live-detail.tsx

@@ -3,7 +3,7 @@ import SectionDetail from '@/business-components/section-detail'
 import UserDetail from '@/business-components/user-detail'
 import request from '@/helpers/request'
 import dayjs from 'dayjs'
-import { Icon, Sticky, Button, Dialog, Toast } from 'vant'
+import { Icon, Sticky, Button, Dialog, Toast, Popup } from 'vant'
 import { defineComponent } from 'vue'
 import styles from './live-detail.module.less'
 import iconTips from '@common/images/icon_tips.png'
@@ -11,6 +11,10 @@ import { onSubmitZero, orderStatus } from '@/views/order-detail/orderStatus'
 import ColHeader from '@/components/col-header'
 import { postMessage } from '@/helpers/native-message'
 import ColSticky from '@/components/col-sticky'
+import ColShare from '@/components/col-share'
+import LiveItem from '@/views/live-class/live-item'
+import iconShare from '@/views/shop-mall/images/icon-share.svg'
+import { state } from '@/state'
 interface IProps {
   courseTime: string
   coursePlan: string
@@ -28,28 +32,36 @@ export default defineComponent({
       recomUserId: query.recomUserId, // 推荐人id
       groupId: query.groupId,
       courseId: query.classId,
-      live: {} as any
+      live: {} as any,
+      shareStatus: false,
+      shareUrl: '',
     }
   },
   computed: {
     userInfo() {
       const live = this.live as any
+      console.log('live', live)
       const planList = live.planList || []
       const startTime = planList[0]?.startTime || new Date()
       const endTime = planList[0]?.endTime || new Date()
       return {
+        avatar: live.avatar,
         headUrl: live.avatar,
         username: live.userName || `游客${live.teacherId || ''}`,
+        id: live.teacherId,
         startTime:
           `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(startTime).format(
             'HH:mm'
           )}~${dayjs(endTime).format('HH:mm')}` || '',
         buyNum: live.studentCount,
+        lessonId: live.courseGroupId,
         lessonPrice: live.coursePrice,
         lessonNum: live.courseNum,
         lessonDesc: live.courseIntroduce,
         lessonCoverUrl: live.backgroundPic || live.backgroundPicTemplate,
         lessonName: live.courseGroupName,
+        subjectName: live.subjectName,
+        courseStartTime: live.courseStartTime,
         auditVersion: live.auditVersion || 0,
         isDegree: live.degreeFlag ? true : false,
         isTeacher: live.teacherFlag ? true : false
@@ -96,6 +108,11 @@ export default defineComponent({
   },
   async mounted() {
     await this._init()
+    if (/(localhost|192)/g.test(location.origin)) {
+      this.shareUrl = `https://dev.colexiu.com/teacher/#/shareLive?recomUserId=${state.user.data?.userId}&groupId=${this.groupId}`
+    } else {
+      this.shareUrl = `${location.origin}/teacher/#/shareLive?recomUserId=${state.user.data?.userId}&groupId=${this.groupId}`
+    }
   },
   methods: {
     async _init() {
@@ -246,7 +263,11 @@ export default defineComponent({
   render() {
     return (
       <div class={[styles['live-detail'], 'mb12']}>
-        <ColHeader />
+        <ColHeader v-slots={{
+          right: () => (
+            <img src={iconShare} onClick={() => this.shareStatus = true} />
+          )
+        }} />
         <UserDetail userInfo={this.userInfo} showBuy={false} />
         <SectionDetail border>
           <p class={styles.introduction}>{this.userInfo.lessonDesc}</p>
@@ -314,6 +335,35 @@ export default defineComponent({
             </div>
           </ColSticky>
         )}
+
+        <Popup
+          v-model:show={this.shareStatus}
+          style={{ background: 'transparent' }}
+        >
+          <ColShare
+            teacherId={this.userInfo.id}
+            shareUrl={this.shareUrl}
+            shareType="live"
+          >
+            <LiveItem
+              class={styles.shareCourse}
+              liveInfo={{
+                backgroundPic: this.userInfo.lessonCoverUrl,
+                courseGroupId: this.userInfo.lessonId,
+                courseGroupName: this.userInfo.lessonName,
+                courseNum: this.userInfo.lessonNum,
+                coursePrice: this.userInfo.lessonPrice,
+                teacherName: this.userInfo.username,
+                teacherId: this.userInfo.id,
+                avatar: this.userInfo.avatar,
+                studentCount: this.userInfo.buyNum,
+                courseStartTime: this.userInfo.courseStartTime,
+                existBuy: 0,
+                subjectName: this.userInfo.subjectName
+              }}
+            />
+          </ColShare>
+        </Popup>
       </div>
     )
   }

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

@@ -27,4 +27,17 @@
       }
     }
   }
+  .shareCourse {
+    margin: 0;
+    padding: 8px;
+    background: #fff;
+    :global(.itemTitle) {
+      max-width: 110px !important;
+    }
+  }
+
+  .coverClass {
+    width: 164px !important;
+    height: 92px !important;
+  }
 }

+ 47 - 3
src/student/video-class/video-detail.tsx

@@ -1,7 +1,7 @@
 import CourseVideoItem from '@/business-components/course-video-item'
 import SectionDetail from '@/business-components/section-detail'
 import UserDetail from '@/business-components/user-detail'
-import { Sticky, Button, Dialog } from 'vant'
+import { Sticky, Button, Dialog, Popup } from 'vant'
 import { defineComponent } from 'vue'
 import styles from './video-detail.module.less'
 import request from '@/helpers/request'
@@ -9,6 +9,10 @@ import ColHeader from '@/components/col-header'
 import { onSubmitZero, orderStatus } from '@/views/order-detail/orderStatus'
 import { tradeOrder } from '../trade/tradeOrder'
 import ColSticky from '@/components/col-sticky'
+import iconShare from '@/views/shop-mall/images/icon-share.svg'
+import ColShare from '@/components/col-share'
+import LiveItem from '@/views/live-class/live-item'
+import { state } from '@/state'
 export default defineComponent({
   name: 'VideoDetail',
   data() {
@@ -19,11 +23,18 @@ export default defineComponent({
       recomUserId: query.recomUserId, // 推荐人id
       params: {
         groupId: query.groupId
-      }
+      },
+      shareStatus: false,
+      shareUrl: '',
     }
   },
   async mounted() {
     await this._init()
+    if (/(localhost|192)/g.test(location.origin)) {
+      this.shareUrl = `https://dev.colexiu.com/teacher#/shareVideo?recomUserId=${state.user.data?.userId}&groupId=${this.params.groupId}`
+    } else {
+      this.shareUrl = `${location.origin}/teacher#/shareVideo?recomUserId=${state.user.data?.userId}&groupId=${this.params.groupId}`
+    }
   },
   methods: {
     async _init() {
@@ -161,7 +172,11 @@ export default defineComponent({
   render() {
     return (
       <div class={[styles['video-detail']]}>
-        <ColHeader />
+        <ColHeader v-slots={{
+          right: () => (
+            <img src={iconShare} onClick={() => this.shareStatus = true} />
+          )
+        }} />
         <UserDetail userInfo={this.userInfo} />
         <SectionDetail border>
           <p class={styles.introduction}>{this.userInfo.lessonDesc}</p>
@@ -198,6 +213,35 @@ export default defineComponent({
             </div>
           </ColSticky>
         )}
+
+        <Popup
+          v-model:show={this.shareStatus}
+          style={{ background: 'transparent' }}
+        >
+          <ColShare
+            teacherId={this.userInfo.id}
+            shareUrl={this.shareUrl}
+            shareType="video"
+          >
+            <LiveItem
+              class={styles.shareCourse}
+              coverClass={styles.coverClass}
+              liveInfo={{
+                backgroundPic: this.userInfo.lessonCoverUrl,
+                courseGroupId: this.userInfo.lessonId,
+                courseGroupName: this.userInfo.lessonName,
+                courseNum: this.userInfo.lessonNum,
+                coursePrice: this.userInfo.lessonPrice,
+                teacherName: this.userInfo.username,
+                teacherId: this.userInfo.id,
+                avatar: this.userInfo.headUrl,
+                studentCount: this.userInfo.buyNum,
+                existBuy: 0,
+                subjectName: this.userInfo.lessonSubjectName
+              }}
+            />
+          </ColShare>
+        </Popup>
       </div>
     )
   }

+ 6 - 7
src/views/member-center/index.tsx

@@ -210,13 +210,12 @@ export default defineComponent({
         <ColHeader
           background="#ffe5cc"
           v-slots={{
-            right: () =>
-              state.platformType === 'TEACHER' && (
-                <div class={styles.shareBtn} onClick={this.onShare}>
-                  <Image src={iconShare} />
-                  分享
-                </div>
-              )
+            right: () => (
+              <div class={styles.shareBtn} onClick={this.onShare}>
+                <Image src={iconShare} />
+                分享
+              </div>
+            )
           }}
         />
         <div class={styles.member_container}>

+ 2 - 2
src/views/shop-mall/components/goods/index.tsx

@@ -46,7 +46,7 @@ export default defineComponent({
             </del> */}
             <p class={styles.goodsPrice}><span class={styles.pre}>¥</span>{moneyFormat(item.price)}</p>
 
-            {this.showAdd && (
+            {/* {this.showAdd && (
               <Icon
                 class={[
                   styles.addCart,
@@ -59,7 +59,7 @@ export default defineComponent({
                   item.stock > 0 && this.onBuyClick(item)
                 }}
               />
-            )}
+            )} */}
           </div>
         </div>
       </div>

+ 14 - 15
src/views/shop-mall/goods-detail/index.tsx

@@ -206,20 +206,15 @@ export default defineComponent({
       <div class={styles.goodsDetail}>
         <ColHeader
           v-slots={{
-            right: () => {
-              if (state.platformType === 'TEACHER' || this.$route.query.teacher) {
-                return (
-                  <div
-                    class={styles.shareBtn}
-                    onClick={() => (this.shareShow = true)}
-                  >
-                    <Icon name={iconShare} size={14} color="#666" />
-                    <span style={{ marginLeft: '3px' }}>分享</span>
-                  </div>
-                )
-              }
-              return null
-            }
+            right: () => (
+              <div
+                class={styles.shareBtn}
+                onClick={() => (this.shareShow = true)}
+              >
+                <Icon name={iconShare} size={14} color="#666" />
+                <span style={{ marginLeft: '3px' }}>分享</span>
+              </div>
+            )
           }}
         />
         <Swipe
@@ -404,7 +399,11 @@ export default defineComponent({
           >
             <div class={styles.shareWrap}>
               <div class={styles.shareLeft}>
-                <img crossorigin="anonymous" class={styles.sharePic} src={sharePic}></img>
+                <img
+                  crossorigin="anonymous"
+                  class={styles.sharePic}
+                  src={sharePic}
+                ></img>
               </div>
               <div class={styles.shareRight}>
                 <div class={styles.shareShopTitle}>{this.product.name}</div>