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
|
| <script>
|
| export default {
| globalData:{
| version:'',
| descs:[],
| update:false
| },
| onLaunch: function() {
| this.checkUpdate();
|
| },
| onShow: function() {
| console.log('App Show')
| this.modalShow = true;
| },
| onHide: function() {
| console.log('App Hide')
| },
| methods: {
| async checkUpdate() {
| //获取当前用户手机系统信息
| let infos = uni.getSystemInfoSync();
| console.log(infos.platform)
| let res = await this.$api.syncRequest({
| url: `/basic/api/car/app/version?curVersion=${plus.runtime.version}&platform=${infos.platform}`,
| //url: '/basic/api/car/app/version?curVersion='+plus.runtime.version,
| //url: 'http://smartai.com:5116/basic/api/car/app/version?curVersion='+plus.runtime.version,
| loading: false
| });
| console.log(res)
| if (res.data.isUpgrade) {
| uni.showModal({
| title: "发现新版本",
| content: `版本${res.data.latestVersion}
| 本次更新(${res.data.size}):
| ${res.data.msg.join(',')}`,
| showCancel: !res.data.forceUpgrade,
| confirmText: '立刻更新',
| success: sucRes => {
| if (sucRes.confirm) {
| plus.runtime.openURL(res.data.url)
| }
| }
| });
| }
| }
| }
|
| }
| </script>
|
| <style lang="scss">
| /*每个页面公共css */
| .icon {
| width: 1em;
| height: 1em;
| vertical-align: -0.15em;
| fill: currentColor;
| overflow: hidden;
| }
|
| .uni-navbar--border {
| border-bottom: none !important;
| }
|
| .uni-nav-bar-right-text {
| font-size: 32rpx !important;
| }
| .min-modal-title{
| text-align: left;
| font-weight: bold;
| font-size: 16px;
| }
| .min-modal-content{
| text-align: left;
| }
| .uni-modal__hd{
| text-align: left;
| }
| .uni-modal__bd{
| text-align: left;
| }
| </style>
|
|