/*
 * @Descripttion: HJ
 * @Company: 思宏科技
 * @version: v1.0
 * @Author: HJ
 * @Date: 2020-08-24 15:08:50
 * @LastEditors: HJ
 * @LastEditTime: 2021-06-10 11:42:47
 */
Component({
  properties: {
    siteData: {
      type: Object,
      value: {},
    },
  },
  data: {
    height: 84,
    navBarHeight: 84,
    menuBotton: 4,
    menuHeight: 32,
    siteData: {
      showCapsule: 1,
    },
    addressname: "",
  },
  attached: function () {
    const { watch, navBarFlag } = getApp();
    navBarFlag ? watch("navBarFlag", this.init.bind(this)) : this.init(true)
  },
  methods: {
    _navback() {
      wx.navigateBack();
    },
    _backhome() {
      wx.reLaunch({
        url: "/pages/home/index",
      });
    },
    golocation: function () {
      wx.navigateTo({
        url: "../../package/addressswitching/addressswitching",
      });
    },
    init(data) {
      if (data) {
        const defaultMenuHeight = 32;
        const defaultBarHeight = 84;
        const defaultMenuBottom = 4;

        const {
          barheight: height,
          share = false,
          navBarHeight,
          menuBotton,
          menuHeight,
        } = getApp().globalData;
        this.setData({
          share,
          height: height || defaultBarHeight,
          navBarHeight: navBarHeight || defaultBarHeight,
          menuBotton: menuBotton || defaultMenuBottom,
          menuHeight: menuHeight || defaultMenuHeight,
        });
      }
    },
  },
});
