代码拉取完成,页面将自动刷新
<script>
export default {
onLaunch: function() {
console.log('onLaunch');
// 获取当前手机系统信息
const system = this.getSystemInfo();
this.$store.dispatch('saveSysinfoToVuex', system);
// 判断是否进入引导页
this.goHomeOrGoGuide();
},
onShow: function() {
console.log('App Show');
// 进入广告页
this.goAdvPage();
},
onHide: function() {
console.log('App Hide');
// hide的时候存储当前时间
uni.setStorageSync('advTimes', new Date());
},
methods: {
goAdvPage() {
const nowTimes = new Date();
const storageTimes = uni.getStorageSync('advTimes');
const oldTimes = new Date(storageTimes);
if (nowTimes - oldTimes > 30 * 60 * 60 * 1000) {
uni.reLaunch({
url: '/pages/adv/adv'
});
}
},
goHomeOrGoGuide() {
if (this.checkGuide()) {
uni.reLaunch({
url: '/pages/index/index'
});
} else {
uni.reLaunch({
url: '/pages/guide/guide'
});
}
},
getSystemInfo() {
return uni.getSystemInfoSync();
},
checkGuide() {
return uni.getStorageSync('guide') || false;
}
}
};
</script>
<style lang="scss">
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import 'uview-ui/index.scss';
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。