LearningSystemDetail.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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" v-if="info.skillTagName">{{info.skillTagName}}</el-button>
  17. <div class="bold font_size30">{{info.courseTitle}}</div>
  18. </div>
  19. <div>
  20. <el-button type="primary" plain v-if="info.studyStageName">{{info.studyStageName}}</el-button>
  21. <el-button type="primary" 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"/>
  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 } 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. onMounted(() => {
  105. getDetail();
  106. });
  107. const getDetail = async () => {
  108. getCourseDetail({id: courseId.value}).then(res => {
  109. if(res.code === 200){
  110. info.value = res.data || {};
  111. }
  112. })
  113. };
  114. const goDetail = (item) => {
  115. //如果未支付,跳转到支付页面
  116. if(item.buyFlag == 0 ){
  117. confirmBuy({
  118. callback:getDetail,
  119. appStore,
  120. router,
  121. price:item.coursePrice,
  122. t,
  123. productId:item.courseId,
  124. orderType:'course_purchase',
  125. payMethod:'BMI'
  126. })
  127. return
  128. }
  129. //增加参数名称
  130. router.push({
  131. path: `/learning-system/detail/${item.courseId}/course/${item.courseId}`,
  132. query: {
  133. courseId: item.courseId,
  134. metaTitle: '课程详情'
  135. }
  136. })
  137. };
  138. </script>
  139. <style scoped lang="scss">
  140. .LearningSystemDetail{
  141. .line5 {
  142. word-break: break-all;
  143. display: -webkit-box;
  144. -webkit-line-clamp: 5;
  145. -webkit-box-orient: vertical;
  146. overflow: hidden;
  147. /* height: 84px; */
  148. }
  149. .coverImageUrlBg{
  150. background-size: cover;
  151. background-position: center;
  152. width: 100%;
  153. height: 400px;
  154. //背景模糊
  155. filter: blur(180px);
  156. }
  157. .xuexi{
  158. color: #ffffff;
  159. padding: 14px 20px;
  160. border-radius: 10px;
  161. font-size: 14px;
  162. }
  163. }
  164. </style>