65 lines
1.5 KiB
Vue
65 lines
1.5 KiB
Vue
<template>
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
<StartPage :flag="!!vdata.list.length" />
|
|
<!-- #endif -->
|
|
<JeepayAdStart ref="refAdStart" :list="vdata.list" :time="6" :url="vdata.url" @openInt="openInt" />
|
|
</template>
|
|
|
|
<script setup>
|
|
import { $adList } from '@/http/apiManager.js';
|
|
import storageManage from '@/commons/utils/storageManage.js';
|
|
import { reactive } from 'vue';
|
|
import appConfig from '@/config/appConfig.js';
|
|
import { onShow } from '@dcloudio/uni-app';
|
|
import StartPage from './components/StartPage';
|
|
onShow(() => {
|
|
if (vdata.list.length > 0 && timeStartFlag && opneInterval) {
|
|
opneInterval();
|
|
}
|
|
});
|
|
|
|
let opneInterval = undefined;
|
|
const vdata = reactive({
|
|
list: [],
|
|
url: ''
|
|
});
|
|
let timeStartFlag = false;
|
|
const params = {
|
|
appPlace: 1
|
|
};
|
|
const isLogin = (flag) => {
|
|
// vdata.url = storageManage.token() ? '/pages/index/index' : '/pages/index/indexCopy'
|
|
vdata.url = storageManage.token() ? '/pages/index/index' : '/pages/login/index';
|
|
if (flag) {
|
|
console.log(vdata.url);
|
|
if (vdata.url == '/pages/index/index')
|
|
return uni.switchTab({
|
|
url: vdata.url
|
|
});
|
|
uni.redirectTo({
|
|
url: vdata.url
|
|
});
|
|
}
|
|
};
|
|
isLogin();
|
|
$adList(params)
|
|
.then(({ bizData }) => {
|
|
const adDate = bizData.map((v) => JSON.parse(v.appContent));
|
|
vdata.list = [...adDate.flat()];
|
|
if (!vdata.list.length) {
|
|
isLogin(true);
|
|
} else {
|
|
opneInterval();
|
|
timeStartFlag = true;
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
opneInterval();
|
|
});
|
|
const openInt = (fun) => {
|
|
opneInterval = fun;
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped></style>
|