四零语境前端代码仓库
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.

505 lines
10 KiB

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