yfs/App.vue
2025-03-23 03:55:07 +08:00

196 lines
3.7 KiB
Vue

<script>
import Vue from "vue";
export default {
onLaunch: function () {
console.log("App Launch");
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
console.log(res.hasUpdate);
});
updateManager.onUpdateReady(function (res) {
uni.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function (res) {
// 新的版本下载失败
});
var that = this;
this.$config.init().then(async (data) => {
//加载配置
let src = await that.$config.getAppSettingAsync("win_audio");
if (src == null || src == "") {
src = that.$img("/static/mp3/open.mp3");
}
//创建中奖音乐
const openBgm = uni.createInnerAudioContext();
Vue.prototype.bgmCtx = {};
Vue.prototype.bgmCtx.openBgm = openBgm;
openBgm.src = src;
});
/* 重置首页公告弹窗状态 */
uni.setStorageSync("_is_this_show", false);
/* 清除缓存中的广告id */
uni.removeStorageSync("_ad_id");
/* 清除缓存中的click_id */
uni.removeStorageSync("_click_id");
},
onShow: function () {
console.log("App Show");
},
onHide: function () {
console.log("App Hide");
},
};
</script>
<style lang="scss">
/*每个页面公共css */
@import "./common/animate.css";
@import url("./common/common.css");
@import url("/components/gaoyia-parse/parse.css");
/* 引入字体 */
@font-face {
font-family: "YouSheBiaoTiHei";
src: url($imgurl + "font/YouSheBiaoTiHei.ttf") format("truetype");
}
@font-face {
font-family: "zihun152hao-jijiachaojihei";
src: url($imgurl + "font/zihun152hao-jijiachaojihei.TTF") format("truetype");
}
@font-face {
font-family: "zihun147hao-xingyuanhei";
src: url($imgurl + "font/zihun147hao-xingyuanhei.TTF") format("truetype");
}
page {
overflow-x: hidden;
&:before {
content: "";
position: fixed;
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: #1c1b20;
}
}
.ziti {
font-family: YouSheBiaoTiHei;
}
.flex_center {
display: flex;
align-items: center;
}
.hang2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-wrap: break-word;
word-break: break-all;
}
.hang1 {
overflow: hidden;
/*超出部分隐藏*/
white-space: nowrap;
/*不换行*/
text-overflow: ellipsis;
/*超出部分文字以...显示*/
}
.icon {
display: flex;
justify-content: center;
align-items: center;
image {
width: 100%;
height: 100%;
}
}
.common_bg {
background-repeat: no-repeat;
background-position: 0 0;
background-size: 100% 100%;
}
.relative {
position: relative;
}
button.hide {
position: absolute;
width: 100% !important;
height: 100% !important;
left: 0;
top: 0;
z-index: 1;
opacity: 0;
}
/* 重写组件样式 */
/deep/.uni-noticebar {
padding: 0 !important;
margin: 0 !important;
}
/deep/.mescroll-upwarp {
box-sizing: border-box;
min-height: 55px;
padding: 15px 0;
text-align: center;
clear: both;
}
/deep/.cmd-progress-outer {
line-height: 0;
.cmd-progress-bg {
margin: 0 !important;
}
}
.uni-tabbar__bd {
height: 50px !important;
}
.uni-tabbar__icon {
height: 50px !important;
}
</style>
<template>
<view>
<!-- 主应用容器 -->
<view>
<slot></slot>
</view>
</view>
</template>