123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <script>
- export default {
- onLaunch: function(param) {
- console.log(param);
- },
- onShow: function() {
- // #ifdef MP
- // 检查是否升级
- this.checkForUpdate();
- // #endif
- },
- onHide: function() {
- console.log('App Hide');
- },
- methods:{
- // 检查是否升级
- checkForUpdate(){
- const _this = this;
- // 获取升级管理实例
- const updateManager = uni.getUpdateManager();
- // 请求版本回调
- updateManager.onCheckForUpdate(function(res){
- console.log(res);
- // 如果有版本升级
- if( res && res.hasUpdate ){
- uni.showModal({
- title:"更新提示",
- content:"检测到新版,点击确认升级程序",
- showCancel:false,
- success(res){
- if(res.confirm){
- uni.showLoading({title:"程序更新中"});
- // 判断是否准备好升级
- updateManager.onUpdateReady(function(res){
- // 关闭加载
- uni.hideLoading();
- // 当新版本下载完成,调用该方法会强制当前uni-app应用上新版本并重启
- updateManager.applyUpdate();
- })
- updateManager.onUpdateFailed(function(err){
- // 关闭加载
- uni.hideLoading();
- })
- }
- }
- })
- }
- })
-
- }
- }
- }
- </script>
- <style lang="less">
- /*每个页面公共css */
- page{
- font-family: Arial, Helvetica, sans-serif;
- background: #F5F5F5;
- }
- // 到底了
- .to_bottom{
- height: 40rpx;
- color: #999999;
- display: block;
- font-size: 20rpx;
- margin-top: 20rpx;
- line-height: 40rpx;
- text-align: center;
- padding-bottom: 160rpx;
- }
- // 添加客服
- .center_popup{
- .add_follow{
- display: block;
- color: #FFFFFF;
- width: 700rpx;
- height: 1100rpx;
- margin: 0 auto;
- font-size: 26rpx;
- border-radius: 40rpx;
- background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
- .close_area{
- height: 100rpx;
- display: block;
- line-height: 100rpx;
- .close_btn{
- color: #FFFFFF;
- float: right;
- width: 100rpx;
- height: 100rpx;
- font-size: 26rpx;
- text-align: center;
- line-height: 100rpx;
- padding: 0rpx 0rpx;
- border: 0rpx solid transparent;
- background-color: transparent;
- }
- .close_btn::after{
- border: 0rpx solid transparent;
- }
- }
- .info_alter{
- display: block;
- height: 100rpx;
- font-size: 42rpx;
- font-weight: bold;
- text-align: center;
- line-height: 100rpx;
- }
- .qr_code_area{
- display: block;
- width: 300rpx;
- height: 300rpx;
- margin: 60rpx auto;
- .qr_code{
- float: left;
- width: 300rpx;
- height: 300rpx;
- }
- }
- .save_btn{
- color: #333333;
- display: block;
- width: 260rpx;
- height: 80rpx;
- font-size: 26rpx;
- text-align: center;
- line-height: 80rpx;
- padding: 0rpx 0rpx;
- margin: 40rpx auto;
- border-radius: 40rpx;
- background-color: #FFFFFF;
- border: 0rpx solid transparent;
- }
- .rule_info{
- width: 600rpx;
- display: block;
- font-size: 26rpx;
- margin: 20rpx auto;
- overflow: hidden;
- line-height: 60rpx;
- }
- }
- }
-
- </style>
|