livepage.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="container">
  3. <u-sticky>
  4. <back text="课程直播" :show="false"></back>
  5. <!-- 视频资源 -->
  6. <view class="video-box">
  7. <video class="video" id="classVideo" :src="classInfo.resource" controls></video>
  8. </view>
  9. </u-sticky>
  10. <!-- 信息模块 -->
  11. <view class="info-box">
  12. <view class="flex-box" style="width: 70%;height: 100%;">
  13. <view class="flex">
  14. <view class="info-name">{{classInfo.title}}</view>
  15. </view>
  16. <view style="display: flex;align-items: baseline;">
  17. <view class="timeInfo">{{today.split('-')[0]}}</view>
  18. <view class="info-msg">月</view>
  19. <view class="timeInfo">{{today.split('-')[1]}}</view>
  20. <view class="info-msg" style="margin-right: 20rpx;">日</view>
  21. <view class="info-msg">{{classInfo.time}}</view>
  22. </view>
  23. </view>
  24. <view class="flex-box" style=" width: 30%;height: 100%;">
  25. <view class="flex" style="width: 95%;margin-left: auto;">
  26. <view class="block-tag-box">
  27. <view class="block-tag">{{classInfo.name}}</view>
  28. </view>
  29. <view class="block-tag-box">
  30. <view class="block-tag">{{classInfo.teacher}}</view>
  31. </view>
  32. </view>
  33. <view class="flex" style="width: 80%;margin-left: auto;">
  34. <view class="t-icon t-icon-fenxiang" @click="actionShow = true" style="margin-left: auto;"></view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 列表名 -->
  39. <view class="list-name-box">
  40. <view class="index"></view>
  41. <view class="list-name">直播与回放</view>
  42. </view>
  43. <!-- 视频列表 -->
  44. <view class="video-list" v-for="(item,index) in classList" :key="index">
  45. <!-- 正文 -->
  46. <view class="class-block">
  47. <view class="content-box">
  48. <view
  49. :class="index<classCurrent-1? 't-icon t-icon-chenggong':(index===classCurrent-1? 't-icon t-icon-bofang1':'t-icon t-icon-yuyue-lishi-shijian')">
  50. </view>
  51. <view class="flex" style="flex-direction: column;">
  52. <!-- 上 -->
  53. <view style="display: flex;align-items: center;width: 460rpx;margin-left: 20rpx;">
  54. <view class="content-info" style="font-size: 34rpx;line-height: 50rpx;">
  55. {{item.title}}
  56. </view>
  57. <view class="block-tag-box" style="margin-left: 40rpx;">
  58. <view class="block-tag">{{item.name}}</view>
  59. </view>
  60. <view class="block-tag-box" style="margin-left: 10rpx;">
  61. <view class="block-tag">{{item.teacher}}</view>
  62. </view>
  63. </view>
  64. <!-- 下 -->
  65. <view style="display: flex;align-items: center;width: 460rpx; margin:10rpx 0 0 20rpx;">
  66. <view style="display: flex;align-items: baseline;">
  67. <view class="info-time" style="font-size: 30rpx;">
  68. {{item.timeFrame.replace('午','午-').split('-')[0]}}</view>
  69. <view class="info-time" style="margin-left: 10rpx;">
  70. {{item.timeFrame.replace('午','午-').split('-')[1]}}</view>
  71. <view class="info-time" style="font-size: 30rpx;margin-left: 40rpx;">
  72. {{item.time.split('-')[0]}}</view>
  73. <view class="info-time" style="margin-left: 10rpx;">开始</view>
  74. </view>
  75. </view>
  76. </view>
  77. <!-- 按钮 -->
  78. <view class="btn" v-if="index<classCurrent-1" :style="{backgroundColor:'#23b46c'}"
  79. @click="showVideo(index)">
  80. <view class="content-subtitle">观看回放</view>
  81. </view>
  82. <view class="btn" v-if="index===classCurrent-1" :style="{backgroundColor:'#ff5959'}"
  83. @click="showLive(index)">
  84. <view class="content-subtitle">正在直播</view>
  85. </view>
  86. <view class="btn" v-if="index>classCurrent-1" :style="{backgroundColor:'#aaa'}">
  87. <view class="content-subtitle">暂未开始</view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <!-- 分享 -->
  93. <u-action-sheet :show="actionShow" @close="actionShow = false" title="分享视频到" :round="10">
  94. <view class="flex-icon">
  95. <view class="flex-box">
  96. <view class="t-icon t-icon-weixin" @click="shareToWeixin"></view>
  97. <text class="text" @click="shareToWeixin">微信</text>
  98. </view>
  99. <view class="flex-box">
  100. <view class="t-icon t-icon-pengyouquan" @click="shareToPengYouQuan"></view>
  101. <text class="text" @click="shareToPengYouQuan">朋友圈</text>
  102. </view>
  103. <view class="flex-box">
  104. <view class="t-icon t-icon-QQ" @click="shareToQQ"></view>
  105. <text class="text" @click="shareToQQ">QQ</text>
  106. </view>
  107. </view>
  108. </u-action-sheet>
  109. </view>
  110. </template>
  111. <script>
  112. import {
  113. mapState
  114. } from 'vuex'
  115. export default {
  116. computed: {
  117. ...mapState('m_children', ['classList', 'classCurrent'])
  118. },
  119. data() {
  120. return {
  121. classInfo: '',
  122. today: '',
  123. //分享
  124. actionShow: false,
  125. };
  126. },
  127. onLoad(options) {
  128. this.classInfo = this.classList[options.info]
  129. this.getToday()
  130. this.videoContext = uni.createVideoContext('classVideo')
  131. },
  132. methods: {
  133. getToday() {
  134. this.today = (new Date()).format("M-d")
  135. },
  136. shareToWeixin() {
  137. uni.share({
  138. provider: "weixin",
  139. scene: "WXSceneSession",
  140. type: 4,
  141. title: "来自醍摩豆家长端的分享",
  142. summary: `孩子正在上${this.classInfo.name}课程,快来围观吧!`,
  143. mediaUrl: this.classInfo.resource,
  144. success: function(res) {
  145. console.log("success:" + JSON.stringify(res));
  146. },
  147. fail: function(err) {
  148. console.log("fail:" + JSON.stringify(err));
  149. }
  150. });
  151. },
  152. shareToPengYouQuan() {
  153. uni.share({
  154. provider: "weixin",
  155. scene: "WXSceneTimeline",
  156. type: 4,
  157. title: "来自醍摩豆家长端的分享",
  158. summary: `孩子正在上${this.classInfo.name}课程,快来围观吧!`,
  159. mediaUrl: this.classInfo.resource,
  160. success: function(res) {
  161. console.log("success:" + JSON.stringify(res));
  162. },
  163. fail: function(err) {
  164. console.log("fail:" + JSON.stringify(err));
  165. }
  166. });
  167. },
  168. shareToQQ() {
  169. },
  170. showVideo(index) {
  171. console.log('导航到回放页面');
  172. uni.redirectTo({
  173. url: `/subpkg/video/videopage?info=${index}`
  174. })
  175. },
  176. showLive(index) {
  177. if (index === this.classCurrent - 1) {
  178. uni.$showMsg('当前正在播放此课程')
  179. } else {
  180. this.classInfo = this.classList[index]
  181. }
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. @import '@/subpkg/common/videopage.scss';
  188. </style>