| | |
| | |
|
| | | <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;
|
| | | }
|
| | | |
| | | <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> |