"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

require("./User.css");

var _Button = _interopRequireDefault(require("../Button"));

var _Popover = _interopRequireDefault(require("../Popover"));

var _Icon = _interopRequireDefault(require("../Icon"));

var _Link = _interopRequireDefault(require("./Link"));

var _constant = require("../_utils/constant.js");

var _component = require("../_utils/component.js");

var _vueNormalizeComponent = _interopRequireDefault(require("../_utils/vue-normalize-component.js"));

/* script */
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var __vue_script__ = {
  name: (0, _component.createComponentName)('header-user'),
  components: {
    Popover: _Popover.default,
    Icon: _Icon.default,
    Button: _Button.default,
    GdLink: _Link.default
  },
  mixins: [_component.componentMixin],
  props: {
    isLogined: {
      type: Boolean,
      default: false
    },
    // 触发退出
    logout: {
      type: Function,
      required: true
    },
    // 触发登录
    login: {
      type: Function,
      required: true
    }
  },

  beforeCreate() {
    this.url = _constant.REQUEST_RUL;
  }

};
/* template */

var __vue_render__ = function __vue_render__() {
  var _vm = this;

  var _h = _vm.$createElement;

  var _c = _vm._self._c || _h;

  return _c("div", {
    class: _vm.bem()
  }, [_vm.isLogined ? _c("Popover", {
    attrs: {
      tag: "div",
      arrow: false,
      placement: "bottom-end"
    }
  }, [_c("div", {
    class: _vm.bem("nick")
  }, [_c("div", {
    class: _vm.bem("username")
  }, [_vm._t("default")], 2), _vm._v(" "), _c("Icon", {
    attrs: {
      name: "triangle-down"
    }
  })], 1), _vm._v(" "), _c("div", {
    attrs: {
      slot: "content"
    },
    slot: "content"
  }, [_c("div", {
    class: _vm.bem("menus"),
    attrs: {
      role: "ul"
    }
  }, [_c("GdLink", {
    class: _vm.bem("menu"),
    attrs: {
      url: _vm.url + "/me/templets"
    }
  }, [_vm._v("作图记录")]), _vm._v(" "), _c("GdLink", {
    class: _vm.bem("menu"),
    attrs: {
      url: _vm.url + "/me/collection-templets"
    }
  }, [_vm._v("收藏夹")]), _vm._v(" "), _c("GdLink", {
    class: _vm.bem("menu"),
    attrs: {
      url: _vm.url + "/me/ps"
    }
  }, [_vm._v("图片记录")]), _vm._v(" "), _c("div", {
    class: _vm.bem("menu"),
    on: {
      click: _vm.logout
    }
  }, [_vm._v("退出")])], 1)])]) : _c("Button", {
    attrs: {
      size: "small",
      round: "",
      type: "primary"
    },
    on: {
      click: _vm.login
    }
  }, [_vm._v("登录/注册")])], 1);
};

var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = undefined;
/* module identifier */

var __vue_module_identifier__ = undefined;
/* functional template */

var __vue_is_functional_template__ = false;
/* component normalizer */

/* style inject */

/* style inject SSR */
var _default = (0, _vueNormalizeComponent.default)({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);

exports.default = _default;