You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.6 KiB

<script>
export default {
onLaunch: function() {
// this.$nextTick(() => {
// uni.login({
// provider: 'weixin',
// success: (res) => {
// console.log(res.code);
// this.$u.api.login({
// code: res.code
// }).then(res1 => {
// uni.request({
// url:'/api/mobile/user/get-user-info',
// header:{
// Authorization:`Bearer ${res1.token}`
// },
// success() {
// this.$u.vuex('vuex_user', res)
// }
// })
// })
// }
// });
// })
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
console.log(res.hasUpdate)
if (res.hasUpdate) {
updateManager.onUpdateReady(function() {
uni.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function() {
// 新的版本下载失败
uni.showModal({
title: "已经有新版本了哟~",
content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~"
});
});
}
});
updateManager.onUpdateFailed(function(res) {
// 新的版本下载失败
});
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "uview-ui/index.scss";
</style>