| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <view class="w100" style="width: 100%;">
- <view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
- <u-icon name="arrow-left" size="28" @click="tosales" v-if="appToken"></u-icon>
- <view class="header-title" :style="{width:menuButtonLeft + 'px',height:menuButtonH+'px',lineHeight:menuButtonH+'px'}">{{courseInfo.title}}</view>
- </view>
- <view>
- <image class="video-poster" :src="courseInfo.imgUrl" mode="aspectFill">
- <view class="title-content" id="title-content">
- <!-- 答题时展示小节课程名,其他展示课程名 -->
- <!-- 小节课程名 -->
- <view class="subtitlebox " >
- {{courseInfo.title}}
- </view>
- <!-- 课程名字 -->
- <view class="base-color-6 fs24">
- {{courseInfo.courseName}}
- </view>
- </view>
- </view>
- <view class="btns">
- <view class="author-btn" @click="comecourse">进入课程</view>
- </view>
- </view>
- </template>
- <script>
- import {
- getH5CourseByVideoId,
- } from "@/api/courseLook.js"
- export default{
- data(){
- return{
- videoId:3450,
- courseInfo:'',
- projectCode:'',
- sendType:'',
- courselist:{},
- statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
- }
- },
- onLoad(option) {
- console.log(option)
- const keys = decodeURIComponent(Object.keys(option)[0]);
- this.courselist=JSON.parse(keys.split('course=')[1])
- this.videoId=this.courselist.videoId
- this.projectCode=this.courselist.projectCode
- console.log(keys)
- console.log(this.courselist)
- // if(this.videoId){
- // this.getH5CourseByVideo()
- // }
- },
- onShow() {
- this.getHeight()
- this.utils.getDomain({projectCode:this.projectCode}).then(res=>{
- if(res.code == 200) {
- if (this.videoId) {
- this.sendType=uni.getStorageSync('sendType')
- this.getH5CourseByVideo()
- // this.utils.getConfigKey()
- }
- }
- })
- },
- methods:{
- getHeight() {
- this.$nextTick(() => {
- const query = uni.createSelectorQuery().in(this);
- query
- .select("#title-content")
- .boundingClientRect((data) => {
- this.height =
- `calc(100vh - ${data.height}px - 420rpx - ${this.statusBarHeight}px - 120rpx )`
- })
- .exec();
- })
- },
- comecourse(){
- if(this.sendType==1){
- uni.navigateTo({
- url:'/pages_course/videovip?course='+JSON.stringify(this.courselist)
- })
- }else{
-
- }
-
- },
- getH5CourseByVideo() {
- const data={
- videoId:this.videoId
- }
- getH5CourseByVideoId(data).then(res=>{
- if (res.code == 200) {
- this.courseInfo = res.data
- uni.setNavigationBarTitle({
- title: this.courseInfo && this.courseInfo.title ? this.courseInfo.title : ''
- });
- }else{
-
- }
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .header-nav {
- height: 88rpx;
- // @include u-flex(row, center, flex-start);
- display: flex;
- justify-content: center;
- align-items: center;
- overflow: hidden;
- background-color: #fff;
- box-sizing: border-box;
- .header-title {
- text-align: center;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- padding: 0 10rpx 0rpx;
- font-family: PingFang SC,PingFang SC;
- font-weight: 500;
- font-size: 15px;
- color: #000;
- box-sizing: border-box;
- }
- }
- .video-poster{
- width: 100%;
- }
- .title-content{
- padding: 20rpx;
- .subtitlebox{
- font-size: 32rpx;
- font-weight: bold;
- }
- }
- .btns{
- position: fixed;
- padding: 40rpx 20rpx;
- bottom: 0;
- width: calc(100% - 40rpx);
- }
- .author-btn{
- z-index:100;
- width: 100%;
- height: 80rpx;
- background: #ff5c03;
- border-radius: 40rpx;
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: 500;
- text-align: center;
- line-height: 80rpx;
- color: rgba(255, 255, 255, 1);
- }
- </style>
|