1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const sheep_platform_provider_wechat_index = require("./provider/wechat/index.js");
- const sheep_platform_provider_apple_index = require("./provider/apple/index.js");
- const sheep_platform_share = require("./share.js");
- const sheep_platform_pay = require("./pay.js");
- const device = common_vendor.index.getSystemInfoSync();
- const os = device.platform;
- let name = "";
- let provider = "";
- let platform = "";
- let isWechatInstalled = true;
- name = "WechatMiniProgram";
- platform = "miniProgram";
- provider = "wechat";
- if (common_vendor.lodashExports.isEmpty(name)) {
- common_vendor.index.showToast({
- title: "暂不支持该平台",
- icon: "none"
- });
- }
- const load = () => {
- if (provider === "wechat") {
- sheep_platform_provider_wechat_index.wechat.load();
- }
- };
- const useProvider = (_provider = "") => {
- if (_provider === "")
- _provider = provider;
- if (_provider === "wechat")
- return sheep_platform_provider_wechat_index.wechat;
- if (_provider === "apple")
- return sheep_platform_provider_apple_index.apple;
- };
- const pay = (payment, orderType, orderSN) => {
- return new sheep_platform_pay.SheepPay(payment, orderType, orderSN);
- };
- const checkUpdate = (silence = false) => {
- useProvider().checkUpdate(silence);
- };
- async function checkNetwork() {
- const networkStatus = await common_vendor.index.getNetworkType();
- if (networkStatus.networkType == "none") {
- return Promise.resolve(false);
- }
- return Promise.resolve(true);
- }
- const getCapsule = () => {
- let capsule2 = common_vendor.index.getMenuButtonBoundingClientRect();
- if (!capsule2) {
- capsule2 = {
- bottom: 56,
- height: 32,
- left: 278,
- right: 365,
- top: 24,
- width: 87
- };
- }
- return capsule2;
- };
- const capsule = getCapsule();
- const getNavBar = () => {
- return device.statusBarHeight + 44;
- };
- const navbar = getNavBar();
- function getLandingPage() {
- let page = "";
- return page;
- }
- const landingPage = getLandingPage();
- const _platform = {
- name,
- device,
- os,
- provider,
- platform,
- useProvider,
- checkUpdate,
- checkNetwork,
- pay,
- share: sheep_platform_share.$share,
- load,
- capsule,
- navbar,
- landingPage,
- isWechatInstalled
- };
- exports._platform = _platform;
|