App.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. console.log('App Launch')
  5. },
  6. onShow: function() {
  7. // #ifdef MP
  8. // 检查是否升级
  9. this.checkForUpdate();
  10. // #endif
  11. },
  12. onHide: function() {
  13. console.log('App Hide');
  14. },
  15. methods:{
  16. // 检查是否升级
  17. checkForUpdate(){
  18. const _this = this;
  19. // 获取升级管理实例
  20. const updateManager = uni.getUpdateManager();
  21. // 请求版本回调
  22. updateManager.onCheckForUpdate(function(res){
  23. console.log(res);
  24. // 如果有版本升级
  25. if( res && res.hasUpdate ){
  26. uni.showModal({
  27. title:"更新提示",
  28. content:"检测到新版,点击确认升级程序",
  29. showCancel:false,
  30. success(res){
  31. if(res.confirm){
  32. uni.showLoading({title:"程序更新中"});
  33. // 判断是否准备好升级
  34. updateManager.onUpdateReady(function(res){
  35. // 关闭加载
  36. uni.hideLoading();
  37. // 当新版本下载完成,调用该方法会强制当前uni-app应用上新版本并重启
  38. updateManager.applyUpdate();
  39. })
  40. updateManager.onUpdateFailed(function(err){
  41. // 关闭加载
  42. uni.hideLoading();
  43. })
  44. }
  45. }
  46. })
  47. }
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="less">
  54. /*每个页面公共css */
  55. page{
  56. font-family: Arial, Helvetica, sans-serif;
  57. background: #F5F5F5;
  58. }
  59. // 到底了
  60. .to_bottom{
  61. height: 40rpx;
  62. color: #999999;
  63. display: block;
  64. font-size: 20rpx;
  65. margin-top: 20rpx;
  66. line-height: 40rpx;
  67. text-align: center;
  68. padding-bottom: 160rpx;
  69. }
  70. // 添加客服
  71. .center_popup{
  72. .add_follow{
  73. display: block;
  74. color: #FFFFFF;
  75. width: 700rpx;
  76. height: 1100rpx;
  77. margin: 0 auto;
  78. font-size: 26rpx;
  79. border-radius: 40rpx;
  80. background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
  81. .close_area{
  82. height: 100rpx;
  83. display: block;
  84. line-height: 100rpx;
  85. .close_btn{
  86. color: #FFFFFF;
  87. float: right;
  88. width: 100rpx;
  89. height: 100rpx;
  90. font-size: 26rpx;
  91. text-align: center;
  92. line-height: 100rpx;
  93. padding: 0rpx 0rpx;
  94. border: 0rpx solid transparent;
  95. background-color: transparent;
  96. }
  97. .close_btn::after{
  98. border: 0rpx solid transparent;
  99. }
  100. }
  101. .info_alter{
  102. display: block;
  103. height: 100rpx;
  104. font-size: 42rpx;
  105. font-weight: bold;
  106. text-align: center;
  107. line-height: 100rpx;
  108. }
  109. .qr_code_area{
  110. display: block;
  111. width: 300rpx;
  112. height: 300rpx;
  113. margin: 60rpx auto;
  114. .qr_code{
  115. float: left;
  116. width: 300rpx;
  117. height: 300rpx;
  118. }
  119. }
  120. .save_btn{
  121. color: #333333;
  122. display: block;
  123. width: 260rpx;
  124. height: 80rpx;
  125. font-size: 26rpx;
  126. text-align: center;
  127. line-height: 80rpx;
  128. padding: 0rpx 0rpx;
  129. margin: 40rpx auto;
  130. border-radius: 40rpx;
  131. background-color: #FFFFFF;
  132. border: 0rpx solid transparent;
  133. }
  134. .rule_info{
  135. width: 600rpx;
  136. display: block;
  137. font-size: 26rpx;
  138. margin: 20rpx auto;
  139. overflow: hidden;
  140. line-height: 60rpx;
  141. }
  142. }
  143. }
  144. </style>