2025.03.07 工作代码提交
This commit is contained in:
parent
4c8f2050e8
commit
8fd05cc702
|
@ -6,8 +6,8 @@ const config = {
|
||||||
// host: 'h5api',
|
// host: 'h5api',
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
host: 'http://91f.xyz:8080',
|
// host: 'http://91f.xyz:8080',
|
||||||
// host: 'http://3dd3096c.r24.cpolar.top',
|
host: 'http://27380b6d.r24.cpolar.top',
|
||||||
// #endif
|
// #endif
|
||||||
// 是否vivo显示
|
// 是否vivo显示
|
||||||
showVivo: true,
|
showVivo: true,
|
||||||
|
|
|
@ -1,138 +1,133 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* 视频菜单组件
|
* 视频菜单组件
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
onMounted
|
onMounted
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import video from '../../api/video';
|
import video from '../../api/video';
|
||||||
import util from '../../common/js/util';
|
import util from '../../common/js/util';
|
||||||
|
|
||||||
// 传参
|
// 传参
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
// 列表数据
|
// 列表数据
|
||||||
list: {
|
list: {
|
||||||
type: Array,
|
type: Array,
|
||||||
},
|
},
|
||||||
// 模式 list列表展示 点击播放视频 menu菜单模式 点击触发回调事件 checkbox多选
|
// 模式 list列表展示 点击播放视频 menu菜单模式 点击触发回调事件 checkbox多选
|
||||||
mode: {
|
mode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'list',
|
default: 'list',
|
||||||
},
|
},
|
||||||
// 多选模式下的 选择数量限制 0为不限制
|
// 多选模式下的 选择数量限制 0为不限制
|
||||||
limit: {
|
limit: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0.
|
||||||
},
|
},
|
||||||
// 是否我自己 0不是 1是
|
// 是否我自己 0不是 1是
|
||||||
isMine: {
|
isMine: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
}
|
||||||
// 是否显示统计 0不显示 1显示
|
})
|
||||||
statistic: {
|
// 子触发父
|
||||||
type: [String, Number],
|
const emit = defineEmits(['item'])
|
||||||
default: 0,
|
// 已选择的视频id
|
||||||
},
|
const ids = defineModel('ids')
|
||||||
})
|
// 视频上下文对象
|
||||||
// 子触发父
|
const videoContext = ref(null)
|
||||||
const emit = defineEmits(['item'])
|
// 视频播放路径
|
||||||
// 已选择的视频id
|
const videoUrl = ref('')
|
||||||
const videoInfo = reactive({
|
|
||||||
videoId: '',
|
|
||||||
coverUrl: '',
|
|
||||||
})
|
|
||||||
// 视频上下文对象
|
|
||||||
const videoContext = ref(null)
|
|
||||||
// 视频播放路径
|
|
||||||
const videoUrl = ref('')
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 创建视频上下文对象
|
// 创建视频上下文对象
|
||||||
videoContext.value = uni.createVideoContext('video')
|
videoContext.value = uni.createVideoContext('video')
|
||||||
})
|
})
|
||||||
|
|
||||||
// 进入全屏
|
// 进入全屏
|
||||||
function requestFullScreen() {
|
function requestFullScreen() {
|
||||||
videoContext.value.requestFullScreen()
|
videoContext.value.requestFullScreen()
|
||||||
}
|
|
||||||
|
|
||||||
// 暂停
|
|
||||||
function pause() {
|
|
||||||
// 暂停当前视频
|
|
||||||
videoContext.value.pause()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点击视频播放
|
|
||||||
* @param {Object} item
|
|
||||||
*/
|
|
||||||
function handleVideo(item) {
|
|
||||||
// 列表模式
|
|
||||||
if (props.mode == 'list') {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: util.setUrl('/pages/index/videoDetail', {
|
|
||||||
videoId: item.id,
|
|
||||||
isMine: props.isMine,
|
|
||||||
statistic: props.statistic,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
// videoUrl.value = item.format_videoUrl
|
|
||||||
// 进入全屏
|
|
||||||
// requestFullScreen()
|
|
||||||
}
|
}
|
||||||
// 菜单模式
|
|
||||||
else if (props.mode == 'menu') {
|
// 暂停
|
||||||
|
function pause() {
|
||||||
|
// 暂停当前视频
|
||||||
|
videoContext.value.pause()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击视频播放
|
||||||
|
* @param {Object} item
|
||||||
|
*/
|
||||||
|
function handleVideo(item) {
|
||||||
|
// 列表模式
|
||||||
|
if (props.mode == 'list') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: util.setUrl('/pages/index/videoDetail', {
|
||||||
|
videoId: item.id,
|
||||||
|
isMine: props.isMine,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// videoUrl.value = item.format_videoUrl
|
||||||
|
// 进入全屏
|
||||||
|
// requestFullScreen()
|
||||||
|
}
|
||||||
|
// 菜单模式
|
||||||
|
else if (props.mode == 'menu') {
|
||||||
|
videoUrl.value = item.format_videoUrl
|
||||||
|
}
|
||||||
|
// 多选模式
|
||||||
|
else if (props.mode == 'checkbox') {
|
||||||
|
const findIndex = ids.value.findIndex(node => node == item.id)
|
||||||
|
if (findIndex >= 0) ids.value.splice(findIndex, 1)
|
||||||
|
else {
|
||||||
|
// 如果有限制 且 数量到达上限
|
||||||
|
if (props.limit != 0 && props.limit <= ids.value.length) return
|
||||||
|
ids.value.push(item.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
emit('item', item)
|
emit('item', item)
|
||||||
}
|
}
|
||||||
// 单选模式
|
|
||||||
else if (props.mode == 'checkbox') {
|
/**
|
||||||
videoInfo.videoId = item.id
|
* 视频进入退出全屏
|
||||||
videoInfo.coverUrl = item.coverUrl
|
* @param {Object} ev
|
||||||
videoUrl.value = item.videoUrl
|
*/
|
||||||
emit('videoInfo', videoInfo)
|
function videoFullscreenchange(ev) {
|
||||||
|
// 根据全屏状态决定是否播放盒暂停
|
||||||
|
if (ev.detail.fullScreen) videoContext.value.play()
|
||||||
|
else pause()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
defineExpose({
|
||||||
* 视频进入退出全屏
|
videoContext,
|
||||||
* @param {Object} ev
|
pause,
|
||||||
*/
|
requestFullScreen,
|
||||||
function videoFullscreenchange(ev) {
|
})
|
||||||
// 根据全屏状态决定是否播放盒暂停
|
|
||||||
if (ev.detail.fullScreen) videoContext.value.play()
|
|
||||||
else pause()
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
videoContext,
|
|
||||||
pause,
|
|
||||||
requestFullScreen,
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<!-- 视频菜单 -->
|
<!-- 视频菜单 -->
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="item pr" v-for="(item, index) in list" :key="index" @click="handleVideo(item)">
|
<view class="item pr" v-for="(item,index) in list" :key="index" @click="handleVideo(item)">
|
||||||
<image :src="item.coverUrl" mode="aspectFill" />
|
<image :src="item.coverUrl" mode="aspectFill" />
|
||||||
|
|
||||||
<view class="window pfull"></view>
|
<view class="window pfull"></view>
|
||||||
|
|
||||||
<!-- 选项 -->
|
<!-- 选项 -->
|
||||||
<view class="amount pa r0 t0 df ptb10 plr10" v-if="mode == 'checkbox'">
|
<view class="amount pa r0 t0 df ptb10 plr10" v-if="mode == 'checkbox'">
|
||||||
<uni-icons type="circle-filled" size="50rpx" color="#20D200" v-if="videoInfo.videoId == item.id" />
|
<uni-icons type="circle-filled" size="50rpx" color="#20D200" v-if="ids.includes(item.id)" />
|
||||||
<uni-icons type="circle" color="#fff" size="50rpx" v-else />
|
<uni-icons type="circle" color="#fff" size="50rpx" v-else />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="amount pa l0 r0 b0 df ptb10 plr10" v-if="item.play">
|
<view class="amount pa l0 r0 b0 df ptb10 plr10" v-if="item.play">
|
||||||
<image class="wh24" src="/static/amount.png" mode="aspectFit" />
|
<image class="wh24" src="/static/amount.png" mode="aspectFit" />
|
||||||
<view class="txt f1 ml10 cfff f20">{{ item.play }}</view>
|
<view class="txt f1 ml10 cfff f20">{{item.play}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -145,37 +140,37 @@ defineExpose({
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
//
|
//
|
||||||
.list {
|
.list {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
grid-gap: 5rpx;
|
grid-gap: 5rpx;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
height: 360rpx;
|
height: 360rpx;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.window {
|
||||||
|
background-color: rgba(0, 0, 0, .1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 播放量
|
||||||
|
.amount {
|
||||||
|
.txt {
|
||||||
|
opacity: .5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.window {
|
// 视频上下文对象
|
||||||
background-color: rgba(0, 0, 0, .1);
|
.videoContext {
|
||||||
|
position: absolute;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 播放量
|
|
||||||
.amount {
|
|
||||||
.txt {
|
|
||||||
opacity: .5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 视频上下文对象
|
|
||||||
.videoContext {
|
|
||||||
position: absolute;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
|
@ -29,15 +29,18 @@
|
||||||
import apex from '@/components/header/apex.vue';
|
import apex from '@/components/header/apex.vue';
|
||||||
// 视频菜单
|
// 视频菜单
|
||||||
import videoMenu from '@/components/index/videoMenu.vue';
|
import videoMenu from '@/components/index/videoMenu.vue';
|
||||||
|
//
|
||||||
|
import payPwd from '@/components/mine/payPwd.vue';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
proxy
|
proxy
|
||||||
} = getCurrentInstance()
|
} = getCurrentInstance()
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const userinfo = computed(() => store.state.userinfo)
|
|
||||||
// 榴莲果兑换播放量数量
|
// 榴莲果兑换播放量数量
|
||||||
const durainView = ref(0)
|
const durainView = ref(0)
|
||||||
|
// 用户信息
|
||||||
|
const userinfo = computed(() => store.state.userinfo)
|
||||||
// 列表数据
|
// 列表数据
|
||||||
const list = reactive({
|
const list = reactive({
|
||||||
data: [],
|
data: [],
|
||||||
|
@ -69,18 +72,24 @@
|
||||||
})
|
})
|
||||||
// 已选择的自己的视频列表id
|
// 已选择的自己的视频列表id
|
||||||
const myVideoIds = reactive([])
|
const myVideoIds = reactive([])
|
||||||
|
// 播放量
|
||||||
|
const viewCount = ref('')
|
||||||
|
// 播放量消耗的榴莲果
|
||||||
|
const viewTotal = computed(() => {
|
||||||
|
let count = Number(viewCount.value) || 0
|
||||||
|
return count * myVideoIds.length
|
||||||
|
})
|
||||||
// 已选择的自己视频列表
|
// 已选择的自己视频列表
|
||||||
const myVideos = computed(() => {
|
const myVideos = computed(() => {
|
||||||
let result = myVideoIds.map(item => {
|
let result = myVideoIds.map(item => {
|
||||||
return list.data.find(node => node.videoId == item) || {}
|
return list.data.find(node => node.id == item) || {}
|
||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
// 已选择额度视频id
|
// 已选择的视频id
|
||||||
const videoIds = computed(() => {
|
const videoIds = computed(() => [...myVideoIds, ...collectVideoIds.value])
|
||||||
let result = [...myVideoIds, ...collectVideoIds.value]
|
// 钱包
|
||||||
return result
|
const purse = computed(() => store.state.purse)
|
||||||
})
|
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
// 获取列表
|
// 获取列表
|
||||||
|
@ -89,6 +98,8 @@
|
||||||
addListener()
|
addListener()
|
||||||
// 获取果子兑换播放量的比例
|
// 获取果子兑换播放量的比例
|
||||||
getDurainViews()
|
getDurainViews()
|
||||||
|
// 获取钱包
|
||||||
|
util.getPurse()
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
|
@ -131,7 +142,6 @@
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
function refreshList() {
|
function refreshList() {
|
||||||
list.pageNum = 1
|
list.pageNum = 1
|
||||||
list.total = 0
|
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,8 +175,8 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 推送视频
|
// 展示播放
|
||||||
function pushVideo() {
|
function handleShowView() {
|
||||||
if (videoIds.value.length < 1) {
|
if (videoIds.value.length < 1) {
|
||||||
util.alert({
|
util.alert({
|
||||||
content: "请选择投流视频",
|
content: "请选择投流视频",
|
||||||
|
@ -174,31 +184,21 @@
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (userinfo.value.fruit <= videoIds.value.length * 10) {
|
//
|
||||||
|
proxy.$refs.views.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 推送视频
|
||||||
|
function pushVideo() {
|
||||||
|
if (purse.value.fruit <= videoIds.value.length * 10) {
|
||||||
util.alert({
|
util.alert({
|
||||||
content: "榴莲果不足",
|
content: "榴莲果不足",
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
proxy.$refs.views.close()
|
||||||
api.video.pushVideo({
|
proxy.$refs.payPwdRef.open()
|
||||||
query: {
|
|
||||||
ids: videoIds.value.join(','),
|
|
||||||
}
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code === 200) {
|
|
||||||
proxy.$refs.applyRef.close()
|
|
||||||
util.alert('申请成功,请等待后台审核')
|
|
||||||
util.getUserinfo()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
util.alert({
|
|
||||||
content: rs.msg,
|
|
||||||
showCancel: false,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 完播申请
|
// 完播申请
|
||||||
|
@ -267,7 +267,39 @@
|
||||||
function link(path) {
|
function link(path) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: path
|
url: path
|
||||||
});
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 二级密码确认
|
||||||
|
function handlePwdConfirm(ev) {
|
||||||
|
// 榴莲果交易
|
||||||
|
api.durian.consume({
|
||||||
|
data: {
|
||||||
|
// 更新用户信息
|
||||||
|
userId: userinfo.value.id,
|
||||||
|
// 交易类型
|
||||||
|
transactionType: 5,
|
||||||
|
// 榴莲果交易数量
|
||||||
|
fruitAmount: viewTotal.value,
|
||||||
|
// 交易值
|
||||||
|
totalAmount: viewTotal.value,
|
||||||
|
// 二级密码
|
||||||
|
secondPassword: ev,
|
||||||
|
// 视频id
|
||||||
|
videoIds: videoIds.value.join(','),
|
||||||
|
}
|
||||||
|
}).then(rs => {
|
||||||
|
if (rs.code === 200) {
|
||||||
|
util.alert('申请成功,请等待后台审核')
|
||||||
|
util.getPurse()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -316,7 +348,7 @@
|
||||||
|
|
||||||
<view class="list mtb20">
|
<view class="list mtb20">
|
||||||
<view class="item fmid br10">
|
<view class="item fmid br10">
|
||||||
<view class="" @click="pushVideo">展示播放量</view>
|
<view class="" @click="handleShowView">展示播放量</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="item fmid fdc br10">
|
<view class="item fmid fdc br10">
|
||||||
|
@ -369,6 +401,31 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 二级支付 -->
|
||||||
|
<payPwd ref="payPwdRef" @confirm="handlePwdConfirm" />
|
||||||
|
|
||||||
|
<!-- 展播量 -->
|
||||||
|
<uni-popup ref="views" type="center">
|
||||||
|
<view class="viewAlt popMid plr30 bfff">
|
||||||
|
<view class="title mt50 mb30 tac">
|
||||||
|
<view>展示播放量</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="form f28">
|
||||||
|
<view class="row mtb20">
|
||||||
|
<view class="key">消耗榴莲果投流视频/个</view>
|
||||||
|
<view class="value inputBox f1 mt10 plr20">
|
||||||
|
<input v-model="viewCount" type="number" placeholder="单个视频消耗榴莲果数量" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="c999 f26">总消耗{{viewTotal}}个榴莲果,给{{videoIds.length}}个视频投流</view>
|
||||||
|
|
||||||
|
<view class="btn lg black mt10 mb40" @click="pushVideo">推流</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
|
||||||
<!-- 申请表单 -->
|
<!-- 申请表单 -->
|
||||||
<uni-popup ref="applyRef" type="center">
|
<uni-popup ref="applyRef" type="center">
|
||||||
<view class="applyAlt popMid plr60 c333 f36 bfff">
|
<view class="applyAlt popMid plr60 c333 f36 bfff">
|
||||||
|
|
|
@ -454,6 +454,22 @@
|
||||||
form.commission = item.commission
|
form.commission = item.commission
|
||||||
proxy.$refs.productRef.close()
|
proxy.$refs.productRef.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 移除商品
|
||||||
|
function handleRemoveProduct() {
|
||||||
|
if (!form.productId) return
|
||||||
|
util.alert({
|
||||||
|
content: '是否清空所选商品信息',
|
||||||
|
}).then(rs => {
|
||||||
|
if (!rs.confirm) return
|
||||||
|
form.productId = ''
|
||||||
|
form.productName = ''
|
||||||
|
form.productPrice = ''
|
||||||
|
form.productImage = ''
|
||||||
|
form.commission = ''
|
||||||
|
form.popupTime = ''
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -534,7 +550,12 @@
|
||||||
|
|
||||||
<template v-if="userinfo.isShop == 1">
|
<template v-if="userinfo.isShop == 1">
|
||||||
<view class="product mtb20" @click="$refs.productRef.open()">
|
<view class="product mtb20" @click="$refs.productRef.open()">
|
||||||
<view class="key">添加商品链接</view>
|
<view class="header rows" @click.stop>
|
||||||
|
<view class="key">添加商品链接</view>
|
||||||
|
<view class="remove">
|
||||||
|
<uni-icons type="trash" color="#999" size="34rpx" @click="handleRemoveProduct" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="main mtb20 ptb20 tac br20" v-if="!form.productId">点击选择</view>
|
<view class="main mtb20 ptb20 tac br20" v-if="!form.productId">点击选择</view>
|
||||||
<view class="main df oh mtb20 plr30 br20" v-else>
|
<view class="main df oh mtb20 plr30 br20" v-else>
|
||||||
|
|
|
@ -3,8 +3,8 @@ import {
|
||||||
} from 'vite';
|
} from 'vite';
|
||||||
import uni from '@dcloudio/vite-plugin-uni';
|
import uni from '@dcloudio/vite-plugin-uni';
|
||||||
|
|
||||||
let target = 'http://91f.xyz:8080'
|
// let target = 'http://91f.xyz:8080'
|
||||||
// let target = 'http://3dd3096c.r24.cpolar.tops'
|
let target = 'http://27380b6d.r24.cpolar.top'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [uni()],
|
plugins: [uni()],
|
||||||
|
|
Loading…
Reference in New Issue