This commit is contained in:
Mr.jiang 2024-07-18 18:17:06 +08:00
parent bcc7f9b0b5
commit df84660448
5 changed files with 751 additions and 0 deletions

View File

@ -56,6 +56,21 @@
"navigationBarTitleText": "修改商家信息"
}
},
{
"path": "pages/video/index",
"style": {
"navigationBarTitleText": "视频",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/video/setVideo",
"style": {
"navigationBarTitleText": "发布视频"
}
},
{
"path": "pages/index/currentIncome",
"style": {

View File

@ -230,6 +230,10 @@
<image src="../../static/index/function4.png"></image>
<view class="box_text">设置中心</view>
</view>
<view class="box" @click="goNav('/pages/video/index')">
<image src="../../static/index/function4.png"></image>
<view class="box_text">视频</view>
</view>
<!-- <view class="box" v-if="renzheng == 0 && XCXIsSelect != '否'" @click="goNav('/my/renzheng/rzType')">
<image src="../../static/images/my/renzheng.png"></image>
<view class="box_text">实名认证</view>

433
pages/video/index.vue Normal file
View File

@ -0,0 +1,433 @@
<template>
<view>
<view class="page-head">
<view class="page-head-hd">
<view class="page-head-btn" @click="fanhui">
<i class="btn-icon"></i>
</view>
<view class="page-head-mian">
<view class="page-head__title">
商家信息
</view>
<view class="page-head-ft">
<view class="page-head-xuan" @click="xuanzhe">
选择
</view>
<view class="" @click="setVideo">
发布视频
</view>
</view>
</view>
</view>
</view>
<scroll-view :style="'width: 100%; height: '+ (windowHeight) +'px; background-color: #000000;'" :scroll-y="true" @scrolltolower="scrolltolower" :lower-threshold="lowerThreshold">
<view style="display: flex; flex-direction: row; flex-wrap: wrap;padding-top: 70px;">
<checkbox-group class="checkbox-group" @change="checkboxChange">
<view class="checkbox-group-list" v-for="(list,index) in dataList" :key="index">
<view class="data-list">
<image v-if="checkboxShow==1" @click="towxh5Video(list)" :src="list.picPath" mode="aspectFill" style="width: 100%; height: 100%;"></image>
<image v-if="checkboxShow==0" :src="list.picPath" mode="aspectFill" style="width: 100%; height: 100%;"></image>
<checkbox v-if="checkboxShow==0" class="check-list" style="border-radius:50%;" activeBackgroundColor="#029d88" color="#029d88" :value="list.id.toString()" :checked="checkbox"/>
</view>
</view>
</checkbox-group>
</view>
</scroll-view>
<view class="shanchu" v-if="checkboxShow==0" @click="deleteVodeo">
<span>删除</span>
</view>
<uni-popup style="width: 100%;height: 100vh;" type="center" ref="pinglun" @touchmove.stop.prevent="moveHandle">
<view style="width: 100%;height: 100%;">
<video
id="myVideo"
style="width: 100%;height: 100%;"
:show-fullscreen-btn='false'
:enable-play-gesture='true'
:autoplay="true"
:show-play-btn='false'
:show-center-play-btn='false'
@click="jieshu"
:src="filePath"></video>
<view class="videoHover" v-if="playShow==true" @click="kaishi">
<image class="playState" src="@/static/play.png"></image>
</view>
<view class="guanbi" @click="guanbi">
<image src="@/static/closeimg.png"></image>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
checkboxShow:1,
checkbox:false,
windowWidth: 0,
windowHeight: 0,
dataList: [],
lowerThreshold: 0,
page: 1,
limit:10,
filePath:'',
playShow:false,
videoId:0,
couponId:''
}
},
onLoad() {
this.windowWidth = uni.getSystemInfoSync().windowWidth
if(uni.getSystemInfoSync().platform == 'ios'){
var model = uni.getSystemInfoSync().model
if(model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8'){
this.windowHeight = (uni.getSystemInfoSync().screenHeight)-125
} else {
this.windowHeight = uni.getSystemInfoSync().screenHeight
}
} else {
this.windowHeight = uni.getSystemInfoSync().screenHeight
}
this.get()
},
methods: {
deleteVodeo(){
var data={
ids:this.couponId
}
this.$Request.get("/app/shipinquan/delete",data).then(res => {
if (res.code == 0) {
this.get()
uni.showToast({
title:'删除成功!',
})
this.checkboxShow=1;
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
this.checkboxShow=0;
}
});
},
checkboxChange(e){
this.couponId=e.detail.value.join(",")
},
xuanzhe(){
this.checkboxShow=!this.checkboxShow
},
guanbi(){
this.$refs.pinglun.close("center")
},
jieshu(){
const videoContext = uni.createVideoContext('myVideo', this);
videoContext.pause(); //
this.playShow=true
},
kaishi(){
const videoContext = uni.createVideoContext('myVideo', this);
videoContext.src = this.filePath; //
videoContext.play(); //
this.playShow=false
},
setVideo(){//
uni.navigateTo({
url:'/pages/video/setVideo'
})
},
fanhui(){//
uni.switchTab({
url:'/pages/my/index'
})
},
towxh5Video(item){
this.filePath=item.filePath;
this.videoId=item.id
this.$refs.pinglun.open("center")
},
towxh5Videos(index){
let list = []
let videoNumber = 36;// 6 DOM
let dotNumber = videoNumber/2;
let inf = (index+1) - dotNumber;
console.log('点击了第'+(index+1)+'个视频.');
let beforeLocation = 0;
let afterLocation = 0;
let location = 0;
if(inf <= 0){
beforeLocation = 0;
location = index;
for(let i=0;i<=index;i++){
list.push(this.dataList[i]);
}
} else {
beforeLocation = inf;
location = index - inf;
for(let i=inf;i<=index;i++){
list.push(this.dataList[i]);
}
}
let onf = this.dataList.length - (index+1)
console.log('下方视频数:'+onf);
if(onf <= dotNumber){
if(onf !== 0){
afterLocation = this.dataList.length - 1;
for(let i=index+1;i<this.dataList.length;i++){
list.push(this.dataList[i]);
}
} else {
afterLocation = this.dataList.length - 1;
}
} else {
afterLocation = index+dotNumber;
for(let i=index+1;i<=index+dotNumber;i++){
list.push(this.dataList[i]);
}
}
console.log('总视频数:'+list.length);
console.log('\n\n第一个视频下标'+beforeLocation+'.\n'+'最后一个视频下标:'+afterLocation+'.\n\n');
uni.setStorageSync("List",this.dataList);
uni.setStorageSync("dataList",list);
uni.navigateTo({
url: './wxh5infoVideo/wxh5infoVideo?option='+location+'&page='+this.page+'&index='+index,
})
},
scrolltolower(){
//
this.page++;
var data={
page: this.page,
limit:this.limit,
}
this.$Request.get("/app/shipinquan/list", data).then(res => {
if (res.code == 0) {
var msg = res.data.records
for (let i = 0; i < msg.length; i++) {
this.dataList.push(msg[i])
}
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
// uni.request({
// url: 'https://bdb24c6d-8c19-4f80-8e7e-c9c9f037f131.bspapp.com/video',
// method: 'POST',
// data:{
// info: 'get_video'
// },
// success: (res) => {
// var msg = res.data.data
// for (let i = 0; i < msg.length; i++) {
// this.dataList.push(msg[i])
// }
// }
// })
},
get(){
var data={
page: this.page,
limit:this.limit,
}
this.$Request.get("/app/shipinquan/list", data).then(res => {
if (res.code == 0) {
this.dataList=res.data.records
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
// uni.request({
// url: 'https://bdb24c6d-8c19-4f80-8e7e-c9c9f037f131.bspapp.com/video',
// method: 'POST',
// data:{
// info: 'get_video'
// },
// success: (res) => {
// var msg = res.data.data
// // console.log(msg)
// this.dataList = msg;
// }
// })
}
}
}
</script>
<style scoped>
.shanchu{
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
background-color: #fff;
}
.check-list{
position: absolute;
bottom: 0;
left: 0;
margin-left: 5px;
margin-bottom: 5px;
}
.data-list{
width:100%;
height:100%;
background-color: #000000;
}
.checkbox-group-list{
position: relative;
width: 33%;
height: 350upx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 5upx;
margin-left: 1px;
}
.checkbox-group{
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
/deep/.uni-checkbox-input{
border-radius: 50%;
width: 26px;
height: 26px;
}
.page-head-xuan{
margin-left: 10px;
}
.page-head-mian{
width: 60%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.videoHover{
width: 76px;
height: 76px;
position: absolute;
top: 0px;
margin-top: 70%;
margin-left: 40%;
}
.videoHover image{
width: 100%;
height: 100%;
}
.guanbi{
width: 30px;
height: 30px;
position: absolute;
top: 0;
right: 0;
margin-top: 15px;
margin-right: 9px;
}
.guanbi image{
width: 100%;
height: 100%;
}
/deep/.uni-popup__wrapper-box{
height: 100%;
width: 100%;
}
/deep/.uni-transition{
width: 100%;
height: 100%;
}
.page-head__title{
font-weight: 700;
font-size: 16px;
opacity: 1;
line-height: 30px;
text-align: center;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: #000;
}
.page-head-ft{
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
-webkit-box-orient: horizontal;
-webkit-box-direction: reverse;
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
font-size: 13px;
box-sizing: border-box;
}
.btn-icon{
color: rgb(0, 0, 0);
font-size: 27px;
overflow: hidden;
min-width: 1em;
display: inline-block;
font: normal normal normal 14px/1 unibtn;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
box-sizing: border-box;
}
.page-head-btn{
position: relative;
width: auto;
margin: 0 2px;
word-break: keep-all;
white-space: pre;
cursor: pointer;
box-sizing: border-box;
}
.page-head-hd{
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
font-size: 16px;
width: 100%;
justify-content: space-between;
}
.page-head{
position: fixed;
left: var(--window-left);
right: var(--window-right);
height: 44px;
height: calc(44px + constant(safe-area-inset-top));
height: calc(44px + env(safe-area-inset-top));
padding: 7px 3px;
padding-top: calc(7px + constant(safe-area-inset-top));
padding-top: calc(7px + env(safe-area-inset-top));
display: -webkit-box;
display: -webkit-flex;
display: flex;
overflow: hidden;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
box-sizing: border-box;
z-index: 998;
color: #fff;
background-color: #fff;
-webkit-transition-property: all;
transition-property: all;
color: rgb(0, 0, 0);
}
</style>

299
pages/video/setVideo.vue Normal file
View File

@ -0,0 +1,299 @@
<template>
<view style="padding-bottom: 100upx; margin-top: 20rpx;">
<view class=" padding bg radius margin">
<view class="padding-top">发布内容</view>
<view class="margin-tb-sm">
<u-input v-model="form.describes" style="border-radius: 20rpx;"
type="textarea" height="200" placeholde="请填写发布内容" maxlengt="200" :clearable="false" />
</view>
<view style="height: 15rpx;"></view>
</view>
<view class=" padding bg radius margin">
<view class="margin-top-sm">上传视频</view>
<view class="flex" style="overflow: hidden;flex-wrap: wrap;">
<view class="margin-top flex margin-right-sm flex-wrap" v-if="videosList">
<view class="flex" style="width: 200rpx;height: 200rpx;margin-right: 5rpx;position: relative;">
<video style="width: 100%;height: 100%;" :src="videosList"></video>
<view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;" @click="headVideoremove">
<u-icon name="close-circle-fill" color="#d81e06" size="50rpx"></u-icon>
</view>
</view>
</view>
</view>
<view class="margin-top" @click="addvideo" v-if="videosList.length<=0">
<view style="width: 200rpx;height: 200rpx;background: #f7f8fa;"
class="flex justify-center align-center">
<view>
<view class="text-center">
<image src="../../static/images/my/avatar.png" style="width: 80rpx;height: 80rpx;">
</image>
</view>
<view class="text-center add-word">添加视频</view>
</view>
</view>
</view>
</view>
<view class=" padding bg radius margin">
<view class="margin-top-sm">视频封面</view>
<view class="flex" style="overflow: hidden;flex-wrap: wrap;">
<view class="margin-top flex margin-right-sm flex-wrap" v-if="form.headImg && form.headImg.length">
<view class="flex" style="width: 200rpx;height: 200rpx;margin-right: 5rpx;position: relative;">
<image :src="form.headImg" style="width: 100%;height: 100%;"></image>
<view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;" @click="headImgremove(index)">
<u-icon name="close-circle-fill" color="#d81e06" size="50rpx"></u-icon>
</view>
</view>
</view>
</view>
<view class="margin-top" @click="addImage(4)" v-if="form.headImg.length<=0">
<view style="width: 200rpx;height: 200rpx;background: #f7f8fa;"
class="flex justify-center align-center">
<view>
<view class="text-center">
<image src="../../static/images/my/avatar.png" style="width: 80rpx;height: 80rpx;">
</image>
</view>
<view class="text-center add-word">添加头像</view>
</view>
</view>
</view>
</view>
<view class="tabbar" style="background: linear-gradient(to right, #019c88, #2dbe93); border-radius: 50rpx;"
@click="submit()">提交发布
</view>
</view>
</template>
<script>
import * as websocketUtils from 'utils/websocketUtils.js';
export default {
data() {
return {
form: {
//
headImg: '',
},
//
headImg: [],
videos: [],
videosList:''
}
},
onLoad(e) {
},
methods: {
headImgremove(index) {
this.form.headImg = ''
},
headVideoremove() {
this.videosList = ''
},
submit() {
if (!this.videosList) {
uni.showToast({
title: '请上视频',
icon: 'none',
duration: 1000
})
return;
}
if (!this.form.describes) {
uni.showToast({
title: '请填发布内容',
icon: 'none',
duration: 1000
})
return
}
if (!this.form.headImg) {
uni.showToast({
title: '请上视频封面',
icon: 'none',
duration: 1000
})
return;
}
let data = {
createBy: uni.getStorageSync("userId"),
filePath: this.videosList,
picPath: this.form.headImg,
content: this.form.describes,
}
this.$Request.postJson("/app/shipinquan/add", data).then(res => {
if (res.code == 0) {
uni.showToast({
title: '操作成功!',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/my/index'
})
}, 1000)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
addvideo(e){
let that = this
uni.chooseVideo({
count: 1,
sourceType: ['album', 'camera'],
success: res => {
that.videos.push(res.tempFilePath);
for (let i = 0; i < that.videos.length; i++) {
that.$queue.showLoading("上传中...");
uni.uploadFile({ //
url: websocketUtils.uploadFileUrl(), //
filePath: that.videos[i],
name: 'file',
success: (uploadFileRes) => {
that.videosList = JSON.parse(uploadFileRes.data).data
console.log("that.videosList",that.videosList)
uni.hideLoading();
}
});
}
}
})
},
addImage(e) {
let that = this
uni.chooseImage({
count: 1,
sourceType: ['album', 'camera'],
success: res => {
for (let i = 0; i < res.tempFilePaths.length; i++) {
that.$queue.showLoading("上传中...");
uni.uploadFile({ //
url: websocketUtils.uploadFileUrl(), //
filePath: res.tempFilePaths[i],
name: 'file',
success: (uploadFileRes) => {
if (e == 1) {
that.form.front = JSON.parse(uploadFileRes.data).data
} else if (e == 2) {
that.form.back = JSON.parse(uploadFileRes.data).data
} else if (e == 4) {
that.form.headImg = JSON.parse(uploadFileRes.data).data
console.log(that.form.headImg)
}
uni.hideLoading();
}
});
}
}
})
},
}
}
</script>
<style>
page {
background-color: #F7F7F7;
}
.bg {
width: 94%;
margin:30rpx auto;
background-color: #FFFFFF;
padding: 20rpx 36rpx;
border-radius: 26rpx;
}
.add-word{
font-size: 26rpx;
color: #afb5c1;
}
.skbox {}
.skleft {
width: 160rpx;
font-size: 28rpx;
}
.u-form-item {
padding: 10rpx !important;
}
.u-form-item--right__content__slot {
flex: 200rpx 1 !important;
}
.footer {
padding-left: 30upx;
font-size: 24upx;
color: #666666;
text-align: center;
display: flex;
margin-bottom: 20rpx;
}
.u-input__input {
color: balck !important;
}
.title_btn {
height: 78upx;
line-height: 78upx;
/* background: #f7f7f7; */
}
.tabbar {
width: 690upx;
height: 86upx;
background: #019c88;
border-radius: 8upx;
margin: 0 auto;
text-align: center;
line-height: 86upx;
color: #FFFFFF;
margin-top: 20rpx;
}
.popup_pay {
width: 100%;
position: relative;
padding-bottom: 45rpx;
/* height: 160px; */
/* #ifndef MP-WEIXIN */
/* height: 130px; */
/* #endif */
}
.pay_btn {
width: 90%;
margin: 0 auto;
text-align: center;
background: #1777FF;
height: 80rpx;
border-radius: 16rpx;
color: #ffffff;
line-height: 80rpx;
}
.hb {
/* #ifdef H5 */
padding-bottom: 180rpx;
/* #endif */
}
.bgCol2 {
color: #557EFD;
}
</style>

BIN
static/play.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB