修改ios審核時候的視頻播放

This commit is contained in:
duan 2025-01-18 09:51:56 +08:00
parent 503f1d4594
commit 940cf8c2e7
10 changed files with 189 additions and 110 deletions

View File

@ -2,11 +2,11 @@
"version" : "1.0", "version" : "1.0",
"configurations" : [ "configurations" : [
{ {
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {
"playground" : "standard", "playground" : "custom",
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
} }
] ]

View File

@ -3,17 +3,24 @@ import http from '@/http/http.js'
//获取短剧视频详情 //获取短剧视频详情
export function getVideoDetail(data) { export function getVideoDetail(data) {
return http.request({ return http.request({
url: 'course/courseSets?courseId='+data.courseId, url: 'course/courseSets',
data data: data
}) })
} }
//追剧 //追剧
export function zhuiju(data) { export function zhuiju(data) {
return http.request({ return http.request({
url: 'courseCollect/insertCourseCollect', url: 'courseCollect/insertCourseCollect',
method:'POST', method: 'POST',
data:{ data: {
classify:1, classify: 1,
...data ...data
} }
}) })
@ -23,9 +30,9 @@ export function zhuiju(data) {
export function dianzan(data) { export function dianzan(data) {
return http.request({ return http.request({
url: 'courseCollect/insertCourseCollect', url: 'courseCollect/insertCourseCollect',
method:'POST', method: 'POST',
data:{ data: {
classify:2, classify: 2,
...data ...data
} }
}) })
@ -33,13 +40,13 @@ export function dianzan(data) {
//插入播放历史记录 //插入播放历史记录
export function insertHistory(data){ export function insertHistory(data) {
return http.request({ return http.request({
url: 'courseCollect/insertCourseCollect', url: 'courseCollect/insertCourseCollect',
method:'POST', method: 'POST',
data:{ data: {
classify:3, classify: 3,
type:1, type: 1,
...data ...data
} }
}) })
@ -54,12 +61,12 @@ export function getJinbiBili(data) {
} }
//获取推荐视频 //获取推荐视频
export function tuijianVideo(data){ export function tuijianVideo(data) {
const randomNum=10+ Math.ceil(Math.random()*20) const randomNum = 10 + Math.ceil(Math.random() * 20)
return http.request({ return http.request({
url: 'course/selectCourseDetailsList', url: 'course/selectCourseDetailsList',
method:'GET', method: 'GET',
data:{ data: {
page: 1, page: 1,
limit: 10, limit: 10,
randomNum: randomNum randomNum: randomNum
@ -67,64 +74,67 @@ export function tuijianVideo(data){
}) })
} }
//解锁10集视频 //解锁10集视频
export function buyTenVideo(data){ export function buyTenVideo(data) {
return http.request({ return http.request({
url: 'order/insertCourseOrders/limit10', url: 'order/insertCourseOrders/limit10',
method:'GET', method: 'GET',
data:data data: data
}) })
} }
//解锁单集或者全部视频 //解锁单集或者全部视频
export function buyVideo(data){ export function buyVideo(data) {
return http.request({ return http.request({
url: 'order/insertCourseOrders', url: 'order/insertCourseOrders',
method:'GET', method: 'GET',
data:data data: data
}) })
} }
//订单支付 //订单支付
export function payOrder(data){ export function payOrder(data) {
let payType='h5' let payType = 'h5'
// #ifdef APP // #ifdef APP
payType='app' payType = 'app'
// #endif // #endif
return http.request({ return http.request({
url: 'wuyou/payOrder/'+data.orderId+'?payType='+payType, url: 'wuyou/payOrder/' + data.orderId + '?payType=' + payType,
method:'GET' method: 'GET'
}) })
} }
//获取订单支付状态 //获取订单支付状态
export function getOrderInfo(data){ export function getOrderInfo(data) {
return http.request({ return http.request({
url: 'wuyou/queryOrder/'+data.orderId, url: 'wuyou/queryOrder/' + data.orderId,
method:'GET' method: 'GET'
}) })
} }
//金币解锁 //金币解锁
export function goldPay(data){ export function goldPay(data) {
return http.request({ return http.request({
url: 'order/payOrders', url: 'order/payOrders',
method:'POST', method: 'POST',
data:{...data,header:{ data: {
'content-type':'application/x-www-form-urlencoded' ...data,
}} header: {
'content-type': 'application/x-www-form-urlencoded'
}
}
}) })
} }
//获取转盘抽奖次数 //获取转盘抽奖次数
export function getDrawCount(data){ export function getDrawCount(data) {
return http.request({ return http.request({
url: 'discSpinning/drawCount', url: 'discSpinning/drawCount',
method:'GET', method: 'GET',
data data
}) })
} }
//播放开始或者结束 //播放开始或者结束
export function playStatus(data){ export function playStatus(data) {
return http.request({ return http.request({
url: 'course/viewCourse', url: 'course/viewCourse',
method:'GET', method: 'GET',
data data
}) })
} }

View File

@ -5,13 +5,12 @@
@change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1" @change="swiperChange" :current="current" :circular="true" vertical class="u-flex-1"
@transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200"> @transition="transition" :indicator-dots="false" :autoplay="false" :interval="0" :duration="200">
<swiper-item v-for="(item,index) in videoList" :key="index"> <swiper-item v-for="(item,index) in videoList" :key="index">
<list-item-vue :total="list.length" :item="item" :isCommand="isCommand" <list-item-vue :total="list.length" :item="item" :isCommand="isCommand" :height="wHeight"
:height="wHeight" @playStatusChange="playStatusChange" :showControls="control.showControls" :current="current"
@playStatusChange="playStatusChange" :isCollect="isCollect" @toDetail="toDetail(item,index)" @controlstoggles="controlstoggles"
:showControls="control.showControls" :current="current" :isCollect="isCollect" :playSpeeds="playSpeeds" :index="index" :nowIndex="nowIndex"
@toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :playSpeeds="playSpeeds" @dianzanClick="dianzanClick(item,index)" @share="share(item)" @zhuijuClick="zhuijuClick(item)"
:index="index" :nowIndex="nowIndex" @dianzanClick="dianzanClick(item,index)" @share="share(item)" @popupShow="popupShow($event,item,index)"></list-item-vue>
@zhuijuClick="zhuijuClick(item)" @popupShow="popupShow($event,item,index)"></list-item-vue>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
@ -23,13 +22,12 @@
<cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)"> <cell v-for="(item,index) in list" :key="item.courseDetailsId" :ref="setRefList(index)">
<view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')"> <view class="swipers-items" :style="boxStyle" @longpress="popupShow('speed')">
<list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect" <list-item-vue :total="list.length" :item="item" :current="current" :isCollect="isCollect"
@playStatusChange="playStatusChange" @playStatusChange="playStatusChange" :height="wHeight" :isCommand="isCommand"
:height="wHeight" :showControls="control.showControls" @toDetail="toDetail(item,index)" @itemMounted="itemMounted"
:isCommand="isCommand" :showControls="control.showControls" @toDetail="toDetail(item,index)" @controlstoggles="controlstoggles" :index="index" :instance="instance" :nowIndex="nowIndex"
@itemMounted="itemMounted" @controlstoggles="controlstoggles" :index="index" :instance="instance" @appear="appear($event,item,index)" :playSpeeds="playSpeeds" @disappear="disappear(item,index)"
:nowIndex="nowIndex" @appear="appear($event,item,index)" :playSpeeds="playSpeeds" @dianzanClick="dianzanClick(item,index)" @share="share(item)" @zhuijuClick="zhuijuClick(item)"
@disappear="disappear(item,index)" @dianzanClick="dianzanClick(item,index)" @share="share(item)" @popupShow="popupShow($event,item,index)"></list-item-vue>
@zhuijuClick="zhuijuClick(item)" @popupShow="popupShow($event,item,index)"></list-item-vue>
</view> </view>
</cell> </cell>
</list> </list>
@ -102,6 +100,8 @@
</view> </view>
</view> </view>
</up-popup> </up-popup>
<!-- 支付确认 --> <!-- 支付确认 -->
<up-popup :show="popup.payTips" :round="10" @close="popupClose('payTips')" :customStyle="customStyle"> <up-popup :show="popup.payTips" :round="10" @close="popupClose('payTips')" :customStyle="customStyle">
<view class="u-p-30"> <view class="u-p-30">
@ -166,7 +166,6 @@
getElRect getElRect
} from '@/utils/util.js' } from '@/utils/util.js'
const $common = useCommonStore() const $common = useCommonStore()
// #ifdef APP // #ifdef APP
const domModule = uni.requireNativePlugin('dom') const domModule = uni.requireNativePlugin('dom')
// #endif // #endif
@ -190,6 +189,9 @@
onMounted, onMounted,
getCurrentInstance getCurrentInstance
} from 'vue'; } from 'vue';
import {
onShow
} from '@dcloudio/uni-app'
let initing = true let initing = true
const refPoster = ref(null) const refPoster = ref(null)
@ -237,7 +239,10 @@
// #ifdef APP // #ifdef APP
control.showControls = false control.showControls = false
// #endif // #endif
let isExamine = ref()
onShow(() => {
$common.init()
})
const customStyle = computed(() => { const customStyle = computed(() => {
// #ifdef H5 // #ifdef H5
return { return {
@ -543,7 +548,7 @@
} }
function popupShow(key = 'show', item, index) { function popupShow(key = 'show', item, index) {
console.log(item); console.log(key, item, 'debug');
if (key == 'show') { if (key == 'show') {
// #ifdef H5 // #ifdef H5
nextTick(() => { nextTick(() => {
@ -560,6 +565,8 @@
popup.data = item popup.data = item
popup.index = index popup.index = index
} }
} }
@ -707,11 +714,13 @@
const insertHistory = debounce(() => { const insertHistory = debounce(() => {
const item = videoList.value[current.value] if (uni.getStorageSync("token")) {
Api.insertHistory({ const item = videoList.value[current.value]
courseId: item.courseId, Api.insertHistory({
courseDetailsId: item.courseDetailsId courseId: item.courseId,
}) courseDetailsId: item.courseDetailsId
})
}
}, 1000) }, 1000)
function swiperChange(e) { function swiperChange(e) {
@ -723,8 +732,10 @@
setVideoList(item) setVideoList(item)
} }
const refPopup=ref(null)
function setVideoList(item) { function setVideoList(item) {
const listLen = props.list.length const listLen = props.list.length
const lastIndex = listLen - 1 const lastIndex = listLen - 1
const index = props.list.findIndex(v => v.courseDetailsId == item.courseDetailsId) const index = props.list.findIndex(v => v.courseDetailsId == item.courseDetailsId)
@ -764,9 +775,10 @@
videoList.value = [props.list[index + 1], props.list[index - 1], item] videoList.value = [props.list[index + 1], props.list[index - 1], item]
} }
} }
console.log(videoList.value); console.log(videoList.value, 'debug');
if (!item.videoUrl) { if (!item.videoUrl) {
popupShow('pay', item, index) popupShow('pay', item, index)
} }
} }
@ -822,7 +834,7 @@
* @param {type} = [start,end] * @param {type} = [start,end]
*/ */
const playStatusChange = debounce((data) => { const playStatusChange = debounce((data) => {
Api.playStatus(data) Api.playStatus(data)
}, 2000) }, 2000)

View File

@ -2,8 +2,8 @@
"name" : "duanju-app-v3", "name" : "duanju-app-v3",
"appid" : "__UNI__E0B05B1", "appid" : "__UNI__E0B05B1",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "2.3.4",
"versionCode" : 100, "versionCode" : 234,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

@ -254,5 +254,15 @@
} }
] ]
}, },
"uniIdRouter": {} "uniIdRouter": {},
"condition" : { //
"current": 0, //(list )
"list": [
{
"name": "", //
"path": "", //
"query": "" //onLoad
}
]
}
} }

View File

@ -10,7 +10,7 @@
</view> --> </view> -->
</view> </view>
<template v-if="$common.isIosExamine()"> <template v-if="$common.isIosExamine">
<view class="gongao"> <view class="gongao">
<view class="gongaoicon"> <view class="gongaoicon">
公告 公告
@ -42,7 +42,7 @@
</view> </view>
</view> </view>
<contentlist :list='datas.list'></contentlist> <contentlist :list='datas.list'></contentlist>
<image v-if="$common.isIosExamine()" @click="goMsg()" src="@/static/index/red-pack-new.gif" <image v-if="$common.isIosExamine" @click="goMsg()" src="@/static/index/red-pack-new.gif"
style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;" mode=""></image> style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;" mode=""></image>
<up-modal :show="datas.version.show" :confirm-text="datas.version.confirmText" <up-modal :show="datas.version.show" :confirm-text="datas.version.confirmText"
:showCancelButton="datas.version.cancelText!=''" @confirm='confirmUpdateVersion' :title="datas.version.title" :showCancelButton="datas.version.cancelText!=''" @confirm='confirmUpdateVersion' :title="datas.version.title"
@ -53,7 +53,7 @@
</scroll-view> </scroll-view>
</view> </view>
</up-modal> </up-modal>
<up-modal :show="datas.ruleShow" v-if="$common.isIosExamine()&&!datas.version.show" confirm-text="知道了" title="规则说明" <up-modal :show="datas.ruleShow" v-if="$common.isIosExamine&&!datas.version.show" confirm-text="知道了" title="规则说明"
:title="datas.rule_title" :title-style="{fontWeight:'700'}" @confirm="ruleConfirm" :title="datas.rule_title" :title-style="{fontWeight:'700'}" @confirm="ruleConfirm"
confirm-color="rgb(255, 117, 129)"> confirm-color="rgb(255, 117, 129)">
<view class="u-p-30 u-text-left"> <view class="u-p-30 u-text-left">
@ -94,8 +94,10 @@
} from '@/store/common.js' } from '@/store/common.js'
const $common = useCommonStore() const $common = useCommonStore()
onShow(()=>{ onShow(()=>{
console.log('cash:'+uni.getStorageSync('userInfo').userId + "" + new Date().getTime(),'debug')
// ios // ios
$common.init() $common.init()
$common.setversion()
}) })
let datas = reactive({ let datas = reactive({
noticeList: [], // noticeList: [], //
@ -123,7 +125,7 @@
versionUpdate() versionUpdate()
getMsg() getMsg()
getrecomVideo() getrecomVideo()
datas.isExamine = $common.isExamine || 0 datas.isExamine = $common.isIosExamine || 0
}) })
onReady(() => { onReady(() => {
if(!uni.getStorageSync('ruleShow')){ if(!uni.getStorageSync('ruleShow')){
@ -158,8 +160,8 @@
} }
if (uni.getSystemInfoSync().platform == 'ios') { if (uni.getSystemInfoSync().platform == 'ios') {
version = res.iosVersion version = res.iosVersion
$common.setversion(widgetInfo.version,version)
} }
console.log(widgetInfo.version + '---' + version)
version = res.version version = res.version
// && uni.getSystemInfoSync().platform == 'android' // && uni.getSystemInfoSync().platform == 'android'
if (widgetInfo.version < version) { if (widgetInfo.version < version) {

View File

@ -31,7 +31,7 @@
<view class="title">我的追剧</view> <view class="title">我的追剧</view>
<view class="num">{{ likeData.collectCount }}</view> <view class="num">{{ likeData.collectCount }}</view>
</navigator> </navigator>
<view class="item" v-if="$common.isIosExamine()" @click="linkTo('/pages/me/withdraw/index')"> <view class="item" v-if="$common.isIosExamine" @click="linkTo('/pages/me/withdraw/index')">
<view class="title">我的红包</view> <view class="title">我的红包</view>
<view class="num">{{ amount || 0 }}</view> <view class="num">{{ amount || 0 }}</view>
</view> </view>

View File

@ -42,19 +42,17 @@
<view class="subhead ">{{ item.detail }}</view> <view class="subhead ">{{ item.detail }}</view>
</view> </view>
<view class="cell_right "> <view class="cell_right ">
<view v-if="item.disabled" class="btn " <view v-if=" item.disabled " class="btn u-font-24 text-bold"
:style="{ backgroundColor: item.buttonBgColor, color: item.buttonFontColor }" :style="{backgroundColor: item.buttonBgColor,color: item.buttonFontColor }"
@tap="goNav(item)"> @click="goNav(item)">
{{ item.type == 1 ? item.buttonTitle : item.number ? `${item.discNumber}/${item.number}` : ( {{ item.type == 1 ? item.buttonTitle : item.number ? `${item.discNumber}/${item.number}` : ( item.discNumber <= 0 ? item.buttonTitle : `剩余${item.discNumber}`) }}
item.discNumber <= 0 ? item.buttonTitle : `剩余${item.discNumber}`) }}
</view> </view>
<view v-else class="btn disabled"> <view v-else class="btn u-font-24 text-bold disabled">
{{ item.type == 1 ? item.buttonTitle : item.number ? `${item.discNumber}/${item.number}` {{ item.type == 1 ? item.buttonTitle : item.number ? `${item.discNumber}/${item.number}` : ( item.discNumber <= 0 ? item.buttonTitle : `剩余${item.discNumber}`) }}
: (item.discNumber <= 0 ? item.buttonTitle : `剩余${item.discNumber}`) }} </view>
<view v-if="item.buttonUnderContent && item.buttonUnderUrl" class=" tip" <view v-if=" item.buttonUnderContent && item.buttonUnderUrl " class="u-font-22 tip" style="text-align: center;"
@tap="goNav(item, item.buttonUnderUrl)"> @click="goNav({id: item.id,buttonUrl: item.buttonUnderUrl, jumpType: 1,title: item.title, disabled: item.disabled, discNumber: item.discNumber})">
{{ item.buttonUnderContent }} {{ item.buttonUnderContent}}
</view>
</view> </view>
</view> </view>
</view> </view>
@ -414,7 +412,7 @@
async function getTaskdata() { async function getTaskdata() {
let res = await selectTaskCenter() let res = await selectTaskCenter()
let arrData = [] let arrData = []
if (!$common.isIosExamine()) { if (!$common.isIosExamine) {
res.forEach(ele => { res.forEach(ele => {
if (ele.title.indexOf('分享奖励') == -1 && ele.title.indexOf('新人福利') == -1 && if (ele.title.indexOf('分享奖励') == -1 && ele.title.indexOf('新人福利') == -1 &&
ele.title.indexOf('观看视频奖励') == -1) { ele.title.indexOf('观看视频奖励') == -1) {

View File

@ -1,17 +1,24 @@
<template> <template>
<view class="min-page"> <view class="min-page">
<my-video-list ref="refVideoList" v-if="state.list.length" @swiperChange="swiperChange" :list="state.list" <my-video-list ref="refVideoList" v-if="state.list.length" @swiperChange="swiperChange" :list="state.list"
:options="options" :options="options" @update="update" :info="state"></my-video-list>
@update="update" :info="state"></my-video-list>
</view> </view>
</template> </template>
<script setup> <script setup>
import { import {
onLoad,onHide, onLoad,
onHide,
onShow onShow
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import {
login
} from '@/api/login/login.js';
import * as Api from '@/api/video/index.js' import * as Api from '@/api/video/index.js'
import {
useCommonStore
} from '@/store/common.js';
const $common = useCommonStore();
import { import {
reactive, reactive,
ref ref
@ -23,7 +30,7 @@
const sysInfo = uni.getSystemInfoSync() const sysInfo = uni.getSystemInfoSync()
let isFirstLoad = true let isFirstLoad = true
let options = { let options = {
courseDetailsId:'' courseDetailsId: ''
} }
const state = reactive({ const state = reactive({
collect: 0, collect: 0,
@ -34,11 +41,40 @@
}) })
const refVideoList = ref(null) const refVideoList = ref(null)
async function init() { async function init() {
try { /**
* 如果是安卓則不做操作如果是ios判斷是否審核不審核不套裝
*/
// 是否审核,是否ios
if ($common.isIosExamine) {
const res = await Api.getVideoDetail(options) const res = await Api.getVideoDetail(options)
isFirstLoad = false isFirstLoad = false
Object.assign(state, res) Object.assign(state, res)
state.list = res.list state.list = res.list
} else {
// ios是否登錄
console.log(uni.getStorageSync('tokenTwo'),'提送hi')
if (uni.getStorageSync('tokenTwo')) {
const res = await Api.getVideoDetail({...options,token:uni.getStorageSync('tokenTwo')})
isFirstLoad = false
Object.assign(state, res)
state.list = res.list
} else {
let res = await login({
password: '123456',
phone: '18681817128'
})
uni.setStorageSync('tokenTwo', res.token)
init()
}
}
// 是否审核,是否ios 保存本地
// 18681817128 123456 测试环境和正式环境都是这个账号 等会给添加上会员就可以了
// return res.token
try {
} catch (error) { } catch (error) {
// if(getCurrentPages().length>=2){ // if(getCurrentPages().length>=2){
// uni.navigateBack() // uni.navigateBack()
@ -81,7 +117,7 @@
const nobuyCourseId = uni.getStorageSync('nobuyCourseId') const nobuyCourseId = uni.getStorageSync('nobuyCourseId')
const item = state.list.find(v => v.courseId == nobuyCourseId) const item = state.list.find(v => v.courseId == nobuyCourseId)
uni.removeStorageSync('nobuyCourseId') uni.removeStorageSync('nobuyCourseId')
if(item){ if (item) {
if (drawRes.count * 1 > 0 && nobuyCourseId !== null && nobuyCourseId !== undefined && item if (drawRes.count * 1 > 0 && nobuyCourseId !== null && nobuyCourseId !== undefined && item
.videoUrl) { .videoUrl) {
uni.navigateTo({ uni.navigateTo({

View File

@ -38,7 +38,6 @@ const $map = {
922: 'withdrawNum', 922: 'withdrawNum',
500: 'payTips', 500: 'payTips',
914: 'goldBili', // 金币比例 914: 'goldBili', // 金币比例
919: 'isExamine' //是否ios审核中
} }
export const useCommonStore = defineStore("common", { export const useCommonStore = defineStore("common", {
@ -46,15 +45,15 @@ export const useCommonStore = defineStore("common", {
return { return {
payTips: '付款完成后不要忘记抽红包哦', payTips: '付款完成后不要忘记抽红包哦',
goldBili: 0, goldBili: 0,
sysInfo:{}, sysInfo: {},
isIos:false, isIos: false,
isExamine:1 isExamines: 0
}; };
}, },
actions: { actions: {
async init() { async init() {
this.sysInfo=uni.getSystemInfoSync() this.sysInfo = uni.getSystemInfoSync()
this.isIos=this.sysInfo.platform == 'ios' this.isIos = this.sysInfo.platform == 'ios'
const res = await getCommonConfig() const res = await getCommonConfig()
if (res) { if (res) {
for (let i in $map) { for (let i in $map) {
@ -66,16 +65,28 @@ export const useCommonStore = defineStore("common", {
} }
} }
}, },
isIosExamine() { setversion(a, b) {
// a是當前應用的版本號 b是接口拿的
let appversion = (a.split('.').join('')) * 1
let resversion = (b.split('.').join('')) * 1
console.log('當前版本-' + appversion, '接口版本-' + resversion, '返回-' + this.isIosExamine,'判斷值-'+this.isExamines)
if (appversion > resversion) {
// 再審核
this.isExamines = 1
}
}
},
getters: {
isIosExamine: function() {
if (!this.isIos) { if (!this.isIos) {
return true return true
} }
if (this.isExamine == 1) { if (this.isExamines == 1) {
return false return false
} }
return true return true
} }
}, },
unistorage: true, // 开启后对 state 的数据读写都将持久化 unistorage: true, // 开启后对 state 的数据读写都将持久化
}); });