app-service.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. const _export_sfc = (sfc, props) => {
  35. const target = sfc.__vccOpts || sfc;
  36. for (const [key, val] of props) {
  37. target[key] = val;
  38. }
  39. return target;
  40. };
  41. var wv;
  42. const _sfc_main$1 = {
  43. data() {
  44. return {
  45. title: "ByteSailing",
  46. url: "http://139.159.251.109:82/#/",
  47. //url: 'http://36.134.91.96:10008/#/',
  48. //url: 'http://36.134.91.96:10007/#/',
  49. //ehsd测试
  50. //url:'http://139.9.102.170:10009/#/',
  51. //ehsd正式
  52. //url:'http://139.9.102.170:10010/#/',
  53. //本地调试
  54. //url:'http://192.168.1.18:8088/',
  55. src: "",
  56. canBack: false
  57. };
  58. },
  59. onBackPress() {
  60. if (wv && this.canBack) {
  61. wv.back();
  62. return true;
  63. }
  64. return false;
  65. },
  66. onReady() {
  67. var self = this;
  68. var currentWebview = this.$scope.$getAppWebview();
  69. setTimeout(function() {
  70. wv = currentWebview.children()[0];
  71. wv.addEventListener(
  72. "progressChanged",
  73. function(e) {
  74. wv.canBack(function(e2) {
  75. self.canBack = e2.canBack;
  76. });
  77. },
  78. false
  79. );
  80. }, 500);
  81. },
  82. onLoad() {
  83. var height = 0;
  84. uni.getSystemInfo({
  85. //成功获取的回调函数,返回值为系统信息
  86. success: (sysinfo) => {
  87. height = sysinfo.windowHeight;
  88. },
  89. complete: () => {
  90. }
  91. });
  92. let info = uni.getSystemInfoSync();
  93. let top = info.statusBarHeight;
  94. var currentWebview = this.$scope.$getAppWebview();
  95. setTimeout(function() {
  96. var wv2 = currentWebview.children()[0];
  97. wv2.setStyle({
  98. //设置web-view距离顶部的距离以及自己的高度,单位为px
  99. top,
  100. //此处是距离顶部的高度,应该是你页面的头部
  101. // bottom:0,//防止输入框被软键盘遮挡
  102. height: height - top,
  103. //webview的高度
  104. scalable: false
  105. //webview的页面是否可以缩放,双指放大缩小
  106. });
  107. }, 1e3);
  108. }
  109. };
  110. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  111. return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, [
  112. vue.createElementVNode("view", { class: "status_bar" }, [
  113. vue.createCommentVNode(" 这里是状态栏 ")
  114. ]),
  115. vue.createElementVNode("web-view", {
  116. src: $data.url,
  117. fullscreen: false
  118. }, null, 8, ["src"])
  119. ]);
  120. }
  121. const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "D:/hongxing/uni-byte-sailing-mobile/pages/index/index.vue"]]);
  122. __definePage("pages/index/index", PagesIndexIndex);
  123. function requireNativePlugin(name) {
  124. return weex.requireModule(name);
  125. }
  126. function formatAppLog(type, filename, ...args) {
  127. if (uni.__log__) {
  128. uni.__log__(type, filename, ...args);
  129. } else {
  130. console[type].apply(console, [...args, filename]);
  131. }
  132. }
  133. const jpushModule = requireNativePlugin("JG-JPush");
  134. formatAppLog("log", "at App.vue:3", jpushModule.getRegistrationID, "jpushModule");
  135. const _sfc_main = {
  136. onLaunch: function() {
  137. formatAppLog("log", "at App.vue:6", "App Launch");
  138. if (uni.getSystemInfoSync().platform == "ios") {
  139. let locationServicesEnabled = jpushModule.locationServicesEnabled();
  140. let locationAuthorizationStatus = jpushModule.getLocationAuthorizationStatus();
  141. formatAppLog("log", "at App.vue:11", "locationAuthorizationStatus", locationAuthorizationStatus);
  142. if (locationServicesEnabled == true && locationAuthorizationStatus < 3) {
  143. jpushModule.requestLocationAuthorization((result) => {
  144. formatAppLog("log", "at App.vue:14", "定位权限", result.status);
  145. });
  146. }
  147. jpushModule.requestNotificationAuthorization((result) => {
  148. let status = result.status;
  149. if (status < 2) {
  150. uni.showToast({
  151. icon: "none",
  152. title: "您还没有打开通知权限",
  153. duration: 3e3
  154. });
  155. }
  156. });
  157. }
  158. jpushModule.getRegistrationID((result) => {
  159. formatAppLog("log", "at App.vue:30", result, "注册ID.....");
  160. uni.showToast({
  161. title: result.registerID,
  162. icon: "success",
  163. duration: 3e4
  164. });
  165. });
  166. jpushModule.initJPushService();
  167. jpushModule.setLoggerEnable(true);
  168. jpushModule.addConnectEventListener((result) => {
  169. formatAppLog("log", "at App.vue:42", result);
  170. let connectEnable = result.connectEnable;
  171. uni.$emit("connectStatusChange", connectEnable);
  172. });
  173. jpushModule.addNotificationListener((result) => {
  174. formatAppLog("log", "at App.vue:49", result);
  175. if (result.notificationEventType == "notificationOpened") {
  176. uni.navigateTo({
  177. url: "/pages/home/warningCenter/warningCenter",
  178. complete(res) {
  179. formatAppLog("log", "at App.vue:55", res);
  180. }
  181. });
  182. }
  183. });
  184. jpushModule.addCustomMessageListener((result) => {
  185. result.type;
  186. result.messageType;
  187. result.content;
  188. uni.showToast({
  189. icon: "none",
  190. title: JSON.stringify(result),
  191. duration: 3e3
  192. });
  193. });
  194. jpushModule.addLocalNotificationListener((result) => {
  195. result.messageID;
  196. result.title;
  197. result.content;
  198. result.extras;
  199. uni.showToast({
  200. icon: "none",
  201. title: JSON.stringify(result),
  202. duration: 3e3
  203. });
  204. });
  205. jpushModule.addGeofenceListener((result) => {
  206. result.code;
  207. result.type;
  208. result.geofenceId;
  209. result.userInfo;
  210. uni.showToast({
  211. icon: "none",
  212. title: "触发地理围栏",
  213. duration: 3e3
  214. });
  215. });
  216. jpushModule.setIsAllowedInMessagePop(true);
  217. jpushModule.pullInMessage((result) => {
  218. let code = result.code;
  219. formatAppLog("log", "at App.vue:100", code);
  220. });
  221. jpushModule.addInMessageListener((result) => {
  222. let eventType = result.eventType;
  223. let messageType = result.messageType;
  224. let content = result.content;
  225. formatAppLog("log", "at App.vue:107", "inMessageListener", eventType, messageType, content);
  226. uni.showToast({
  227. icon: "none",
  228. title: JSON.stringify(result),
  229. duration: 3e3
  230. });
  231. });
  232. },
  233. onShow: function() {
  234. formatAppLog("log", "at App.vue:117", "App Show");
  235. },
  236. onHide: function() {
  237. formatAppLog("log", "at App.vue:120", "App Hide");
  238. }
  239. };
  240. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/hongxing/uni-byte-sailing-mobile/App.vue"]]);
  241. function createApp() {
  242. const app = vue.createVueApp(App);
  243. return {
  244. app
  245. };
  246. }
  247. const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
  248. uni.Vuex = __Vuex__;
  249. uni.Pinia = __Pinia__;
  250. __app__.provide("__globalStyles", __uniConfig.styles);
  251. __app__._component.mpType = "app";
  252. __app__._component.render = () => {
  253. };
  254. __app__.mount("#app");
  255. })(Vue);