视频圈优化

This commit is contained in:
曹磊 2024-09-11 10:29:33 +08:00
parent e0b87e4983
commit e3aad9bbad
3 changed files with 531 additions and 37 deletions

View File

@ -6,7 +6,7 @@
<view class="text_view">
<view class="item_view">
<view class="item_title" @tap="Cityshow = true">服务城市</view>
<u-input type="text" :disabled="true" v-model="city" placeholder="选择城市" />
<u-input type="text" v-model="city" placeholder="选择城市" @focus="Cityshow = true"/>
<view class="xian"></view>
</view>
<view class="item_view">

View File

@ -231,7 +231,7 @@
</view>
</uni-popup>
</view>
<uni-popup style="width: 100%;height: 100vh;" type="center" ref="pinglun" @touchmove.stop.prevent="moveHandle">
<uni-popup style="width: 100%;height: 100vh;" type="center" ref="bofang" @touchmove.stop.prevent="moveHandle">
<view style="width: 100%;height: 100%;position: relative;">
<video
id="myVideo"
@ -253,13 +253,35 @@
<view class="guanbi" @click="guanbi">
<image src="@/static/closeimg.png"></image>
</view>
<view class="userInfo">
<!-- 1.头像 -->
<image @click="tozuozhe(artificerItem)" class="userAvatar" :src="artificerItem.artificerImg" mode="aspectFill"></image>
<!-- 2.点赞 -->
<view class="list-view" @click="cLike(artificerItem);" style="opacity: 0.9; margin-top: 17px;">
<image v-if="artificerItem.sfdz==1" src="@/static/img/index/xin.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
<image v-if="artificerItem.sfdz==0" src="@/static/img/index/xin-2.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
<text style="color: #FFFFFF; margin-top: 5px; font-size: 14px; text-align: center; margin-top: 40px; font-weight: bold;" :class="{'likeNumActive':artificerItem.sfdz}">{{artificerItem.dzs}}</text>
</view>
<!-- 3.评论 -->
<view class="comment list-view" @click="toComment(artificerItem)" style="opacity: 0.9; margin-top: 17px;">
<image src="@/static/img/index/liaotian-2.png" style="width:38px; height:36px; position: absolute; right: 7px;"></image>
<text style="color: #FFFFFF; margin-top: 5px; font-size: 14px; font-weight: bold; text-align: center; margin-top: 40px;">{{artificerItem.pls}}</text>
</view>
</view>
</view>
</uni-popup>
<uni-popup class="uni-popup" type="bottom" ref="pinglun" @touchmove.stop.prevent="moveHandle">
<view class="popup-content-pl" :style="'width: '+ windowWidth +'px; height: '+ (boxStyle.height/heightNum) +'px;'">
<CComment ref="ccRef" :showPopup="showPopup" :userInfo="userInfo" :tableData="tableData" :tableTotal="tableTotal" likeFun="likeFun" @replyFun="replyFun" @deleteFun="deleteFun" :deleteMode="deleteMode"></CComment>
</view>
</uni-popup>
</view>
</template>
<script>
import CComment from "@/components/XJ-comment/index";
export default {
components:{CComment},
data() {
return {
playShow:false,
@ -334,7 +356,26 @@
filePath:'',
contentVideo:'',
videoId:'',
artificerClassifyList:[]
artificerClassifyList:[],
artificerItem:{},
showPopup:false,
ccRef: null,
userInfo: {
id: 120,
user_name: "🍁",
user_avatar: "https://pic1.zhimg.com/80/v2-a79071a705f55c5d88f6c74e6111fe84_720w.webp",
},
tableTotal: 4,
tableData: [],
deleteMode: "all",
windowWidth: 0,
windowHeight: 0,
heightNum: 1.18,
deleteHeight: 0,
boxStyle:{//🌟💗
'height': 0,
'width': 0,
},
}
},
onLoad(option) {
@ -344,6 +385,13 @@
title: '加载中...',
});
if(this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')){
this.deleteHeight = 0// tabbar
}
this.windowWidth = uni.getSystemInfoSync().windowWidth;
this.windowHeight = uni.getSystemInfoSync().windowHeight;
this.boxStyle.width = this.windowWidth + 'px';//px
this.boxStyle.height = this.windowHeight - this.deleteHeight;// tabbar
this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
this.artificerId = option.artificerId
this.myId = uni.getStorageSync('userId')
@ -369,7 +417,7 @@
this.playShow=false;
const videoContext = uni.createVideoContext('myVideo', this);
videoContext.pause(); //
this.$refs.pinglun.close("center");
this.$refs.bofang.close("center");
},
jieshu(){
this.playShow=true;
@ -386,8 +434,9 @@
this.playShow=true;
this.filePath=item.filePath;
this.contentVideo=item.content;
this.artificerItem=item;
this.videoId=item.id
this.$refs.pinglun.open("center")
this.$refs.bofang.open("center")
},
getVideo(){
var that=this;
@ -718,6 +767,171 @@
current: imgArr[index]
});
},
tozuozhe(item){
// console.log("itemitemitemitemitem",item)
uni.reLaunch({
url:'/pages/therapist/orderDetail?artificerId='+item.createBy+'&classifyId='+'undefined'
})
this.currents = 1//
},
cLike(item){
var data={
createBy:uni.getStorageSync('userId'),
shipinquanId:item.id,
}
if(item.sfdz=='0'){
this.$Request.post("/app/shipinquan/addDianzan", data).then(res => {
if (res.code == 0) {
this.artificerItem.dzs += 1;
this.artificerItem.sfdz = '1';
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}else{//
this.$Request.post("/app/shipinquan/delDianzan", data).then(res => {
if (res.code == 0) {
this.artificerItem.dzs -= 1;
this.artificerItem.sfdz = '0';
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}
},
likeFun(params, callback) {//
console.log("likeFun", params);
// Implement your logic for likeFun
},
toComment(item){
//
/*
1先加载缓冲
2获取当前视频 ID 信息
3🌟🌟🌟🌟重要🌟🌟🌟🌟
- 一定要记得看 index.vue 里面
uni.setStorageSync("user",this.peopleList[i]);
这个东西用于存储当前用户信息 插件里面会使用到这个东西
记得写一下
4打开评论
*/
uni.showToast({
title: '加载中...',
icon: 'none',
position: 'bottom',
duration: 300
})
uni.setStorageSync("videoID",item.id);
this.videoID = item.id;
this.$refs.pinglun.open('bottom');
this.getPingL(this.videoID);
},
getPingL(shipinquanId){//
var data={
page: this.page,
limit:310,
shipinquanId:shipinquanId
}
this.$Request.get("/app/shipinquan/contentlist", data).then(res => {
if (res.code == 0) {
var msg = res.data.records||{}
this.tableTotal=res.data.total;
var list=[];
// for (let i = 0; i < msg.length; i++) {
// list.push(msg[i])
// }
this.tableData = msg.map(item => {
return {
...item,
parent_id: null,
reply_id: null,
reply_name: null,
user_name: item.userName,
user_avatar: item.userPhoto?item.userPhoto:'../../static/logo.png',
user_content: item.content,
is_like: true,
like_count: 8,
create_time: item.createTime
};
});
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
replyFun(params, callback) {
// console.log("replyFun", params);
if(params.params.user_content==''){
uni.hideLoading();
uni.showToast({
icon:'error',
title:'请填写发布评论'
})
}else{
var data={
createBy:uni.getStorageSync('userId'),
content:params.params.user_content,
shipinquanId:this.videoID,
}
this.$Request.post("/app/shipinquan/addContent",data).then(res => {
if (res.code == 0) {
setTimeout(() => this.getPingL(this.videoID), 500);
this.showPopup==true;
uni.hideLoading();
this.artificerItem.pls++
// callback(this.videoID);
} else {
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}
},
deleteFun({ params, mode }, callback) {
console.log("deleteFun", { params, mode });
// , callback;
switch (this.deleteMode) {
case "bind":
// : update
setTimeout(() => callback(), 500); // , callback
break;
case "only":
// : delete
setTimeout(() => callback(), 500); // , callback
break;
default:
// all
// : [delete]
// Demo:
// axios.post("http://xxx/delete", { ids: params }).then((res) => {
// if (res.code === 0) {
// callback(res);
// }
// });
setTimeout(() => callback(), 500); // , callback
break;
}
},
closeScrollview(){
//
this.$refs.pinglun.close('bottom');
},
}
}
@ -773,9 +987,6 @@
/deep/.uni-popup__wrapper-box{
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.videoHovers image{
width: 100%;
@ -1012,7 +1223,16 @@
display: flex;
flex-direction: column;
}
.popup-content-pl{
width: 100%;
height: 100%;
background-color: #242424;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
position: relative;
display: flex;
flex-direction: column;
}
.content{
width: 100%;
background-color: #f7f7f7;
@ -1539,4 +1759,31 @@
margin-right: 10rpx;
margin-top: 5px;
}
.userInfo{
position: absolute;
bottom:110px;
right: 10px;
display: flex;
flex-direction: column;
z-index: 18;
}
.userAvatar{
border-radius: 500%;
border-style: solid;
border-width: 2px;
border-color: #ffffff;
width : 100rpx;
height: 100rpx;
}
.list-view{
display: flex;
flex-direction: column;
align-items: center;
}
.uni-popup{
width: 100%;
height: 500px;
overflow: auto;
}
</style>

View File

@ -76,7 +76,7 @@
{{item.content}}
</view>
<view class="data-list">
<view class="videoHovers" @click="towxh5Video(item)">
<view class="videoHovers" @click="towxh5Video(item,index)">
<image src="@/static/bofang.png"></image>
</view>
<view class="playState">
@ -84,12 +84,13 @@
</view>
</view>
<view class="scroll-bottom">
<view class="pinglun">
<view class="pinglun" @click="toComment(index)">
<image src="../../static/pinglun.png" mode=""></image>
<span>{{item.pls}}</span>
</view>
<view class="pinglun" style="margin-left: 20px;">
<image src="../../static/guanzhu.png" mode=""></image>
<view class="pinglun" style="margin-left: 20px;" @click="cLike(item,index);">
<image v-if="item.sfdz==0" src="../../static/guanzhu.png" mode=""></image>
<image v-if="item.sfdz==1" src="@/static/img/index/xin.png" mode=""></image>
<span>{{item.dzs}}</span>
</view>
</view>
@ -106,7 +107,7 @@
</template>
</scroll-view>
<empty v-if="getVideoData.length==0"></empty>
<uni-popup style="width: 100%;height: 100vh;" type="center" ref="pinglun" @touchmove.stop.prevent="moveHandle">
<uni-popup style="width: 100%;height: 100vh;" type="center" ref="bofang" @touchmove.stop.prevent="moveHandle">
<view style="width: 100%;height: 100%;position: relative;">
<video
id="myVideo"
@ -128,15 +129,36 @@
<view class="guanbi" @click="guanbi">
<image src="@/static/closeimg.png"></image>
</view>
<view class="userInfo">
<!-- 1.头像 -->
<image @click="tozuozhe(artificerItem)" class="userAvatar" :src="artificerItem.artificerImg" mode="aspectFill"></image>
<!-- 2.点赞 -->
<view class="list-view" @click="cLike(artificerItem,k);" style="opacity: 0.9; margin-top: 17px;">
<image v-if="artificerItem.sfdz==1" src="@/static/img/index/xin.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
<image v-if="artificerItem.sfdz==0" src="@/static/img/index/xin-2.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
<text style="color: #FFFFFF; margin-top: 5px; font-size: 14px; text-align: center; margin-top: 40px; font-weight: bold;" :class="{'likeNumActive':artificerItem.sfdz}">{{artificerItem.dzs}}</text>
</view>
<!-- 3.评论 -->
<view class="comment list-view" @click="toComment(k)" style="opacity: 0.9; margin-top: 17px;">
<image src="@/static/img/index/liaotian-2.png" style="width:38px; height:36px; position: absolute; right: 7px;"></image>
<text style="color: #FFFFFF; margin-top: 5px; font-size: 14px; font-weight: bold; text-align: center; margin-top: 40px;">{{artificerItem.pls}}</text>
</view>
</view>
</view>
</uni-popup>
<uni-popup class="uni-popup" type="bottom" ref="pinglun" @touchmove.stop.prevent="moveHandle">
<view class="popup-content" :style="'width: '+ windowWidth +'px; height: '+ (boxStyle.height/heightNum) +'px;'">
<CComment ref="ccRef" :showPopup="showPopup" :userInfo="userInfo" :tableData="tableData" :tableTotal="tableTotal" likeFun="likeFun" @replyFun="replyFun" @deleteFun="deleteFun" :deleteMode="deleteMode"></CComment>
</view>
</uni-popup>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
import empty from '@/components/empty.vue';
import CComment from "@/components/XJ-comment/index";
export default {
components:{empty},
components:{CComment,empty},
data() {
return {
isFollow: false,
@ -154,15 +176,43 @@
playShow:false,
filePath:'',
contentVideo:'',
artificerImg:'',
artificerItem:{},
videoId:'',
getVideoData:[],
//
loadingText : ["上拉或点击加载更多","已加载全部数据",'加载中',''],
ordersScore:''
ordersScore:'',
showPopup:false,
ccRef: null,
userInfo: {
id: 120,
user_name: "🍁",
user_avatar: "https://pic1.zhimg.com/80/v2-a79071a705f55c5d88f6c74e6111fe84_720w.webp",
},
tableTotal: 4,
tableData: [],
deleteMode: "all",
windowWidth: 0,
windowHeight: 0,
heightNum: 1.18,
deleteHeight: 0,
boxStyle:{//🌟💗
'height': 0,
'width': 0,
},
k: 0,
}
},
onLoad(e) {
if(this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')){
this.deleteHeight = 0// tabbar
}
this.windowWidth = uni.getSystemInfoSync().windowWidth;
this.windowHeight = uni.getSystemInfoSync().windowHeight;
this.boxStyle.width = this.windowWidth + 'px';//px
this.boxStyle.height = this.windowHeight - this.deleteHeight;// tabbar
this.artificerId = e.artificerId;
this.latitude = uni.getStorageSync('latitude');
this.longitude = uni.getStorageSync('longitude');
@ -291,7 +341,7 @@
this.playShow=false;
const videoContext = uni.createVideoContext('myVideo', this);
videoContext.pause(); //
this.$refs.pinglun.close("center");
this.$refs.bofang.close("center");
},
jieshu(){
this.playShow=true;
@ -304,12 +354,180 @@
videoContext.src = this.filePath; //
videoContext.play(); //
},
towxh5Video(item){
towxh5Video(item,index){
this.playShow=true;
this.filePath=item.filePath;
this.contentVideo=item.content;
this.videoId=item.id
this.$refs.pinglun.open("center")
this.artificerItem=item;
this.videoId=item.id;
this.k=index;
this.$refs.bofang.open("center");
},
tozuozhe(item){
// console.log("itemitemitemitemitem",item)
uni.reLaunch({
url:'/pages/therapist/orderDetail?artificerId='+item.createBy+'&classifyId='+'undefined'
})
this.currents = 1//
},
cLike(item,index){
var data={
createBy:uni.getStorageSync('userId'),
shipinquanId:item.id,
}
if(item.sfdz=='0'){
this.$Request.post("/app/shipinquan/addDianzan", data).then(res => {
if (res.code == 0) {
this.getVideoData[index].dzs += 1;
this.getVideoData[index].sfdz = '1';
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}else{//
this.$Request.post("/app/shipinquan/delDianzan", data).then(res => {
if (res.code == 0) {
this.getVideoData[index].dzs -= 1;
this.getVideoData[index].sfdz = '0';
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}
},
likeFun(params, callback) {//
// console.log("likeFun", params);
// Implement your logic for likeFun
},
toComment(index){
//
/*
1先加载缓冲
2获取当前视频 ID 信息
3🌟🌟🌟🌟重要🌟🌟🌟🌟
- 一定要记得看 index.vue 里面
uni.setStorageSync("user",this.peopleList[i]);
这个东西用于存储当前用户信息 插件里面会使用到这个东西
记得写一下
4打开评论
*/
uni.showToast({
title: '加载中...',
icon: 'none',
position: 'bottom',
duration: 300
})
this.k = index;
uni.setStorageSync("videoID",this.getVideoData[index].id);
this.videoID = this.getVideoData[index].id;
this.$refs.pinglun.open('bottom');
this.getPingL(this.videoID);
},
getPingL(shipinquanId){//
var data={
page: this.page,
limit:310,
shipinquanId:shipinquanId
}
this.$Request.get("/app/shipinquan/contentlist", data).then(res => {
if (res.code == 0) {
var msg = res.data.records||{}
this.tableTotal=res.data.total;
var list=[];
// for (let i = 0; i < msg.length; i++) {
// list.push(msg[i])
// }
this.tableData = msg.map(item => {
return {
...item,
parent_id: null,
reply_id: null,
reply_name: null,
user_name: item.userName,
user_avatar: item.userPhoto?item.userPhoto:'../../static/logo.png',
user_content: item.content,
is_like: true,
like_count: 8,
create_time: item.createTime
};
});
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
replyFun(params, callback) {
// console.log("replyFun", params);
if(params.params.user_content==''){
uni.hideLoading();
uni.showToast({
icon:'error',
title:'请填写发布评论'
})
}else{
var data={
createBy:uni.getStorageSync('userId'),
content:params.params.user_content,
shipinquanId:this.videoID,
}
this.$Request.post("/app/shipinquan/addContent",data).then(res => {
if (res.code == 0) {
setTimeout(() => this.getPingL(this.videoID), 500);
this.showPopup==true;
uni.hideLoading();
this.getVideoData[this.k].pls++
// callback(this.videoID);
} else {
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}
},
deleteFun({ params, mode }, callback) {
console.log("deleteFun", { params, mode });
// , callback;
switch (this.deleteMode) {
case "bind":
// : update
setTimeout(() => callback(), 500); // , callback
break;
case "only":
// : delete
setTimeout(() => callback(), 500); // , callback
break;
default:
// all
// : [delete]
// Demo:
// axios.post("http://xxx/delete", { ids: params }).then((res) => {
// if (res.code === 0) {
// callback(res);
// }
// });
setTimeout(() => callback(), 500); // , callback
break;
}
},
closeScrollview(){
//
this.$refs.pinglun.close('bottom');
},
//
UserEdit() {
@ -322,6 +540,21 @@
</script>
<style scoped>
.uni-popup{
width: 100%;
height: 500px;
overflow: auto;
}
.popup-content{
width: 100%;
height: 100%;
background-color: #242424;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
position: relative;
display: flex;
flex-direction: column;
}
.dvideo-concent{
font-size: 26rpx;
color: #666;
@ -484,11 +717,6 @@
/* height: 100vh; */
/* overflow: scroll; */
}
.scroll-Y {
width: 100%;
/* height: 700px;*/
background-color: #fff;
}
.top-view {
width:100%;
background-color: #fff;
@ -524,8 +752,8 @@
word-break: break-all;
}
.data-list{
width: 200px;
height: 200px;
width: 100%;
/* height: 200px; */
position: relative;
margin: 10px 0px;
}
@ -553,7 +781,7 @@
margin-top: 10px;
}
.scroll-list{
width: 95%;
width: 98%;
padding: 0px 10px;
background-color: #fff;
display: flex;
@ -586,13 +814,13 @@
margin-left: 15px;
color: #fff;
}
/deep/.uni-scroll-view-content{
/* /deep/.uni-scroll-view-content{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
} */
.guanbi{
width: 30px;
height: 30px;
@ -610,17 +838,15 @@
width: 100%;
height: 100%;
}
.data-list{
width:100%;
height: 162px;
}
.videoHovers{
width: 60px;
height: 60px;
position: absolute;
top: 0px;
/* top: 0px;
margin-top: 20%;
margin-left: 40%;
margin-left: 40%; */
top: 45%;
margin-left: 45%;
z-index: 99;
}
.videoHover{
@ -737,4 +963,25 @@
display: flex;
flex-direction: row;
}
.userInfo{
position: absolute;
bottom:110px;
right: 10px;
display: flex;
flex-direction: column;
z-index: 18;
}
.userAvatar{
border-radius: 500%;
border-style: solid;
border-width: 2px;
border-color: #ffffff;
width : 100rpx;
height: 100rpx;
}
.list-view{
display: flex;
flex-direction: column;
align-items: center;
}
</style>