From 79742a0a1e5166e42f5530917d700742a0df8edd Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Mon, 31 Mar 2025 09:45:26 +0800 Subject: [PATCH] =?UTF-8?q?2025.03.29=20~=202025.03.30=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiuyi2/api/durian.js | 21 +- jiuyi2/components/index/videoMenu.vue | 11 +- jiuyi2/pages/index/dataCenter/push.vue | 318 ++++++++++++------------- jiuyi2/pages/index/durian.vue | 2 +- 4 files changed, 179 insertions(+), 173 deletions(-) diff --git a/jiuyi2/api/durian.js b/jiuyi2/api/durian.js index 82de2070..d878d517 100644 --- a/jiuyi2/api/durian.js +++ b/jiuyi2/api/durian.js @@ -75,8 +75,9 @@ export const durian = { load: true, }) }, + /** - * 榴莲果配置 + * 榴莲果互转配置 * @param {Object} param */ durianFruitConfig() { @@ -85,17 +86,31 @@ export const durian = { method: 'GET', }) }, + /** - * 获取榴莲果兑换播放量比例 + * 获取榴莲果兑换展播量比例 * @param {Object} param */ - getDurainViews(param) { + getShowPlayConfig(param) { return util.request({ url: `/coreplay/durianFruitTransactionType/5`, method: 'GET', data: param.data, }) }, + + /** + * 获取榴莲果兑换完播量比例 + * @param {Object} param + */ + getFullPlayConfig(param) { + return util.request({ + url: `/coreplay/durianFruitTransactionType/7`, + method: 'GET', + data: param.data, + }) + }, + /** * 获取榴莲果交易列表 * @param {Object} param diff --git a/jiuyi2/components/index/videoMenu.vue b/jiuyi2/components/index/videoMenu.vue index d75dab34..bd09dcb1 100644 --- a/jiuyi2/components/index/videoMenu.vue +++ b/jiuyi2/components/index/videoMenu.vue @@ -24,10 +24,10 @@ type: String, default: 'list', }, - // 多选模式下的 选择数量限制 0为不限制 + // 多选模式下的 选择数量限制 0为不限制 1为单选 limit: { type: Number, - default: 0. + default: 0, }, // 是否我自己 0不是 1是 isMine: { @@ -87,8 +87,13 @@ const findIndex = ids.value.findIndex(node => node == item.id) if (findIndex >= 0) ids.value.splice(findIndex, 1) else { + // 如果是单选 + if (props.limit == 1) { + ids.value[0] = item.id + return + } // 如果有限制 且 数量到达上限 - if (props.limit != 0 && props.limit <= ids.value.length) return + else if (props.limit != 0 && props.limit <= ids.value.length) return ids.value.push(item.id) } } diff --git a/jiuyi2/pages/index/dataCenter/push.vue b/jiuyi2/pages/index/dataCenter/push.vue index 750f829a..26a952c3 100644 --- a/jiuyi2/pages/index/dataCenter/push.vue +++ b/jiuyi2/pages/index/dataCenter/push.vue @@ -37,68 +37,54 @@ } = getCurrentInstance() const store = useStore() - // 榴莲果兑换播放量数量 - const durainView = ref(0) + // 榴莲果兑换展播量比例 + const durainChangeShowPlay = ref(0) + // 榴莲果兑换完播量比例 + const durainChangeFullPlay = ref(0) + // 榴莲果 + const durainChangeFullPlayLimit = ref(0) // 用户信息 const userinfo = computed(() => store.state.userinfo) - // 列表数据 + // 我的视频列表 const list = reactive({ data: [], pageSize: 10, pageNum: 1, total: 0, }) - // 表单 - const form = reactive({ - userId: userinfo.value.userId, - videoId: [], - reason: '', - context: '', - pic: [], - }) - // 表单 - const apply = reactive({ - author: '', - mobile: '', - mail: '', - address: '', - }) - // 收藏的视频 - const collectVideo = ref({}) - // 已选择的自己的视频列表id - const myVideoIds = reactive([]) - // 播放量 - const viewCount = ref('') - // 播放量消耗的榴莲果 - const viewTotal = computed(() => { - let total = Number(viewCount.value) || 0 - let count = myVideoIds.length - if (collectVideo.value.id) count++ - return total * count - }) - // 已选择的自己视频列表 - const myVideos = computed(() => { - let result = myVideoIds.map(item => { - return list.data.find(node => node.id == item) || {} - }) + // 选择的我的作品 + const myVideo = ref({}) + // 选择的收藏的视频 + const collecVideo = ref({}) + // 申请数量 + const playNum = ref('') + // 榴莲果交易类型 5展播量兑换 7完播量兑换 + const transactionType = ref('') + // 已选择的视频 + const selectVideo = computed(() => myVideo.value || collecVideo.value || {}) + // 榴莲果支付价格 + const price = computed(() => { + let result = parseFloat(playNum.value) + if (transactionType.value == 5) result = result + if (transactionType.value == 7) result = result + durainChangeFullPlayLimit.value return result }) - // 已选择的视频id - const videoIds = computed(() => { - let result = [...myVideoIds] - if (collectVideo.value.id) result.push(collectVideo.value.id) - return result + // 展播量预计结果 + const showPlayCount = computed(() => { + return (playNum.value || 0) * durainChangeShowPlay.value }) // 钱包 const purse = computed(() => store.state.purse) onLoad(() => { - // 获取列表 + // 获取视频列表 getList() // 开启监听 addListener() - // 获取果子兑换播放量的比例 - getDurainViews() + // 获取榴莲果兑换展播量 + getShowPlayConfig() + // 获取榴莲果兑换完播量 + getFullPlayConfig() // 获取钱包 util.getPurse() }) @@ -111,7 +97,8 @@ function addListener() { // 选择投流的收藏视频 uni.$on('selectPushCollectVideo', (item) => { - collectVideo.value = item + myVideo.value = {} + collecVideo.value = item }) } @@ -120,12 +107,29 @@ uni.$off('selectPushCollectVideo') } - // 获取果子兑换播放量的比例 - function getDurainViews() { - api.durian.getDurainViews({}).then(rs => { + // 获取榴莲果兑换展播量比例 + function getShowPlayConfig() { + api.durian.getShowPlayConfig({}).then(rs => { if (rs.code == 200) { - // 榴莲果兑换 - durainView.value = rs.data.proportion + // 展播量兑换比例 + durainChangeShowPlay.value = rs.data.proportion + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) + } + + // 获取榴莲果兑换完播量比例 + function getFullPlayConfig() { + api.durian.getFullPlayConfig({}).then(rs => { + if (rs.code == 200) { + // 完播量兑换比例 + durainChangeFullPlay.value = rs.data.proportion + // 完播量兑换门槛 + durainChangeFullPlayLimit.value = rs.data.minConsumption return } util.alert({ @@ -171,92 +175,80 @@ }) } - // 展示播放 - function handleShowView() { - console.log('videoIds', videoIds.value) - if (videoIds.value.length < 1) { - util.alert({ - content: "请选择投流视频", - showCancel: false, - }) + /** + * 选择我的视频 + * @param {Object} item 选择的视频对象 + */ + function handleMyWork(item) { + myVideo.value = item + collecVideo.value = {} + proxy.$refs.select.close() + } + + // 展播量申请弹窗 + function handleShowViewRef() { + if (!selectVideo.value.id) { + util.alert("请选择需要投流的视频") return } - // - proxy.$refs.views.open() + proxy.$refs.viewsRef.open() + } + + // 完播量申请弹窗 + function handleShowApplyRef() { + if (!myVideo.value.id) { + util.alert("请选择自己的作品") + return + } + proxy.$refs.applyRef.open() } // 推送视频 - function pushVideo() { - if (purse.value.fruit <= videoIds.value.length * 10) { + function handlePushShow() { + if (purse.value.fruit <= playNum.value * durainChangeShowPlay.value) { util.alert({ content: "榴莲果不足", showCancel: false, }) return } - proxy.$refs.views.close() + // 展播量 + transactionType.value = 5 + proxy.$refs.viewsRef.close() proxy.$refs.payPwdRef.open() } // 完播申请 - function applyVideo() { - if (videoIds.value.length < 1) { - util.alert({ - content: "请选择投流视频", - showCancel: false, - }) - return - } - - if (userinfo.value.fruit <= videoIds.value.length * 10) { + function handlePushFull() { + if (purse.value.fruit <= playNum.value * durainChangeFullPlay.value + durainChangeFullPlayLimit.value) { util.alert({ content: "榴莲果不足", showCancel: false, }) return } - - api.video.applyVideo({ - data: { - videoIds: videoIds.value.join(","), - author: apply.author, - mobile: apply.mobile, - address: apply.address, - mail: apply.mail - } - }).then(rs => { - if (rs.code === 200) { - proxy.$refs.applyRef.close() - util.alert('申请成功,请等待后台审核') - util.getUserinfo() - return - } - - util.alert({ - content: rs.msg, - showCancel: false, - }) - }) + // 展播量 + transactionType.value = 7 + proxy.$refs.applyRef.close() + proxy.$refs.payPwdRef.open() } /** - * 确认取消投流 - * @param {Object} item - * @param {Object} index + * 取消选择的收藏的别人的视频 */ - function handleCancel(item, index) { + function handleCancel() { util.alert({ - content: `确认取消投流${item.title}`, + content: `确认取消投流${selectVideo.title}`, }).then(rs => { if (!rs.confirm) return - collectVideo.value = {} + selectVideo.value = {} }) } // 推流收藏视频 function pushCollect() { link(util.setUrl('/pages/index/dataCenter/pushVideoCollects', { - ids: collectVideo.value.id, + ids: selectVideo.value.id, })) } @@ -267,23 +259,26 @@ }) } - // 二级密码确认 - function handlePwdConfirm(ev) { + /** + * 二级密码确认 + * @param {Object} event 二级密码 + */ + function handlePwdConfirm(event) { // 榴莲果交易 api.durian.consume({ data: { // 更新用户信息 userId: userinfo.value.id, // 交易类型 - transactionType: 5, + transactionType: transactionType.value, // 榴莲果交易数量 - fruitAmount: viewTotal.value, + fruitAmount: price.value, // 交易值 - totalAmount: viewTotal.value, + totalAmount: price.value, // 二级密码 - secondPassword: ev, + secondPassword: event, // 视频id - videoIds: videoIds.value, + videoIds: [selectVideo.value.id], } }).then(rs => { if (rs.code === 200) { @@ -308,27 +303,25 @@ - - + 我想投流的视频 - 点击选择视频,已选择{{myVideos.length}}个 - - 选择视频 + + 选择自己的作品 - + - - + + @@ -347,23 +340,24 @@ - + - + - {{collectVideo.title}} - {{collectVideo.userNickname}} + {{collecVideo.title}} + {{collecVideo.userNickname}} - 商家出让佣金 {{collectVideo.commission}} + 商家出让佣金 {{collecVideo.commission}} + - 取消 + 取消 @@ -371,42 +365,51 @@ - + 我想要 - + 展示播放量 - 无需平台审核 - 投流 + + 投流 - + 完播播放量 - 需申请平台审核 - 申请 + + 申请 + + + + 投流说明: + 1. 只能选择一个视频用来投流推广。 + 2. 展示播放量可以选择自己发布的视频和收藏的视频。 + 3. 完播播放量只能选择自己的视频,需要先向平台发起申请。 + - 消耗{{videoIds.length}}*1 榴莲果可提升 {{videoIds.length}}*{{durainView}}+ 展示量 + + 消耗 1 榴莲果可提升 {{durainChangeShowPlay}}+ 展示播放量 + 消耗 1 榴莲果可提升 {{durainChangeFullPlay}}+ 完播播放量 当前拥有{{userinfo.fruit}}榴莲果 - - + - - + + 展示播放量 @@ -414,56 +417,39 @@ - 消耗榴莲果投流视频/个 + 耗榴莲果投流视频 - + - 总消耗{{viewTotal}}个榴莲果,给{{videoIds.length}}个视频投流 + 预计获得 {{showPlayCount}}+ 展示播放量 - 推流 + 推流 - + 完播播放量 - 消耗10颗榴莲果 + 消耗{{durainChangeFullPlayLimit}}榴莲果 - - 视频作者: - - - - - - 手机号: - - - - - - 邮箱号: - - - - - - 地址: - - + + 消耗榴莲果: + + - 不论是否申请成功,榴莲果直接销毁 - 提交申请 + 申请成功则消耗全部榴莲果,申请不成功则返回申请榴莲果 + + 提交申请 @@ -484,7 +470,7 @@ - + diff --git a/jiuyi2/pages/index/durian.vue b/jiuyi2/pages/index/durian.vue index 7dc97135..43587ae8 100644 --- a/jiuyi2/pages/index/durian.vue +++ b/jiuyi2/pages/index/durian.vue @@ -228,7 +228,7 @@ }) } - // 榴莲果配置 + // 榴莲果互转配置 function getConfig() { api.durian.durianFruitConfig().then(rs => { if (rs.code == 200) {