app-service.js 14.6 KB
Newer Older
杜庆泉's avatar
杜庆泉 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
  Promise.prototype.finally = function(callback) {
    const promise = this.constructor;
    return this.then((value) => promise.resolve(callback()).then(() => value), (reason) => promise.resolve(callback()).then(() => {
      throw reason;
    }));
  };
}
;
if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
  const global = uni.requireGlobal();
  ArrayBuffer = global.ArrayBuffer;
  Int8Array = global.Int8Array;
  Uint8Array = global.Uint8Array;
  Uint8ClampedArray = global.Uint8ClampedArray;
  Int16Array = global.Int16Array;
  Uint16Array = global.Uint16Array;
  Int32Array = global.Int32Array;
  Uint32Array = global.Uint32Array;
  Float32Array = global.Float32Array;
  Float64Array = global.Float64Array;
  BigInt64Array = global.BigInt64Array;
  BigUint64Array = global.BigUint64Array;
}
;
if (uni.restoreGlobal) {
  uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
}
(function(shared, vue) {
  "use strict";
  function isDebugMode() {
    return typeof __channelId__ === "string" && __channelId__;
  }
  function jsonStringifyReplacer(k, p) {
    switch (shared.toRawType(p)) {
      case "Function":
        return "function() { [native code] }";
      default:
        return p;
    }
  }
  function normalizeLog(type, filename, args) {
    if (isDebugMode()) {
      args.push(filename.replace("at ", "uni-app:///"));
      return console[type].apply(console, args);
    }
    const msgs = args.map(function(v) {
      const type2 = shared.toTypeString(v).toLowerCase();
      if (["[object object]", "[object array]", "[object module]"].indexOf(type2) !== -1) {
        try {
          v = "---BEGIN:JSON---" + JSON.stringify(v, jsonStringifyReplacer) + "---END:JSON---";
        } catch (e) {
          v = type2;
        }
      } else {
        if (v === null) {
          v = "---NULL---";
        } else if (v === void 0) {
          v = "---UNDEFINED---";
        } else {
          const vType = shared.toRawType(v).toUpperCase();
          if (vType === "NUMBER" || vType === "BOOLEAN") {
            v = "---BEGIN:" + vType + "---" + v + "---END:" + vType + "---";
          } else {
            v = String(v);
          }
        }
      }
      return v;
    });
    return msgs.join("---COMMA---") + " " + filename;
  }
  function formatAppLog(type, filename, ...args) {
    const res = normalizeLog(type, filename, args);
    res && console[type](res);
  }
  var _export_sfc = (sfc, props) => {
    const target = sfc.__vccOpts || sfc;
    for (const [key, val] of props) {
      target[key] = val;
    }
    return target;
  };
  const _sfc_main$5 = {
    name: "page-head",
    props: {
      title: {
        type: String,
        default: ""
      }
    }
  };
杜庆泉's avatar
杜庆泉 已提交
93
  function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
杜庆泉's avatar
杜庆泉 已提交
94 95 96 97
    return vue.openBlock(), vue.createElementBlock("view", { class: "common-page-head" }, [
      vue.createElementVNode("view", { class: "common-page-head-title" }, vue.toDisplayString($props.title), 1)
    ]);
  }
杜庆泉's avatar
杜庆泉 已提交
98
  var __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__file", "D:/Do/Source/hello-uts/components/page-head/page-head.vue"]]);
杜庆泉's avatar
杜庆泉 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
  function requireNativePlugin(name) {
    return weex.requireModule(name);
  }
  function resolveEasycom(component, easycom) {
    return shared.isString(component) ? easycom : component;
  }
  let callbackId = 1;
  let proxy;
  const callbacks = {};
  function normalizeArg(arg) {
    if (typeof arg === "function") {
      const id = callbackId++;
      callbacks[id] = arg;
      return id;
    } else if (shared.isPlainObject(arg)) {
      Object.keys(arg).forEach((name) => {
        arg[name] = normalizeArg(arg[name]);
      });
    }
    return arg;
  }
  function getProxy() {
    if (!proxy) {
      proxy = requireNativePlugin("UTS-Proxy");
    }
    return proxy;
  }
  function resolveSyncResult(res) {
    if (res.errMsg) {
      throw new Error(res.errMsg);
    }
    return res.params;
  }
  function initProxyFunction(async, { package: pkg2, class: cls2, name: propOrMethod, id: instanceId, companion }) {
    const invokeCallback = ({ id, name, params, keepAlive }) => {
      const callback = callbacks[id];
      if (callback) {
        callback(...params);
        if (!keepAlive) {
          delete callbacks[id];
        }
      } else {
        console.error(`${pkg2}${cls2}.${propOrMethod} ${name} is not found`);
      }
    };
    const baseArgs = instanceId ? { id: instanceId, name: propOrMethod } : {
      package: pkg2,
      class: cls2,
      name: propOrMethod,
      companion
    };
    return (...args) => {
      const invokeArgs = shared.extend({}, baseArgs, {
        params: args.map((arg) => normalizeArg(arg))
      });
      if (async) {
        return new Promise((resolve, reject) => {
          getProxy().invokeAsync(invokeArgs, (res) => {
            if (res.type !== "return") {
              invokeCallback(res);
            } else {
              if (res.errMsg) {
                reject(res.errMsg);
              } else {
                resolve(res.params);
              }
            }
          });
        });
      }
      return resolveSyncResult(getProxy().invokeSync(invokeArgs, invokeCallback));
    };
  }
  function initUtsStaticMethod(async, opts) {
    return initProxyFunction(async, opts);
  }
  const initUtsProxyFunction = initUtsStaticMethod;
  const pkg$2 = "uts.modules.utsHelloworld";
  const cls$2 = "IndexKt";
  const callWithoutParam = initUtsProxyFunction(false, { package: pkg$2, class: cls$2, name: "callWithoutParam" });
  const callWithStringParam = initUtsProxyFunction(false, { package: pkg$2, class: cls$2, name: "callWithStringParam" });
  const callWithJSONParam = initUtsProxyFunction(false, { package: pkg$2, class: cls$2, name: "callWithJSONParam" });
  const _sfc_main$4 = {
    data() {
      return {
        title: "UTS\u5165\u95E8\u793A\u4F8B",
        stringParam: "hello world"
      };
    },
    onUnload: function() {
    },
    methods: {
      testDoSthWithCallback: function() {
        callWithoutParam({
          success: function() {
            uni.showToast({
              title: "\u6210\u529F\u8C03\u7528uts\u63D2\u4EF6uts-helloworld\u7684callWithoutParam",
              icon: "none"
            });
          }
        });
      },
      testDoSthWithString: function() {
        callWithStringParam({
          input: this.stringParam,
          success: function(response) {
            uni.showToast({
              title: "uts\u63D2\u4EF6uts-helloworld\u7684callWithStringParam\u65B9\u6CD5\u6536\u5230\u4E86\u4F60\u8F93\u5165\u7684\u5B57\u7B26\u4E32\uFF1A" + response,
              icon: "none"
            });
          }
        });
      },
      testDoSthWithJSON: function() {
        formatAppLog("log", "at pages/tabBar/Primer/Primer.vue:51", this.jsonParam);
        var inputObject = {
          inputText: this.stringParam
        };
        callWithJSONParam({
          input: inputObject,
          success: function(response) {
            formatAppLog("log", "at pages/tabBar/Primer/Primer.vue:59", response);
            uni.showToast({
              title: "\u6267\u884C\u7ED3\u679C:" + JSON.stringify(response),
              icon: "none"
            });
          }
        });
      }
    }
  };
杜庆泉's avatar
杜庆泉 已提交
230
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
杜庆泉's avatar
杜庆泉 已提交
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
    const _component_page_head = resolveEasycom(vue.resolveDynamicComponent("page-head"), __easycom_0);
    return vue.openBlock(), vue.createElementBlock("view", null, [
      vue.createVNode(_component_page_head, { title: $data.title }, null, 8, ["title"]),
      vue.withDirectives(vue.createElementVNode("input", {
        class: "uni-input",
        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.stringParam = $event)
      }, null, 512), [
        [vue.vModelText, $data.stringParam]
      ]),
      vue.createElementVNode("view", { class: "uni-btn-v uni-common-mt" }, [
        vue.createElementVNode("button", {
          type: "primary",
          onClick: _cache[1] || (_cache[1] = (...args) => $options.testDoSthWithCallback && $options.testDoSthWithCallback(...args))
        }, "uts\u5F02\u6B65\u65B9\u6CD5\uFF08\u65E0\u53C2\u6570\uFF09"),
        vue.createElementVNode("button", {
          type: "primary",
          onClick: _cache[2] || (_cache[2] = (...args) => $options.testDoSthWithString && $options.testDoSthWithString(...args))
        }, "uts\u5F02\u6B65\u65B9\u6CD5\uFF08\u5B57\u7B26\u4E32\u53C2\u6570\uFF09"),
        vue.createElementVNode("button", {
          type: "primary",
          onClick: _cache[3] || (_cache[3] = (...args) => $options.testDoSthWithJSON && $options.testDoSthWithJSON(...args))
        }, "uts\u5F02\u6B65\u65B9\u6CD5\uFF08json\u53C2\u6570\uFF09")
      ])
    ]);
  }
