detail.vue 26 KB

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