فهرست منبع

添加唤起和支付

lex-wxl 2 سال پیش
والد
کامیت
c249f6bc2d

+ 11 - 0
src/router/routes-student.ts

@@ -172,6 +172,17 @@ export default [
   },
   ...rootRouter,
   {
+    path: '/transfer',
+    component: () => import('@/student/down-load/transfer'),
+    meta: {
+      title: '酷乐秀学院'
+    }
+  },
+  {
+    path: '/download',
+    component: () => import('@/student/down-load/download')
+  },
+  {
     path: '/:pathMatch(.*)*',
     component: () => import('@/views/404'),
     meta: {

+ 95 - 0
src/student/down-load/download.tsx

@@ -0,0 +1,95 @@
+import { browser } from '@/helpers/utils'
+import { Button, Toast } from 'vant'
+import { defineComponent } from 'vue'
+import styles from './index.module.less'
+
+export const getAssetsHomeFile = (fileName: string) => {
+  const path = `./images/${fileName}`
+  const modules = import.meta.globEager('./images/*')
+  return modules[path].default
+}
+
+export default defineComponent({
+  name: 'download',
+  data() {
+    const query = this.$route.query
+    return {
+      type: query.type || 'student',
+      wxStatus: false
+    }
+  },
+  mounted() {
+    if (this.type === 'student') {
+      document.title = '酷乐秀学院下载'
+    } else if (this.type === 'teacher') {
+      document.title = '酷乐秀下载'
+    }
+  },
+  methods: {
+    downLoadApp() {
+      if (browser().weixin) {
+        this.wxStatus = true
+        return
+      }
+
+      if (
+        browser().ios ||
+        /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)
+      ) {
+        if (this.type == 'student') {
+          window.location.href =
+            'https://apps.apple.com/cn/app/%E7%AE%A1%E4%B9%90%E8%BF%B7/id1487054260'
+        } else if (this.type == 'teacher') {
+          window.location.href =
+            'https://apps.apple.com/cn/app/%E7%AE%A1%E4%B9%90%E8%BF%B7/id1487054260'
+        }
+      } else if (/(Android)/i.test(navigator.userAgent)) {
+        if (this.type == 'student') {
+          window.location.href =
+            'https://sj.qq.com/myapp/detail.htm?apkName=com.daya.studaya_android'
+        } else if (this.type == 'teacher') {
+          window.location.href =
+            'https://sj.qq.com/myapp/detail.htm?apkName=com.daya.studaya_android'
+        }
+      } else {
+        this.$toast('请用手机或移动设备打开')
+      }
+    }
+  },
+  render() {
+    return (
+      <div class={styles.downContainer}>
+        <div class={styles.logo}>
+          {this.type === 'student' ? (
+            <img src={getAssetsHomeFile('logo.png')} alt="" />
+          ) : (
+            <img src={getAssetsHomeFile('teacher_logo.png')} alt="" />
+          )}
+        </div>
+        <div class={styles.down}>
+          <Button type="primary" round plain onClick={this.downLoadApp}>
+            点击下载App
+          </Button>
+        </div>
+        <div class={styles.mainImg}>
+          {this.type === 'student' ? (
+            <img src={getAssetsHomeFile('student_bg.png')} alt="" />
+          ) : (
+            <img src={getAssetsHomeFile('teacher_bg.png')} alt="" />
+          )}
+        </div>
+
+        {this.wxStatus && (
+          <div
+            class={styles.wxpopup}
+            onClick={() => {
+              this.wxStatus = false
+            }}
+          >
+            <img src={getAssetsHomeFile('wx_bg.png')} alt="" />
+          </div>
+        )}
+      </div>
+    )
+  }
+})

BIN
src/student/down-load/images/bg.png


BIN
src/student/down-load/images/logo.png


BIN
src/student/down-load/images/student_bg.png


BIN
src/student/down-load/images/teacher_bg.png


BIN
src/student/down-load/images/teacher_logo.png


BIN
src/student/down-load/images/wx_bg.png


+ 48 - 0
src/student/down-load/index.module.less

@@ -0,0 +1,48 @@
+.downContainer {
+  position: relative;
+  background: url("./images/bg.png") center top no-repeat;
+  background-size: cover;
+  min-height: 100vh;
+}
+
+.logo {
+  padding-top: 68px;
+  padding-bottom: 28px;
+  width: 104px;
+  height: 127px;
+  margin: 0 auto;
+}
+
+.down {
+  text-align: center;
+  :global {
+    .van-button {
+      width: 194px;
+      border-color: #fff;
+      font-size: 18px;
+    }
+  }
+}
+
+.mainImg {
+  padding-top: 50px;
+  padding-bottom: 32px;
+  width: 227px;
+  margin: 0 auto;
+  img {
+    width: 100%;
+  }
+}
+
+.wxpopup {
+  width: 100%;
+  height: 100vh;
+  position: absolute;
+  top: 0;
+  left: 0;
+  background: rgba(0, 0, 0, 0.5);
+  img {
+    width: 88%;
+    margin: 0 6%;
+  }
+}

+ 86 - 0
src/student/down-load/transfer.tsx

@@ -0,0 +1,86 @@
+import { browser } from '@/helpers/utils'
+import { Button, Toast } from 'vant'
+import { defineComponent } from 'vue'
+import styles from './index.module.less'
+
+export const getAssetsHomeFile = (fileName: string) => {
+  const path = `./images/${fileName}`
+  const modules = import.meta.globEager('./images/*')
+  return modules[path].default
+}
+
+export default defineComponent({
+  name: 'transfer',
+  data() {
+    return {
+      wxStatus: false
+    }
+  },
+  mounted() {
+    const { origin, pathname } = location
+    let str = origin + pathname + '#/'
+    let params = this.$route.query
+    // 判断是否有跳转连接
+    if (!params.url) {
+      return
+    }
+    str += params.url
+    str = encodeURIComponent(str)
+    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
+      window.location.href = `StudentsColexiu://linkUrl=${str}`
+    } else if (/(Android)/i.test(navigator.userAgent)) {
+      window.location.href = `StudentsColexiu://html:8888/SplashActivity?url=${str}`
+    } else {
+      Toast('请用手机或移动设备打开')
+    }
+  },
+  methods: {
+    downLoadApp() {
+      if (browser().weixin) {
+        this.wxStatus = true
+        return
+      }
+
+      if (
+        browser().ios ||
+        /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)
+      ) {
+        window.location.href =
+          'https://apps.apple.com/cn/app/%E7%AE%A1%E4%B9%90%E8%BF%B7/id1487054260'
+      } else if (/(Android)/i.test(navigator.userAgent)) {
+        window.location.href =
+          'https://sj.qq.com/myapp/detail.htm?apkName=com.daya.studaya_android'
+      } else {
+        this.$toast('请用手机或移动设备打开')
+      }
+    }
+  },
+  render() {
+    return (
+      <div class={styles.downContainer}>
+        <div class={styles.logo}>
+          <img src={getAssetsHomeFile('logo.png')} alt="" />
+        </div>
+        <div class={styles.down}>
+          <Button type="primary" round plain onClick={this.downLoadApp}>
+            点击下载App
+          </Button>
+        </div>
+        <div class={styles.mainImg}>
+          <img src={getAssetsHomeFile('student_bg.png')} alt="" />
+        </div>
+
+        {this.wxStatus && (
+          <div
+            class={styles.wxpopup}
+            onClick={() => {
+              this.wxStatus = false
+            }}
+          >
+            <img src={getAssetsHomeFile('wx_bg.png')} alt="" />
+          </div>
+        )}
+      </div>
+    )
+  }
+})