杜庆泉's avatar
杜庆泉 已提交
256
  var PagesTabBarPrimerPrimer = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__file", "D:/Do/Source/hello-uts/pages/tabBar/Primer/Primer.vue"]]);
杜庆泉's avatar
杜庆泉 已提交
257 258
  const pkg$1 = "uts.modules.utsAdvance";
  const cls$1 = "IndexKt";
杜庆泉's avatar
杜庆泉 已提交
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
  const doTimerTask = initUtsProxyFunction(false, { package: pkg$1, class: cls$1, name: "doTimerTask" });
  const doIntervalTask = initUtsProxyFunction(false, { package: pkg$1, class: cls$1, name: "doIntervalTask" });
  const _sfc_main$3 = {
    data() {
      return {
        title: "UTS\u8FDB\u9636\u793A\u4F8B",
        taskId: 0
      };
    },
    onUnload: function() {
    },
    methods: {
      testTimer: function() {
        doTimerTask({
          start: function(response) {
            uni.showToast({
              title: response,
              icon: "none"
            });
          },
          work: function(response) {
            uni.showToast({
              title: response,
              icon: "none"
            });
杜庆泉's avatar
杜庆泉 已提交
284 285
          }
        });
杜庆泉's avatar
杜庆泉 已提交
286 287 288 289 290 291 292 293 294 295 296 297 298 299
      },
      testInterval: function() {
        var ret = doIntervalTask({
          start: function(response) {
            uni.showToast({
              title: response,
              icon: "none"
            });
          },
          work: function(response) {
            uni.showToast({
              title: response,
              icon: "none"
            });
杜庆泉's avatar
杜庆泉 已提交
300
          }
杜庆泉's avatar
杜庆泉 已提交
301 302 303 304 305
        });
        this.taskId = ret.taskId;
      },
      testClearInterval: function() {
        formatAppLog("log", "at pages/tabBar/Advance/Advance.vue:62", this.taskId);
杜庆泉's avatar
杜庆泉 已提交
306 307
      }
    }
杜庆泉's avatar
杜庆泉 已提交
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
  };
  function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
    const _component_page_head = resolveEasycom(vue.resolveDynamicComponent("page-head"), __easycom_0);
    return vue.openBlock(), vue.createElementBlock("view", null, [
      vue.createVNode(_component_page_head, { title: $data.title }, null, 8, ["title"]),
      vue.createElementVNode("view", { class: "uni-btn-v uni-common-mt" }, [
        vue.createElementVNode("button", {
          type: "primary",
          onClick: _cache[0] || (_cache[0] = (...args) => $options.testTimer && $options.testTimer(...args))
        }, "\u5EF6\u8FDF\u4EFB\u52A1"),
        vue.createElementVNode("button", {
          type: "primary",
          onClick: _cache[1] || (_cache[1] = (...args) => $options.testInterval && $options.testInterval(...args))
        }, "\u5B9A\u65F6\u4EFB\u52A1"),
        vue.createElementVNode("button", {
          type: "primary",
          onClick: _cache[2] || (_cache[2] = (...args) => $options.testClearInterval && $options.testClearInterval(...args))
        }, "\u5173\u95ED\u5B9A\u65F6\u4EFB\u52A1")
      ])
    ]);
  }
  var PagesTabBarAdvanceAdvance = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "D:/Do/Source/hello-uts/pages/tabBar/Advance/Advance.vue"]]);
