App.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <script>
  2. export default {
  3. globalData: {
  4. $t: ''
  5. },
  6. onLaunch: function() {
  7. let _this = this
  8. console.log('App Launch');
  9. this.globalData.$t = (val, arr = {}) => {
  10. return this.$t(val, arr);
  11. };
  12. // #ifdef APP-PLUS || APP-NVUE
  13. plus.screen.lockOrientation('portrait-primary');
  14. let appid = plus.runtime.appid;
  15. if (appid && appid.toLocaleLowerCase() != "hbuilder") {
  16. uni.request({
  17. url: baseUrl + '/api/v1/app/versionCheck', //检查更新的服务器地址
  18. data: {
  19. appid: plus.runtime.appid,
  20. version: plus.runtime.version
  21. },
  22. success: (res) => {
  23. console.log('success', res);
  24. if (res.statusCode == 200 && res.data.isUpdate) {
  25. let openUrl = plus.os.name === 'iOS' ? res.data.iOS : res.data.Android;
  26. // 提醒用户更新
  27. uni.showModal({
  28. title: _this.$t('更新提示'),
  29. content: this.$t(res.data.note ? res.data.note : '是否选择更新'),
  30. success: (showResult) => {
  31. if (showResult.confirm) {
  32. plus.runtime.openURL(openUrl);
  33. }
  34. }
  35. })
  36. }
  37. }
  38. })
  39. }
  40. var domModule = weex.requireModule('dom');
  41. domModule.addRule('fontFace', {
  42. 'fontFamily': "texticons",
  43. 'src': "url('./static/text-icon.ttf')"
  44. });
  45. // #endif
  46. },
  47. onShow: function() {
  48. console.log('App Show')
  49. },
  50. onHide: function() {
  51. console.log('App Hide')
  52. }
  53. }
  54. </script>
  55. <style>
  56. /*每个页面公共css */
  57. .u-tabbar--fixed {
  58. padding: 19rpx 0;
  59. }
  60. .uni-swiper-slide-frame {
  61. width: 100% !important;
  62. flex: 1;
  63. }
  64. .u-tabbar-item__text {
  65. font-size: 32rpx;
  66. padding: 12rpx 0;
  67. }
  68. .u-tabbar__content {
  69. background: #303030 !important;
  70. }
  71. .u-popup__content {
  72. width: 100%;
  73. height: 100%;
  74. }
  75. .popup-box {
  76. width: 100%;
  77. }
  78. .popup-main {
  79. width: 100%;
  80. }
  81. .u-action-sheet__header {
  82. border-bottom: 2rpx solid #e4e4e4;
  83. }
  84. .u-action-sheet__header__title {
  85. color: #999;
  86. }
  87. .u-tabbar__content {
  88. background: #303030 !important;
  89. }
  90. .u-action-sheet__header__title {
  91. color: #999 !important;
  92. font-weight: normal !important;
  93. }
  94. .u-textarea__field {
  95. line-height: 56rpx;
  96. }
  97. </style>