合并代码

This commit is contained in:
sx 2025-01-13 00:25:06 +08:00
parent 708caca967
commit b26bd82e07
4 changed files with 51 additions and 66 deletions

View File

@ -10,7 +10,6 @@ const video = {
homeVideo(param) {
return util.request({
url: `/video/video/list`,
// url: `/video/api/queryVideoByPage`,
query: param.query,
method: 'GET',
})
@ -23,31 +22,6 @@ const video = {
saveVideo(param) {
return util.request({
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,
method: 'POST',
})
@ -59,8 +33,8 @@ const video = {
*/
videoLike(param) {
return util.request({
url: `/home/videoLike`,
query: param.query,
url: `/video/videolike/like`,
data: param.data,
method: 'POST',
})
},
@ -84,7 +58,6 @@ const video = {
getLabel(param) {
return util.request({
url: `/video/tag/list`,
// url: `/video/api/getTagsByPage`,
data: param.data,
method: 'GET',
load: true,
@ -275,10 +248,11 @@ const video = {
* 视频评论列表
* @param {Object} param
*/
commentList(param) {
getcomment(param) {
return util.request({
url: `/video/api/getCommentsByParams`,
url: `/video/comment/getcomment`,
query: param.query,
data: param.data,
method: 'GET',
})
},

View File

@ -66,7 +66,7 @@
//
function getList() {
//
api.video.commentList({
api.video.getcomment({
query: {
videoId: detail.id,
pageSize: listProperty.pageSize,

View File

@ -357,13 +357,15 @@
/**
* 点赞
* @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 => {
emit('like', {
index,
isLike,
likeType,
isDelFlag,
})
}).catch(() => {
uni.navigateTo({
@ -386,11 +388,13 @@
}).then(rs => {
if (rs.confirm) emit('like', {
index,
isLike: 2,
likeType: 1,
isDelFlag: 0,
})
else emit('like', {
index,
isLike: 1
likeType: 2,
isDelFlag: 0,
})
})
}).catch(() => {
@ -515,18 +519,21 @@
<view class="item">
<view class="col">
<view class="pr">
<image class="wh50" src="/static/indexLike.png" mode="aspectFit"
v-if="item.likeStatus == 0" @click="handleLike(index, 1)"
@longpress="handlePrivateLike(index)" />
<!-- 公开赞 -->
<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.likeStatus == 2" @click="handleLike(index, 0)" />
<template v-if="item.isLike">
<!-- 公开赞 -->
<image class="wh50" src="/static/indexLike1.png" mode="aspectFit"
v-if="item.likeType == 0" @click="handleLike(index,0, 0)" />
<!-- 私密赞的图标 -->
<image class="wh50" src="/static/privateLike.png" mode="aspectFit"
v-else-if="item.likeType == 1" @click="handleLike(index,1, 0)" />
</template>
<template v-else>
<image class="wh50" src="/static/indexLike.png" mode="aspectFit"
@click="handleLike(index, 0, 0)" @longpress="handlePrivateLike(index)" />
</template>
</view>
<view class="txt mt10">
<text class="text">{{ item.publicLikeCount }}</text>
<text class="text">{{ item.likeCount }}</text>
</view>
</view>
</view>
@ -536,7 +543,7 @@
<view class="col">
<image class="wh50" src="@/static/indexMsg.png" mode="aspectFit" />
<view class="txt mt10">
<text class="text">{{ item.commentCount }}</text>
<text class="text">{{ item.reviewCount }}</text>
</view>
</view>
</view>
@ -548,7 +555,7 @@
v-if="item.isCollect" />
<image class="wh50" src="@/static/indexCollect.png" mode="aspectFit" v-else />
<view class="txt mt10">
<text class="text">{{ item.favoriteCount }}</text>
<text class="text">{{ item.collectCount }}</text>
</view>
</view>
</view>

View File

@ -182,7 +182,7 @@
// 校验
if (!item && !item.videoId) return
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, {
...tabCurrent.value.listData()[findIndex],
...item,
@ -582,33 +582,37 @@
* 视频点赞
* @param {Object} param 见下
* @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) {
const {
index,
isLike
} = param
// 当前项
const item = tabCurrent.value.listData()[index]
// 请求
let request = api.video.cancelLikes
// 如果不是取消点赞
if (isLike !== 0) request = api.video.saveLikes
const item = tabCurrent.value.listData()[param.index]
//
request({
api.video.videoLike({
data: {
// 0未点赞 1公开赞 2私密赞
type: isLike,
// 视频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 => {
console.log('request', rs)
if (rs.code == 200) {
uni.$emit('updateVideo', rs.data)
console.log('item', {
...item,
...rs.data,
})
uni.$emit('updateVideo', {
...item,
...rs.data,
})
return
}
util.alert({