"use strict";
const common_vendor = require("../vendor.js");
function goto(url) {
  common_vendor.index.navigateTo({ url, fail: () => common_vendor.index.switchTab({ url }) });
}
function gotoEventToPage(e) {
  if ((e == null ? void 0 : e.redirect_type) === "InnerPage") {
    goto(e == null ? void 0 : e.redirect_path);
    return;
  }
  if ((e == null ? void 0 : e.redirect_type) === "H5") {
    common_vendor.index.navigateTo({ url: `/pages/web_view/index?web_url=${encodeURIComponent(e == null ? void 0 : e.redirect_path)}` });
    return;
  }
  if ((e == null ? void 0 : e.redirect_type) === "AnotherMiniProgram") {
    common_vendor.index.navigateToMiniProgram({
      appId: e == null ? void 0 : e.app_id,
      path: (e == null ? void 0 : e.redirect_path) || "",
      success(res) {
      }
    });
  }
}
function showToastBack(label, delta = 1, back = true) {
  common_vendor.index.showToast({
    title: label || "提交成功！",
    duration: 1e3,
    icon: "none",
    success() {
      if (back) {
        setTimeout(() => {
          common_vendor.index.navigateBack({ delta });
        }, 1e3);
      }
    }
  });
}
function showToast(label) {
  common_vendor.index.showToast({
    title: label || "提交成功！",
    duration: 1e3,
    icon: "none"
  });
}
exports.goto = goto;
exports.gotoEventToPage = gotoEventToPage;
exports.showToast = showToast;
exports.showToastBack = showToastBack;
