{"size": 1456, "ext": "js", "max_stars_repo_path": "src/views/component/aby/characterShowbox.js", "max_stars_repo_name": "Asado33/Adachi-BOT", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/views/component/aby/characterShowbox.js", "max_issues_repo_name": "Asado33/Adachi-BOT", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/views/component/aby/characterShowbox.js", "max_forks_repo_name": "Asado33/Adachi-BOT", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.0, "max_line_length": 114, "alphanum_fraction": 0.6195054945}
import { html } from "../common/html.js";

// eslint-disable-next-line no-undef
const { defineComponent } = Vue;

const showboxTemplate = html`
  <div class="container-character" :class="additionalClass">
    <img class="avatar-face" :class="rarity" :src="avatarIcon" alt="加载图片失败" />
    <p class="showbox-label">{{label}}</p>
  </div>
`;

export default defineComponent({
  name: "characterShowbox",
  template: showboxTemplate,
  props: {
    data: Object,
    prefix: String,
    suffix: String,
    showType: String,
    htmlClass: String,
  },
  setup(props) {
    const rarityClassMap = {
      5: "star-five",
      4: "star-four",
    };
    const showType = props.showType;
    const avatarIcon = showType === "revealRank" ? encodeURI(props.data.avatar_icon) : encodeURI(props.data.icon);
    const rarity = rarityClassMap[props.data.rarity] || "star-four";
    const prefix = props.prefix || "";
    const suffix = props.suffix || "";
    const htmlClass = props.htmlClass || "";
    const label =
      showType === "revealRank"
        ? Object.prototype.hasOwnProperty.call(props.data, "value")
          ? prefix + props.data.value.toString() + suffix
          : ""
        : Object.prototype.hasOwnProperty.call(props.data, "level")
        ? prefix + props.data.level.toString() + suffix
        : "";
    const additionalClass = htmlClass;

    return {
      avatarIcon,
      rarity,
      label,
      additionalClass,
    };
  },
});
