video.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <view class="kc_bg">
  3. <view class="header-nav" :style="{height: `calc(44px + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
  4. <image class="back_icon" :src="baseUrl+'/course/images/course_home.png'" mode="aspectFill" @click="goHome()"></image>
  5. </view>
  6. <view class="kc_body" :style="{paddingTop: `calc(44px + ${statusBarHeight}px + 32rpx)`}">
  7. <view class="coursebox-bg" :class="'coursebox-bg'+templateId">
  8. <view class="coursebox" @click="getLink(1)">
  9. <image class="coursebox-img" :src="configJson.coverImg||courseInfo.imgUrl" mode="aspectFill"></image>
  10. <view class="coursebox-title x-ac" :class="'text_clip'+templateId">
  11. <image class="star" :src="baseUrl+'/course/images/course_star.png'"></image>
  12. <view>{{courseInfo.title}}</view>
  13. <image class="star" :src="baseUrl+'/course/images/course_star.png'" style="transform: scaleX(-1);"></image>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="btn" :class="'btn'+templateId" @click="getLink(1)">点击开始观看</view>
  18. <view class="title" :class="'title'+templateId">{{title}}</view>
  19. <view class="desc-box line" :class="'desc-box'+templateId+' line'+templateId" v-if="configJson.complaintPhone">监督投诉电话:{{configJson.complaintPhone}}</view>
  20. <view class="desc-box x-baseline mt40" :class="'desc-box'+templateId" v-if="configJson.tvEnable" @click="showImg(configJson.tvImg)">
  21. <view class="label-dot"></view>
  22. <text class="label">首播电视台:</text>
  23. <view v-if="configJson.tv">
  24. <view v-for="(it,index) in configJson.tv.split(',')">{{it}}</view>
  25. </view>
  26. </view>
  27. <view class="desc-box x-baseline mt20" :class="'desc-box'+templateId" v-if="configJson.unitEnable" @click="showImg(configJson.unitImg)">
  28. <view class="label-dot"></view>
  29. <text class="label">制作单位:</text>
  30. <view v-if="configJson.unit">
  31. <view v-for="(it,index) in configJson.unit.split(',')">{{it}}</view>
  32. </view>
  33. </view>
  34. <view class="desc-box x-baseline mt20" :class="'desc-box'+templateId" v-if="configJson.networkEnable" @click="showImg(configJson.networkImg)">
  35. <view class="label-dot"></view>
  36. <text class="label">网络播放平台:</text>
  37. <view v-if="configJson.network">
  38. <view v-for="(it,index) in configJson.network.split(',')">{{it}}</view>
  39. </view>
  40. </view>
  41. <view class="desc-box x-baseline mt20" :class="'desc-box'+templateId" v-if="configJson.compereEnable">
  42. <view class="label-dot"></view>
  43. <text class="label">主讲人姓名:</text>
  44. <view v-if="configJson.compere">
  45. <view v-for="(it,index) in configJson.compere.split(',')">{{it}}</view>
  46. </view>
  47. </view>
  48. <view class="desc-box x-baseline mt20" :class="'desc-box'+templateId" v-if="configJson.compereTitleEnable" @click="showImg(configJson.compereTitleImg)">
  49. <view class="label-dot"></view>
  50. <text class="label">主讲人名头:</text>
  51. <view v-if="configJson.compereTitle">
  52. <view>{{configJson.compereTitle}}</view>
  53. </view>
  54. </view>
  55. </view>
  56. <yk-screenRecord></yk-screenRecord>
  57. </view>
  58. </template>
  59. <script>
  60. import ykScreenRecord from '@/components/yk-screenRecord/yk-screenRecord';
  61. import {getRealLink,getH5CourseByVideoId} from "@/api/courseAuto.js"
  62. export default {
  63. components: {
  64. ykScreenRecord
  65. },
  66. data() {
  67. return {
  68. templateId:1,
  69. baseUrl:getApp().globalData.courseImg,
  70. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  71. title:'<<以下资料已审核>>',
  72. urlOption: {},
  73. videoId: '',
  74. courseInfo: {},
  75. loading: false,
  76. configJson: {
  77. broadcasting: '',
  78. coverImg: "",
  79. network: '',
  80. compereTitle: '',
  81. compere: '',
  82. tv: '',
  83. unit: '',
  84. complaintPhone:''
  85. },
  86. isshowImg: 0
  87. }
  88. },
  89. onLoad(option) {
  90. if (!option.course) {
  91. const keys = decodeURIComponent(Object.keys(option)[0]);
  92. this.urlOption = JSON.parse(keys.split('course=')[1])
  93. } else {
  94. this.urlOption = option.course ? JSON.parse(decodeURIComponent(option.course)) : {}
  95. }
  96. console.log("this.urlOption==",this.urlOption,option)
  97. this.videoId = this.urlOption.videoId || ''
  98. this.sortLink = this.urlOption.link || ''
  99. if (this.videoId) {
  100. this.getH5CourseByVideo()
  101. }
  102. },
  103. onShow() {
  104. if(this.isshowImg==1) return
  105. if(this.sortLink){
  106. this.getLink()
  107. } else {
  108. uni.showToast({
  109. title: '链接地址有误',
  110. icon: 'none'
  111. });
  112. }
  113. },
  114. methods: {
  115. showImg(img) {
  116. //预览图片
  117. this.isshowImg = 1
  118. uni.previewImage({
  119. urls: [img],
  120. current: 0
  121. });
  122. },
  123. goHome() {
  124. uni.switchTab({
  125. url: '/pages/index/index'
  126. })
  127. },
  128. getH5CourseByVideo() {
  129. uni.showLoading({
  130. title: '加载中'
  131. })
  132. getH5CourseByVideoId({
  133. videoId: this.videoId
  134. }).then(res => {
  135. this.courseInfo = res.data || {}
  136. this.configJson = res.data&&res.data.configJson ? JSON.parse(res.data.configJson) : {};
  137. console.log(this.configJson)
  138. uni.hideLoading()
  139. }).catch(() => {
  140. uni.hideLoading()
  141. })
  142. },
  143. getLink(type) {
  144. let that = this;
  145. if(this.loading) {
  146. return
  147. }
  148. this.isshowImg = type==1?0:this.isshowImg
  149. uni.showLoading({
  150. title: '加载中'
  151. })
  152. this.loading = true
  153. getRealLink({sortLink:this.sortLink}).then(res=>{
  154. uni.hideLoading()
  155. this.loading = false
  156. if(res.code == 200) {
  157. if(type==1) {
  158. uni.navigateTo({
  159. url: '/pages_course/videoDetail?course='+ JSON.stringify(this.urlOption)
  160. })
  161. }
  162. } else {
  163. uni.hideLoading()
  164. uni.showToast({
  165. title: '课程已过期或链接无效',
  166. icon: 'none'
  167. });
  168. }
  169. }).catch(err=>{
  170. uni.hideLoading()
  171. this.loading = false
  172. uni.showToast({
  173. title: '发生错误,请稍后再试',
  174. icon: 'none'
  175. });
  176. })
  177. },
  178. }
  179. }
  180. </script>
  181. <style scoped lang="scss">
  182. .mt20 {
  183. margin-top: 20rpx;
  184. }
  185. .mt40 {
  186. margin-top: 40rpx;
  187. }
  188. .kc_bg {
  189. min-height: 100vh;
  190. background-image: url('https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com/course/images/kc_bg.png');
  191. background-size: 100%;
  192. background-color: #fff;
  193. }
  194. .header-nav {
  195. display: flex;
  196. align-items: center;
  197. position: fixed;
  198. top: 0;
  199. left: 0;
  200. width: 100%;
  201. box-sizing: border-box;
  202. background-image: url('https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com/course/images/kc_bg.png');
  203. background-repeat: no-repeat;
  204. background-size: 100%;
  205. background-position: top;
  206. overflow: hidden;
  207. background-color: #fff;
  208. z-index: 9999;
  209. }
  210. .back_icon {
  211. height: 70rpx;
  212. width: 70rpx;
  213. padding-left: 28rpx;
  214. }
  215. .kc_body {
  216. padding:36rpx 36rpx 120rpx 36rpx;
  217. display: flex;
  218. flex-direction: column;
  219. align-items: center;
  220. .title {
  221. font-family: Source Han Sans CN;
  222. font-weight: 500;
  223. font-size: 38rpx;
  224. color: #FFFFFF;
  225. padding: 10rpx 60rpx;
  226. border-radius: 4rpx;
  227. display: inline-block;
  228. margin-top: 54rpx;
  229. }
  230. .line {
  231. padding: 42rpx 0 27rpx 0;
  232. text-align: center;
  233. }
  234. .x-baseline {
  235. display: flex;
  236. align-items: baseline;
  237. }
  238. .desc-box {
  239. width: 100%;
  240. font-family: PingFang;
  241. font-weight: bold;
  242. font-size: 29rpx;
  243. .label {
  244. flex-shrink: 0;
  245. }
  246. .label-dot {
  247. width: 16rpx;
  248. height: 16rpx;
  249. border-radius: 50%;
  250. margin: 0 6rpx;
  251. }
  252. }
  253. .coursebox-bg {
  254. position: relative;
  255. padding: 4rpx;
  256. border-radius: 29rpx;
  257. overflow: hidden;
  258. }
  259. .coursebox {
  260. position: relative;
  261. z-index: 2;
  262. background: #FFFFFF;
  263. border-radius: 29rpx;
  264. padding: 20rpx 20rpx 0 20rpx;
  265. display: flex;
  266. flex-direction: column;
  267. align-items: center;
  268. &-img {
  269. height: 362rpx;
  270. width: 633rpx;
  271. border-radius: 16rpx;
  272. }
  273. &-title {
  274. text-align: center;
  275. margin: 40rpx 0;
  276. font-family: Source Han Sans CN;
  277. font-weight: bold;
  278. font-size: 45rpx;
  279. line-height: 51rpx;
  280. }
  281. .star {
  282. flex-shrink: 0;
  283. height: 48rpx;
  284. width: 48rpx;
  285. margin: 0 15rpx;
  286. }
  287. }
  288. .name {
  289. margin-top: 28rpx;
  290. font-weight: bold;
  291. font-size: 36rpx;
  292. color: #9B6B2F;
  293. line-height: 40rpx;
  294. image {
  295. height: 44rpx;
  296. width: 44rpx;
  297. margin-right: 10rpx;
  298. }
  299. }
  300. .btn {
  301. width: 660rpx;
  302. height: 81rpx;
  303. margin-top: 55rpx;
  304. border-radius: 40rpx;
  305. font-family: Source Han Sans CN;
  306. font-weight: 500;
  307. font-size: 42rpx;
  308. color: #FFFFFF;
  309. display: flex;
  310. align-items: center;
  311. justify-content: center;
  312. will-change: transform;
  313. animation: scaleAnimation 1s ease infinite;
  314. }
  315. }
  316. $themes: (
  317. 1: (light: #6AB99E, main: #409076, color1: #DCF2E0, color2: #94BFA9, shadow:rgba(68, 148, 121, 0.29)),
  318. );
  319. @mixin text-gradient($c1, $c2) {
  320. color: $c1;
  321. background: linear-gradient(to right, $c1 0%, $c2 52%, $c1 98%);
  322. -webkit-background-clip: text;
  323. -webkit-text-fill-color: transparent;
  324. }
  325. @mixin radial-btn($c1, $c2) {
  326. background: radial-gradient(circle at center, $c1 0%, $c2 100%);
  327. }
  328. @mixin card-box($main, $color1, $color2,$shadow) {
  329. background: linear-gradient(to bottom, $color1 0%, $color2 52%, $shadow 98%);
  330. box-shadow: 0rpx 4rpx 17rpx 0rpx $shadow;
  331. }
  332. /* ===== 3. 一次性生成 6 套皮肤 ===== */
  333. @each $key, $map in $themes {
  334. .title#{$key} {
  335. @include radial-btn(map-get($map, light), map-get($map, main));
  336. }
  337. .line#{$key} {
  338. border-bottom: 1rpx solid map-get($map, main);
  339. }
  340. .desc-box#{$key}, .text_clip#{$key} {
  341. @include text-gradient(map-get($map, main), map-get($map, light));
  342. .label-dot { background: map-get($map, main); }
  343. }
  344. .coursebox-bg#{$key} {
  345. @include card-box(map-get($map, main), map-get($map, color1), map-get($map, color2),map-get($map, shadow));
  346. }
  347. .btn#{$key} {
  348. @include radial-btn(map-get($map, light), map-get($map, main));
  349. }
  350. }
  351. @keyframes scaleAnimation {
  352. 0% {
  353. transform: scale(1);
  354. }
  355. 50% {
  356. transform: scale(0.9);
  357. }
  358. 100% {
  359. transform: scale(1);
  360. }
  361. }
  362. </style>