"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_u_icon2 = common_vendor.resolveComponent("u-icon");
  const _easycom_up__image2 = common_vendor.resolveComponent("up--image");
  const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  (_easycom_u_icon2 + _easycom_up__image2 + _easycom_up_icon2)();
}
const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
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_u_icon + _easycom_up__image + _easycom_up_icon)();
}
const _sfc_main = {
  __name: "navBarSearch",
  props: {
    searchWord: {
      type: String,
      default: ""
    },
    type: {
      type: String,
      default: ""
    },
    navName: {
      type: String,
      default: "肝胆相照临床病例库"
    }
  },
  emits: ["changeWord"],
  setup(__props, { emit: __emit }) {
    const keyWord = common_vendor.ref("");
    const userHeadImg = common_vendor.ref("");
    const props = __props;
    const placeholder = common_vendor.ref("输入疾病名称、标题、作者搜索");
    common_vendor.watch(() => props.type, (newVal) => {
      if (newVal === "doctor") {
        placeholder.value = "输入医生姓名";
      } else if (newVal === "hospital") {
        placeholder.value = "输入医院名称";
      } else if (newVal === "video" || newVal === "article" || newVal === "case") {
        placeholder.value = "搜索疾病、症状、医院";
      }
    }, { immediate: true });
    common_vendor.watch(() => props.searchWord, (newVal) => {
      keyWord.value = newVal;
    });
    const emit = __emit;
    const goMy = () => {
      utils_navTo.navTo({
        url: "/pages/my/my"
      });
    };
    const goBack = () => {
      common_vendor.index.navigateBack({
        delta: 1
      });
    };
    common_vendor.onLoad(() => {
      let userInfo = common_vendor.index.getStorageSync("userInfo");
      if (userInfo && userInfo.avatar) {
        userHeadImg.value = userInfo.avatar;
      } else {
        userHeadImg.value = common_assets.headImg;
      }
    });
    const search = () => {
      emit("changeWord", keyWord.value);
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          name: "arrow-left",
          color: "#000",
          size: "24"
        }),
        b: common_vendor.o(goBack),
        c: common_vendor.p({
          src: common_vendor.unref(common_assets.logoImg),
          width: "62rpx",
          height: "62rpx",
          radius: "50%"
        }),
        d: common_vendor.t(__props.navName),
        e: placeholder.value,
        f: keyWord.value,
        g: common_vendor.o(($event) => keyWord.value = $event.detail.value),
        h: common_vendor.o(search),
        i: common_vendor.p({
          name: "search",
          size: "26",
          color: "#999"
        }),
        j: common_vendor.o(goMy),
        k: common_vendor.p({
          src: common_vendor.unref(common_assets.headImg),
          mode: "widthFix",
          width: "62rpx",
          height: "62rpx",
          radius: "50%"
        })
      };
    };
  }
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4eb3cf28"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/navBarSearch/navBarSearch.js.map
