合并代码
This commit is contained in:
parent
708caca967
commit
b26bd82e07
|
@ -10,7 +10,6 @@ const video = {
|
||||||
homeVideo(param) {
|
homeVideo(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/video/video/list`,
|
url: `/video/video/list`,
|
||||||
// url: `/video/api/queryVideoByPage`,
|
|
||||||
query: param.query,
|
query: param.query,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
|
@ -23,31 +22,6 @@ const video = {
|
||||||
saveVideo(param) {
|
saveVideo(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/video/video/add`,
|
url: `/video/video/add`,
|
||||||
// url: `/video/api/saveVideo`,
|
|
||||||
data: param.data,
|
|
||||||
method: 'POST',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存点赞
|
|
||||||
* @param {Object} param
|
|
||||||
*/
|
|
||||||
saveLikes(param) {
|
|
||||||
return util.request({
|
|
||||||
url: `/video/api/saveLikes`,
|
|
||||||
data: param.data,
|
|
||||||
method: 'POST',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消点赞
|
|
||||||
* @param {Object} param
|
|
||||||
*/
|
|
||||||
cancelLikes(param) {
|
|
||||||
return util.request({
|
|
||||||
url: `/video/api/cancelLikes`,
|
|
||||||
data: param.data,
|
data: param.data,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
|
@ -59,8 +33,8 @@ const video = {
|
||||||
*/
|
*/
|
||||||
videoLike(param) {
|
videoLike(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/home/videoLike`,
|
url: `/video/videolike/like`,
|
||||||
query: param.query,
|
data: param.data,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -84,7 +58,6 @@ const video = {
|
||||||
getLabel(param) {
|
getLabel(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/video/tag/list`,
|
url: `/video/tag/list`,
|
||||||
// url: `/video/api/getTagsByPage`,
|
|
||||||
data: param.data,
|
data: param.data,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
load: true,
|
load: true,
|
||||||
|
@ -275,10 +248,11 @@ const video = {
|
||||||
* 视频评论列表
|
* 视频评论列表
|
||||||
* @param {Object} param
|
* @param {Object} param
|
||||||
*/
|
*/
|
||||||
commentList(param) {
|
getcomment(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/video/api/getCommentsByParams`,
|
url: `/video/comment/getcomment`,
|
||||||
query: param.query,
|
query: param.query,
|
||||||
|
data: param.data,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
// 获取评论列表
|
// 获取评论列表
|
||||||
function getList() {
|
function getList() {
|
||||||
//
|
//
|
||||||
api.video.commentList({
|
api.video.getcomment({
|
||||||
query: {
|
query: {
|
||||||
videoId: detail.id,
|
videoId: detail.id,
|
||||||
pageSize: listProperty.pageSize,
|
pageSize: listProperty.pageSize,
|
||||||
|
|
|
@ -357,13 +357,15 @@
|
||||||
/**
|
/**
|
||||||
* 点赞
|
* 点赞
|
||||||
* @param {Number} index 操作的视频下标
|
* @param {Number} index 操作的视频下标
|
||||||
* @param {Number|String} isLike 点赞操作
|
* @param {Number|String} likeType 点赞类型 0.公开赞 1.隐私赞
|
||||||
|
* @param {Number|String} isDelFlag 0.点赞 1.取消点赞
|
||||||
*/
|
*/
|
||||||
function handleLike(index, isLike) {
|
function handleLike(index, likeType, isDelFlag) {
|
||||||
util.isLogin().then(rs => {
|
util.isLogin().then(rs => {
|
||||||
emit('like', {
|
emit('like', {
|
||||||
index,
|
index,
|
||||||
isLike,
|
likeType,
|
||||||
|
isDelFlag,
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -386,11 +388,13 @@
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.confirm) emit('like', {
|
if (rs.confirm) emit('like', {
|
||||||
index,
|
index,
|
||||||
isLike: 2,
|
likeType: 1,
|
||||||
|
isDelFlag: 0,
|
||||||
})
|
})
|
||||||
else emit('like', {
|
else emit('like', {
|
||||||
index,
|
index,
|
||||||
isLike: 1
|
likeType: 2,
|
||||||
|
isDelFlag: 0,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -515,18 +519,21 @@
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="col">
|
<view class="col">
|
||||||
<view class="pr">
|
<view class="pr">
|
||||||
<image class="wh50" src="/static/indexLike.png" mode="aspectFit"
|
<template v-if="item.isLike">
|
||||||
v-if="item.likeStatus == 0" @click="handleLike(index, 1)"
|
<!-- 公开赞 -->
|
||||||
@longpress="handlePrivateLike(index)" />
|
<image class="wh50" src="/static/indexLike1.png" mode="aspectFit"
|
||||||
<!-- 公开赞 -->
|
v-if="item.likeType == 0" @click="handleLike(index,0, 0)" />
|
||||||
<image class="wh50" src="/static/indexLike1.png" mode="aspectFit"
|
<!-- 私密赞的图标 -->
|
||||||
v-else-if="item.likeStatus == 1" @click="handleLike(index, 0)" />
|
<image class="wh50" src="/static/privateLike.png" mode="aspectFit"
|
||||||
<!-- 私密赞的图标 -->
|
v-else-if="item.likeType == 1" @click="handleLike(index,1, 0)" />
|
||||||
<image class="wh50" src="/static/privateLike.png" mode="aspectFit"
|
</template>
|
||||||
v-else-if="item.likeStatus == 2" @click="handleLike(index, 0)" />
|
<template v-else>
|
||||||
|
<image class="wh50" src="/static/indexLike.png" mode="aspectFit"
|
||||||
|
@click="handleLike(index, 0, 0)" @longpress="handlePrivateLike(index)" />
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt mt10">
|
<view class="txt mt10">
|
||||||
<text class="text">{{ item.publicLikeCount }}</text>
|
<text class="text">{{ item.likeCount }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -536,7 +543,7 @@
|
||||||
<view class="col">
|
<view class="col">
|
||||||
<image class="wh50" src="@/static/indexMsg.png" mode="aspectFit" />
|
<image class="wh50" src="@/static/indexMsg.png" mode="aspectFit" />
|
||||||
<view class="txt mt10">
|
<view class="txt mt10">
|
||||||
<text class="text">{{ item.commentCount }}</text>
|
<text class="text">{{ item.reviewCount }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -548,7 +555,7 @@
|
||||||
v-if="item.isCollect" />
|
v-if="item.isCollect" />
|
||||||
<image class="wh50" src="@/static/indexCollect.png" mode="aspectFit" v-else />
|
<image class="wh50" src="@/static/indexCollect.png" mode="aspectFit" v-else />
|
||||||
<view class="txt mt10">
|
<view class="txt mt10">
|
||||||
<text class="text">{{ item.favoriteCount }}</text>
|
<text class="text">{{ item.collectCount }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -182,7 +182,7 @@
|
||||||
// 校验
|
// 校验
|
||||||
if (!item && !item.videoId) return
|
if (!item && !item.videoId) return
|
||||||
const list = tabCurrent.value.listData()
|
const list = tabCurrent.value.listData()
|
||||||
const findIndex = list.findIndex(node => node.videoId == item.videoId)
|
const findIndex = list.findIndex(node => node.id == item.id)
|
||||||
if (findIndex >= 0) list.splice(findIndex, 1, {
|
if (findIndex >= 0) list.splice(findIndex, 1, {
|
||||||
...tabCurrent.value.listData()[findIndex],
|
...tabCurrent.value.listData()[findIndex],
|
||||||
...item,
|
...item,
|
||||||
|
@ -582,33 +582,37 @@
|
||||||
* 视频点赞
|
* 视频点赞
|
||||||
* @param {Object} param 见下
|
* @param {Object} param 见下
|
||||||
* @param {Number} param.index 操作的视频下标
|
* @param {Number} param.index 操作的视频下标
|
||||||
* @param {Number|String} param.isLike 点赞操作
|
* @param {Number|String} param.isDelFlag 0.点赞 1.取消点赞
|
||||||
|
* @param {Number|String} param.likeType 点赞类型 0.公开赞 1.隐私赞
|
||||||
*/
|
*/
|
||||||
function videoLike(param) {
|
function videoLike(param) {
|
||||||
const {
|
|
||||||
index,
|
|
||||||
isLike
|
|
||||||
} = param
|
|
||||||
// 当前项
|
// 当前项
|
||||||
const item = tabCurrent.value.listData()[index]
|
const item = tabCurrent.value.listData()[param.index]
|
||||||
// 请求
|
|
||||||
let request = api.video.cancelLikes
|
|
||||||
|
|
||||||
// 如果不是取消点赞
|
|
||||||
if (isLike !== 0) request = api.video.saveLikes
|
|
||||||
|
|
||||||
//
|
//
|
||||||
request({
|
api.video.videoLike({
|
||||||
data: {
|
data: {
|
||||||
// 0未点赞 1公开赞 2私密赞
|
|
||||||
type: isLike,
|
|
||||||
// 视频id
|
// 视频id
|
||||||
videoId: item.id,
|
videoId: item.id,
|
||||||
|
// 点赞用户id
|
||||||
|
likeUserId: userinfo.value.id,
|
||||||
|
// 被点赞用户id
|
||||||
|
targetUserId: item.userId,
|
||||||
|
// 点赞类型 0.公开赞 1.隐私赞
|
||||||
|
likeType: param.likeType,
|
||||||
|
// //点赞 0.点赞 1.取消点赞
|
||||||
|
isDelFlag: param.isDelFlag,
|
||||||
}
|
}
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
console.log('request', rs)
|
console.log('request', rs)
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
uni.$emit('updateVideo', rs.data)
|
console.log('item', {
|
||||||
|
...item,
|
||||||
|
...rs.data,
|
||||||
|
})
|
||||||
|
uni.$emit('updateVideo', {
|
||||||
|
...item,
|
||||||
|
...rs.data,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.alert({
|
util.alert({
|
||||||
|
|
Loading…
Reference in New Issue