|
@@ -14,7 +14,8 @@ import {
|
|
|
Sticky,
|
|
|
Field,
|
|
|
List,
|
|
|
- Toast
|
|
|
+ Toast,
|
|
|
+ Dialog
|
|
|
} from 'vant'
|
|
|
import { defineComponent } from 'vue'
|
|
|
import styles from './video-class-detail.module.less'
|
|
@@ -23,6 +24,7 @@ import { state } from '@/state'
|
|
|
import iconTeacher from '@common/images/icon_teacher.png'
|
|
|
import ColResult from '@/components/col-result'
|
|
|
import dayjs from 'dayjs'
|
|
|
+import { onSubmitZero, orderStatus } from '@/views/order-detail/orderStatus'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'VideoClassDetail',
|
|
@@ -36,6 +38,7 @@ export default defineComponent({
|
|
|
lessonPrice: 0,
|
|
|
useRelationType: '',
|
|
|
alreadyBuy: false,
|
|
|
+ videoDetail: {} as any,
|
|
|
detailList: [],
|
|
|
posterUrl: '',
|
|
|
srcUrl: '',
|
|
@@ -74,32 +77,7 @@ export default defineComponent({
|
|
|
this.navHeight = sessionStorage.getItem('navHeight') || 0
|
|
|
try {
|
|
|
//
|
|
|
- this.reload = true
|
|
|
- const res = await request.get(
|
|
|
- '/api-student/videoLesson/selectVideoLesson',
|
|
|
- {
|
|
|
- params: {
|
|
|
- groupId: this.groupId
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
- const result = res.data || {}
|
|
|
- this.title = result.lessonGroup.lessonName
|
|
|
- this.lessonPrice = result.lessonGroup.lessonPrice
|
|
|
- this.useRelationType = result.lessonGroup.relationType
|
|
|
- this.alreadyBuy = result.alreadyBuy
|
|
|
- this.detailList = result.detailList || []
|
|
|
- this.trySee = !result.alreadyBuy
|
|
|
- this.detailList.forEach((item: any, index: number) => {
|
|
|
- if (item.id === Number(this.classId)) {
|
|
|
- this.posterUrl = item.coverUrl
|
|
|
- this.srcUrl = item.videoUrl
|
|
|
- this.title = item.videoTitle
|
|
|
- this.currentClassIndex = index + 1
|
|
|
- this.videoContent = item.videoContent
|
|
|
- }
|
|
|
- })
|
|
|
- this.reload = false
|
|
|
+ await this.__init()
|
|
|
|
|
|
const config = await request.get(
|
|
|
'/api-student/sysConfig/queryByParamNameList',
|
|
@@ -115,6 +93,39 @@ export default defineComponent({
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ async __init() {
|
|
|
+ try {
|
|
|
+ this.reload = true
|
|
|
+ const res = await request.get(
|
|
|
+ '/api-student/videoLesson/selectVideoLesson',
|
|
|
+ {
|
|
|
+ params: {
|
|
|
+ groupId: this.groupId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ const result = res.data || {}
|
|
|
+ this.videoDetail = result.lessonGroup
|
|
|
+ this.title = result.lessonGroup.lessonName
|
|
|
+ this.lessonPrice = result.lessonGroup.lessonPrice
|
|
|
+ this.useRelationType = result.lessonGroup.relationType
|
|
|
+ this.alreadyBuy = result.alreadyBuy
|
|
|
+ this.detailList = result.detailList || []
|
|
|
+ this.trySee = !result.alreadyBuy
|
|
|
+ this.detailList.forEach((item: any, index: number) => {
|
|
|
+ if (item.id === Number(this.classId)) {
|
|
|
+ this.posterUrl = item.coverUrl
|
|
|
+ this.srcUrl = item.videoUrl
|
|
|
+ this.title = item.videoTitle
|
|
|
+ this.currentClassIndex = index + 1
|
|
|
+ this.videoContent = item.videoContent
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.reload = false
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ },
|
|
|
onSearch() {
|
|
|
this.params.page = 1
|
|
|
this.list = []
|
|
@@ -125,7 +136,7 @@ export default defineComponent({
|
|
|
},
|
|
|
async getList() {
|
|
|
try {
|
|
|
- let params = this.params
|
|
|
+ const params = this.params
|
|
|
const res = await request.post('/api-student/videoLesson/page', {
|
|
|
data: {
|
|
|
...params,
|
|
@@ -197,6 +208,50 @@ export default defineComponent({
|
|
|
src={this.srcUrl}
|
|
|
poster={this.posterUrl}
|
|
|
height={this.videoHeight}
|
|
|
+ isBuy
|
|
|
+ onBuyEmit={async () => {
|
|
|
+ if (this.lessonPrice > 0) {
|
|
|
+ this.$router.back()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const userInfo = this.videoDetail
|
|
|
+ orderStatus.orderObject.orderType = 'VIDEO'
|
|
|
+ orderStatus.orderObject.orderName = '视频课购买'
|
|
|
+ orderStatus.orderObject.orderDesc = '视频课购买'
|
|
|
+ orderStatus.orderObject.actualPrice = userInfo.lessonPrice
|
|
|
+ orderStatus.orderObject.recomUserId = ''
|
|
|
+ orderStatus.orderObject.orderNo = ''
|
|
|
+ orderStatus.orderObject.orderList = [
|
|
|
+ {
|
|
|
+ orderType: 'VIDEO',
|
|
|
+ goodsName: '视频课购买',
|
|
|
+ courseGroupId: userInfo.id,
|
|
|
+ courseGroupName: userInfo.lessonName,
|
|
|
+ coursePrice: userInfo.lessonPrice,
|
|
|
+ teacherName:
|
|
|
+ userInfo.username ||
|
|
|
+ `游客${userInfo.teacherId || ''}`,
|
|
|
+ teacherId: userInfo.teacherId,
|
|
|
+ avatar: userInfo.headUrl,
|
|
|
+ relationType: userInfo.relationType,
|
|
|
+ courseInfo: this.detailList,
|
|
|
+ recomUserId: ''
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ await onSubmitZero(() => {
|
|
|
+ Dialog.alert({
|
|
|
+ message: '领取成功',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ confirmButtonColor: '#2dc7aa'
|
|
|
+ }).then(() => {
|
|
|
+ this.__init()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }}
|
|
|
/>
|
|
|
)
|
|
|
}}
|