视频点赞

This commit is contained in:
Mr.jiang 2024-07-22 21:06:16 +08:00
parent 7ebbc70841
commit b87f4cdeb5
1 changed files with 39 additions and 16 deletions

View File

@ -1,15 +1,6 @@
<template> <template>
<view> <view>
<!-- <!-- 视频 id 切记是字符串类型 -->
注意这是 H5微信小程序界面请勿和 new_index.nvueindex.nvue 混用
1. new_index.nvueindex.nvue这两个是App页面
2. 另外data.js 是上一版本留下的假数据这一版改成了 URL 请求了如不需要可以删除也可作为后端请求参考
3. 请各位大神多多留手我已经把请求内存开到最大了
4. 视频 id 切记是字符串类型 -->
<image v-if="isShowAixin" src="@/static/img/index/aixining.png" :style="'position: fixed; margin-left: '+ aixinLeft +'px; margin-top: '+ aixinTop +'px; width: 70px; height: 65px; transform: rotate('+ Rotate +'deg);'"></image> <image v-if="isShowAixin" src="@/static/img/index/aixining.png" :style="'position: fixed; margin-left: '+ aixinLeft +'px; margin-top: '+ aixinTop +'px; width: 70px; height: 65px; transform: rotate('+ Rotate +'deg);'"></image>
<swiper :style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px; background-color: #000000;'" :vertical="true" @animationfinish="animationfinish" @change="change" :current="current" :indicator-dots="false" :duration="duration"> <swiper :style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px; background-color: #000000;'" :vertical="true" @animationfinish="animationfinish" @change="change" :current="current" :indicator-dots="false" :duration="duration">
<swiper-item v-for="(list,index) in dataList" :key="index"> <swiper-item v-for="(list,index) in dataList" :key="index">
@ -60,7 +51,7 @@
</view> </view>
<view class="userInfo"> <view class="userInfo">
<!-- 1.头像 --> <!-- 1.头像 -->
<image @click="tozuozhe" class="userAvatar" :src="list.href" mode="aspectFill"></image> <image @click="tozuozhe" class="userAvatar" :src="list.artificerImg" mode="aspectFill"></image>
<!-- 2.点赞 --> <!-- 2.点赞 -->
<view class="list-view" @click="cLike(list.like);" style="opacity: 0.9; margin-top: 17px;"> <view class="list-view" @click="cLike(list.like);" style="opacity: 0.9; margin-top: 17px;">
<image v-if="list.like" src="@/static/img/index/xin.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image> <image v-if="list.like" src="@/static/img/index/xin.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
@ -70,7 +61,7 @@
<!-- 3.评论 --> <!-- 3.评论 -->
<view class="comment list-view" @click="toComment(index)" style="opacity: 0.9; margin-top: 17px;"> <view class="comment list-view" @click="toComment(index)" style="opacity: 0.9; margin-top: 17px;">
<image src="@/static/img/index/liaotian-2.png" style="width: 35px; height: 35px; position: absolute; right: 7px;"></image> <image src="@/static/img/index/liaotian-2.png" style="width: 35px; height: 35px; position: absolute; right: 7px;"></image>
<text style="color: #FFFFFF; margin-top: 5px; font-size: 14px; font-weight: bold; text-align: center; margin-top: 40px;">{{list.sms_n}}</text> <text style="color: #FFFFFF; margin-top: 5px; font-size: 14px; font-weight: bold; text-align: center; margin-top: 40px;">{{list.pls}}</text>
</view> </view>
<!-- 4.分享 --> <!-- 4.分享 -->
<!-- <view @click="share" class="list-view" style="opacity: 0.9; margin-top: 17px;"> <!-- <view @click="share" class="list-view" style="opacity: 0.9; margin-top: 17px;">
@ -548,7 +539,7 @@
} }
this.$Request.get("/app/shipinquan/list", data).then(res => { this.$Request.get("/app/shipinquan/list", data).then(res => {
if (res.code == 0) { if (res.code == 0) {
var msg = res.data.records var msg = res.data.list||{}
// 2. // 2.
for (let i = 0; i < msg.length; i++) { for (let i = 0; i < msg.length; i++) {
this.dataList.push(msg[i]) this.dataList.push(msg[i])
@ -583,7 +574,7 @@
} }
this.$Request.get("/app/shipinquan/list", data).then(res => { this.$Request.get("/app/shipinquan/list", data).then(res => {
if (res.code == 0) { if (res.code == 0) {
var msg = res.data.records var msg = res.data.list||{}
// this.dataList=res.data.records // this.dataList=res.data.records
this.isShow = false; this.isShow = false;
// 2. // 2.
@ -677,9 +668,41 @@
this.$refs.pinglun.open('bottom') this.$refs.pinglun.open('bottom')
}, },
cLike(sss){ cLike(sss){
var data={
createBy:this.dataList[this.k].createBy,
shipinquanId:this.dataList[this.k].id,
}
this.dataList[this.k].like = !this.dataList[this.k].like this.dataList[this.k].like = !this.dataList[this.k].like
const video = this.dataList[this.k]; if(this.dataList[this.k].like==true){
sss?video.dzs -= 1:video.dzs += 1; this.$Request.post("/app/shipinquan/addDianzan", data).then(res => {
if (res.code == 0) {
const video = this.dataList[this.k];
sss=video.dzs += 1;
} else {
this.dataList[this.k].like =false
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}else{//
this.$Request.post("/app/shipinquan/delDianzan", data).then(res => {
if (res.code == 0) {
const video = this.dataList[this.k];
sss=video.dzs -= 1;
} else {
this.dataList[this.k].like =true
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}
} }
} }
} }