四零语境前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

498 lines
10 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="directory-container">
  3. <view class="book-container">
  4. <view class="book-info">
  5. <view class="book-cover">
  6. <image :src="bookInfo.booksImg" mode="aspectFill" :style="{width: '100%', height: '100%'}"></image>
  7. </view>
  8. <view class="book-details">
  9. <view class="book-title">{{ bookInfo.translate }}</view>
  10. <view class="book-subtitle">{{ bookInfo.booksName }}</view>
  11. <view class="book-author">{{ bookInfo.booksAuthor }}</view>
  12. <view class="book-level" :class="classMap[bookInfo.vipInfo.title]">{{ bookInfo.vipInfo.title }}</view>
  13. </view>
  14. </view>
  15. <view class="book-knowledge">
  16. <view class="book-knowledge-title">
  17. <text>
  18. 适合词汇量
  19. </text>
  20. <text class="book-knowledge-vocabulary">
  21. {{ bookInfo.vocabularyRange }}
  22. </text>
  23. </view>
  24. <view class="border" />
  25. <view class="book-knowledge-detail">
  26. <view class="book-knowledge-detail-title">
  27. 知识收获
  28. </view>
  29. <rich-text :nodes="bookInfo.knowledgePoints">
  30. </rich-text>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 课程和简介容器 -->
  35. <view class="content-container">
  36. <!-- 课程部分 -->
  37. <view class="course-section">
  38. <view class="course-header">
  39. <view class="course-title">课程</view>
  40. </view>
  41. <view class="course-list">
  42. <view
  43. v-for="(course, index) in courseList.records"
  44. :key="index"
  45. class="course-item"
  46. >
  47. <view class="course-number">{{ String(index + 1).padStart(2, '0') }}</view>
  48. <view class="course-content">
  49. <view class="course-name">{{ course.english }}</view>
  50. <view class="course-subtitle">{{ course.chinese }}</view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="course-footer">
  55. <view class="course-total">全部课程 · {{ courseList.total }}</view>
  56. <uv-icon name="arrow-right" size="24rpx" color="#999"></uv-icon>
  57. </view>
  58. </view>
  59. <!-- 简介部分 -->
  60. <view class="intro-section">
  61. <view class="intro-title">简介</view>
  62. <view class="intro-content">
  63. {{ bookInfo.booksIntro }}
  64. </view>
  65. </view>
  66. <!-- 作者部分 -->
  67. <view class="author-section">
  68. <view class="author-title">作者</view>
  69. <view class="author-info">
  70. <view class="author-avatar">
  71. <image :src="bookInfo.aouthorImg" mode="aspectFill"></image>
  72. <view>
  73. <view class="author-name">{{ bookInfo.enAuthor }}</view>
  74. <view class="author-subtitle">{{ bookInfo.booksAuthor }}</view>
  75. </view>
  76. </view>
  77. <view class="author-details">
  78. <view class="author-description">
  79. {{ bookInfo.aouthorIntro }}
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- 底部固定操作栏 -->
  86. <view class="bottom-action-bar">
  87. <view class="bottom-action-container">
  88. <view class="action-button secondary" @click="joinCourse">
  89. <image src="/static/课程图标.png" class="button-icon" mode="aspectFill"></image>
  90. <text>加入课程</text>
  91. </view>
  92. <view class="action-button primary">
  93. <image src="/static/内容图标.png" class="button-icon" ></image>
  94. <text>内容朗读</text>
  95. </view>
  96. <uv-button type="primary" :custom-style="{
  97. width: '400rpx',
  98. height: '80rpx',
  99. borderRadius: '198rpx',
  100. background: '#06DADC',
  101. fontSize: '28rpx',
  102. fontWeight: '600'
  103. }" >开始学习</uv-button>
  104. </view>
  105. <uv-safe-bottom></uv-safe-bottom>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. export default {
  111. data() {
  112. return {
  113. classMap: {
  114. '朵蕾会员': 'book-level-1',
  115. '萌芽会员': 'book-level-2',
  116. '盛放会员': 'book-level-3',
  117. },
  118. bookInfo: {
  119. },
  120. id: '',
  121. courseList: [
  122. ]
  123. }
  124. },
  125. methods: {
  126. goBack() {
  127. uni.navigateBack()
  128. },
  129. // 加入课程
  130. async joinCourse() {
  131. const joinRes = await this.$api.book.addStand({
  132. id: this.id
  133. })
  134. if (joinRes.code === 200){
  135. uni.showToast({
  136. title: '加入成功',
  137. icon: 'success',
  138. duration: 2000
  139. })
  140. }
  141. },
  142. // 获取书籍详情
  143. async getDetail() {
  144. const detailRes = await this.$api.book.detail({
  145. id: this.id
  146. })
  147. if (detailRes.code === 200){
  148. this.bookInfo = detailRes.result
  149. }
  150. },
  151. // 获取书籍的课程
  152. async getCourse() {
  153. const courseRes = await this.$api.book.course({
  154. id: this.id,
  155. pageNo: 1,
  156. pageSize: 5
  157. })
  158. if (courseRes.code === 200){
  159. this.courseList = courseRes.result
  160. }
  161. },
  162. },
  163. onLoad(options) {
  164. if (options.id){
  165. this.id = options.id
  166. Promise.all([
  167. this.getDetail(),
  168. this.getCourse()
  169. ])
  170. }
  171. }
  172. }
  173. </script>
  174. <style scoped lang="scss">
  175. .directory-container {
  176. min-height: 100vh;
  177. background-color: #264C8F;
  178. }
  179. .book-container{
  180. position: sticky;
  181. left: 0;
  182. right: 0;
  183. top: 0;
  184. padding: 30rpx;
  185. }
  186. .book-info {
  187. display: flex;
  188. align-items: start;
  189. gap: 32rpx;
  190. .book-cover {
  191. width: 208rpx;
  192. height: 292rpx;
  193. border-radius: 16rpx;
  194. }
  195. .book-details{
  196. color: white;
  197. display: flex;
  198. flex-direction: column;
  199. gap: 16rpx;
  200. .book-title{
  201. font-weight: 500;
  202. font-size: 40rpx;
  203. }
  204. .book-subtitle{
  205. font-weight: 500;
  206. font-size: 30rpx;
  207. }
  208. .book-author{
  209. font-size: 24rpx;
  210. }
  211. .book-level{
  212. font-size: 24rpx;
  213. width: 124rpx;
  214. height: 38rpx;
  215. border-radius: 8rpx;
  216. text-align: center;
  217. line-height: 38rpx;
  218. color: #080D21;
  219. }
  220. .book-level-1{
  221. background: #E9F1FF;
  222. border: 2rpx solid #C4DAFF
  223. }
  224. .book-level-2{
  225. background: #FFE9E9;
  226. border: 2rpx solid #FFDBC4
  227. }
  228. .book-level-3{
  229. background: #FFF4E9;
  230. border: 2rpx solid #FFE2C4
  231. }
  232. }
  233. }
  234. .book-knowledge{
  235. box-shadow: 0px 1px 5px 0px #103577;
  236. background: #234684;
  237. color: #fff;
  238. margin-top: 32rpx;
  239. border: 2rpx solid #FFFFFF3B;
  240. border-radius: 32rpx;
  241. padding-top: 32rpx;
  242. padding-right: 40rpx;
  243. padding-bottom: 32rpx;
  244. padding-left: 40rpx;
  245. gap: 24rpx;
  246. display: flex;
  247. flex-direction: column;
  248. gap: 22rpx;
  249. .book-knowledge-title{
  250. font-size: 32rpx;
  251. font-weight: 600;
  252. display: flex;
  253. justify-content: space-between;
  254. .book-knowledge-vocabulary{
  255. font-size: 40rpx;
  256. color: #06DADC;
  257. }
  258. }
  259. .border {
  260. width: 100%;
  261. border: 2rpx solid;
  262. border-image-source: linear-gradient(90deg, rgba(233, 181, 123, 0) 0%, rgba(255, 255, 255, 0.79) 50.48%, rgba(233, 181, 123, 0) 100%);
  263. border-image-slice: 1;
  264. }
  265. .book-knowledge-detail-title{
  266. font-size: 32rpx;
  267. font-weight: 600;
  268. margin-bottom: 16rpx;
  269. }
  270. }
  271. /* 课程和简介容器 */
  272. .content-container {
  273. padding: 40rpx 32rpx 240rpx;
  274. border-radius: 40rpx 40rpx 0 0;
  275. overflow: hidden;
  276. background: #fff;
  277. display: flex;
  278. gap: 24rpx;
  279. flex-direction: column;
  280. position: relative;
  281. z-index: 100;
  282. }
  283. /* 课程部分 */
  284. .course-section {
  285. background: #F8F8F8;
  286. border-radius: 32rpx;
  287. border-radius: 32rpx;
  288. padding-top: 36rpx;
  289. padding-right: 32rpx;
  290. padding-bottom: 36rpx;
  291. padding-left: 32rpx;
  292. gap: 36rpx;
  293. display: flex;
  294. flex-direction: column;
  295. }
  296. .course-title {
  297. font-size: 32rpx;
  298. font-weight: 600;
  299. color: #3B3D3D;
  300. }
  301. .course-list {
  302. // margin-bottom: 32rpx;
  303. display: flex;
  304. flex-direction: column;
  305. gap: 24rpx;
  306. }
  307. .course-item {
  308. display: flex;
  309. align-items: center;
  310. // background: red;
  311. border-bottom: 2rpx solid #EEEEEE;
  312. padding-bottom: 20rpx;
  313. gap: 36rpx;
  314. }
  315. .course-item:last-child {
  316. border-bottom: none;
  317. }
  318. .course-number {
  319. font-size: 36rpx;
  320. color: #999;
  321. }
  322. .course-content {
  323. flex: 1;
  324. }
  325. .course-name {
  326. font-size: 32rpx;
  327. font-weight: 600;
  328. color: #3B3D3D;
  329. margin-bottom: 8rpx;
  330. }
  331. .course-subtitle {
  332. font-size: 28rpx;
  333. color: #3B3D3D;
  334. }
  335. .course-footer {
  336. display: flex;
  337. align-items: center;
  338. // justify-content: space-between;
  339. }
  340. .course-total {
  341. font-size: 24rpx;
  342. color: #999;
  343. }
  344. /* 简介部分 */
  345. .intro-section {
  346. background: #F8F8F8;
  347. border-radius: 32rpx;
  348. padding: 32rpx;
  349. }
  350. .intro-title {
  351. font-size: 32rpx;
  352. font-weight: 600;
  353. color: #3B3D3D;
  354. margin-bottom: 24rpx;
  355. }
  356. .intro-content {
  357. font-size: 28rpx;
  358. line-height: 48rpx;
  359. color: #4F4F4F;
  360. }
  361. /* 作者部分 */
  362. .author-section {
  363. background: #F8F8F8;
  364. border-radius: 32rpx;
  365. padding: 32rpx;
  366. .author-title {
  367. font-size: 32rpx;
  368. font-weight: 600;
  369. color: #3B3D3D;
  370. margin-bottom: 24rpx;
  371. }
  372. .author-info {
  373. display: flex;
  374. gap: 24rpx;
  375. align-items: flex-start;
  376. flex-direction: column;
  377. .author-avatar {
  378. display: flex;
  379. align-items: center;
  380. gap: 16rpx;
  381. image {
  382. width: 80rpx;
  383. height: 80rpx;
  384. border-radius: 50%;
  385. overflow: hidden;
  386. flex-shrink: 0;
  387. }
  388. .author-name {
  389. font-size: 36rpx;
  390. font-weight: 600;
  391. color: #252545;
  392. margin-bottom: 12rpx;
  393. }
  394. .author-subtitle {
  395. font-size: 28rpx;
  396. color: #3B3D3D;
  397. // margin-bottom: 16rpx;
  398. }
  399. }
  400. .author-details {
  401. flex: 1;
  402. .author-description {
  403. font-size: 28rpx;
  404. line-height: 48rpx;
  405. color: #4F4F4F;
  406. }
  407. }
  408. }
  409. }
  410. /* 底部固定操作栏 */
  411. .bottom-action-bar {
  412. position: fixed;
  413. bottom: 0;
  414. left: 0;
  415. right: 0;
  416. background: #fff;
  417. padding: 24rpx 32rpx 0;
  418. box-shadow: 0rpx -2rpx 0rpx 0rpx #0000001A;
  419. z-index: 999;
  420. .bottom-action-container{
  421. display: flex;
  422. align-items: center;
  423. gap: 20rpx;
  424. .action-button {
  425. display: flex;
  426. flex-direction: column;
  427. align-items: center;
  428. justify-content: center;
  429. padding: 16rpx 0rpx;
  430. border-radius: 16rpx;
  431. min-width: 120rpx;
  432. gap: 8rpx;
  433. .button-icon {
  434. width: 44rpx;
  435. height: 44rpx;
  436. }
  437. text {
  438. font-size: 24rpx;
  439. color: #999999;
  440. }
  441. }
  442. }
  443. }
  444. </style>