170 lines
3.3 KiB
Vue
170 lines
3.3 KiB
Vue
<script>
|
||
import { iap } from "@/utils/myIapCheck.js";
|
||
import store from "@/store/index.js";
|
||
import socket from "@/config/socket";
|
||
// #ifdef H5
|
||
import { h5Login } from "@/config/html5Utils";
|
||
// #endif
|
||
// #ifdef APP-PLUS
|
||
import updata from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
|
||
// #endif
|
||
|
||
import Vue from "vue";
|
||
export default {
|
||
data() {
|
||
return {
|
||
platform: null, // 系统
|
||
appRegisterMap: undefined,
|
||
};
|
||
},
|
||
onLaunch: function() {
|
||
uni.setStorageSync("isJump", null);
|
||
// 禁止横屏
|
||
// #ifdef APP-PLUS
|
||
plus.screen.lockOrientation("portrait-primary");
|
||
// 检测自动更新
|
||
updata();
|
||
// #endif
|
||
uni.getSystemInfo({
|
||
success(res) {
|
||
Vue.prototype.winWidth = res.screenWidth;
|
||
Vue.prototype.winHeight = res.screenHeight;
|
||
Vue.prototype.statusBarHeight = res.statusBarHeight;
|
||
},
|
||
});
|
||
|
||
//取出缓存数据
|
||
store.commit("setCacheData");
|
||
// #ifdef MP-WEIXIN
|
||
if (store.state.userInfo.token) {
|
||
socket.init();
|
||
}
|
||
// #endif
|
||
// #ifdef H5
|
||
if (store.state.userInfo.token) {
|
||
socket.init();
|
||
} else {
|
||
h5Login("force", () => {
|
||
socket.init();
|
||
});
|
||
}
|
||
// #endif
|
||
// #ifdef APP-PLUS
|
||
if (store.state.userInfo.token) {
|
||
socket.init();
|
||
}
|
||
// #endif
|
||
},
|
||
onShow: function(e) {
|
||
// #ifdef APP-PLUS
|
||
plus.screen.lockOrientation("portrait-primary");
|
||
// 检测是否有未关闭苹果内购订单
|
||
iap.getChannels()
|
||
// #endif
|
||
// #ifdef MP-WEIXIN
|
||
//获取二维码携带的参数
|
||
let scene = decodeURIComponent(e.query.scene);
|
||
scene = scene.split("&");
|
||
let data = {
|
||
//场景值
|
||
scene: e.scene,
|
||
};
|
||
scene.forEach((item) => {
|
||
let arr = item.split("=");
|
||
if (arr.length == 2) {
|
||
data[arr[0]] = arr[1];
|
||
}
|
||
});
|
||
store.commit("setChatScenesInfo", Object.assign(e.query, data));
|
||
// #endif
|
||
},
|
||
onHide: function() {
|
||
console.log('App Hide')
|
||
},
|
||
//页面销毁
|
||
destroyed() {
|
||
store.commit("setUserInfo", {
|
||
playFlag: true,
|
||
});
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
@import "@/uni_modules/uview-ui/index.scss";
|
||
@import "@/uni_modules/uni-scss/index.scss";
|
||
/* #ifndef APP-PLUS-NVUE */
|
||
/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
|
||
@import "@/static/uni.css";
|
||
@import "@/static/customicons.css";
|
||
@import "@/static/common.scss";
|
||
|
||
/* H5 兼容 pc 所需 */
|
||
/* #ifdef H5 */
|
||
@media screen and (min-width: 768px) {
|
||
body {
|
||
overflow-y: scroll;
|
||
}
|
||
}
|
||
/deep/uni-page-body {
|
||
background-color: $themeBgColor;
|
||
min-height: 100% !important;
|
||
height: 100% !important;
|
||
}
|
||
|
||
.uni-top-window uni-tabbar .uni-tabbar {
|
||
background-color: #fff !important;
|
||
}
|
||
|
||
.uni-app--showleftwindow .hideOnPc {
|
||
display: none !important;
|
||
}
|
||
|
||
/* #endif */
|
||
|
||
/* 以下样式用于 hello uni-app 演示所需 */
|
||
page {
|
||
background-color: #eff5f8;
|
||
height: 100%;
|
||
font-size: 28rpx;
|
||
}
|
||
|
||
.fix-pc-padding {
|
||
padding: 0 50px;
|
||
}
|
||
|
||
.uni-header-logo {
|
||
padding: 30rpx;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
align-items: center;
|
||
margin-top: 10rpx;
|
||
}
|
||
|
||
.uni-header-image {
|
||
width: 100px;
|
||
height: 100px;
|
||
}
|
||
|
||
.uni-hello-text {
|
||
color: #7a7e83;
|
||
}
|
||
|
||
.uni-hello-addfile {
|
||
text-align: center;
|
||
line-height: 300rpx;
|
||
background: #fff;
|
||
padding: 50rpx;
|
||
margin-top: 10px;
|
||
font-size: 38rpx;
|
||
color: #808080;
|
||
}
|
||
|
||
/* #endif*/
|
||
|
||
/deep/ .uni-tabbar__label {
|
||
font-size: 12px !important; /* 修改 tabBar 文字大小 */
|
||
}
|
||
</style>
|
||
|