杜庆泉's avatar
杜庆泉 已提交
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
  const pkg = "uts.modules.utsOsapi";
  const cls = "IndexKt";
  const getBatteryCapacity = initUtsProxyFunction(false, { package: pkg, class: cls, name: "getBatteryCapacity" });
  const _sfc_main$2 = {
    data() {
      return {
        title: "\u7CFB\u7EDFAPI\u793A\u4F8B"
      };
    },
    onUnload: function() {
    },
    methods: {
      testGetBatteryCapacity: function() {
        var capacity = getBatteryCapacity();
        formatAppLog("log", "at pages/tabBar/SystemAPI/SystemAPI.vue:25", capacity);
        uni.showToast({
          title: "\u5F53\u524D\u7535\u91CF\uFF1A" + capacity,
          icon: "none"
        });
      }
    }
  };
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
    const _component_page_head = resolveEasycom(vue.resolveDynamicComponent("page-head"), __easycom_0);
    return vue.openBlock(), vue.createElementBlock("view", null, [
      vue.createVNode(_component_page_head, { title: $data.title }, null, 8, ["title"]),
      vue.createElementVNode("view", { class: "uni-btn-v uni-common-mt" }, [
        vue.createElementVNode("button", {
          type: "primary",
          onClick: _cache[0] || (_cache[0] = (...args) => $options.testGetBatteryCapacity && $options.testGetBatteryCapacity(...args))
        }, "\u83B7\u53D6\u7535\u6C60\u7535\u91CF")
      ])
    ]);
  }
  var PagesTabBarSystemAPISystemAPI = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "D:/Do/Source/hello-uts/pages/tabBar/SystemAPI/SystemAPI.vue"]]);
  const _sfc_main$1 = {
    data() {
      return {};
    },
    methods: {}
  };
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
    return vue.openBlock(), vue.createElementBlock("view", null, [
      vue.createElementVNode("text", null, "sdk\u96C6\u6210")
    ]);
  }
  var PagesTabBarSDKIntegrationSDKIntegration = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "D:/Do/Source/hello-uts/pages/tabBar/SDKIntegration/SDKIntegration.vue"]]);
  __definePage("pages/tabBar/Primer/Primer", PagesTabBarPrimerPrimer);
  __definePage("pages/tabBar/Advance/Advance", PagesTabBarAdvanceAdvance);
  __definePage("pages/tabBar/SystemAPI/SystemAPI", PagesTabBarSystemAPISystemAPI);
  __definePage("pages/tabBar/SDKIntegration/SDKIntegration", PagesTabBarSDKIntegrationSDKIntegration);
  const _sfc_main = {
    onLaunch: function() {
      formatAppLog("log", "at App.vue:4", "App Launch");
    },
    onShow: function() {
      formatAppLog("log", "at App.vue:7", "App Show");
    },
    onHide: function() {
      formatAppLog("log", "at App.vue:10", "App Hide");
    }
  };
  var App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/Do/Source/hello-uts/App.vue"]]);
  function createApp() {
    const app = vue.createVueApp(App);
    return {
      app
    };
  }
  const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
  uni.Vuex = __Vuex__;
  uni.Pinia = __Pinia__;
  __app__.provide("__globalStyles", __uniConfig.styles);
  __app__._component.mpType = "app";
  __app__._component.render = () => {
  };
  __app__.mount("#app");
})(uni.VueShared, Vue);