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',
// #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,

View File

@ -1,138 +1,133 @@
<script setup>
/**
* 视频菜单组件
*
*/
/**
* 视频菜单组件
*
*/
import {
ref,
reactive,
onMounted
} from 'vue'
import video from '../../api/video';
import util from '../../common/js/util';
import {
ref,
reactive,
onMounted
} from 'vue'
import video from '../../api/video';
import util from '../../common/js/util';
//
const props = defineProps({
//
list: {
type: Array,
},
// list menu checkbox
mode: {
type: String,
default: 'list',
},
// 0
limit: {
type: Number,
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 props = defineProps({
//
list: {
type: Array,
},
// list menu checkbox
mode: {
type: String,
default: 'list',
},
// 0
limit: {
type: Number,
default: 0.
},
// 0 1
isMine: {
type: [String, Number],
default: 0,
}
})
//
const emit = defineEmits(['item'])
// id
const ids = defineModel('ids')
//
const videoContext = ref(null)
//
const videoUrl = ref('')
onMounted(() => {
//
videoContext.value = uni.createVideoContext('video')
})
onMounted(() => {
//
videoContext.value = uni.createVideoContext('video')
})
//
function 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()
//
function requestFullScreen() {
videoContext.value.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)
}
//
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) {
//
if (ev.detail.fullScreen) videoContext.value.play()
else pause()
}
}
/**
* 视频进入退出全屏
* @param {Object} ev
*/
function videoFullscreenchange(ev) {
//
if (ev.detail.fullScreen) videoContext.value.play()
else pause()
}
defineExpose({
videoContext,
pause,
requestFullScreen,
})
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,37 +140,37 @@ defineExpose({
</template>
<style lang="scss" scoped>
//
.list {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 5rpx;
//
.list {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 5rpx;
.item {
height: 360rpx;
.item {
height: 360rpx;
image {
width: 100%;
height: 100%;
image {
width: 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>

View File

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

View File

@ -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="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 df oh mtb20 plr30 br20" v-else>

View File

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