-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
119 lines (108 loc) · 2.51 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
<script>
import { mapState, mapMutations } from 'vuex';
Date.prototype.Format = function(fmt) {
//author: meizz
var o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
'q+': Math.floor((this.getMonth() + 3) / 3), //季度
S: this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
return fmt;
};
export default {
onLaunch: function() {
console.log('App Launch');
const db = uniCloud.database();
this.setUniDb(db);
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) {
// 新的版本下载失败
});
},
onShow: function() {
console.log('App Show');
},
onHide: function() {
console.log('App Hide');
},
methods: {
...mapMutations(['setUniDb'])
}
};
</script>
<style lang="scss">
/*每个页面公共css */
@import "@/uni_modules/uview-ui/index.scss";
</style>
<style>
.container {
font-size: 30rpx;
background-color: #f4f5f6;
}
.wrapper {
font-size: 26rpx;
text-align: left;
}
* {
transition: width 2s;
-moz-transition: width 2s;
-webkit-transition: width 2s;
-o-transition: width 2s;
}
* {
color: #353535;
}
.gray {
color: #808080;
}
.wxParse {
text-indent: 2em;
}
.wxParse image {
text-indent: 0;
}
.wxParse ._view {
padding: 0 10rpx;
text-indent: 0;
}
.wxParse .p {
text-indent: 1em;
}
.primary-button {
background-color: #6190e8;
}
.user-tag {
font-size: 12px;
padding: 2px 6px;
color: #ffffff;
border-radius: 4px;
}
page {
width: 100%;
height: 100%;
font-family: Verdana;
background: #f2f2f2;
}
</style>