123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- <template>
- <view class="container">
- <view class="conwarp">
- <view class="cl-one"><video id='myVideo' class="vidBox" @timeupdate="timeupdate" @play="play"
- initial-time="0" :src="selInfo.files" controls></video></view>
- <view class="dfsb">
- <view class="gdHead flex1">
- <view class="head">{{ selInfo.title }}</view>
- <view class="subtit dfsb textgrey fontssm flex1">{{ selInfo.desc }}
- <view @click="getSon()" class="promain fontsm dffs">{{showSon?'关闭':"展开更多"}}
- <u-icon class="icondoen" size="12" name='arrow-right-double'></u-icon>
- </view>
- </view>
- </view>
- <view @click.stop="downItem(selInfo)" class="down dffs">
- <u-icon name='download' color="#26565A"></u-icon>
- 下载文档
- </view>
- </view>
- <view v-if="showSon" class="sonlist">
- <video-list flag="5" :list="sonList"></video-list>
- <view v-if="status1 !='nomore'" @click="getmore()" class="promain tips fontsm dffs"> 查看更多 <u-icon class="icon"
- name='arrow-down' size='14'></u-icon>
- </view>
- </view>
- </view>
- <view class="listBox">
- <view @click="selItem(item)" class="bb vidLi dfsb" v-for="(item, ind) in list" :key="ind">
- <view v-if="item.id!=selInfo.id" class="show">
- </view>
- <!-- <image class="imgbox" :src="item.img" mode=""></image> -->
- <view class="imgbox">
- <image :src="item.img" mode=""></image>
- <view class="look">{{ item.fen }} </view>
- </view>
- <view class="dffd flex1">
- <view class="title elli">{{ item.title }}</view>
- <view class="textgrey oneelli fontsm">{{ item.desc }}</view>
- <view class="auth dfsb">
- <text class="fontssm prosecond"> {{ item.is_pay==0?'免费':item.my_is_pay==0?'付费':'已购买' }}</text>
- <view @click.stop="downItem(item)" class="down dffs">
- <u-icon name='download' color="#26565A"></u-icon>
- 下载文档
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="fixBox">
- <view @click="buyTips" v-if="totalInfo.my_is_pay==0" class="clickbtn promain">
- 购买全部视频课程:¥{{totalInfo.is_vip==1?totalInfo.vip_price:totalInfo.price}}
- </view>
- </view>
- <y-modal ref='popup' title="提示" text='您确认付费购买此课程吗' @onConfirm='onConfirm'></y-modal>
- </view>
- </template>
- <script>
- import {
- mixin
- } from './mixin.js'
- import videoList from '@/pages/index/components/wordlist.vue';
- export default {
- components: {
- videoList
- },
- mixins: [mixin],
- data() {
- return {
- cat_id: 0, //二级分类cat_id
- list: [], //返回列表
- selInfo: {}, //选中视频
- totalInfo: {}, //总数居
- page: 1,
- limit: 6,
- status: 'loadmore',
- page1: 1,
- limit1: 6,
- status1: 'loadmore',
- showSon: false,
- sonList: [],
- };
- },
- onPullDownRefresh() {
- this.page = 1;
- this.list = [];
- this.loadData();
- setTimeout(res => {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onReachBottom() {
- if (this.status == 'nomore') return;
- this.status = 'loading';
- this.page = ++this.page;
- this.loadData();
- },
- onLoad(option) {
- this.cat_id = option.cat_id || '';
- this.loadData();
- },
- onReady: function(res) {
- this.videoContext = uni.createVideoContext('myVideo')
- },
- methods: {
- getmore() {
- this.status1 = 'loading';
- this.page1 = ++this.page1;
- this.getsonList();
- },
- // 获取文档
- getSon() {
- if (this.showSon) {
- this.showSon = !this.showSon
- return
- }
- this.showSon = !this.showSon
- this.page1=1;
- this.status1='loading'
- this.sonList=[];
- this.getsonList()
- },
- getsonList() {
- let url = 'new_cate/getVideoFiles';
- this.$api
- .request(url, {
- video_id: this.selInfo.id,
- page: this.page1,
- limit: this.limit1
- })
- .then(data => {
- if (data.code == '200') {
- this.sonList = this.sonList.concat(data.data);
- if (data.data.length < this.limit1) {
- this.status1 = 'nomore';
- }
- } else {
- this.$api.toast(data.msg);
- }
- });
- },
- // 提示购买
- buyTips(item) {
- this.buyId = this.totalInfo.id;
- this.$refs['popup'].open();
- },
- timeupdate(e) {
- console.log(parseInt(e.detail.currentTime));
- // is_pay 0 免费 1 付费 my_is_pay 0 未购买 1 已购买
- if (this.selInfo.is_pay != 0 && this.selInfo.my_is_pay != 1) {
- // is_vip/是否是会员: 0=否 1=是 see_time 可试看时长: 秒
- if (parseInt(e.detail.currentTime) >= parseInt(this.selInfo.see_time)) {
- this.$api.toast('请购买后观看完整视频');
- setTimeout(res => {
- // #ifdef MP-WEIXIN
- this.videoContext.stop();
- // #endif
- // #ifndef MP-WEIXIN
- this.videoContext.pause();
- // #endif
- this.videoContext.seek(0);
- }, 800);
- }
- }
- },
- play(e) {
- let url = 'index/setSee';
- this.$api
- .request(url, {
- id: this.selInfo.id
- })
- .then(res => {
- if (res.code != '200') {
- this.$api.toast(res.msg);
- }
- });
- },
- // 下载
- downItem(item) {
- // "is_pay": 0, //是否免费: 0=是(直接看) 1=付费(没购买的需要判断试看时长停止播放, 购买过得不需要)
- // "my_is_pay": 1 //是否已购买: 0=否 1=是
- if (item.is_pay == 1 && item.my_is_pay == 0) {
- this.$api.toast('请先购买')
- } else {
- uni.navigateTo({
- url: '/pagesA/catList/downlist?video_id=' + item.id
- })
- }
- },
- //选中
- selItem(item) {
- this.showSon = false;
- this.page1 = 1;
- this.sonList = [];
- this.selInfo = item;
- },
- async loadData() {
- let url = 'new_cate/getVideoList';
- this.$api
- .request(url, {
- id: this.cat_id,
- page: this.page,
- limit: this.limit
- })
- .then(res => {
- if (res.code == '200') {
- this.totalInfo = res.data.info;
- if (!this.selInfo.title) {
- this.selInfo = res.data.list[0]
- }
- console.log(!this.selInfo);
- this.list = this.list.concat(res.data.list);
- if (res.data.list.length < this.pagnum) {
- this.status = 'nomore';
- }
- } else {
- this.$api.toast(res.msg);
- }
- });
- },
- //去支付购买
- toPay() {
- uni.navigateTo({
- url: '/pages/pay/payVid?item=' + JSON.stringify(this.selInfo)
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .container {
- padding-bottom: 100rpx;
- .conwarp {
- background-color: #fff;
- padding: 0rpx 30rpx 10rpx;
- border-radius: 16rpx;
- margin-bottom: 20rpx;
- .gdHead {
- line-height: 58rpx;
- margin: 16rpx 0;
- .head {
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 600;
- color: #333333;
- line-height: 48rpx;
- }
- /deep/ .u-icon--right {
- transform: rotate(90deg);
- }
- }
- .cl-one {
- .vidBox {
- margin-top: 30rpx;
- width: 690rpx;
- height: 335rpx;
- }
- }
- }
- .down {
- padding: 0 15rpx;
- // width: 147rpx;
- height: 64rpx;
- text-align: center;
- line-height: 64rpx;
- background: rgba(205, 222, 222, 0.39);
- color: #26565A;
- font-size: 26rpx;
- border-radius: 34rpx;
- }
- .vidLi {
- position: relative;
- width: 100%;
- padding: 27rpx;
- background-color: #fff;
- .show {
- position: absolute;
- width: 100%;
- height: 100%;
- background-color: #000;
- opacity: 0.5;
- z-index: 999;
- }
- &:nth-of-type(2n) {
- margin-right: 0;
- }
- // .imgbox {
- // width: 250rpx;
- // height: 180rpx;
- // }
- .imgbox {
- width: 250rpx;
- height: 180rpx;
- margin-right: 18rpx;
- border-radius: 10rpx;
- position: relative;
- image {
- width: 250rpx;
- height: 180rpx;
- border-radius: 10rpx;
- }
- .look {
- position: absolute;
- bottom: 15rpx;
- right: 19rpx;
- background: rgba(#000, 0.3);
- border-radius: 18rpx;
- font-size: 20rpx;
- line-height: 28rpx;
- padding: 5rpx 14rpx;
- color: #ffffff;
- display: inline-block;
- }
- }
- .title {
- font-size: 28rpx;
- line-height: 40rpx;
- margin-bottom: 12rpx;
- }
- .auth {
- margin-top: 15rpx;
- width: 100%;
- }
- }
- .bgg {
- background: #ececec;
- }
- .clickbtn {
- margin: 0 30rpx;
- background: rgba(205, 222, 222, 0.39);
- }
- .sonlist {
- padding: 10rpx 30rpx;
- .tips{
- padding-top: 20rpx;
- width: 100%;
- justify-content: center;
- }
- }
- }
- </style>
|