detail.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. <template>
  2. <view>
  3. <nav-bar title="课程详情"></nav-bar>
  4. <view class="videoBox" >
  5. <!-- <view > -->
  6. <view class="video_box" v-if="!startStatus">
  7. <image :src="$method.splitImgHost(detail.coverUrl)" style="width: 100%;height: 450rpx;"></image>
  8. <image v-if="false" class="video_play" src="/static/play.png" @click="startVideo"></image>
  9. </view>
  10. <view v-else class="video_box" style="width: 100%;height: 450rpx;">
  11. <polyv-player
  12. id="playerVideo"
  13. playerId="playerVideo"
  14. height="450rpx"
  15. :vid="vid"
  16. :showSettingBtn="true"
  17. :enablePlayGesture="true"
  18. :playbackRate="playbackRate"
  19. :isAllowSeek="isAllowSeek"
  20. :autoplay="autoplay"
  21. :startTime="startTime"
  22. @statechange="onStateChange"
  23. ></polyv-player>
  24. </view>
  25. <view class="cou_title">
  26. <view class="title_name">
  27. <!-- <view class="yearTag" v-if="detail.year">{{detail.year}}</view> -->
  28. <view class="titleTag">{{detail.goodsName}}</view>
  29. </view>
  30. <view style="display: flex;justify-content: space-between;margin-top: 13rpx;">
  31. <view class="prices">
  32. <text v-if="detail.standPrice" class="price_word">¥ {{ detail.standPrice }}</text>
  33. <text v-else class="price_word free">免费</text>
  34. <text v-if="detail.linePrice" class="sale"> ¥ </text>
  35. <text v-if="detail.linePrice" class="price_line"> {{detail.linePrice }}</text>
  36. </view>
  37. <view class="noteTag">
  38. 共 <text class="blackFont">{{courseList.length}} 课程 {{detail.classHours || '-'}}</text> 学时
  39. </view>
  40. </view>
  41. </view>
  42. <!-- </view> -->
  43. </view>
  44. <view class="contents">
  45. <!-- <u-line color="#D6D6DB" /> -->
  46. <!-- <view style="height: 80rpx;">
  47. <view><u-tabs :list="list" :item-width="itemWidth()" font-size="30" bar-width="24" :current="current" @change="change" active-color="#007AFF"></u-tabs></view>
  48. </view> -->
  49. <view class="tabs">
  50. <view v-for="(item, index) in list" :key="index" class="tab_item"
  51. :class="[list.length == 2 ? 'twoBtn' : list.length == 3 ? 'threeBtn' : '',{nactive: current == index}]" @click="change(index)">{{ item.name }}</view>
  52. </view>
  53. <view style="padding: 20rpx;padding-bottom: 100rpx;position: relative;" v-show="current==0">
  54. <view class="content">
  55. <view v-html="detail.mobileDetailHtml" style="width: 100%;overflow: hidden;"></view>
  56. </view>
  57. </view>
  58. <view style="padding: 20rpx;padding-bottom: 100rpx;position: relative;" v-show="current==1">
  59. <!-- <view v-for="(item, index) in courseItem.courseList" :key="index" > -->
  60. <view v-for="(courseItem, gTindex) in goodsTeacher" :key="gTindex">
  61. <view v-for="(item, index) in courseItem.courseList" :key="index">
  62. <view class="courseItemBox" v-if="item.show && item.show == 1">
  63. <view class="courseItem" @click="openCourse(item)">
  64. <view class="courseName">{{item.courseName}}</view>
  65. <view>
  66. <image src="/static/icon/up.png" class="icon_up" v-if="item.down"></image>
  67. <image src="/static/icon/down.png" class="icon_up" v-if="!item.down"></image>
  68. </view>
  69. </view>
  70. <view v-if="courseItem.teaList && courseItem.teaList.length > 0" class='teacher_names'>
  71. <view v-for="(tea, tindex) in courseItem.teaList" :key="tindex" class="names" :class="[States[gTindex] == tindex ? 'nactive' : '']"
  72. @click.stop="switchTeacher(tea, tindex, gTindex)">
  73. <view >{{ tea.aliasName }}</view>
  74. </view>
  75. </view>
  76. <view v-show="!item.down">
  77. <view v-for="(itemM,indexM) in item.menuList" :key="indexM">
  78. <courseModule :courseId="itemM.courseId" :needOpen="(isFirstEnter && menuIndex[0] === index && menuIndex[1] === indexM) ? true : false" v-if="itemM.type==1" :menuItem="itemM"></courseModule>
  79. <courseChapter :courseId="itemM.courseId" :needOpen="(isFirstEnter && menuIndex[0] === index && menuIndex[1] === indexM) ? true : false" v-if="itemM.type==2" :isBuy="false" :menuItem="itemM"></courseChapter>
  80. <courseSection :courseId="itemM.courseId" v-if="itemM.type==3" :isBuy="false" :menuItem="itemM"></courseSection>
  81. <u-line></u-line>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view style="padding: 20rpx;padding-bottom: 100rpx;position: relative;" v-show="current==2">
  89. <!-- <view > -->
  90. <view v-for="(item,index) in freeMenuList" :key="index" >
  91. <view class="courseItemBox" >
  92. <view class="courseItem">
  93. <view class="courseName">{{item.freeExamName}}</view>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- </view> -->
  98. </view>
  99. </view>
  100. <view class="bottomBox" v-if="!hideBuyState">
  101. <view class="icons">
  102. <view class="icon_item ones">
  103. <image src="/static/index/share.png" class="share"></image>
  104. <button type="default" open-type="share" class="bt_share"></button>
  105. <view class="share_w">分享</view>
  106. </view>
  107. <view class="icon_item">
  108. <image src="/static/index/shopcar.png" class="shopcar" @click="toShopcar()"></image>
  109. <view class="share_w">购物车</view>
  110. </view>
  111. </view>
  112. <view style="display: flex;color: #FFFFFF;align-items: center;">
  113. <view class="btn1" @click="addCart">加购物车</view>
  114. <view class="btn2" @click="buy">立即购买 </view>
  115. </view>
  116. </view>
  117. <!-- 已购买过课程的弹窗 -->
  118. <u-popup v-model="bugCourseModel" mode="center" border-radius="40">
  119. <view class="had_bugCourse">
  120. <image src="/pages3/static/imgs/hadBug.png" class="share"></image>
  121. <view class="tips">
  122. <view class="warns">温馨提示</view>
  123. <view class="words">您<text>已购买过</text>该商品课程</view>
  124. <view class="words">可立即前往学习</view>
  125. </view>
  126. <view class="tip_botton">
  127. <view class="cancel_btn" @click="changeKown()">知道了</view>
  128. <view class="confirm_btn" @click="toStudy()">去学习</view>
  129. </view>
  130. </view>
  131. </u-popup>
  132. </view>
  133. </template>
  134. <script>
  135. import courseModule from '@/components/course/courseModule.vue';
  136. import courseChapter from '@/components/course/courseChapter.vue';
  137. import courseSection from '@/components/course/courseSection.vue';
  138. import { mapGetters,mapMutations } from 'vuex';
  139. export default {
  140. components: {
  141. courseModule,
  142. courseChapter,
  143. courseSection
  144. },
  145. data() {
  146. return {
  147. id:0,
  148. list: [],
  149. menuIndex:[],
  150. current:0,
  151. detail:{},
  152. courseList:[],
  153. menuList:[],
  154. freeMenuList:[],
  155. startStatus:false,
  156. playbackRate: [1.0],
  157. isAllowSeek:'no',
  158. vid:'',
  159. autoplay:true,
  160. listenConfigList:[],
  161. listenSecond:0,
  162. isFirstEnter:true, //是否首次进入
  163. timer:null,
  164. businessData:{},
  165. startTime:0,
  166. bugCourseModel: false, // 弹窗
  167. hadBuyCourse: {}, // 已购买课程信息
  168. goodsTeacher: [],
  169. teaIndex: 0,
  170. States: {0: 0},
  171. };
  172. },
  173. computed: { ...mapGetters(['userInfo','goodsAuditionConfigIdList','playSectionId','hideBuyState']) },
  174. onLoad(option) {
  175. // this.id => goodsId
  176. this.id = option.id;
  177. this.getDetail()
  178. this.goodsCourseList()
  179. this.appCommonGoodsCourseModuleFreeExamList();
  180. this.getIsBuy() // 判断是否已经购买过该课程
  181. wx.showShareMenu({
  182. withShareTicket: true,
  183. menus: ["shareAppMessage", "shareTimeline"]
  184. })
  185. },
  186. onUnload(option) {
  187. this.$store.commit('setPlaySectionId', {playSectionId :0});
  188. //移除所有的事件监听器
  189. uni.$off();
  190. },
  191. // 分享到朋友圈
  192. onShareTimeline() {
  193. return {
  194. title: this.detail.goodsName,
  195. query: 'id=' + this.id,
  196. imageUrl: this.$method.splitImgHost(this.detail.coverUrl)
  197. }
  198. },
  199. // 分享给朋友
  200. onShareAppMessage() {
  201. return {
  202. title: this.detail.goodsName,
  203. path: `/pages3/course/detail?id=` + this.id,
  204. imageUrl: this.$method.splitImgHost(this.detail.coverUrl)
  205. }
  206. },
  207. mounted() {
  208. let self = this
  209. uni.$on('getSection', item => {
  210. //播放试听
  211. self.listenSecond = 0
  212. for (var itemChild of self.listenConfigList) {
  213. if(self.playSectionId == (itemChild.sectionId || itemChild.menuId) && item.courseId == itemChild.courseId){
  214. if(itemChild.auditionMinute>0){
  215. // self.listenSecond = itemChild.auditionMinute *60 //试听秒数
  216. self.listenSecond = itemChild.auditionMinute //试听秒数 auditionMinute调整为秒单位
  217. }
  218. }
  219. }
  220. if(self.listenSecond>0){
  221. if(self.timer){
  222. clearInterval(self.timer);
  223. }
  224. if(self.vid){
  225. //切换视频
  226. var polyvPlayerContext = self.selectComponent('#playerVideo');
  227. polyvPlayerContext.changeVid(item.recordingUrl)
  228. }else{
  229. self.vid = item.recordingUrl
  230. }
  231. self.startStatus = true
  232. self.startTime = 0
  233. }else{
  234. self.$u.toast('试听配置错误');
  235. }
  236. })
  237. this.updateChapterOpen(true)
  238. },
  239. methods: {
  240. ...mapMutations(['updateChapterOpen']),
  241. itemWidth() {
  242. return (100/this.list.length)+'%'
  243. },
  244. appCommonGoodsCourseModuleFreeExamList() {
  245. // url: '/app/common/goods/course/moduleFreeExamList/'+data,
  246. this.$api.appCommonGoodsCourseModuleFreeExamList(this.id).then(res => {
  247. if(res.data.data.length) {
  248. this.freeMenuList = res.data.data;
  249. this.list = [
  250. {
  251. name: '课程介绍'
  252. },
  253. {
  254. name: '课程目录'
  255. },
  256. {
  257. name: '赠送'
  258. }
  259. ]
  260. } else {
  261. this.list = [
  262. {
  263. name: '课程介绍'
  264. },
  265. {
  266. name: '课程目录'
  267. }
  268. ]
  269. }
  270. console.log(this.list)
  271. })
  272. },
  273. courseBusiness(){
  274. // url: '/app/common/course/business/'+data,
  275. this.$api.courseBusiness(this.detail.businessId).then(res => {
  276. this.businessData = res.data.data;
  277. })
  278. },
  279. toFixed(number) {
  280. if(number > 0) {
  281. return number.toFixed(2)
  282. } else {
  283. return '0.00'
  284. }
  285. },
  286. onStateChange(newstate, oldstate) {
  287. if (newstate.detail.newstate == 'playing') {
  288. //开始播放
  289. if(this.timer){
  290. clearInterval(this.timer);
  291. }
  292. this.timer = setInterval(this.timeEvent, 1500);//定时器
  293. }
  294. },
  295. closePlay(){
  296. this.$store.commit('setPlaySectionId', {playSectionId :0});
  297. this.vid = ""
  298. this.startStatus = false
  299. },
  300. timeEvent() {
  301. let self = this
  302. var polyvPlayerContext = this.selectComponent('#playerVideo');
  303. if (polyvPlayerContext != null) {
  304. let PlayCurrentTime = polyvPlayerContext.getCurrentTime();
  305. if(PlayCurrentTime>=this.listenSecond){
  306. polyvPlayerContext.stop();
  307. polyvPlayerContext.exitFullScreen();
  308. clearInterval(this.timer);
  309. this.timer = null
  310. uni.showModal({
  311. title: '提示',
  312. content: '试听结束,购买课程可学习全部',
  313. showCancel:false,
  314. success: function(resst) {
  315. self.closePlay()
  316. }
  317. });
  318. }
  319. }
  320. },
  321. openCourse(item){
  322. item.down = !item.down
  323. if(!item.down&&item.menuList.length==0){
  324. this.getMenuList(item)
  325. }
  326. },
  327. addShopCart() {
  328. let self = this
  329. this.$api.addCart({goodsId:this.id}).then(res => {
  330. if(res.data.code==200){
  331. uni.setStorageSync('updateCart',1) //提醒刷新购物车
  332. uni.showToast({
  333. title: '添加成功'
  334. });
  335. }else{
  336. this.$u.toast(res.data.msg);
  337. }
  338. });
  339. },
  340. goodsCourseList() {
  341. // url: '/app/common/goods/course/list/'+ data,
  342. this.$api.goodsCourseList(this.id).then(res => {
  343. if(res.data.code==200){
  344. for(let i=0;i<res.data.rows.length;i++){
  345. let item = res.data.rows[i]
  346. item.down = true
  347. item.menuList = []
  348. }
  349. this.courseList = res.data.rows;
  350. this.getFirstCourse();
  351. this.getCourseTeacher(res.data.rows)
  352. }
  353. });
  354. },
  355. /**
  356. * 获取第一个有模块或者章的课程
  357. */
  358. async getFirstCourse() {
  359. for(let i = 0; i < this.courseList.length; i++) {
  360. let menuIndexOrFalse = await this.getCourseMenus(this.courseList[i]);
  361. if(menuIndexOrFalse !== false) {
  362. this.menuIndex = [i,menuIndexOrFalse]
  363. this.openCourse(this.courseList[i])
  364. break
  365. }
  366. }
  367. },
  368. getCourseMenus(item) {
  369. return new Promise(resolve => {
  370. // url: '/app/common/course/menuList',
  371. this.$api.menuList({courseId:item.courseId}).then(res => {
  372. if(res.data.code==200){
  373. for(let i=0;i<res.data.rows.length;i++){
  374. if(res.data.rows[i].type == 1 || res.data.rows[i].type == 2) {
  375. resolve(i)
  376. break;
  377. }
  378. }
  379. }
  380. });
  381. })
  382. },
  383. getCourseTeacher(rows) {
  384. //获取商品双师资模板
  385. this.$api.getGoodsCourseTeacher({
  386. goodsId: this.id
  387. }).then((res1) => {
  388. // console.log(res1,'res1');
  389. if(res1.data.data && res1.data.data.length > 0){
  390. //课程老师模板
  391. let teacherTel = res1.data.data;
  392. //商品课程
  393. let courses = rows
  394. teacherTel.forEach((tea) => {
  395. let dataList = []
  396. let teacherList = []
  397. courses.forEach((item) => {
  398. if(tea.courseIds.search(item.courseId) > -1){
  399. dataList.push(item)
  400. teacherList = tea.courseList
  401. }
  402. })
  403. let result = {
  404. teaList:teacherList,
  405. courseList:dataList
  406. }
  407. this.goodsTeacher.push(result)
  408. })
  409. if(this.goodsTeacher && this.goodsTeacher.length > 0){
  410. let courseIds = []
  411. this.goodsTeacher.forEach((item) => {
  412. item.courseList.forEach((course) => {
  413. courseIds.push(course.courseId)
  414. })
  415. })
  416. if(courseIds.length > 0){
  417. courses.forEach((item) => {
  418. if(!courseIds.includes(item.courseId)){
  419. let data = {
  420. teaList:[],
  421. courseList: []
  422. }
  423. data.courseList.push(item)
  424. this.goodsTeacher.push(data)
  425. }
  426. })
  427. }
  428. this.goodsTeacher.forEach((item) => {
  429. if(item.courseList && item.courseList.length > 0){
  430. item.courseList[0].show = 1
  431. }
  432. })
  433. }
  434. }else{
  435. //没有双师资模板
  436. rows.forEach((item) => {
  437. item.show = 1
  438. let data = {
  439. teaList:[],
  440. courseList: []
  441. }
  442. data.courseList.push(item)
  443. this.goodsTeacher.push(data)
  444. })
  445. }
  446. })
  447. console.log(this.goodsTeacher,'this.goodsTeacher');
  448. },
  449. //切换老师
  450. switchTeacher(data, tindex, gTindex){
  451. // console.log(data,'data');
  452. this.States[gTindex] = tindex
  453. this.teaIndex = tindex
  454. this.goodsTeacher.forEach((item,index) => {
  455. if(item.teaList && item.teaList.length > 0){
  456. let list = item.teaList.filter(x => x.aliasName == data.aliasName)
  457. if(list && list.length > 0){
  458. item.courseList.forEach((course,courseIndex) => {
  459. if(course.courseId == data.courseId){
  460. this.$set(this.goodsTeacher[index].courseList[courseIndex],"show",1)
  461. }else{
  462. this.$set(this.goodsTeacher[index].courseList[courseIndex],"show",0)
  463. }
  464. })
  465. }
  466. }
  467. })
  468. console.log('切换后的this.goodsTeacher, ', this.goodsTeacher)
  469. },
  470. getMenuList(item) {
  471. let self = this
  472. this.$api.menuList({courseId:item.courseId}).then(res => {
  473. if(res.data.code==200){
  474. for(let i=0;i<res.data.rows.length;i++){
  475. let item = res.data.rows[i]
  476. item.down = true
  477. item.id = item.menuId
  478. item.name = item.menuName
  479. if(item.type==3){
  480. //判断是否试听
  481. item.tryListen = false
  482. if(self.goodsAuditionConfigIdList.indexOf(item.id)!==-1){
  483. item.tryListen = true
  484. }
  485. }
  486. }
  487. item.menuList = res.data.rows
  488. }
  489. });
  490. },
  491. // 获取课程详情
  492. getDetail() {
  493. let self = this
  494. let sectionIdList = []
  495. // /app/common/goods/+data
  496. this.$api.commonGoodsDetail(this.id).then(res => {
  497. if(res.data.code==200){
  498. if(res.data.data.mobileDetailHtml){
  499. res.data.data.mobileDetailHtml = res.data.data.mobileDetailHtml.replace(/<img/gi,'<img style="max-width:100%;"')
  500. }
  501. self.detail = res.data.data
  502. this.courseBusiness();
  503. if(self.detail.goodsAuditionConfig){
  504. self.listenConfigList = JSON.parse(self.detail.goodsAuditionConfig)
  505. for (var itemChild of self.listenConfigList) {
  506. sectionIdList.push(itemChild.sectionId)//存储试听节ID
  507. }
  508. self.$store.commit('setGoodsAuditionConfigIdList', {goodsAuditionConfigIdList:sectionIdList});
  509. }
  510. }
  511. });
  512. },
  513. buy(){
  514. if(this.$method.isGoLogin()){
  515. return
  516. }
  517. this.$navTo.togo('/pages2/order/confirm_list?id='+this.id);
  518. },
  519. addCart(){
  520. if(this.$method.isGoLogin()){
  521. return
  522. }
  523. this.addShopCart()
  524. },
  525. open(item){
  526. item.showChildren = !item.showChildren
  527. },
  528. change(index){
  529. this.current = index;
  530. },
  531. toShopcar() {
  532. uni.switchTab({
  533. url: '/pages/shopping/shoppingCart'
  534. })
  535. },
  536. getIsBuy() {
  537. this.$http({
  538. url: '/order/buyGoodsNotExpired',
  539. method: 'get',
  540. data: { goodsId: this.id }
  541. }).then((res) => {
  542. if (res.data.code == 200) {
  543. if (res.data.data) { // 有data返回是已经购买过的课程
  544. this.hadBuyCourse = res.data.data
  545. this.bugCourseModel = true
  546. }
  547. }
  548. })
  549. },
  550. changeKown() {
  551. this.bugCourseModel = false
  552. },
  553. async toStudy() {
  554. let item = this.hadBuyCourse
  555. if (item.goodsType == 6) { // 进入直播课
  556. this.toLive(item)
  557. return
  558. }
  559. // /course/goodsRebuildStatus查询用户商品重修状态
  560. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
  561. if (rebuildStatus == 0) {
  562. this.$navTo.togo('/pages2/learn/details', {
  563. gradeId: item.gradeId,
  564. goodsId: item.goodsId,
  565. orderGoodsId: item.orderGoodsId,
  566. });
  567. return;
  568. }
  569. // /lock/lockStatus
  570. this.$api.lockLockStatus({
  571. action: 'jxjy',
  572. uuid:this.$method.getUuid()
  573. }).then(res => {
  574. if (res.data.code == 200) { //有其他端在操作,不能学习
  575. uni.showToast({
  576. icon: 'none',
  577. title: res.data.msg,
  578. mask: true,
  579. duration: 3000
  580. })
  581. } else if (res.data.code == 500) { //可以学习
  582. this.$http({
  583. url: '/course/courseList',
  584. method: 'get',
  585. data: {
  586. pageNum: 1,
  587. pageSize: 1,
  588. goodsId: item.goodsId,
  589. gradeId: item.gradeId,
  590. orderGoodsId: item.orderGoodsId,
  591. },
  592. })
  593. .then(res => {
  594. if (res.data.code == 200) {
  595. if(res.data.total > 1) {
  596. // this.$navTo.togo(`/pages2/wd/course?id=${item.goodsId}&gid=${item.gradeId}&orderGoodsId=${item.orderGoodsId}`);
  597. uni.navigateTo({
  598. url: `/pages3/polyv/detail?id=''&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
  599. })
  600. } else if(res.data.total == 1) {
  601. uni.navigateTo({
  602. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
  603. })
  604. } else {
  605. uni.showToast({
  606. icon:'none',
  607. title:'暂无可观看的视频课程'
  608. })
  609. }
  610. }
  611. })
  612. }
  613. })
  614. },
  615. toLive(item) {
  616. this.$api.courseCourseList({
  617. pageNum: 1,
  618. pageSize: 1,
  619. goodsId: item.goodsId,
  620. gradeId: 0,
  621. orderGoodsId: item.orderGoodsId,
  622. }).then(res => {
  623. if (res.data.code == 200) {
  624. if(res.data.total > 1) {
  625. // uni.navigateTo({
  626. // url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
  627. // })
  628. uni.navigateTo({
  629. url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId=""'
  630. })
  631. } else if(res.data.total == 1) {
  632. uni.navigateTo({
  633. url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId='+ res.data.rows[0].courseId
  634. })
  635. } else {
  636. uni.showToast({
  637. icon:'none',
  638. title:'暂无可观看的直播课程'
  639. })
  640. }
  641. }
  642. })
  643. },
  644. /**
  645. * @param {Object} goodsId 商品id
  646. * 查询商品重修状态
  647. */
  648. courseGoodsRebuildStatus(goodsId, gradeId) {
  649. return new Promise(resolve => {
  650. this.$http({
  651. url: '/course/goodsRebuildStatus',
  652. method: 'get',
  653. data: {
  654. goodsId: goodsId,
  655. gradeId: gradeId
  656. },
  657. // noLoading: true,
  658. // compleLoading: true, // 请求成功是否还要继续显示加载中
  659. })
  660. .then(res => {
  661. resolve(res.data.data)
  662. })
  663. })
  664. },
  665. }
  666. };
  667. </script>
  668. <style >
  669. page{
  670. background-color: #F2F2F2;
  671. }
  672. </style>
  673. <style lang="scss" scope>
  674. @import './index.scss';
  675. .video_t2 {
  676. font-size: 24rpx;
  677. font-family: PingFang SC;
  678. font-weight: 500;
  679. color: #666666;
  680. }
  681. .video_t1 {
  682. height: 80rpx;
  683. color: #333333;
  684. line-height: 80rpx;
  685. font-size: 30rpx;
  686. font-family: PingFang SC;
  687. font-weight: bold;
  688. color: #333333;
  689. overflow: hidden;
  690. text-overflow:ellipsis;
  691. white-space: nowrap;
  692. }
  693. .video_t1_t {
  694. display: flex;
  695. flex-direction: column;
  696. height: 80rpx;
  697. color: #333333;
  698. text-align: center;
  699. align-items: center;
  700. border-left: solid 1px #d6d6db;
  701. }
  702. .video_play {
  703. position: absolute;
  704. width: 95rpx;
  705. height: 95rpx;
  706. top: 0;
  707. left: 0;
  708. right: 0;
  709. bottom: 0;
  710. margin: auto;
  711. }
  712. .video_box {
  713. position: relative;
  714. }
  715. .contents {
  716. width: 100%;
  717. height: 100%;
  718. background-color: #ffffff;
  719. margin-top: 16rpx;
  720. overflow: hidden;
  721. }
  722. .cou_title {
  723. padding: 24rpx 32rpx 40rpx 32rpx;
  724. display: flex;
  725. flex-direction: column;
  726. justify-content: space-around;
  727. }
  728. .prices {
  729. .price_word {
  730. font-size: 40rpx;
  731. font-weight: 800;
  732. color: #FC3F3F;
  733. }
  734. .sale {
  735. color: #999999;
  736. font-size: 28rpx;
  737. margin-left: 8rpx;
  738. }
  739. .price_line {
  740. color: #999999;
  741. font-size: 28rpx;
  742. text-decoration:line-through;
  743. font-weight: 400;
  744. }
  745. .free {
  746. font-size: 32rpx;
  747. }
  748. }
  749. // tab
  750. .tabs {
  751. // width: 100%;
  752. height: 78rpx;
  753. display: flex;
  754. align-items: center;
  755. justify-content: space-between;
  756. background-color: #F2F7FF;
  757. border-radius: 38rpx;
  758. margin: 24rpx;
  759. padding: 0rpx 5rpx;
  760. .tab_item {
  761. width: 345rpx;
  762. height: 65rpx;
  763. line-height: 65rpx;
  764. font-size: 28rpx;
  765. font-weight: bold;
  766. border-radius: 32rpx;
  767. text-align: center;
  768. color: #333;
  769. &.nactive {
  770. color: #fff;
  771. background-color: #3577E8;
  772. }
  773. &.twoBtn {
  774. width: 50%;
  775. }
  776. &.threeBtn {
  777. width: 33%;
  778. }
  779. }
  780. // /deep/ .u-tabs {
  781. // background:none!important;
  782. // }
  783. }
  784. .courseName{
  785. white-space:nowrap;
  786. overflow:hidden;
  787. text-overflow:ellipsis;
  788. }
  789. .videoBox{
  790. background-color: #FFFFFF;
  791. width: 100%;
  792. /* height: 680rpx; */
  793. z-index: 999;
  794. }
  795. .icon_up{
  796. width: 32rpx;
  797. height: 32rpx;
  798. }
  799. .courseItemBox{
  800. background: #FFFFFF;
  801. border-radius: 16rpx;
  802. padding: 0 10rpx;
  803. margin-bottom: 20rpx;
  804. }
  805. .courseItem{
  806. height: 80rpx;
  807. color: #333333;
  808. font-size: 32rpx;
  809. line-height: 80rpx;
  810. font-weight: bold;
  811. display: flex;
  812. justify-content: space-between;
  813. }
  814. .content{
  815. background-color: #FFFFFF;
  816. width: 100%;
  817. }
  818. .btn2 {
  819. width: 187rpx;
  820. height: 79rpx;
  821. line-height: 79rpx;
  822. background: #FC3F3F;
  823. border-radius: 40rpx;
  824. text-align: center;
  825. font-size: 24rpx;
  826. }
  827. .btn1 {
  828. width: 187rpx;
  829. height: 79rpx;
  830. line-height: 79rpx;
  831. background: #FFB102;
  832. border-radius: 40rpx;
  833. text-align: center;
  834. margin-right: 11rpx;
  835. font-size: 24rpx;
  836. }
  837. .blackFont{
  838. margin: 0 4rpx;
  839. }
  840. .wk_icon{
  841. width: 24rpx;
  842. height: 24rpx;
  843. margin-right: 12rpx;
  844. }
  845. .noteTag, .blackFont {
  846. font-size: 30rpx;
  847. font-family: PingFang SC;
  848. font-weight: 400;
  849. color: #A7B0B8;
  850. align-items: center;
  851. }
  852. .priceTag{
  853. /* font-size: 30rpx;
  854. font-family: PingFang SC;
  855. font-weight: bold;
  856. color: #FF2D55; */
  857. width: 60rpx;
  858. height: 40rpx;
  859. line-height: 40rpx;
  860. text-align: center;
  861. border: 1rpx solid #333;
  862. }
  863. .titleTag{
  864. font-size: 32rpx;
  865. font-weight: bold;
  866. color: #333333;
  867. // margin-left: 8rpx;
  868. }
  869. .yearTag{
  870. width: 80rpx;
  871. height: 32rpx;
  872. background: #EBF5FF;
  873. border: 2rpx solid #007AFF;
  874. border-radius: 16rpx;
  875. font-size: 24rpx;
  876. color: #007AFF;
  877. text-align: center;
  878. line-height: 32rpx;
  879. }
  880. .itemBox{
  881. background: #FFFFFF;
  882. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  883. border-radius: 24rpx;
  884. width: 100%;
  885. padding: 20rpx;
  886. margin-bottom: 20rpx;
  887. }
  888. // 老师名字样式
  889. .teacher_names {
  890. display: flex;
  891. padding-bottom: 15rpx;
  892. border-bottom: 2rpx solid #F0F0F0;
  893. .names {
  894. padding: 6rpx 12rpx;
  895. font-size: 26rpx;
  896. color: #969696;
  897. background: #F8F8F8;
  898. border-radius: 8rpx;
  899. margin-right: 10rpx;
  900. &.nactive {
  901. color: #3F8DFD;
  902. background: #F2F7FF;
  903. }
  904. }
  905. }
  906. </style>