App.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <script>
  2. import Vue from 'vue'
  3. export default {
  4. onLaunch: function() {
  5. //检查更新
  6. // #ifdef APP-PLUS
  7. var appUpdateData = {};
  8. uni.request({
  9. url: 'https://xrzp.haowork365.com/mainapp.php/update/index',
  10. data: {
  11. appid: plus.runtime.appid,
  12. version: plus.runtime.version
  13. },
  14. method: 'GET',
  15. success: (res) => {
  16. appUpdateData = res.data.data;
  17. if (appUpdateData.statusAndroid===1 && plus.os.name=="Android") {
  18. uni.showModal({
  19. title: "更新提示",
  20. content: appUpdateData.updatecon,
  21. showCancel: false,
  22. success: (res) => {
  23. if (res.confirm) {
  24. plus.runtime.openURL(appUpdateData.downAndroidUrl);
  25. }
  26. }
  27. });
  28. }
  29. if (appUpdateData.statusIos===1 && plus.os.name=="iOS") {
  30. uni.showModal({
  31. title: "更新提示",
  32. content: appUpdateData.updatecon,
  33. showCancel: false,
  34. success: (res) => {
  35. if (res.confirm) {
  36. plus.runtime.openURL(appUpdateData.downIosUrl);
  37. }
  38. }
  39. });
  40. }
  41. }
  42. });
  43. // #endif
  44. uni.getSystemInfo({
  45. success: function(e) {
  46. // #ifndef MP
  47. Vue.prototype.StatusBar = e.statusBarHeight;
  48. if (e.platform == 'android') {
  49. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  50. } else {
  51. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  52. };
  53. // #endif
  54. // #ifdef MP-WEIXIN
  55. Vue.prototype.StatusBar = e.statusBarHeight;
  56. let custom = wx.getMenuButtonBoundingClientRect();
  57. Vue.prototype.Custom = custom;
  58. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  59. // #endif
  60. // #ifdef MP-ALIPAY
  61. Vue.prototype.StatusBar = e.statusBarHeight;
  62. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  63. // #endif
  64. }
  65. });
  66. console.log('App Launch')
  67. },
  68. onShow: function() {
  69. console.log('App Show')
  70. },
  71. onHide: function() {
  72. console.log('App Hide')
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. /*每个页面公共css */
  78. @import "@/uni_modules/uview-ui/index.scss";
  79. @import "components/gaoyia-parse/parse.css";
  80. @import "static/uni.css";
  81. @import "colorui/main.css";
  82. @import "colorui/icon.css";
  83. @import "static/echoUi.css";
  84. </style>