2025.03.07 工作代码提交
This commit is contained in:
parent
4c8f2050e8
commit
8fd05cc702
|
@ -6,8 +6,8 @@ const config = {
|
|||
// host: 'h5api',
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
host: 'http://91f.xyz:8080',
|
||||
// host: 'http://3dd3096c.r24.cpolar.top',
|
||||
// host: 'http://91f.xyz:8080',
|
||||
host: 'http://27380b6d.r24.cpolar.top',
|
||||
// #endif
|
||||
// 是否vivo显示
|
||||
showVivo: true,
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<script setup>
|
||||
/**
|
||||
/**
|
||||
* 视频菜单组件
|
||||
*
|
||||
*/
|
||||
|
||||
import {
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import video from '../../api/video';
|
||||
import util from '../../common/js/util';
|
||||
} from 'vue'
|
||||
import video from '../../api/video';
|
||||
import util from '../../common/js/util';
|
||||
|
||||
// 传参
|
||||
const props = defineProps({
|
||||
// 传参
|
||||
const props = defineProps({
|
||||
// 列表数据
|
||||
list: {
|
||||
type: Array,
|
||||
|
@ -26,59 +26,50 @@ const props = defineProps({
|
|||
// 多选模式下的 选择数量限制 0为不限制
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
default: 0.
|
||||
},
|
||||
// 是否我自己 0不是 1是
|
||||
isMine: {
|
||||
type: [String, Number],
|
||||
default: 0,
|
||||
},
|
||||
// 是否显示统计 0不显示 1显示
|
||||
statistic: {
|
||||
type: [String, Number],
|
||||
default: 0,
|
||||
},
|
||||
})
|
||||
// 子触发父
|
||||
const emit = defineEmits(['item'])
|
||||
// 已选择的视频id
|
||||
const videoInfo = reactive({
|
||||
videoId: '',
|
||||
coverUrl: '',
|
||||
})
|
||||
// 视频上下文对象
|
||||
const videoContext = ref(null)
|
||||
// 视频播放路径
|
||||
const videoUrl = ref('')
|
||||
}
|
||||
})
|
||||
// 子触发父
|
||||
const emit = defineEmits(['item'])
|
||||
// 已选择的视频id
|
||||
const ids = defineModel('ids')
|
||||
// 视频上下文对象
|
||||
const videoContext = ref(null)
|
||||
// 视频播放路径
|
||||
const videoUrl = ref('')
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(() => {
|
||||
// 创建视频上下文对象
|
||||
videoContext.value = uni.createVideoContext('video')
|
||||
})
|
||||
})
|
||||
|
||||
// 进入全屏
|
||||
function requestFullScreen() {
|
||||
// 进入全屏
|
||||
function requestFullScreen() {
|
||||
videoContext.value.requestFullScreen()
|
||||
}
|
||||
}
|
||||
|
||||
// 暂停
|
||||
function pause() {
|
||||
// 暂停
|
||||
function pause() {
|
||||
// 暂停当前视频
|
||||
videoContext.value.pause()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 点击视频播放
|
||||
* @param {Object} item
|
||||
*/
|
||||
function handleVideo(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
|
||||
|
@ -87,52 +78,56 @@ function handleVideo(item) {
|
|||
}
|
||||
// 菜单模式
|
||||
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)
|
||||
}
|
||||
// 单选模式
|
||||
else if (props.mode == 'checkbox') {
|
||||
videoInfo.videoId = item.id
|
||||
videoInfo.coverUrl = item.coverUrl
|
||||
videoUrl.value = item.videoUrl
|
||||
emit('videoInfo', videoInfo)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 视频进入退出全屏
|
||||
* @param {Object} ev
|
||||
*/
|
||||
function videoFullscreenchange(ev) {
|
||||
function videoFullscreenchange(ev) {
|
||||
// 根据全屏状态决定是否播放盒暂停
|
||||
if (ev.detail.fullScreen) videoContext.value.play()
|
||||
else pause()
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
defineExpose({
|
||||
videoContext,
|
||||
pause,
|
||||
requestFullScreen,
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<!-- 视频菜单 -->
|
||||
<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" />
|
||||
|
||||
<view class="window pfull"></view>
|
||||
|
||||
<!-- 选项 -->
|
||||
<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 />
|
||||
</view>
|
||||
|
||||
<view class="amount pa l0 r0 b0 df ptb10 plr10" v-if="item.play">
|
||||
<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>
|
||||
|
@ -145,8 +140,8 @@ defineExpose({
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
//
|
||||
.list {
|
||||
//
|
||||
.list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-gap: 5rpx;
|
||||
|
@ -170,12 +165,12 @@ defineExpose({
|
|||
opacity: .5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 视频上下文对象
|
||||
.videoContext {
|
||||
// 视频上下文对象
|
||||
.videoContext {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -29,15 +29,18 @@
|
|||
import apex from '@/components/header/apex.vue';
|
||||
// 视频菜单
|
||||
import videoMenu from '@/components/index/videoMenu.vue';
|
||||
//
|
||||
import payPwd from '@/components/mine/payPwd.vue';
|
||||
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance()
|
||||
|
||||
const store = useStore()
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
// 榴莲果兑换播放量数量
|
||||
const durainView = ref(0)
|
||||
// 用户信息
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
// 列表数据
|
||||
const list = reactive({
|
||||
data: [],
|
||||
|
@ -69,18 +72,24 @@
|
|||
})
|
||||
// 已选择的自己的视频列表id
|
||||
const myVideoIds = reactive([])
|
||||
// 播放量
|
||||
const viewCount = ref('')
|
||||
// 播放量消耗的榴莲果
|
||||
const viewTotal = computed(() => {
|
||||
let count = Number(viewCount.value) || 0
|
||||
return count * myVideoIds.length
|
||||
})
|
||||
// 已选择的自己视频列表
|
||||
const myVideos = computed(() => {
|
||||
let result = myVideoIds.map(item => {
|
||||
return list.data.find(node => node.videoId == item) || {}
|
||||
return list.data.find(node => node.id == item) || {}
|
||||
})
|
||||
return result
|
||||
})
|
||||
// 已选择额度视频id
|
||||
const videoIds = computed(() => {
|
||||
let result = [...myVideoIds, ...collectVideoIds.value]
|
||||
return result
|
||||
})
|
||||
// 已选择的视频id
|
||||
const videoIds = computed(() => [...myVideoIds, ...collectVideoIds.value])
|
||||
// 钱包
|
||||
const purse = computed(() => store.state.purse)
|
||||
|
||||
onLoad(() => {
|
||||
// 获取列表
|
||||
|
@ -89,6 +98,8 @@
|
|||
addListener()
|
||||
// 获取果子兑换播放量的比例
|
||||
getDurainViews()
|
||||
// 获取钱包
|
||||
util.getPurse()
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
|
@ -131,7 +142,6 @@
|
|||
// 刷新列表
|
||||
function refreshList() {
|
||||
list.pageNum = 1
|
||||
list.total = 0
|
||||
getList()
|
||||
}
|
||||
|
||||
|
@ -165,8 +175,8 @@
|
|||
})
|
||||
}
|
||||
|
||||
// 推送视频
|
||||
function pushVideo() {
|
||||
// 展示播放
|
||||
function handleShowView() {
|
||||
if (videoIds.value.length < 1) {
|
||||
util.alert({
|
||||
content: "请选择投流视频",
|
||||
|
@ -174,31 +184,21 @@
|
|||
})
|
||||
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({
|
||||
content: "榴莲果不足",
|
||||
showCancel: false,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
api.video.pushVideo({
|
||||
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,
|
||||
})
|
||||
})
|
||||
proxy.$refs.views.close()
|
||||
proxy.$refs.payPwdRef.open()
|
||||
}
|
||||
|
||||
// 完播申请
|
||||
|
@ -267,7 +267,39 @@
|
|||
function link(path) {
|
||||
uni.navigateTo({
|
||||
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>
|
||||
|
||||
|
@ -316,7 +348,7 @@
|
|||
|
||||
<view class="list mtb20">
|
||||
<view class="item fmid br10">
|
||||
<view class="" @click="pushVideo">展示播放量</view>
|
||||
<view class="" @click="handleShowView">展示播放量</view>
|
||||
</view>
|
||||
|
||||
<view class="item fmid fdc br10">
|
||||
|
@ -369,6 +401,31 @@
|
|||
</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">
|
||||
<view class="applyAlt popMid plr60 c333 f36 bfff">
|
||||
|
|
|
@ -454,6 +454,22 @@
|
|||
form.commission = item.commission
|
||||
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>
|
||||
|
||||
<template>
|
||||
|
@ -534,7 +550,12 @@
|
|||
|
||||
<template v-if="userinfo.isShop == 1">
|
||||
<view class="product mtb20" @click="$refs.productRef.open()">
|
||||
<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 df oh mtb20 plr30 br20" v-else>
|
||||
|
|
|
@ -3,8 +3,8 @@ import {
|
|||
} from 'vite';
|
||||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
|
||||
let target = 'http://91f.xyz:8080'
|
||||
// let target = 'http://3dd3096c.r24.cpolar.tops'
|
||||
// let target = 'http://91f.xyz:8080'
|
||||
let target = 'http://27380b6d.r24.cpolar.top'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
|
|
Loading…
Reference in New Issue