-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathApp.vue
128 lines (121 loc) · 2.67 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<script>
import store from '@/store/index.js';
import socket from '@/config/socket';
// #ifdef H5
import { h5Login } from '@/config/html5Utils';
// #endif
// #ifdef APP-PLUS
import APPUpdate from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
// #endif
export default {
onLaunch: function(e) {
//取出缓存数据
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();
}
APPUpdate();
// #endif
},
onShow: function(e) {
// #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));
//小程序更新
if (uni.getUpdateManager) {
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) {
// 新的版本下载失败
uni.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
showCancel: false
});
});
}
// #endif
},
onHide: function() {}
};
</script>
<style lang="scss">
/* #ifndef APP-NVUE */
@import './style/common.scss';
@import './style/input.scss';
page {
height: 100%;
background-color: #f5f5f5;
}
/* #endif */
/* #ifdef H5 */
//修复H5底部导航挡住内容bug
uni-app {
height: auto;
}
//修复H5输入框上下不居中bug
.uni-input-form {
height: 100%;
}
//去除地图上高德地图标识符
.amap-copyright {
display: none !important;
}
.amap-logo {
display: none !important;
}
.amap-ui-control-zoom {
width: 60upx !important;
}
.amap-ui-control-zoom > * {
width: 60upx !important;
height: 60upx !important;
line-height: 60upx !important;
}
.amap-ui-control-theme-dark {
display: none !important;
}
/* #endif */
</style>