视频点赞
This commit is contained in:
parent
7ebbc70841
commit
b87f4cdeb5
|
@ -1,15 +1,6 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--
|
||||
注意:这是 H5、微信小程序界面,请勿和 new_index.nvue、index.nvue 混用
|
||||
|
||||
1. new_index.nvue、index.nvue这两个是App页面
|
||||
|
||||
2. 另外:data.js 是上一版本留下的假数据,这一版改成了 URL 请求了(如不需要可以删除,也可作为后端请求参考)
|
||||
|
||||
3. 请各位大神多多留手,我已经把请求内存开到最大了
|
||||
|
||||
4. 视频 id 切记是字符串类型 -->
|
||||
<!-- 视频 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>
|
||||
<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">
|
||||
|
@ -60,7 +51,7 @@
|
|||
</view>
|
||||
<view class="userInfo">
|
||||
<!-- 1.头像 -->
|
||||
<image @click="tozuozhe" class="userAvatar" :src="list.href" mode="aspectFill"></image>
|
||||
<image @click="tozuozhe" class="userAvatar" :src="list.artificerImg" mode="aspectFill"></image>
|
||||
<!-- 2.点赞 -->
|
||||
<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>
|
||||
|
@ -70,7 +61,7 @@
|
|||
<!-- 3.评论 -->
|
||||
<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>
|
||||
<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>
|
||||
<!-- 4.分享 -->
|
||||
<!-- <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 => {
|
||||
if (res.code == 0) {
|
||||
var msg = res.data.records
|
||||
var msg = res.data.list||{}
|
||||
// 2.这里把视频添加到视频列表
|
||||
for (let i = 0; i < msg.length; i++) {
|
||||
this.dataList.push(msg[i])
|
||||
|
@ -583,7 +574,7 @@
|
|||
}
|
||||
this.$Request.get("/app/shipinquan/list", data).then(res => {
|
||||
if (res.code == 0) {
|
||||
var msg = res.data.records
|
||||
var msg = res.data.list||{}
|
||||
// this.dataList=res.data.records
|
||||
this.isShow = false;
|
||||
// 2.这里把视频添加到视频列表
|
||||
|
@ -677,9 +668,41 @@
|
|||
this.$refs.pinglun.open('bottom')
|
||||
},
|
||||
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
|
||||
const video = this.dataList[this.k];
|
||||
sss?video.dzs -= 1:video.dzs += 1;
|
||||
if(this.dataList[this.k].like==true){
|
||||
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'
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue