app-service.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
  2. Promise.prototype.finally = function(callback) {
  3. const promise = this.constructor;
  4. return this.then(
  5. (value) => promise.resolve(callback()).then(() => value),
  6. (reason) => promise.resolve(callback()).then(() => {
  7. throw reason;
  8. })
  9. );
  10. };
  11. }
  12. ;
  13. if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
  14. const global = uni.requireGlobal();
  15. ArrayBuffer = global.ArrayBuffer;
  16. Int8Array = global.Int8Array;
  17. Uint8Array = global.Uint8Array;
  18. Uint8ClampedArray = global.Uint8ClampedArray;
  19. Int16Array = global.Int16Array;
  20. Uint16Array = global.Uint16Array;
  21. Int32Array = global.Int32Array;
  22. Uint32Array = global.Uint32Array;
  23. Float32Array = global.Float32Array;
  24. Float64Array = global.Float64Array;
  25. BigInt64Array = global.BigInt64Array;
  26. BigUint64Array = global.BigUint64Array;
  27. }
  28. ;
  29. if (uni.restoreGlobal) {
  30. uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
  31. }
  32. (function(vue) {
  33. "use strict";
  34. function formatAppLog(type, filename, ...args) {
  35. if (uni.__log__) {
  36. uni.__log__(type, filename, ...args);
  37. } else {
  38. console[type].apply(console, [...args, filename]);
  39. }
  40. }
  41. const _export_sfc = (sfc, props) => {
  42. const target = sfc.__vccOpts || sfc;
  43. for (const [key, val] of props) {
  44. target[key] = val;
  45. }
  46. return target;
  47. };
  48. var wv;
  49. const _sfc_main$1 = {
  50. data() {
  51. return {
  52. title: "ByteSailing",
  53. url: "http://139.159.251.109:82/#/",
  54. //url: 'http://36.134.91.96:10008/#/',
  55. //url: 'http://36.134.91.96:10007/#/',
  56. //ehsd测试
  57. //url:'http://139.9.102.170:10009/#/',
  58. //ehsd正式
  59. //url:'http://139.9.102.170:10010/#/',
  60. //本地调试
  61. //url:'http://192.168.1.18:8088/',
  62. src: "",
  63. canBack: false
  64. };
  65. },
  66. onBackPress() {
  67. if (wv && this.canBack) {
  68. wv.back();
  69. return true;
  70. }
  71. return false;
  72. },
  73. onReady() {
  74. var self = this;
  75. var currentWebview = this.$scope.$getAppWebview();
  76. setTimeout(function() {
  77. wv = currentWebview.children()[0];
  78. wv.addEventListener(
  79. "progressChanged",
  80. function(e) {
  81. wv.canBack(function(e2) {
  82. self.canBack = e2.canBack;
  83. });
  84. },
  85. false
  86. );
  87. }, 500);
  88. },
  89. onLoad() {
  90. var height = 0;
  91. uni.getSystemInfo({
  92. //成功获取的回调函数,返回值为系统信息
  93. success: (sysinfo) => {
  94. formatAppLog("log", "at pages/index/index.vue:61", sysinfo);
  95. height = sysinfo.windowHeight;
  96. },
  97. complete: () => {
  98. }
  99. });
  100. let info = uni.getSystemInfoSync();
  101. let top = info.statusBarHeight;
  102. formatAppLog("log", "at pages/index/index.vue:68", info, 12312312312);
  103. var currentWebview = this.$scope.$getAppWebview();
  104. setTimeout(function() {
  105. var wv2 = currentWebview.children()[0];
  106. wv2.setStyle({
  107. //设置web-view距离顶部的距离以及自己的高度,单位为px
  108. top,
  109. //此处是距离顶部的高度,应该是你页面的头部
  110. // bottom:0,//防止输入框被软键盘遮挡
  111. height: height - top,
  112. //webview的高度
  113. scalable: false
  114. //webview的页面是否可以缩放,双指放大缩小
  115. });
  116. }, 1e3);
  117. }
  118. };
  119. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  120. return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, [
  121. vue.createElementVNode("view", { class: "status_bar" }, [
  122. vue.createCommentVNode(" 这里是状态栏 ")
  123. ]),
  124. vue.createElementVNode("web-view", {
  125. src: $data.url,
  126. fullscreen: false
  127. }, null, 8, ["src"])
  128. ]);
  129. }
  130. const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "D:/hongxing/uni-byte-sailing-mobile/pages/index/index.vue"]]);
  131. __definePage("pages/index/index", PagesIndexIndex);
  132. const _sfc_main = {
  133. onLaunch: function() {
  134. formatAppLog("log", "at App.vue:4", "App Launch");
  135. },
  136. onShow: function() {
  137. formatAppLog("log", "at App.vue:7", "App Show");
  138. },
  139. onHide: function() {
  140. formatAppLog("log", "at App.vue:10", "App Hide");
  141. }
  142. };
  143. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/hongxing/uni-byte-sailing-mobile/App.vue"]]);
  144. function createApp() {
  145. const app = vue.createVueApp(App);
  146. return {
  147. app
  148. };
  149. }
  150. const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
  151. uni.Vuex = __Vuex__;
  152. uni.Pinia = __Pinia__;
  153. __app__.provide("__globalStyles", __uniConfig.styles);
  154. __app__._component.mpType = "app";
  155. __app__._component.render = () => {
  156. };
  157. __app__.mount("#app");
  158. })(Vue);