lex 2 년 전
부모
커밋
eb0a7743a9

BIN
src/teacher/share-page/images/share-banner.png


BIN
src/teacher/share-page/images/share-vip-tips.png


+ 139 - 8
src/teacher/share-page/share-vip/index.module.less

@@ -1,13 +1,144 @@
-.live-detail {
-  .introduction {
-    color: #7a7a7a;
-    line-height: 23px;
-    padding-bottom: 8px;
+.member-center {
+  min-height: 100vh;
+  position: relative;
+  background-color: #fff;
+
+  .intro {
+    background: url('../images/share-vip-tips.png') no-repeat center;
+    background-size: contain;
+    height: 142px;
+    font-size: 14px;
+    color: #bb6e3a;
+    p {
+      padding: 45px 25px 0;
+      text-align: justify;
+      line-height: 22px;
+    }
+  }
+
+  .shareBanner {
+    width: 100%;
+  }
+
+  .memberContainer {
+    position: relative;
+    margin-top: 15px;
+    padding: 0 14px 65px;
+    z-index: 99;
+  }
+  .memberItem {
+    padding-top: 20px;
+    .title {
+      font-size: 16px;
+      color: #333333;
+      font-weight: 500;
+      span {
+        color: #f7b500;
+      }
+    }
+  }
+
+  .member_function {
+    display: flex;
+    justify-content: space-between;
+    flex-wrap: wrap;
+    .function_item__content {
+      height: 100%;
+    }
+    .function_item {
+      width: 80px;
+      padding: 12px 0;
+      margin-top: 8px;
+      border-radius: 8px;
+      overflow: hidden;
+      background-color: #faefe3;
+      text-align: center;
+    }
+    .function_text {
+      font-size: 12px;
+      color: #814014;
+      line-height: 16px;
+    }
+  }
+  .system-list::-webkit-scrollbar {
+    display: none; /* Chrome Safari */
   }
+  .system-list {
+    width: 100%;
+    overflow-x: auto;
+    overflow-y: hidden;
+    display: flex;
+    position: relative;
+    user-select: none;
+    box-sizing: content-box;
+    padding-top: 16px;
+    padding-bottom: 10px;
+    margin-bottom: 10px;
+  }
+  .system-item {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    flex: 1 0 auto;
+    width: 96px;
+    min-height: 120px;
+    box-sizing: border-box;
+    background: #ffffff;
+    border-radius: 12px;
+    border: 1px solid #e5e5e5;
+    margin-right: 10px;
+    .title {
+      font-size: 14px;
+      font-weight: 500;
+      color: #333333;
+      line-height: 20px;
+    }
+    .price {
+      color: #dc9362;
+      font-size: 25px;
+      line-height: 1.5;
+      span {
+        font-size: 16px;
+      }
+    }
+    .originalPrice {
+      color: #937059;
+      font-size: 13px;
+    }
 
-  :global {
-    .van-tabs__wrap {
-      margin-bottom: 15px;
+    &.active {
+      background: linear-gradient(
+        215deg,
+        #ffe7c4 0%,
+        rgba(250, 211, 156, 0.21) 100%
+      );
+      border: 1px solid #b1652e;
+      position: relative;
+      .title {
+        color: #814014;
+      }
+      .price {
+        color: #b1652e;
+      }
+      .originalPrice {
+        color: #937059;
+      }
+      &::before {
+        content: '\e728';
+        font: 14px/1 'vant-icon';
+        color: #fff;
+        background-color: #b1652e;
+        width: 27px;
+        height: 18px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        position: absolute;
+        top: 0;
+        right: 0;
+        border-radius: 0 12px 0 12px;
+      }
     }
   }
 

+ 69 - 136
src/teacher/share-page/share-vip/index.tsx

@@ -1,148 +1,67 @@
-import CoursePlanStep from '@/business-components/course-plan-step'
-import SectionDetail from '@/business-components/section-detail'
-import UserDetail from '@/business-components/user-detail'
-import ColSticky from '@/components/col-sticky'
-import { postMessage, promisefiyPostMessage } from '@/helpers/native-message'
+import ColHeader from '@/components/col-header'
+import { Button, Cell, Icon, Image, Popup, Toast } from 'vant'
+import { defineComponent } from 'vue'
+import styles from './index.module.less'
 import request from '@/helpers/request'
-import { browser } from '@/helpers/utils'
 import { state } from '@/state'
-import dayjs from 'dayjs'
-import { Button, Dialog, Toast } from 'vant'
-import { defineComponent } from 'vue'
+import shareBanner from '../images/share-banner.png'
+import wxImage from '../images/wx_bg.png'
 import { shareCall } from '../share'
-import styles from './index.module.less'
-import qs from 'query-string'
+import { browser } from '@/helpers/utils'
+
 export const getAssetsHomeFile = (fileName: string) => {
-  const path = `../images/${fileName}`
-  const modules = import.meta.globEager('../images/*')
+  const path = `../../../views/member-center/images/${fileName}`
+  const modules = import.meta.globEager('../../../views/member-center/images/*')
   return modules[path].default
 }
-interface IProps {
-  courseTime: string
-  coursePlan: string
-  videoPosterUrl?: string
-  roomUid?: string
-  liveState?: number
-  id?: number | string
-}
+
 export default defineComponent({
-  name: 'LiveDetail',
+  name: 'MemberCenter',
   data() {
     const query = this.$route.query
     return {
-      recomUserId: query.recomUserId, // 分享人编号
-      groupId: query.groupId,
-      live: {} as any,
+      activityId: query.activityId,
+      recomUserId: query.recomUserId,
+      functionList: [],
       wxStatus: false
     }
   },
   computed: {
     userInfo() {
-      const live = this.live as any
-      const planList = live.planList || []
-      const startTime = planList[0]?.startTime || new Date()
-      const endTime = planList[0]?.endTime || new Date()
+      const users = state.user.data
       return {
-        headUrl: live.avatar,
-        username: live.userName,
-        id: live.teacherId,
-        startTime:
-          `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(startTime).format(
-            'HH:mm'
-          )}~${dayjs(endTime).format('HH:mm')}` || '',
-        lessonPrice: live.coursePrice,
-        buyNum: live.studentCount || 0,
-        lessonNum: live.courseNum || 0, // 课时数
-        lessonDesc: live.courseIntroduce,
-        lessonCoverUrl: live.backgroundPic || live.backgroundPicTemplate,
-        lessonName: live.courseGroupName,
-        auditVersion:0
+        username: users?.username,
+        phone: users?.phone,
+        avatar: users?.heardUrl,
+        id: users?.userId,
+        memberRankSettingId: users?.memberRankSettingId,
+        membershipDays: users?.membershipDays,
+        membershipEndTime: users?.membershipEndTime
       }
-    },
-    courseInfo() {
-      const tempArr = [] as IProps[]
-      const coursePlanList = this.live.planList || []
-      coursePlanList.forEach((item: any) => {
-        const startTime = item.startTime || new Date()
-        const endTime = item.endTime || new Date()
-        tempArr.push({
-          courseTime: `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(
-            startTime
-          ).format('HH:mm')}~${dayjs(endTime).format('HH:mm')}`,
-          coursePlan: item.plan,
-          roomUid: item.roomUid,
-          liveState: item.liveState,
-          id: item.courseId
-        })
-      })
-      return tempArr || []
-    }
-  },
-  created() {
-    if (browser().isApp) {
-      if (state.platformType === 'STUDENT') {
-        // 自动跳转到学生端视频课详情购买页
-        if (browser().ios) {
-          window.location.replace(
-            `${location.origin}/student/#/liveDetail??${qs.stringify(
-              this.$route.query
-            )}`
-          )
-        } else {
-          postMessage({
-            api: 'openWebView',
-            content: {
-              url: `${location.origin}/student/#/liveDetail??${qs.stringify(
-                this.$route.query
-              )}`,
-              orientation: 1,
-              isHideTitle: false
-            }
-          })
-
-          postMessage({ api: 'back' })
-        }
-      } else if (state.platformType === 'TEACHER') {
-        Dialog.alert({
-          title: '提示',
-          message: '请使用酷乐秀学生端扫码打开',
-          confirmButtonColor: '#2dc7aa'
-        }).then(() => {
-          postMessage({ api: 'back' })
-        })
-      }
-    } else {
-      // 如果不在app里面则不需要唤起操作
-      this.reCall()
     }
   },
   async mounted() {
     try {
-      const res = await request.post('/api-teacher/open/liveShareProfit', {
-        data: {
-          bizId: this.groupId,
-          userId: this.recomUserId
+      const res = await request.post(
+        `/api-teacher/open/memberPriceSettings/vipPermissions`
+      )
+      const result = res.data || []
+      this.functionList = result.map((item: any) => {
+        return {
+          title: item.paramName,
+          icon: getAssetsHomeFile(`${item.paramValue}.png`)
         }
       })
-      this.live = res.data.liveCourseGroup || {}
     } catch {
       //
     }
   },
   methods: {
-    locationReplace(url: string) {
-      if (history.replaceState) {
-        history.replaceState(null, document.title, url)
-        window.location.reload()
-      } else {
-        location.replace(url)
-      }
-    },
     reCall() {
       const { origin } = location
-      let str = origin + '/student/#/liveDetail'
+      let str = origin + '/student/#/memberCenter'
       const params = this.$route.query
-      str += `?recomUserId=${this.recomUserId}&groupId=${params.groupId}`
+      str += `?recomUserId=${this.recomUserId}&activityId=${params.activityId}`
       shareCall(str, {})
     },
     onShare() {
@@ -158,28 +77,42 @@ export default defineComponent({
   },
   render() {
     return (
-      <div class={[styles['live-detail'], 'mb12']}>
-        <UserDetail userInfo={this.userInfo} showBuy={false} />
-        <SectionDetail border>
-          <p class={styles.introduction}>{this.userInfo.lessonDesc}</p>
-        </SectionDetail>
-
-        <SectionDetail
-          title="课程列表"
-          icon="courseList"
-          border
-          // contentStyle={{ paddingTop: '0' }}
-        >
-          <CoursePlanStep courseInfo={this.courseInfo} />
-        </SectionDetail>
-
-        <ColSticky position="bottom">
-          <div class={['btnGroup']} style={{ paddingTop: '12px' }}>
-            <Button block round type="primary" onClick={this.onShare}>
-              下载酷乐秀进入课程
-            </Button>
+      <div class={styles['member-center']}>
+        <Image src={shareBanner} class={styles.shareBanner} />
+        <div class={styles.memberContainer}>
+          <div class={[styles.intro]}>
+            <p>
+              酷乐秀会员可使用包括平台提供的所有训练乐谱,并专享“
+              <b>小酷Ai</b>
+              ”八大核心功能,孩子在家就能轻松完成乐器自主规范练习。
+            </p>
           </div>
-        </ColSticky>
+          {this.functionList.length > 0 && (
+            <div class={styles.memberItem}>
+              <div class={styles.title}>会员功能</div>
+
+              <div class={styles.member_function}>
+                {this.functionList.map((item: any) => (
+                  <div class={styles.function_item}>
+                    <Icon name={item.icon} size={34} />
+                    <div class={styles.function_text} v-html={item.title}></div>
+                  </div>
+                ))}
+              </div>
+            </div>
+          )}
+        </div>
+        <div class={['btnGroup']} style={{ paddingTop: '12px' }}>
+          <Button
+            block
+            round
+            type="primary"
+            onClick={this.onShare}
+            color="linear-gradient(220deg, #DFA164 0%, #FAC87E 100%)"
+          >
+            下载小酷Ai开始练习吧!
+          </Button>
+        </div>
 
         {this.wxStatus && (
           <div
@@ -188,7 +121,7 @@ export default defineComponent({
               this.wxStatus = false
             }}
           >
-            <img src={getAssetsHomeFile('wx_bg.png')} alt="" />
+            <img src={wxImage} alt="" />
           </div>
         )}
       </div>

+ 32 - 10
src/views/member-center/index.tsx

@@ -45,7 +45,8 @@ export default defineComponent({
         username: ''
       },
       shareStatus: false,
-      shareUrl: ''
+      shareUrl: '',
+      shareDiscount: 0 // 是否有优惠活动
     }
   },
   computed: {
@@ -113,15 +114,37 @@ export default defineComponent({
       }
       console.log(settingList)
       this.memberList = settingList
-
-      // 只有老师端才会有分享功能
-      this.shareUrl = `${location.origin}/teacher#/shareMember?recomUserId=${this.userInfo.id}`
     } catch {}
   },
   methods: {
+    async onShare() {
+      try {
+        const res = await request.post('/api-teacher/open/vipProfit', {
+          data: {
+            userId: this.userInfo.id
+          }
+        })
+
+        // 只有老师端才会有分享功能
+        this.shareUrl = `${location.origin}/teacher#/shareMember?recomUserId=${this.userInfo.id}&activityId=${res.data.activityId}`
+        this.shareStatus = true
+        this.shareDiscount = res.data.discount || 0
+        // let url =
+        //   location.origin +
+        //   `/accompany/colexiu-share.html?id=${moreData.value.id}&recomUserId=${state.user.data?.userId}`
+        // // 判断是否有活动
+        // if (res.data.discount === 1) {
+        //   url += `&activityId=${res.data.activityId}`
+        // }
+        // shareDiscount.value = res.data.discount || 0
+        // shareUrl.value = url
+        // isMore.value = false
+        // shareStatus.value = true
+        return
+      } catch {}
+    },
     calcSalePrice(item: any) {
       // discount
-
       if (item.discount === 1) {
         const tempPrice = Number(
           (item.salePrice - item.discountPrice).toFixed(2)
@@ -182,10 +205,7 @@ export default defineComponent({
           v-slots={{
             right: () =>
               state.platformType === 'TEACHER' && (
-                <div
-                  class={styles.shareBtn}
-                  onClick={() => (this.shareStatus = true)}
-                >
+                <div class={styles.shareBtn} onClick={this.onShare}>
                   <Image src={iconShare} />
                   分享
                 </div>
@@ -358,7 +378,9 @@ export default defineComponent({
             shareLength={2}
           >
             <div class={styles.shareVip}>
-              <div class={styles.tagDiscount}>专属优惠</div>
+              {this.shareDiscount === 1 && (
+                <div class={styles.tagDiscount}>专属优惠</div>
+              )}
 
               <img class={styles.icon} src={iconMemberLogo} />
               <div class={styles.info}>