2025.03.07 工作代码提交

This commit is contained in:
sx 2025-03-08 09:40:51 +08:00
parent 4c8f2050e8
commit 8fd05cc702
5 changed files with 244 additions and 171 deletions

View File

@ -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,

View File

@ -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>

View File

@ -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">

View File

@ -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>

View File

@ -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()],