"use strict";
const common_vendor = require("../common/vendor.js");
function useNav() {
  const nav = (e) => {
    if (e.call) {
      common_vendor.index.makePhoneCall({
        phoneNumber: "4008005326"
        //仅为示例
      });
      return;
    }
    if (!common_vendor.index.getStorageSync("token")) {
      common_vendor.index.showModal({
        title: "提示",
        content: "为提供更好的服务，请前往登录",
        success: (res) => {
          if (res.confirm) {
            common_vendor.index.navigateTo({
              url: "/pages/login/login"
            });
          } else if (res.cancel) {
            common_vendor.index.__f__("log", "at hooks/useNav.js:28", "用户点击取消");
          }
        }
      });
      return;
    }
    common_vendor.index[e.type == "nav" || !e.type ? "navigateTo" : e.type == "switchTab" ? "switchTab" : "navigateTo"]({
      url: e.path
    });
  };
  const navTo = (path, token, call) => {
    if (!common_vendor.index.getStorageSync("token")) {
      common_vendor.index.showModal({
        title: "提示",
        content: "为提供更好的服务，请前往登录",
        success: (res) => {
          if (res.confirm) {
            common_vendor.index.navigateTo({
              url: "/pages/login/login"
            });
          } else if (res.cancel) {
            common_vendor.index.__f__("log", "at hooks/useNav.js:57", "用户点击取消");
          }
        }
      });
      return;
    }
    common_vendor.index.navigateTo({
      url: path
    });
  };
  return {
    nav,
    navTo
  };
}
exports.useNav = useNav;
//# sourceMappingURL=../../.sourcemap/mp-weixin/hooks/useNav.js.map
