From f86fee271896a5a42f3a78192d8c6e64e4058238 Mon Sep 17 00:00:00 2001 From: lf <1534621107@qq.com> Date: Tue, 23 Jul 2024 14:57:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=AE=E5=82=A8app=E5=94=A4=E8=B5=B7?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YT_Client_api.js | 61 ++++++++++++++++++++++++++++++++++++++ combining.html | 16 +++++++++- packkey/combining.html | 16 +++++++++- packkey/reduce.html | 13 +++++++- reduce.html | 14 ++++++++- xw-pages/reduce.html | 16 +++++++++- xw-pages/wx-combining.html | 16 +++++++++- 7 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 YT_Client_api.js diff --git a/YT_Client_api.js b/YT_Client_api.js new file mode 100644 index 0000000..1d70ae6 --- /dev/null +++ b/YT_Client_api.js @@ -0,0 +1,61 @@ +/** + * @author 何杰 + * @date 2016-08-01 12:00:00 + * @address www.yitong.com.cn + * @mail hj@yitong.com.cn + * @desc: 屹通客户端组件api + */ +var Fw = {}; +Fw.device = {}; +Fw.device.Device = function () { + var userAgent = navigator.userAgent; + //ios 事件队列 + var eventQueue = []; + return { + //是否iOS设备 + is_ios: userAgent.indexOf('iPhone') > -1 || userAgent.indexOf('iPad') > -1, + //是否Android设备 + is_android: userAgent.indexOf('Android') > -1, + /** + * ios + * 注册事件 + * @param code 事件编码 + * @param options 参数 + */ + addEvent: function (code, options) { + if (options && code) { + eventQueue.push(JSON.stringify({ + code: code, + name: options + })); + } + }, + /** + * ios + * 原生调用,从队列中获取事件 + * @returns {string} + */ + getEvent: function () { + return eventQueue.length > 0 ? eventQueue.shift() : '0'; + } + }; +}(); +/** + * 供第三方调用API + */ +Fw.device.api = function () { + var device = Fw.device.Device; + return { + /** + * @brief app跳转微信小程序 + */ + openWXMiniProgram: function (param) { + if (!device.is_ios && !device.is_android) { + alert("请在ios/android设备上使用!"); + return; + } + device.is_ios && device.addEvent("openWXMiniProgram", JSON.stringify(param)); + device.is_android && GetInfoJs.openWXMiniProgram(JSON.stringify(param)); + }, + } +}(); \ No newline at end of file diff --git a/combining.html b/combining.html index b375249..eb79522 100644 --- a/combining.html +++ b/combining.html @@ -14,6 +14,7 @@ +