LearningSystemDetail.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <div class="LearningSystemDetail container-height">
  3. <div v-if="!isChildRoute">
  4. <Breadcrumb />
  5. <div>
  6. <div style="width:100%;position: absolute;top: 60px;left: 0;overflow: hidden;z-index: -1;">
  7. <div :style="{backgroundImage: `url(${info.coverImageUrl})`}" class="coverImageUrlBg">
  8. <div style="background-color: rgba(255, 255, 255, 0.5);width: 100%;height: 400px;"></div>
  9. </div>
  10. </div>
  11. </div>
  12. <div class="flex-between" >
  13. <img :src="info.coverImageUrl" alt="" class="border_radius_16" style="width: 500px; height: 280px;">
  14. <div class="flex_1 ml20">
  15. <div class="gap10">
  16. <el-button type="primary" class="font_size14" v-if="info.skillTagName">{{info.skillTagName}}</el-button>
  17. <div class="bold font_size30">{{info.courseTitle}}</div>
  18. </div>
  19. <div>
  20. <el-button class="font_size12" type="primary" size="small" plain v-if="info.studyStageName">{{info.studyStageName}}</el-button>
  21. <el-button class="font_size12" type="primary" size="small" plain v-if="info.courseCategoryName">{{info.courseCategoryName}}</el-button>
  22. </div>
  23. <div class="gray font_size16 mt10 line2" :title="info.courseIntro">
  24. {{info.courseIntro}}
  25. </div>
  26. </div>
  27. </div>
  28. <div class="border_radius_16 gradient mt20 pt10">
  29. <div class="border_radius_16 bg_color_fff flex-center-between" style="padding:0 16px">
  30. <div class="color_price">
  31. <span class="bold font_size36">{{info.coursePrice}}</span>
  32. <span class="font_size18">{{$t('common.baomibi')}}</span>
  33. </div>
  34. <div class="flex-center-between" @click="goDetail(info)">
  35. <img :src="zuIcon" alt="" style="height:98px">
  36. <div class="gap5 gradient border_radius_4 cursor-pointer xuexi ml10">
  37. <img :src="playIcon" alt="" style="width:13px;height:15px">
  38. <div>{{$t('common.lijixuexi')}}</div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="flex-between mt20">
  44. <div class="flex_1 bg_color_fff padding16 border_radius_16 box_shadow_card mr20">
  45. <el-tabs v-model="activeName" class="demo-tabs">
  46. <el-tab-pane :label="$t('common.kechengjieshao')" name="first">
  47. <CourseDescription :info="info" />
  48. </el-tab-pane>
  49. <el-tab-pane :label="$t('common.kechengmulu')" name="kechengmulu">
  50. <keep-alive>
  51. <CourseDirectory :info="info" formPage="LearningSystemDetail" :chapterId="info.listTimeChapterId"/>
  52. </keep-alive>
  53. </el-tab-pane>
  54. <el-tab-pane :label="$t('common.pinglun')" name="pinglun">
  55. <keep-alive>
  56. <Pinglun :info="info" />
  57. </keep-alive>
  58. </el-tab-pane>
  59. <el-tab-pane :label="$t('common.xuxibiji')" name="xuxibiji">
  60. <keep-alive>
  61. <Xuxibiji :info="info" />
  62. </keep-alive>
  63. </el-tab-pane>
  64. </el-tabs>
  65. </div>
  66. <div class="detail_right bg_color_fff padding16 border_radius_16 box_shadow_card">
  67. <keep-alive>
  68. <OtherCourse :info="info"/>
  69. </keep-alive>
  70. </div>
  71. </div>
  72. </div>
  73. <router-view />
  74. </div>
  75. </template>
  76. <script setup>
  77. import playIcon from '@/assets/imgs/bofang.png'
  78. import zuIcon from '@/assets/imgs/zu.png'
  79. import OtherCourse from './components/OtherCourse.vue'
  80. import CourseDescription from './components/CourseDescription.vue'
  81. import CourseDirectory from './components/CourseDirectory.vue'
  82. import Pinglun from './components/pinglun.vue'
  83. import Xuxibiji from './components/xuxibiji.vue'
  84. // 引入api
  85. import { getCourseDetail } from '@/api/course.js'
  86. import { confirmBuy } from '@/utils/util.js'
  87. import { useI18n } from 'vue-i18n'
  88. const { t } = useI18n()
  89. import { useRouter, useRoute } from 'vue-router'
  90. const router = useRouter()
  91. const route = useRoute()
  92. //获取当前路由路径
  93. const isChildRoute = computed(() => {
  94. return route.matched.length > 2
  95. });
  96. import { ref, computed, onMounted, onActivated, watch } from 'vue'
  97. import { useAppStore } from '@/pinia/appStore'
  98. const appStore = useAppStore()
  99. const activeName = ref('first');
  100. //获取参数
  101. const query = route.query;
  102. const courseId = ref(route.params.courseId || '');
  103. const info = ref({})
  104. //监听route.params.courseId变化
  105. watch(() => route.params.courseId, (newVal, oldVal) => {
  106. courseId.value = newVal || '';
  107. if(newVal !== oldVal){
  108. getDetail();
  109. }
  110. })
  111. onMounted(() => {
  112. getDetail();
  113. });
  114. const getDetail = async () => {
  115. getCourseDetail({id: courseId.value}).then(res => {
  116. if(res.code === 200){
  117. info.value = res.data || {};
  118. }
  119. })
  120. };
  121. const goDetail = (item) => {
  122. //如果未支付,跳转到支付页面
  123. if(item.buyFlag == 0 ){
  124. confirmBuy({
  125. callback:getDetail,
  126. appStore,
  127. router,
  128. price:item.coursePrice,
  129. t,
  130. productId:item.courseId,
  131. orderType:'course_purchase',
  132. payMethod:'BMI'
  133. })
  134. return
  135. }
  136. //增加参数名称
  137. router.push({
  138. path: `/learning-system/detail/${item.courseId}/course/${item.courseId}`,
  139. query: {
  140. courseId: item.courseId,
  141. chapterId: item.listTimeChapterId || '',
  142. metaTitle: '课程详情'
  143. }
  144. })
  145. };
  146. </script>
  147. <style scoped lang="scss">
  148. .LearningSystemDetail{
  149. .line5 {
  150. word-break: break-all;
  151. display: -webkit-box;
  152. -webkit-line-clamp: 5;
  153. -webkit-box-orient: vertical;
  154. overflow: hidden;
  155. /* height: 84px; */
  156. }
  157. .coverImageUrlBg{
  158. background-size: cover;
  159. background-position: center;
  160. width: 100%;
  161. height: 400px;
  162. //背景模糊
  163. filter: blur(80px);
  164. opacity: 0.8;
  165. }
  166. .xuexi{
  167. color: #ffffff;
  168. padding: 14px 20px;
  169. border-radius: 10px;
  170. font-size: 14px;
  171. }
  172. }
  173. </style>