This commit is contained in:
YeMingfei666 2025-01-14 10:14:17 +08:00
commit c80b7ca975
5 changed files with 60 additions and 39 deletions

10
App.vue
View File

@ -1,6 +1,5 @@
<script>
import { ref } from 'vue';
import { init,commonType } from '@/api/init.js';
export default {
onLaunch: function () {
console.log('App Launch');
@ -16,14 +15,7 @@ export default {
},
onShow: function () {
// ios
commonType(919).then(res=>{
uni.setStorageSync('isExamine', res.value);
})
//
commonType(249).then(res=>{
uni.setStorageSync('moreSearch', res.value)
})
},
onHide: function () {

View File

@ -244,6 +244,7 @@
})
onMounted(() => {
init()
console.log('itemMounted',props.index);
emits('itemMounted', props.index)
})
@ -289,6 +290,8 @@
transform: `translateX(${(!isPlying.value||!props.item.videoUrl)?'0':60}px)`
}
})
</script>
<style lang="scss" scoped>

View File

@ -86,9 +86,9 @@
<image class="hot" src="@/static/images/hot.png" mode=""></image>
<text class="u-font-28 font-bold">{{info.price}}元解锁全剧</text>
</view>
<view class="pay-list-item" @click="payBtnClick('gold',1)">
<view class="pay-list-item" @click="payBtnClick('gold',1)" v-if="nowDanjiPrice*goldBili>0">
<image class="hot" src="@/static/images/hot.png" mode=""></image>
<text class="u-font-28 font-bold">{{nowDanjiPrice*jinbiBili}}金币解锁单集视频</text>
<text class="u-font-28 font-bold">{{nowDanjiPrice*goldBili}}金币解锁单集视频</text>
</view>
<view class="pay-list-item" @click="payBtnClick('money',1)">
<!-- <image class="hot" src="@/static/images/hot.png" mode=""></image> -->
@ -157,7 +157,8 @@
import {
useCommonStore
} from '@/store/common.js'
const $common=useCommonStore()
const $common = useCommonStore()
// #ifdef APP
const domModule = uni.requireNativePlugin('dom')
// #endif
@ -167,7 +168,8 @@
} from '@/commons/config.js'
import color from '@/commons/color.js'
import {
debounce
debounce,
throttle
} from 'lodash';
import * as Api from '@/api/video/index.js'
import infoBox from '@/utils/infoBox.js'
@ -180,7 +182,7 @@
onMounted,
getCurrentInstance
} from 'vue';
let initing = true
const refPoster = ref(null)
const props = defineProps({
@ -190,6 +192,14 @@
[]
}
},
options:{
tpye: Object,
default: () => {
return {
courseDetailsId:''
}
}
},
isCommand: {
type: Boolean,
default: false
@ -255,7 +265,7 @@
const $mountedComponents = {}
function itemMounted(index) {
// $mountedComponents[index]=true
$mountedComponents[index]=true
}
function back() {
@ -305,7 +315,7 @@
let cacheIndex = null
function appear(isFirst, item, index) {
if (isFirst) {
if(isFirst){
$mountedComponents[index] = true
}
if (!initing) {
@ -334,7 +344,7 @@
async function payOrder(data) {
const res = await Api.payOrder(data)
if (res) {
uni.setStorageSync('nobuyCourseId',popup.data.courseId)
uni.setStorageSync('nobuyCourseId', popup.data.courseId)
// #ifdef APP
uni.navigateTo({
url: '/pages/pays/pays?orderId=' + data.orderId + '&url=' + res.h5Url
@ -405,7 +415,7 @@
function jiClick(item, index) {
initing=false
initing = false
let newCurrent = (current.value + 1) % 3;
videoList.value[newCurrent] = item;
current.value = newCurrent;
@ -433,7 +443,8 @@
console.log('goListPosition:' + index)
const el = refList.value[index]
if (initing) {
if (!$mountedComponents[props.list.length - 1]) {
console.log($mountedComponents);
if (!$mountedComponents[index]) {
positonmer = setTimeout(() => {
goListPosition(index)
}, 200)
@ -473,11 +484,10 @@
}
let jinbiBili = ref(0)
let goldBili = ref($common.goldBili || 0)
let wHeight = ref(0)
async function configInit() {
const res = await Api.getJinbiBili()
jinbiBili.value = res.value
goldBili.value = $common.goldBili
const sysInfo = uni.getSystemInfoSync()
wHeight.value = sysInfo.windowHeight
@ -509,13 +519,15 @@
function init() {
if (JSON.stringify(props.current) !== '{}') {
let item=props.list.find(v=>props.options.courseDetailsId==v.courseDetailsId)
item=item?item:props.info.current;
if (JSON.stringify(item) !== '{}') {
// #ifdef H5
setVideoList(props.info.current)
setVideoList(item)
// #endif
// #ifdef APP
nextTick(() => {
const index = props.list.findIndex(v => v.courseDetailsId == props.info.current.courseDetailsId)
const index = props.list.findIndex(v => v.courseDetailsId ==item.courseDetailsId)
goListPosition(index)
})
// #endif
@ -557,6 +569,13 @@
courseId: item.courseId,
courseDetailsId: item.courseDetailsId,
type: item.isGood ? 1 : 0
}).then(res=>{
if(res){
uni.showToast({
title:'操作成功!',
icon:'none'
})
}
})
}, 500)
@ -682,7 +701,6 @@
function waiting() {
}
let initing = true
configInit()
onMounted(() => {
init()

View File

@ -1,14 +1,14 @@
<template>
<view class="min-page">
<my-video-list ref="refVideoList" v-if="state.list.length" @swiperChange="swiperChange" :list="state.list"
:options="options"
@update="update" :info="state"></my-video-list>
</view>
</template>
<script setup>
import {
onLoad,
onLoad,onHide,
onShow
} from '@dcloudio/uni-app'
import * as Api from '@/api/video/index.js'
@ -22,7 +22,9 @@
const sysInfo = uni.getSystemInfoSync()
let isFirstLoad = true
let options = {}
let options = {
courseDetailsId:''
}
const state = reactive({
collect: 0,
current: {},
@ -60,6 +62,7 @@
}
onLoad((opt) => {
Object.assign(options, opt)
console.log(options);
init()
})

View File

@ -1,7 +1,9 @@
import {
defineStore
} from "pinia";
import {getCommonConfig} from '@/api/init.js'
import {
getCommonConfig
} from '@/api/init.js'
const $map = {
882: 'isWxIosPay',
833: 'checkIosLogin',
@ -16,11 +18,11 @@ const $map = {
251: 'isGuanggao',
254: 'isGuanggaody',
202: 'kefu',
249: 'moreSearch', //热搜词
206: 'kefuPhone',
204: 'kefuUrl',
203: 'kefuAppId',
248: 'isVips',
249: 'moreSearch',
49: 'AppUrl',
823: 'OfferID',
824: 'payEnv',
@ -34,27 +36,30 @@ const $map = {
881: '',
109: '',
922: 'withdrawNum',
500:'payTips'
500: 'payTips',
914: 'goldBili', // 金币比例
919: 'isExamine' //是否ios审核中
}
export const useCommonStore = defineStore("common", {
state() {
return {
payTips:'付款完成后不要忘记抽红包哦'
payTips: '付款完成后不要忘记抽红包哦',
goldBili: 0
};
},
actions:{
async init(){
const res=await getCommonConfig()
if(res){
actions: {
async init() {
const res = await getCommonConfig()
if (res) {
for (let i in $map) {
const key = $map[i]
if (key) {
this[key]=res[i]
this[key] = res[i]
uni.setStorageSync(key,res[i])
}
}
}
console.log(res);
}
},
unistorage: true, // 开启后对 state 的数据读写都将持久化