修复我的喜欢跳转视频详情进去走的历史记录问题,公共配置全部放到store/common.js下

This commit is contained in:
2025-01-14 10:13:05 +08:00
parent 781783a665
commit 66236012c9
4 changed files with 33 additions and 18 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

@@ -158,6 +158,7 @@
useCommonStore
} from '@/store/common.js'
const $common = useCommonStore()
// #ifdef APP
const domModule = uni.requireNativePlugin('dom')
// #endif
@@ -191,6 +192,14 @@
[]
}
},
options:{
tpye: Object,
default: () => {
return {
courseDetailsId:''
}
}
},
isCommand: {
type: Boolean,
default: false
@@ -510,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
@@ -558,6 +569,13 @@
courseId: item.courseId,
courseDetailsId: item.courseDetailsId,
type: item.isGood ? 1 : 0
}).then(res=>{
if(res){
uni.showToast({
title:'操作成功!',
icon:'none'
})
}
})
}, 500)

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

@@ -18,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',
@@ -37,14 +37,15 @@ const $map = {
109: '',
922: 'withdrawNum',
500: 'payTips',
914: 'goldBili' // 金币比例
914: 'goldBili', // 金币比例
919: 'isExamine' //是否ios审核中
}
export const useCommonStore = defineStore("common", {
state() {
return {
payTips: '付款完成后不要忘记抽红包哦',
goldBili:0
goldBili: 0
};
},
actions: {
@@ -55,6 +56,7 @@ export const useCommonStore = defineStore("common", {
const key = $map[i]
if (key) {
this[key] = res[i]
uni.setStorageSync(key,res[i])
}
}
}