+ 1 - 0
src/student/live-class/live-detail.tsx

@@ -98,6 +98,7 @@ export default defineComponent({
         orderStatus.orderObject.orderName = '直播课购买'
         orderStatus.orderObject.orderDesc = '直播课购买'
         orderStatus.orderObject.actualPrice = live.coursePrice
+        orderStatus.orderObject.orderNo = ''
         orderStatus.orderObject.orderList = [
           {
             orderType: 'LIVE',

+ 150 - 9
src/student/trade/tradeOrder.ts

@@ -1,19 +1,51 @@
+import request from '@/helpers/request'
 import { orderStatus } from '@/views/order-detail/orderStatus'
+import dayjs from 'dayjs'
 //   LIVE: '直播课',
 // PRACTICE: '陪练课',
 // VIDEO: '视频课',
 // VIP: '开通会员',
 // MUSIC: '单曲点播'
-export const formatOrderDetail = (item: any) => {
+export const formatOrderDetail = async (item: any) => {
   const type = item.goodType
-  console.log(type)
   let tempList: any = {}
+
   switch (type) {
     case 'LIVE':
+      {
+        try {
+          const live = await getLiveDetail(item.bizId)
+          const courseInfo: any[] = []
+          const coursePlanList = live.planList || []
+          coursePlanList.forEach((item: any) => {
+            const startTime = item.startTime || new Date()
+            const endTime = item.endTime || new Date()
+            courseInfo.push({
+              courseTime: `${dayjs(startTime).format('YYYY-MM-DD')} ${dayjs(
+                startTime
+              ).format('HH:mm')}~${dayjs(endTime).format('HH:mm')}`,
+              coursePlan: item.plan,
+              id: item.courseId
+            })
+          })
+          tempList = {
+            orderType: item.goodType,
+            goodsName: item.goodName,
+            courseGroupId: live.courseGroupId,
+            courseGroupName: live.courseGroupName,
+            coursePrice: live.coursePrice,
+            teacherName: live.teacherName || `游客${live.teacherId || ''}`,
+            teacherId: live.teacherId,
+            avatar: live.avatar,
+            courseInfo
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
       break
     case 'PRACTICE': {
       const bizContent: any = JSON.parse(item.bizContent)
-      console.log(bizContent)
       tempList = {
         ...bizContent,
         teacherName: item.username,
@@ -22,17 +54,122 @@ export const formatOrderDetail = (item: any) => {
       }
       break
     }
-    case 'VIDEO':
+    case 'VIDEO': {
+      try {
+        const res = await getVideoDetail(item.bizId)
+        const { lessonGroup, detailList } = res
+        tempList = {
+          orderType: item.goodType,
+          goodsName: item.goodName,
+          courseGroupId: lessonGroup.id,
+          courseGroupName: lessonGroup.lessonName,
+          coursePrice: lessonGroup.lessonPrice,
+          teacherName: lessonGroup.username,
+          teacherId: lessonGroup.teacherId,
+          avatar: lessonGroup.avatar,
+          courseInfo: detailList
+        }
+      } catch (e: any) {
+        throw new Error(e.message)
+      }
       break
+    }
     case 'VIP':
+      {
+        try {
+          const res = await getVipDetail()
+          const buyObject = res.find((member: any) => member.id === item.bizId)
+          tempList = {
+            orderType: item.goodType,
+            goodsName: item.goodName,
+            id: buyObject.id,
+            title: buyObject.title,
+            price: buyObject.salePrice
+            // startTime: dayjs(startTime).format('YYYY-MM-DD'),
+            // endTime: dayjs(endTime).format('YYYY-MM-DD')
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
       break
     case 'MUSIC':
+      {
+        try {
+          const res = await getMusicDetail(item.bizId)
+          tempList = {
+            orderType: item.goodType,
+            goodsName: item.goodName,
+            ...res
+          }
+        } catch (e: any) {
+          throw new Error(e.message)
+        }
+      }
       break
   }
   tempList.orderType = type
   tempList.goodsName = item.goodsName
   orderStatus.orderObject.orderList.push(tempList)
 }
+// 获取视频课详情
+export const getVideoDetail = async (groupId: any) => {
+  try {
+    const res = await request.get(
+      '/api-student/videoLesson/selectVideoLesson',
+      {
+        params: {
+          groupId
+        }
+      }
+    )
+    return res.data
+  } catch {
+    throw new Error('获取视频课详情失败')
+  }
+}
+
+// 获取直播课详情
+export const getLiveDetail = async (groupId: any) => {
+  try {
+    const res = await request.get(
+      '/api-student/courseGroup/queryLiveCourseInfo',
+      {
+        params: {
+          groupId
+        }
+      }
+    )
+    return res.data
+  } catch {
+    throw new Error('获取直播课详情失败')
+  }
+}
+
+// 获取会员详情
+export const getVipDetail = async () => {
+  try {
+    const setting = await request.post(
+      '/api-student/memberPriceSettings/list',
+      {
+        data: {}
+      }
+    )
+    return setting.data || []
+  } catch {
+    throw new Error('获取会员详情失败')
+  }
+}
+
+// 获取曲目详情
+export const getMusicDetail = async (id: any) => {
+  try {
+    const res = await request.get(`/api-student/music/sheet/detail/${id}`)
+    return res.data
+  } catch {
+    throw new Error('获取曲目详情失败')
+  }
+}
 
 export const tradeOrder = (result: any, callBack?: any) => {
   const {
@@ -50,9 +187,13 @@ export const tradeOrder = (result: any, callBack?: any) => {
   orderStatus.orderObject.orderNo = orderNo
   orderStatus.orderObject.actualPrice = actualPrice
   orderStatus.orderObject.orderList = []
-  orderDetailList.forEach((item: any) => {
-    formatOrderDetail(item)
-  })
-  console.log(orderStatus.orderObject)
-  callBack && callBack()
+  try {
+    orderDetailList.forEach(async (item: any) => {
+      await formatOrderDetail(item)
+    })
+    // console.log(orderStatus.orderObject, 'orderStatus.orderObject')
+    callBack && callBack()
+  } catch {
+    //
+  }
 }

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

@@ -7,6 +7,7 @@ import styles from './video-detail.module.less'
 import request from '@/helpers/request'
 import ColHeader from '@/components/col-header'
 import { orderStatus } from '@/views/order-detail/orderStatus'
+import { tradeOrder } from '../trade/tradeOrder'
 export default defineComponent({
   name: 'VideoDetail',
   data() {
@@ -73,6 +74,7 @@ export default defineComponent({
         orderStatus.orderObject.orderName = '视频课购买'
         orderStatus.orderObject.orderDesc = '视频课购买'
         orderStatus.orderObject.actualPrice = userInfo.lessonPrice
+        orderStatus.orderObject.orderNo = ''
         orderStatus.orderObject.orderList = [
           {
             orderType: 'VIDEO',
@@ -97,9 +99,7 @@ export default defineComponent({
             confirmButtonText: '继续支付'
           })
             .then(async () => {
-              orderStatus.orderObject.orderNo = result.orderNo
-              orderStatus.orderObject.actualPrice = result.actualPrice
-              this.routerTo()
+              tradeOrder(result, this.routerTo)
             })
             .catch(() => {
               Dialog.close()

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

@@ -90,9 +90,7 @@ export default defineComponent({
             classTime: classCourse
           }
         } else if (item.orderType === 'VIP') {
-          params.bizContent = {
-            id: item.id
-          }
+          params.bizContent = item.id
         } else if (item.orderType === 'MUSIC') {
           params.bizContent = {
             musicSheetId: item.id,