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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
<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"
@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, onLoad,onHide,
onShow onShow
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import * as Api from '@/api/video/index.js' import * as Api from '@/api/video/index.js'
@ -22,7 +22,9 @@
const sysInfo = uni.getSystemInfoSync() const sysInfo = uni.getSystemInfoSync()
let isFirstLoad = true let isFirstLoad = true
let options = {} let options = {
courseDetailsId:''
}
const state = reactive({ const state = reactive({
collect: 0, collect: 0,
current: {}, current: {},
@ -60,6 +62,7 @@
} }
onLoad((opt) => { onLoad((opt) => {
Object.assign(options, opt) Object.assign(options, opt)
console.log(options);
init() init()
}) })

View File

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