CourseDescription.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <div class="course-description">
  3. <!-- <div class="section-header">
  4. <div class="header-line"></div>
  5. <h3 class="section-title">{{$t('common.kechengjieshao')}}</h3>
  6. </div> -->
  7. <div class="description-content">
  8. <div class="rich-text" v-html="info.courseIntro"></div>
  9. <div v-if="info.coverImageUrl" class="cover-image-wrapper">
  10. <img :src="info.coverImageUrl" alt="" class="cover-image">
  11. <div class="image-glow"></div>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script setup>
  17. import { getCourseList } from '@/api/course.js'
  18. import { ref, onMounted } from 'vue'
  19. defineProps({
  20. info: {
  21. type: Object,
  22. default: () => ({})
  23. }
  24. })
  25. const list = ref([]);
  26. </script>
  27. <style scoped lang="scss">
  28. .course-description {
  29. background: rgba(255, 255, 255, 0.95);
  30. backdrop-filter: blur(20px);
  31. -webkit-backdrop-filter: blur(20px);
  32. border: 1px solid rgba(255, 255, 255, 0.8);
  33. border-radius: 20px;
  34. padding: 24px;
  35. box-shadow:
  36. 0 8px 32px rgba(79, 70, 229, 0.08),
  37. inset 0 1px 0 rgba(255, 255, 255, 0.8);
  38. .section-header {
  39. display: flex;
  40. align-items: center;
  41. gap: 12px;
  42. margin-bottom: 20px;
  43. .header-line {
  44. width: 4px;
  45. height: 24px;
  46. background: linear-gradient(135deg, #4f46e5, #7c3aed);
  47. border-radius: 2px;
  48. box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  49. }
  50. .section-title {
  51. font-size: 18px;
  52. font-weight: 700;
  53. color: #1f2937;
  54. margin: 0;
  55. letter-spacing: -0.02em;
  56. }
  57. }
  58. .description-content {
  59. .rich-text {
  60. font-size: 15px;
  61. line-height: 1.8;
  62. color: #374151;
  63. :deep(h1), :deep(h2), :deep(h3), :deep(h4) {
  64. color: #1f2937;
  65. font-weight: 700;
  66. margin: 24px 0 12px 0;
  67. line-height: 1.3;
  68. &:first-child {
  69. margin-top: 0;
  70. }
  71. }
  72. :deep(h1) { font-size: 24px; }
  73. :deep(h2) { font-size: 20px; }
  74. :deep(h3) { font-size: 18px; }
  75. :deep(h4) { font-size: 16px; }
  76. :deep(p) {
  77. margin: 12px 0;
  78. text-align: justify;
  79. }
  80. :deep(ul), :deep(ol) {
  81. margin: 16px 0;
  82. padding-left: 24px;
  83. li {
  84. margin: 8px 0;
  85. position: relative;
  86. &::marker {
  87. color: #4f46e5;
  88. font-weight: 600;
  89. }
  90. }
  91. }
  92. :deep(blockquote) {
  93. margin: 20px 0;
  94. padding: 16px 20px;
  95. background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
  96. border-left: 4px solid #4f46e5;
  97. border-radius: 8px;
  98. font-style: italic;
  99. color: #4b5563;
  100. }
  101. :deep(img) {
  102. max-width: 100%;
  103. height: auto;
  104. border-radius: 12px;
  105. margin: 16px 0;
  106. box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  107. }
  108. :deep(a) {
  109. color: #4f46e5;
  110. text-decoration: none;
  111. font-weight: 500;
  112. transition: all 0.3s ease;
  113. border-bottom: 1px solid transparent;
  114. &:hover {
  115. color: #7c3aed;
  116. border-bottom-color: #7c3aed;
  117. }
  118. }
  119. :deep(code) {
  120. background: rgba(79, 70, 229, 0.08);
  121. padding: 2px 6px;
  122. border-radius: 4px;
  123. font-family: 'Monaco', 'Menlo', monospace;
  124. font-size: 13px;
  125. color: #4f46e5;
  126. }
  127. :deep(pre) {
  128. background: #1f2937;
  129. color: #f9fafb;
  130. padding: 20px;
  131. border-radius: 12px;
  132. overflow-x: auto;
  133. margin: 20px 0;
  134. box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  135. code {
  136. background: none;
  137. color: inherit;
  138. padding: 0;
  139. }
  140. }
  141. :deep(table) {
  142. width: 100%;
  143. border-collapse: collapse;
  144. margin: 20px 0;
  145. font-size: 14px;
  146. th, td {
  147. padding: 12px 16px;
  148. text-align: left;
  149. border-bottom: 1px solid #e5e7eb;
  150. }
  151. th {
  152. background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
  153. font-weight: 600;
  154. color: #1f2937;
  155. }
  156. tr:hover {
  157. background: rgba(79, 70, 229, 0.02);
  158. }
  159. }
  160. :deep(hr) {
  161. border: none;
  162. height: 1px;
  163. background: linear-gradient(to right, transparent, #e5e7eb, transparent);
  164. margin: 32px 0;
  165. }
  166. :deep(strong), :deep(b) {
  167. font-weight: 600;
  168. color: #1f2937;
  169. }
  170. :deep(em), :deep(i) {
  171. font-style: italic;
  172. color: #4b5563;
  173. }
  174. }
  175. .cover-image-wrapper {
  176. position: relative;
  177. margin-top: 24px;
  178. border-radius: 16px;
  179. overflow: hidden;
  180. box-shadow:
  181. 0 8px 32px rgba(79, 70, 229, 0.12),
  182. 0 2px 8px rgba(0, 0, 0, 0.06);
  183. .cover-image {
  184. width: 100%;
  185. height: auto;
  186. display: block;
  187. transition: transform 0.3s ease;
  188. }
  189. .image-glow {
  190. position: absolute;
  191. top: -50%;
  192. left: -50%;
  193. right: -50%;
  194. bottom: -50%;
  195. background: radial-gradient(circle at center, rgba(79, 70, 229, 0.15), transparent 70%);
  196. opacity: 0;
  197. transition: opacity 0.3s ease;
  198. pointer-events: none;
  199. }
  200. &:hover {
  201. .cover-image {
  202. transform: scale(1.02);
  203. }
  204. .image-glow {
  205. opacity: 1;
  206. }
  207. }
  208. }
  209. }
  210. }
  211. @media (max-width: 768px) {
  212. .course-description {
  213. padding: 20px;
  214. border-radius: 16px;
  215. .section-header {
  216. margin-bottom: 16px;
  217. .header-line {
  218. height: 20px;
  219. }
  220. .section-title {
  221. font-size: 16px;
  222. }
  223. }
  224. .description-content {
  225. .rich-text {
  226. font-size: 14px;
  227. line-height: 1.7;
  228. :deep(h1) { font-size: 20px; }
  229. :deep(h2) { font-size: 18px; }
  230. :deep(h3) { font-size: 16px; }
  231. :deep(h4) { font-size: 15px; }
  232. }
  233. .cover-image-wrapper {
  234. margin-top: 20px;
  235. border-radius: 14px;
  236. }
  237. }
  238. }
  239. }
  240. @media (max-width: 480px) {
  241. .course-description {
  242. padding: 16px;
  243. border-radius: 14px;
  244. .description-content {
  245. .rich-text {
  246. font-size: 13px;
  247. line-height: 1.6;
  248. :deep(ul), :deep(ol) {
  249. padding-left: 20px;
  250. }
  251. :deep(blockquote) {
  252. padding: 12px 16px;
  253. margin: 16px 0;
  254. }
  255. :deep(pre) {
  256. padding: 16px;
  257. font-size: 12px;
  258. }
  259. :deep(table) {
  260. font-size: 13px;
  261. th, td {
  262. padding: 10px 12px;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. </style>