"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const utils_navTo = require("../../utils/navTo.js");
if (!Array) {
  const _easycom_up__image2 = common_vendor.resolveComponent("up--image");
  const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  (_easycom_up__image2 + _easycom_up_icon2)();
}
const _easycom_up__image = () => "../../node-modules/uview-plus/components/u--image/u--image.js";
const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
if (!Math) {
  (_easycom_up__image + _easycom_up_icon)();
}
const _sfc_main = {
  __name: "navBar",
  props: {
    searchWord: {
      type: String,
      default: ""
    },
    type: {
      type: String,
      default: "home"
    },
    navName: {
      type: String,
      default: "肝胆相照临床病例库"
    }
  },
  emits: ["changeWord"],
  setup(__props, { emit: __emit }) {
    const userHeadImg = common_vendor.ref("");
    const keyWord = common_vendor.ref("");
    const props = __props;
    const placeholder = common_vendor.ref("输入疾病名称、标题、作者搜索");
    common_vendor.watch(() => props.type, (newVal) => {
    }, { immediate: true });
    common_vendor.watch(() => props.searchWord, (newVal) => {
      keyWord.value = newVal;
    });
    const goMy = () => {
      utils_navTo.navTo({
        url: "/pages/my/my"
      });
    };
    const search = () => {
      if (props.type == "home") {
        utils_navTo.navTo({
          url: `/pages/search/search?keyWord=${keyWord.value}`
        });
      } else if (props.type == "caseTalk") {
        utils_navTo.navTo({
          url: `/pages/specialList/specialList?keyWord=${keyWord.value}`
        });
      }
    };
    common_vendor.onLoad(() => {
      let userInfo = common_vendor.index.getStorageSync("userInfo");
      if (userInfo && userInfo.avatar) {
        userHeadImg.value = userInfo.avatar;
      } else {
        userHeadImg.value = common_assets.headImg;
      }
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          src: common_vendor.unref(common_assets.logoImg),
          width: "62rpx",
          height: "62rpx",
          radius: "50%"
        }),
        b: common_vendor.t(__props.navName),
        c: placeholder.value,
        d: keyWord.value,
        e: common_vendor.o(($event) => keyWord.value = $event.detail.value),
        f: common_vendor.o(search),
        g: common_vendor.p({
          name: "search",
          size: "26",
          color: "#999"
        }),
        h: common_vendor.o(goMy),
        i: common_vendor.p({
          src: userHeadImg.value,
          mode: "widthFix",
          width: "62rpx",
          height: "62rpx",
          radius: "50%"
        })
      };
    };
  }
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-fba290dc"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/navBar/navBar.js.map
