app-service.js 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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 requireNativePlugin(name) {
  35. return weex.requireModule(name);
  36. }
  37. function formatAppLog(type, filename, ...args) {
  38. if (uni.__log__) {
  39. uni.__log__(type, filename, ...args);
  40. } else {
  41. console[type].apply(console, [...args, filename]);
  42. }
  43. }
  44. const _export_sfc = (sfc, props) => {
  45. const target = sfc.__vccOpts || sfc;
  46. for (const [key, val] of props) {
  47. target[key] = val;
  48. }
  49. return target;
  50. };
  51. var wv;
  52. const _sfc_main$1 = {
  53. data() {
  54. return {
  55. title: "wdly",
  56. url: "http://139.9.102.170:10012/#/",
  57. src: "",
  58. canBack: false
  59. };
  60. },
  61. onBackPress() {
  62. if (wv && this.canBack) {
  63. wv.back();
  64. return true;
  65. }
  66. return false;
  67. },
  68. onReady() {
  69. var self = this;
  70. var currentWebview = this.$scope.$getAppWebview();
  71. setTimeout(function() {
  72. wv = currentWebview.children()[0];
  73. wv.addEventListener(
  74. "progressChanged",
  75. function(e) {
  76. wv.canBack(function(e2) {
  77. self.canBack = e2.canBack;
  78. });
  79. },
  80. false
  81. );
  82. }, 500);
  83. },
  84. onLoad() {
  85. var height = 0;
  86. uni.getSystemInfo({
  87. //成功获取的回调函数,返回值为系统信息
  88. success: (sysinfo) => {
  89. formatAppLog("log", "at pages/index/index.vue:57", sysinfo);
  90. height = sysinfo.windowHeight;
  91. },
  92. complete: () => {
  93. }
  94. });
  95. let info = uni.getSystemInfoSync();
  96. let top = info.statusBarHeight;
  97. formatAppLog("log", "at pages/index/index.vue:64", info, 12312312312);
  98. var currentWebview = this.$scope.$getAppWebview();
  99. let wvOne = currentWebview.children()[0];
  100. let data = {
  101. text: getApp().globalData.text
  102. };
  103. wvOne.evalJS(`getVueMessage(${JSON.stringify(data)})`);
  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:/uni-wdly-mobile/pages/index/index.vue"]]);
  131. __definePage("pages/index/index", PagesIndexIndex);
  132. const jpushModule = requireNativePlugin("JG-JPush");
  133. formatAppLog("log", "at App.vue:3", jpushModule.getRegistrationID, "jpushModule");
  134. const _sfc_main = {
  135. globalData: {
  136. text: "text"
  137. },
  138. onLaunch: function() {
  139. formatAppLog("log", "at App.vue:10", "App Launch");
  140. if (uni.getSystemInfoSync().platform == "ios") {
  141. let locationServicesEnabled = jpushModule.locationServicesEnabled();
  142. let locationAuthorizationStatus = jpushModule.getLocationAuthorizationStatus();
  143. formatAppLog("log", "at App.vue:15", "locationAuthorizationStatus", locationAuthorizationStatus);
  144. if (locationServicesEnabled == true && locationAuthorizationStatus < 3) {
  145. jpushModule.requestLocationAuthorization((result) => {
  146. formatAppLog("log", "at App.vue:18", "定位权限", result.status);
  147. });
  148. }
  149. jpushModule.requestNotificationAuthorization((result) => {
  150. let status = result.status;
  151. if (status < 2) {
  152. uni.showToast({
  153. icon: "none",
  154. title: "您还没有打开通知权限",
  155. duration: 3e3
  156. });
  157. }
  158. });
  159. }
  160. jpushModule.getRegistrationID((result) => {
  161. formatAppLog("log", "at App.vue:34", result, "注册ID.....");
  162. getApp().globalData.text = result.registerID;
  163. uni.showToast({
  164. title: result.registerID,
  165. icon: "success",
  166. duration: 3e4
  167. });
  168. });
  169. jpushModule.initJPushService();
  170. jpushModule.setLoggerEnable(true);
  171. jpushModule.addConnectEventListener((result) => {
  172. formatAppLog("log", "at App.vue:47", result);
  173. let connectEnable = result.connectEnable;
  174. uni.$emit("connectStatusChange", connectEnable);
  175. });
  176. jpushModule.addNotificationListener((result) => {
  177. formatAppLog("log", "at App.vue:54", result);
  178. if (result.notificationEventType == "notificationOpened") {
  179. uni.navigateTo({
  180. url: "/pages/home/warningCenter/warningCenter",
  181. complete(res) {
  182. formatAppLog("log", "at App.vue:60", res);
  183. }
  184. });
  185. }
  186. });
  187. jpushModule.addCustomMessageListener((result) => {
  188. result.type;
  189. result.messageType;
  190. result.content;
  191. uni.showToast({
  192. icon: "none",
  193. title: JSON.stringify(result),
  194. duration: 3e3
  195. });
  196. });
  197. jpushModule.addLocalNotificationListener((result) => {
  198. result.messageID;
  199. result.title;
  200. result.content;
  201. result.extras;
  202. uni.showToast({
  203. icon: "none",
  204. title: JSON.stringify(result),
  205. duration: 3e3
  206. });
  207. });
  208. jpushModule.addGeofenceListener((result) => {
  209. result.code;
  210. result.type;
  211. result.geofenceId;
  212. result.userInfo;
  213. uni.showToast({
  214. icon: "none",
  215. title: "触发地理围栏",
  216. duration: 3e3
  217. });
  218. });
  219. jpushModule.setIsAllowedInMessagePop(true);
  220. jpushModule.pullInMessage((result) => {
  221. let code = result.code;
  222. formatAppLog("log", "at App.vue:105", code);
  223. });
  224. jpushModule.addInMessageListener((result) => {
  225. let eventType = result.eventType;
  226. let messageType = result.messageType;
  227. let content = result.content;
  228. formatAppLog("log", "at App.vue:112", "inMessageListener", eventType, messageType, content);
  229. uni.showToast({
  230. icon: "none",
  231. title: JSON.stringify(result),
  232. duration: 3e3
  233. });
  234. });
  235. },
  236. onShow: function() {
  237. formatAppLog("log", "at App.vue:122", "App Show");
  238. },
  239. onHide: function() {
  240. formatAppLog("log", "at App.vue:125", "App Hide");
  241. }
  242. };
  243. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/uni-wdly-mobile/App.vue"]]);
  244. function createApp() {
  245. const app = vue.createVueApp(App);
  246. return {
  247. app
  248. };
  249. }
  250. const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
  251. uni.Vuex = __Vuex__;
  252. uni.Pinia = __Pinia__;
  253. __app__.provide("__globalStyles", __uniConfig.styles);
  254. __app__._component.mpType = "app";
  255. __app__._component.render = () => {
  256. };
  257. __app__.mount("#app");
  258. })(Vue);