|
|
@@ -1,6 +1,5 @@
|
|
|
<template>
|
|
|
<view class="push" :style="'width: 100%;height: '+boxHeight+'px;flex:1;'">
|
|
|
- <!-- <view id="navbar"> -->
|
|
|
<u-navbar :height="'146rpx'" :titleStyle="{width: '100%'}" bgColor="transparent" :autoBack="false"
|
|
|
:placeholder="false" :safeAreaInsetTop="true">
|
|
|
<view slot="left" @click="goBack()">
|
|
|
@@ -21,43 +20,48 @@
|
|
|
:text="$tt('暂无数据')">
|
|
|
</u-empty>
|
|
|
</view>
|
|
|
- <swiper class="swiper" :style="'width: '+boxWidth+'px;height: '+boxHeight+'px;flex:1;'" :vertical="true"
|
|
|
- @change="changeplay" @touchstart="touchStart" @touchend="touchEnd">
|
|
|
- <swiper-item class="swiper-item-box" v-for="(item,index) in videoList" :key="'v'+item.id"
|
|
|
+ <swiper v-else class="swiper" :style="'width: '+boxWidth+'px;height: '+boxHeight+'px;flex:1;'" :vertical="true"
|
|
|
+ @change="changeplay">
|
|
|
+ <swiper-item :id="'swiper-'+item.id" class="swiper-item-box" v-for="(item,index) in videoList" :key="index"
|
|
|
:style="'width: '+boxWidth+'px;height: '+boxHeight+'px;flex:1;'">
|
|
|
- <view class="swiper-item" :style="'width: '+boxWidth+'px;flesx:1;'">
|
|
|
-
|
|
|
- <view class="album-swiper" v-if="videoInfo.type==2"
|
|
|
+ <view class="swiper-item" :style="'width: '+boxWidth+'px;flex:1;'">
|
|
|
+ <view class="album-swiper" v-if="item.type==2"
|
|
|
:style="'width: '+boxWidth+'px;height: '+boxHeight+'px;flex:1;'">
|
|
|
- <u-swiper class="albumPlayer" :list="videoInfo.albums" keyName="url" :autoplay="true" circular
|
|
|
- bgColor="#303030" :height="boxHeight"
|
|
|
- :style="'width: '+boxWidth+'px;height: '+boxHeight+'px;flex:1;'"></u-swiper>
|
|
|
+ <u-swiper class="albumPlayer" :list="item.albums" keyName="url" :autoplay="true" circular
|
|
|
+ bgColor="#303030" :height="boxHeight" indicatorMode="dot" :indicator="true"
|
|
|
+ :indicatorStyle="{bottom: '120px'}"
|
|
|
+ :style="'width: '+boxWidth+'px;height: '+boxHeight+'px;flex:2;'"></u-swiper>
|
|
|
+ </view>
|
|
|
+ <view class="video-box" v-else :style="'width: '+boxWidth+'px;height: '+boxHeight+'px;'">
|
|
|
+ <video :id="'video-'+index" class="video" :src="item.file_url" :loop="true"
|
|
|
+ :autoplay="page==index?true:false" :controls="false" @click="changeClick" :muted="false"
|
|
|
+ :style="'width: '+boxWidth+'px;height: '+boxHeight+'px;flex:1;'" object-fit="cover"></video>
|
|
|
</view>
|
|
|
- <videoPlay v-else @changeClick='changeClick' ref="player" :video="videoInfo" :index="index"
|
|
|
- :width="boxWidth" :height="boxHeight" :objectFit="'cover'">
|
|
|
- </videoPlay>
|
|
|
+ <!-- <videoPlay v-else @changeClick='changeClick' ref="player" :video="item" :index="index"
|
|
|
+ :width="boxWidth" :height="(boxHeight-120)" :objectFit="'cover'">
|
|
|
+ </videoPlay> -->
|
|
|
|
|
|
- <view class="video-box" :style="'width: '+boxWidth+'px;'" v-show="showInfo">
|
|
|
+ <view class="video-box" :style="'width: '+boxWidth+'px;'" v-if="page==index">
|
|
|
<view :class="'video-info-box video-info-'+device" :style="'width: '+boxWidth+'px;'">
|
|
|
<view class="video-info-nicknl
|
|
|
lme">
|
|
|
- <view class="is-live" v-if="videoInfo.live_id>0">
|
|
|
+ <view class="is-live" v-if="item.live_id>0">
|
|
|
<image class="is-live-icon" src="../../static/icons/user/icon-live-player.png"
|
|
|
mode="aspectFill"></image>
|
|
|
<text class="is-live-text">{{$tt('直播中')}}</text>
|
|
|
</view>
|
|
|
<text class="follow-type"
|
|
|
- v-if="videoInfo.is_follow==1 && videoInfo.is_fans==1">{{$tt('你的朋友')}}</text>
|
|
|
- <text class="follow-type" v-else-if="videoInfo.is_fans==1">{{$tt('你的粉丝')}}</text>
|
|
|
- <text class="follow-type" v-else-if="videoInfo.is_follow==1">{{$tt('你的关注')}}</text>
|
|
|
- <text class="nickname-text">@{{videoInfo.member.nickname}}</text>
|
|
|
+ v-if="item.is_follow==1 && item.is_fans==1">{{$tt('你的朋友')}}</text>
|
|
|
+ <text class="follow-type" v-else-if="item.is_fans==1">{{$tt('你的粉丝')}}</text>
|
|
|
+ <text class="follow-type" v-else-if="item.is_follow==1">{{$tt('你的关注')}}</text>
|
|
|
+ <text class="nickname-text">@{{item.member.nickname}}</text>
|
|
|
</view>
|
|
|
<view class="video-info">
|
|
|
<view class="desc">
|
|
|
- <text class="desc-text">{{videoInfo.description}}</text>
|
|
|
+ <text class="desc-text">{{item.description}}</text>
|
|
|
</view>
|
|
|
- <view class="tags" v-if="videoInfo.tags">
|
|
|
- <text class="tag" v-for="(vv,kk) in videoInfo.tags" :key="kk">#{{vv}}</text>
|
|
|
+ <view class="tags" v-if="item.tags">
|
|
|
+ <text class="tag" v-for="(vv,kk) in item.tags" :key="kk">#{{vv}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -65,59 +69,58 @@
|
|
|
<view class="video-menus">
|
|
|
<view class="menu-item video-author">
|
|
|
<view class="author-avatar">
|
|
|
- <image v-if="videoInfo.live_id>0" class="author-avatar-image live-image"
|
|
|
- @click="gotoPage('/pages/live/index?id='+videoInfo.live_id)"
|
|
|
- :src="videoInfo.member.avatar" mode="aspectFill">
|
|
|
+ <image v-if="item.live_id>0" class="author-avatar-image live-image"
|
|
|
+ @click="gotoPage('/pages/live/index?id='+item.live_id)"
|
|
|
+ :src="item.member.avatar" mode="aspectFill">
|
|
|
<image v-else class="author-avatar-image"
|
|
|
- @click="gotoPage('/pages/user/home?id='+videoInfo.user_id)"
|
|
|
- :src="videoInfo.member.avatar" mode="aspectFill">
|
|
|
+ @click="gotoPage('/pages/user/home?id='+item.user_id)"
|
|
|
+ :src="item.member.avatar" mode="aspectFill">
|
|
|
</image>
|
|
|
|
|
|
<view
|
|
|
- v-if="!videoInfo.is_publisher && (videoInfo.is_follow != 1 || (videoInfo.is_follow == 1 && videoInfo.is_fans==1))"
|
|
|
- :class="'follow-user'+(videoInfo.is_follow == 1 && videoInfo.is_fans==1?' followed-user':'')">
|
|
|
- <image v-if="videoInfo.is_follow == 1 && videoInfo.is_fans==1"
|
|
|
+ v-if="!item.is_publisher && (item.is_follow != 1 || (item.is_follow == 1 && item.is_fans==1))"
|
|
|
+ :class="'follow-user'+(item.is_follow == 1 && item.is_fans==1?' followed-user':'')">
|
|
|
+ <image v-if="item.is_follow == 1 && item.is_fans==1"
|
|
|
class="follow-user-image followed"
|
|
|
src="../../static/icons/user/follow.-back.png" mode="aspectFill">
|
|
|
</image>
|
|
|
- <image v-else-if="videoInfo.is_follow != 1"
|
|
|
- @click="follow(index, videoInfo)" class="follow-user-image no-follow"
|
|
|
+ <image v-else-if="item.is_follow != 1" @click="follow(index, item)"
|
|
|
+ class="follow-user-image no-follow"
|
|
|
src="../../static/icons/user/add.png" mode="aspectFill">
|
|
|
</image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="menu-item video-like">
|
|
|
- <image v-if="videoInfo.is_like!=1" class="menu-icon like-image"
|
|
|
- @click="like(index,videoInfo)" src="../../static/icons/user/follow.png"
|
|
|
- mode="aspectFill">
|
|
|
+ <image v-if="item.is_like!=1" class="menu-icon like-image" @click="like(index,item)"
|
|
|
+ src="../../static/icons/user/follow.png" mode="aspectFill">
|
|
|
</image>
|
|
|
- <image v-else class="menu-icon like-image checked" @click="like(index,videoInfo)"
|
|
|
+ <image v-else class="menu-icon like-image checked" @click="like(index,item)"
|
|
|
src="../../static/icons/user/follow-active.png" mode="aspectFill">
|
|
|
</image>
|
|
|
- <text class="icon-text">{{getNumText(videoInfo.like_num)||0}}</text>
|
|
|
+ <text class="icon-text">{{getNumText(item.like_num)||0}}</text>
|
|
|
</view>
|
|
|
<view class="menu-item video-comment">
|
|
|
<image class="menu-icon comment-image" @click="showCommentPopup"
|
|
|
src="../../static/icons/user/comment.png" mode="aspectFill">
|
|
|
</image>
|
|
|
- <text class="icon-text">{{getNumText(videoInfo.comment_num)||'0'}}</text>
|
|
|
+ <text class="icon-text">{{getNumText(item.comment_num)||'0'}}</text>
|
|
|
</view>
|
|
|
<view class="menu-item video-collect">
|
|
|
- <image v-if="videoInfo.is_collect!=1" class="menu-icon collect-image"
|
|
|
- @click="collect(index,videoInfo)" src="../../static/icons/user/collect.png"
|
|
|
+ <image v-if="item.is_collect!=1" class="menu-icon collect-image"
|
|
|
+ @click="collect(index,item)" src="../../static/icons/user/collect.png"
|
|
|
mode="aspectFill">
|
|
|
</image>
|
|
|
- <image v-else class="menu-icon collect-image checked" @click="collect(index,videoInfo)"
|
|
|
+ <image v-else class="menu-icon collect-image checked" @click="collect(index,item)"
|
|
|
src="../../static/icons/user/collect-active.png" mode="aspectFill">
|
|
|
</image>
|
|
|
- <text class="icon-text">{{getNumText(videoInfo.collect_num)||0}}</text>
|
|
|
+ <text class="icon-text">{{getNumText(item.collect_num)||0}}</text>
|
|
|
</view>
|
|
|
|
|
|
<view class="video-music" @click="playerMusic">
|
|
|
<image :class="'music-pic' + (playMusic?' rotate':'')+(device=='h5'?' music-pic-h5':'')"
|
|
|
- :src="videoInfo.music_pic?videoInfo.music_pic:videoInfo.member.avatar"
|
|
|
- mode="aspectFill" :style="musicStyle"></image>
|
|
|
+ :src="item.music_pic?item.music_pic:item.member.avatar" mode="aspectFill"
|
|
|
+ :style="musicStyle"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -125,25 +128,32 @@
|
|
|
</swiper-item>
|
|
|
</swiper>
|
|
|
|
|
|
- <u-loading-icon class="loading" :show="loading" size="48" color="#14ECCC"
|
|
|
- custom-style="position:absolute; top: 40%;z-index: 99;left:0;right:0;margin: 0 auto;">
|
|
|
+ <!-- 评论 -->
|
|
|
+ <comment v-if="showComment" :show="showComment" :id="videoInfo.id" :videoIndex="page"
|
|
|
+ :liveUserId="videoInfo.user_id"></comment>
|
|
|
+
|
|
|
+ <u-loading-icon class="loading" :show="loading" size="80" color="#14ECCC"
|
|
|
+ custom-style="position:absolute; top: 360rpx;z-index: 10099;left:0;right:0;margin: 0 auto;">
|
|
|
</u-loading-icon>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import videoPlay from '../video/videoPlay.vue'
|
|
|
+ import comment from '../video/comment.vue'
|
|
|
import request from '../../config/request.js'
|
|
|
let app = getApp().globalData;
|
|
|
export default {
|
|
|
- name: "play",
|
|
|
+ name: "push",
|
|
|
components: {
|
|
|
- videoPlay
|
|
|
+ videoPlay,
|
|
|
+ comment
|
|
|
},
|
|
|
- props: ['id'],
|
|
|
+ props: ['id', 'type'],
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
+ loaded: false,
|
|
|
device: 'android',
|
|
|
boxHeight: 800,
|
|
|
boxWidth: 360,
|
|
|
@@ -158,20 +168,24 @@
|
|
|
musicStyle: 'transform: rotate(0deg);',
|
|
|
playMusic: true,
|
|
|
showInfo: true,
|
|
|
+ showComment: false,
|
|
|
videoList: [],
|
|
|
params: {
|
|
|
+ id: 0,
|
|
|
page: 1,
|
|
|
- uid: 0,
|
|
|
- pageSize: 20,
|
|
|
+ pageSize: 30,
|
|
|
},
|
|
|
pageStatrY: 0,
|
|
|
pageEndY: 0,
|
|
|
page: 0,
|
|
|
deg: 0,
|
|
|
timeId: null,
|
|
|
+ videoContext: null,
|
|
|
+ submitting: false,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ let _this = this
|
|
|
const windowInfo = uni.getWindowInfo();
|
|
|
this.boxHeight = windowInfo.windowHeight
|
|
|
this.boxWidth = windowInfo.windowWidth
|
|
|
@@ -179,19 +193,47 @@
|
|
|
// #ifdef H5 || MP-WEIXIN
|
|
|
this.device = 'h5'
|
|
|
// #endif
|
|
|
+
|
|
|
this.getVideoInfo();
|
|
|
|
|
|
+ // this.getList()
|
|
|
this.musicAnimation()
|
|
|
if (this.music) {
|
|
|
this.music.destroy();
|
|
|
}
|
|
|
+
|
|
|
+ uni.$on('close-comment', function() {
|
|
|
+ console.log('关闭')
|
|
|
+ _this.showComment = false
|
|
|
+ })
|
|
|
+
|
|
|
+ uni.$on('load.comment_num', function(data) {
|
|
|
+ if (typeof(_this.videoList[data.index]) != 'undefined') {
|
|
|
+ _this.videoList[data.index].comment_num += data.num;
|
|
|
+ _this.videoList[data.index].comment_num = _this.videoList[data.index].comment_num > 0 ? _this
|
|
|
+ .videoList[data.index].comment_num : 0
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onHide() {
|
|
|
+ if (this.page >= 0) {
|
|
|
+ uni.createVideoContext('video-' + this.page, this).pause();
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
$tt(text, arr = {}) {
|
|
|
return app.$t(text, arr);
|
|
|
},
|
|
|
goBack() {
|
|
|
- uni.navigateBack();
|
|
|
+ if (this.type == 2) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateBack();
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
playerMusic() {
|
|
|
if (this.playMusic) {
|
|
|
@@ -199,15 +241,15 @@
|
|
|
console.log(this.videoInfo)
|
|
|
clearInterval(this.musicTimerId)
|
|
|
if (this.videoInfo.type == 1) {
|
|
|
- this.$refs.player[this.page].pause()
|
|
|
- this.$refs.player[this.page].muted = true
|
|
|
+ uni.createVideoContext('video-' + this.page, this).pause();
|
|
|
} else {
|
|
|
this.music.pause();
|
|
|
}
|
|
|
} else {
|
|
|
this.playMusic = true
|
|
|
if (this.videoInfo.type == 1) {
|
|
|
- this.$refs.player[this.page].player()
|
|
|
+ uni.createVideoContext('video-' + this.page, this).seek(0);
|
|
|
+ uni.createVideoContext('video-' + this.page, this).play();
|
|
|
} else {
|
|
|
this.music.play();
|
|
|
}
|
|
|
@@ -223,21 +265,26 @@
|
|
|
getNumText(num) {
|
|
|
return num > 10000 ? (num / 10000).toFixed(1) + 'w' : num;
|
|
|
},
|
|
|
+ showCommentPopup() {
|
|
|
+ this.showComment = true
|
|
|
+ uni.$emit('show-comment', true)
|
|
|
+ },
|
|
|
changeClick(e) {
|
|
|
+ console.log(uni.createVideoContext('video-' + this.page, this))
|
|
|
if (!e) {
|
|
|
this.playMusic = false
|
|
|
console.log(this.videoInfo)
|
|
|
clearInterval(this.musicTimerId)
|
|
|
if (this.videoInfo.type == 1) {
|
|
|
- this.$refs.player[this.page].muted = false
|
|
|
- this.$refs.player[this.page].pause()
|
|
|
+
|
|
|
+ uni.createVideoContext('video-' + this.page, this).pause();
|
|
|
} else {
|
|
|
this.music.pause();
|
|
|
}
|
|
|
} else {
|
|
|
this.playMusic = true
|
|
|
if (this.videoInfo.type == 1) {
|
|
|
- this.$refs.player[this.page].player()
|
|
|
+ uni.createVideoContext('video-' + this.page, this).play();
|
|
|
} else {
|
|
|
this.music.play();
|
|
|
}
|
|
|
@@ -251,84 +298,46 @@
|
|
|
if (this.music) {
|
|
|
this.music.destroy();
|
|
|
}
|
|
|
+ let scrollType = res.detail.current > this.page ? 1 : 0
|
|
|
this.page = res.detail.current
|
|
|
- this.$forceUpdate()
|
|
|
-
|
|
|
- this.showInfo = false
|
|
|
- this.timeId = setTimeout(() => {
|
|
|
- let videoInfo = this.videoList[this.page]
|
|
|
- if (this.pageStatrY < this.pageEndY) {
|
|
|
- if (videoInfo.type == 2) {
|
|
|
- if (videoInfo.music_url) {
|
|
|
- _this.music = uni.createInnerAudioContext();
|
|
|
- _this.music.autoplay = true
|
|
|
- _this.music.loop = true
|
|
|
- _this.music.src = videoInfo.music_url;
|
|
|
- _this.music.play()
|
|
|
- }
|
|
|
- } else {
|
|
|
- let lastPlayer = typeof(this.$refs.player[this.page + 1]) != 'undefined' ? this.$refs
|
|
|
- .player[this.page + 1] : null;
|
|
|
- let player = typeof(this.$refs.player[this.page]) != 'undefined' ? this.$refs.player[
|
|
|
- this.page] : null;
|
|
|
-
|
|
|
- if (lastPlayer) {
|
|
|
- lastPlayer.muted = true
|
|
|
- lastPlayer.pause()
|
|
|
- }
|
|
|
- if (player) {
|
|
|
- player.player()
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ this.videoContext = uni.createVideoContext('video-' + this.page, this)
|
|
|
+ for (let i = 0; i < this.videoList.length; i++) {
|
|
|
+ if (i != this.page) {
|
|
|
+ this.videoList[i].play = false
|
|
|
+ uni.createVideoContext('video-' + i, _this).pause();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- console.log('向上滑动')
|
|
|
- // setTimeout(() => {
|
|
|
- // this.$refs.player[this.page].play()
|
|
|
- // }, 10)
|
|
|
- this.pageStatrY = 0
|
|
|
- this.pageEndY = 0
|
|
|
- } else {
|
|
|
- console.log('向下滑动')
|
|
|
- if (videoInfo.type == 2) {
|
|
|
- if (videoInfo.music_url) {
|
|
|
- _this.music = uni.createInnerAudioContext();
|
|
|
- _this.music.src = videoInfo.music_url;
|
|
|
- _this.music.autoplay = true
|
|
|
- _this.music.loop = true
|
|
|
- _this.music.play()
|
|
|
- }
|
|
|
- } else {
|
|
|
- let lastPlayer = typeof(this.$refs.player[this.page - 1]) != 'undefined' ? this.$refs
|
|
|
- .player[this.page - 1] : null;
|
|
|
- let player = typeof(this.$refs.player[this.page]) != 'undefined' ? this.$refs.player[
|
|
|
- this.page] : null;
|
|
|
- if (lastPlayer) {
|
|
|
- lastPlayer.muted = true
|
|
|
- lastPlayer.pause()
|
|
|
- }
|
|
|
- if (player) {
|
|
|
- player.player()
|
|
|
- }
|
|
|
+ setTimeout(function() {
|
|
|
+ let videoInfo = _this.videoList[_this.page]
|
|
|
+ _this.videoList[_this.page].play = true
|
|
|
+ _this.videoContext.seek(0)
|
|
|
+ _this.videoContext.play()
|
|
|
+ if (videoInfo.type == 2) {
|
|
|
+ if (videoInfo.music_url) {
|
|
|
+ _this.music = uni.createInnerAudioContext();
|
|
|
+ _this.music.autoplay = true
|
|
|
+ _this.music.loop = true
|
|
|
+ _this.music.src = videoInfo.music_url;
|
|
|
+ _this.music.play()
|
|
|
}
|
|
|
-
|
|
|
- // setTimeout(() => {
|
|
|
- // this.$refs.player[this.page].play()
|
|
|
- // }, 10)
|
|
|
-
|
|
|
- this.pageStatrY = 0
|
|
|
- this.pageEndY = 0
|
|
|
}
|
|
|
- _this.deg = 0
|
|
|
+
|
|
|
_this.videoInfo = videoInfo
|
|
|
_this.musicAnimation()
|
|
|
- }, 1)
|
|
|
-
|
|
|
- setTimeout(function() {
|
|
|
- _this.showInfo = true
|
|
|
-
|
|
|
+ _this.updatePlay(_this.page, _this.videoInfo)
|
|
|
}, 5)
|
|
|
},
|
|
|
+ // 播放浏览数据更新
|
|
|
+ async updatePlay(index, video) {
|
|
|
+ console.log('更新浏览')
|
|
|
+ const res = request.api('/video/play', {
|
|
|
+ id: video.id
|
|
|
+ });
|
|
|
+ if (res.success = true) {
|
|
|
+ this.videoList[index].views += 1;
|
|
|
+ }
|
|
|
+ },
|
|
|
// 图标动画
|
|
|
musicAnimation() {
|
|
|
let _this = this
|
|
|
@@ -377,7 +386,6 @@
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
// 列表
|
|
|
async getList() {
|
|
|
@@ -391,6 +399,9 @@
|
|
|
},
|
|
|
// 关注
|
|
|
async follow(index, row) {
|
|
|
+ if (this.loading) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
this.loading = true;
|
|
|
const res = await request.api('/user/follow', {
|
|
|
id: row.user_id,
|
|
|
@@ -418,6 +429,9 @@
|
|
|
},
|
|
|
// 点赞
|
|
|
async like(index, row) {
|
|
|
+ if (this.loading) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
this.loading = true;
|
|
|
const res = await request.api('/video/like', {
|
|
|
id: row.id,
|
|
|
@@ -426,14 +440,36 @@
|
|
|
})
|
|
|
this.loading = false;
|
|
|
if (res.success == true) {
|
|
|
- if (this.videoInfo.is_like == 1) {
|
|
|
- this.videoList[index].like_num -= 1;
|
|
|
+ if (row.is_like == 1) {
|
|
|
+ this.videoList[index].is_like = this.videoList[index].is_like == 1 ? 2 : 1;
|
|
|
+ this.videoList[index].like_num = row.like_num - 1 > 0 ? row.like_num - 1 : 0;
|
|
|
} else {
|
|
|
- this.videoList[index].like_num += 1;
|
|
|
+ this.videoList[index].is_like = this.videoList[index].is_like == 1 ? 2 : 1;
|
|
|
+ this.videoList[index].like_num = row.like_num + 1;
|
|
|
+ this.updateTask(res.data)
|
|
|
}
|
|
|
|
|
|
- this.videoList[index].is_like = this.videoList[index].is_like == 1 ? 2 : 1;
|
|
|
+
|
|
|
this.$forceUpdate()
|
|
|
+ } else if (res.code == 403) {
|
|
|
+ uni.showModal({
|
|
|
+ title: this.$tt('操作提示'),
|
|
|
+ content: this.$tt('请先登录账号后使用'),
|
|
|
+ cancelText: this.$tt('暂不登录'),
|
|
|
+ confirmText: this.$tt('立即登录'),
|
|
|
+ confirmColor: '#14ECCC',
|
|
|
+ success: function(result) {
|
|
|
+ if (result.confirm) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: this.$tt(res.msg),
|
|
|
@@ -441,8 +477,15 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ // 任务检测
|
|
|
+ async updateTask(params) {
|
|
|
+ const res = await request.api('/task/check', params)
|
|
|
+ },
|
|
|
// 收藏
|
|
|
async collect(index, row) {
|
|
|
+ if (this.loading) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
this.loading = true;
|
|
|
const res = await request.api('/video/collect', {
|
|
|
id: row.id,
|
|
|
@@ -452,13 +495,35 @@
|
|
|
this.loading = false;
|
|
|
if (res.success == true) {
|
|
|
|
|
|
- if (this.videoInfo.is_collect == 1) {
|
|
|
- this.videoList[index].collect_num -= 1;
|
|
|
+ if (this.videoList[index].is_collect == 1) {
|
|
|
+ this.videoList[index].is_collect = row.is_collect == 1 ? 2 : 1;
|
|
|
+ this.videoList[index].collect_num = row.collect_num - 1 > 0 ? row.collect_num - 1 : 0;
|
|
|
} else {
|
|
|
- this.videoList[index].collect_num += 1;
|
|
|
+ this.videoList[index].is_collect = row.is_collect == 1 ? 2 : 1;
|
|
|
+ this.videoList[index].collect_num = row.collect_num + 1;
|
|
|
+ this.updateTask(res.data)
|
|
|
}
|
|
|
- this.videoList[index].is_collect = this.videoList[index].is_collect == 1 ? 2 : 1;
|
|
|
+
|
|
|
this.$forceUpdate()
|
|
|
+ } else if (res.code == 403) {
|
|
|
+ uni.showModal({
|
|
|
+ title: this.$tt('操作提示'),
|
|
|
+ content: this.$tt('请先登录账号后使用'),
|
|
|
+ cancelText: this.$tt('暂不登录'),
|
|
|
+ confirmText: this.$tt('立即登录'),
|
|
|
+ confirmColor: '#14ECCC',
|
|
|
+ success: function(result) {
|
|
|
+ if (result.confirm) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: this.$tt(res.msg),
|
|
|
@@ -511,12 +576,13 @@
|
|
|
position: fixed;
|
|
|
z-index: 992;
|
|
|
padding: 20rpx 30rpx;
|
|
|
- bottom: 20rpx;
|
|
|
+ bottom: 30px;
|
|
|
+ /* bottom: 200rpx; */
|
|
|
right: 0;
|
|
|
}
|
|
|
|
|
|
.video-info-android {
|
|
|
- bottom: 110rpx;
|
|
|
+ bottom: 130rpx;
|
|
|
}
|
|
|
|
|
|
.video-info-h5 {
|
|
|
@@ -598,7 +664,7 @@
|
|
|
width: 120rpx;
|
|
|
position: fixed;
|
|
|
right: 20rpx;
|
|
|
- bottom: 180rpx;
|
|
|
+ bottom: 40px;
|
|
|
z-index: 993;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|