修复我的喜欢跳转视频详情进去走的历史记录问题,公共配置全部放到store/common.js下
This commit is contained in:
10
App.vue
10
App.vue
@@ -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 () {
|
||||||
|
|||||||
@@ -158,6 +158,7 @@
|
|||||||
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
|
||||||
@@ -191,6 +192,14 @@
|
|||||||
[]
|
[]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
options:{
|
||||||
|
tpye: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
courseDetailsId:''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
isCommand: {
|
isCommand: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@@ -510,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
|
||||||
@@ -558,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)
|
||||||
|
|
||||||
|
|||||||
@@ -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()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -18,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',
|
||||||
@@ -37,14 +37,15 @@ const $map = {
|
|||||||
109: '',
|
109: '',
|
||||||
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", {
|
||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
payTips: '付款完成后不要忘记抽红包哦',
|
payTips: '付款完成后不要忘记抽红包哦',
|
||||||
goldBili:0
|
goldBili: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@@ -55,6 +56,7 @@ export const useCommonStore = defineStore("common", {
|
|||||||
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])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user