study.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="kecheng-study-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">{{title}}</text>
  6. </view>
  7. <!-- 播放器 -->
  8. <videoPlayVue ref="videoRef"></videoPlayVue>
  9. <!-- 中间区域 -->
  10. <view>
  11. <view>{{period}}分钟</view>
  12. <view>{{userCount}}人学习</view>
  13. </view>
  14. <!-- 大纲 -->
  15. <view class="uni-padding-wrap uni-common-mt">
  16. <uni-segmented-control :current="current" :values="items" style-type="text"
  17. :active-color="activeColor" @clickItem="onClickItem" />
  18. </view>
  19. <view class="content">
  20. <!-- 目录 -->
  21. <view v-if="current === 0">
  22. <kechengMuluVue :chapterArr="list"></kechengMuluVue>
  23. </view>
  24. <!-- 介绍 -->
  25. <view v-if="current === 1"><text class="content-text">选项卡2的内容</text></view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import * as kechengApi from "@/api/kecheng.js";
  31. import videoPlayVue from "@/components/videoPlay/videoPlay.vue";
  32. import kechengMuluVue from "@/components/kecheng-mulu/kecheng-mulu.vue";
  33. import {
  34. formatDuration
  35. } from "@/utils/common.js"
  36. export default {
  37. components: {
  38. videoPlayVue,kechengMuluVue
  39. },
  40. data() {
  41. return {
  42. items: ['目录', '介绍'],
  43. colors: ['#007aff', '#4cd964', '#dd524d'],
  44. activeColor: '#007aff',
  45. current: 0, // 激活的选项卡
  46. kcId: '', // 课程
  47. title: '',
  48. period: 0, // 时长
  49. userCount: 0, // 学习人数
  50. list: [],
  51. }
  52. },
  53. onLoad(options) {
  54. this.kcId = options.kcId;
  55. this.init();
  56. },
  57. methods: {
  58. goUpPage() {
  59. uni.redirectTo({
  60. url: '/pages/admin/Kecheng/list'
  61. })
  62. },
  63. onClickItem(e) {
  64. if (this.current !== e.currentIndex) {
  65. this.current = e.currentIndex
  66. }
  67. },
  68. init() {
  69. kechengApi.getKechengGlStart({
  70. kcId: this.kcId
  71. }).then(res => {
  72. console.log('rrr', res.data)
  73. const {
  74. userCount,
  75. period,
  76. name,
  77. kejianUserVo,
  78. intro
  79. } = res.data;
  80. this.userCount = userCount;
  81. this.period = formatDuration(period);
  82. this.name = name;
  83. this.list = kejianUserVo.zhangList;
  84. this.intro = intro;
  85. })
  86. }
  87. }
  88. }
  89. </script>
  90. <style>
  91. </style>