<template>
  <div class="app-container">
    <div class="top">
      <p>
        <label @click="toggleMenu('0057c0f3380c49dc9731bdba94420d9c')"
          >应用排行</label
        >
        <label @click="toggleMenu('5734225f9f4441c99553f00d06553831')"
          >游戏排行</label
        >
      </p>
      <p>
        <span v-for="(item, index) in tabList" :key="index">今日流行</span>
        <span>上升最快</span>
        <span>本周热议</span>
        <span>最近更新</span>
      </p>
    </div>
    <div class="content">
      <div class="item">
        <img src="../../assets/images/evue-logo.png" alt="icon" />
        <div class="text">
          <p class="title">EVUE</p>
          <p class="subtitle">
            <star-rating
              v-bind:rating="3.5"
              v-bind:increment="0.1"
              v-bind:max-rating="5"
              v-bind:star-size="15"
              v-bind:read-only="true"
              inactive-color="#9E9E9E"
              active-color="#FFC83D"
            >
            </star-rating>
          </p>
          <p class="subtitle">八零八零八附带上方</p>
        </div>
        <button class="install">安装</button>
      </div>
      <div class="item">
        <img src="../../assets/images/evue-logo.png" alt="icon" />
        <div class="text">
          <p class="title">EVUE</p>
          <p class="subtitle">
            <star-rating
              v-bind:rating="3.5"
              v-bind:increment="0.1"
              v-bind:max-rating="5"
              v-bind:star-size="15"
              v-bind:read-only="true"
              inactive-color="#9E9E9E"
              active-color="#FFC83D"
            >
            </star-rating>
          </p>
          <p class="subtitle">八零八零八附带上方</p>
        </div>
        <button class="install">安装</button>
      </div>
      <div class="item">
        <img src="../../assets/images/evue-logo.png" alt="icon" />
        <div class="text">
          <p class="title">EVUE</p>
          <p class="subtitle">
            <star-rating
              v-bind:rating="3.5"
              v-bind:increment="0.1"
              v-bind:max-rating="5"
              v-bind:star-size="15"
              v-bind:read-only="true"
              inactive-color="#9E9E9E"
              active-color="#FFC83D"
            >
            </star-rating>
          </p>
          <p class="subtitle">八零八零八附带上方</p>
        </div>
        <button class="install">安装</button>
      </div>
      <div class="item">
        <img src="../../assets/images/evue-logo.png" alt="icon" />
        <div class="text">
          <p class="title">EVUE</p>
          <p class="subtitle">
            <star-rating
              v-bind:rating="3.5"
              v-bind:increment="0.1"
              v-bind:max-rating="5"
              v-bind:star-size="15"
              v-bind:read-only="true"
              inactive-color="#9E9E9E"
              active-color="#FFC83D"
            >
            </star-rating>
          </p>
          <p class="subtitle">八零八零八附带上方</p>
        </div>
        <button class="install">安装</button>
      </div>
      <div class="item">
        <img src="../../assets/images/evue-logo.png" alt="icon" />
        <div class="text">
          <p class="title">EVUE</p>
          <p class="subtitle">
            <star-rating
              v-bind:rating="3.5"
              v-bind:increment="0.1"
              v-bind:max-rating="5"
              v-bind:star-size="15"
              v-bind:read-only="true"
              inactive-color="#9E9E9E"
              active-color="#FFC83D"
            >
            </star-rating>
          </p>
          <p class="subtitle">八零八零八附带上方</p>
        </div>
        <button class="install">安装</button>
      </div>
      <div class="item">
        <img src="../../assets/images/evue-logo.png" alt="icon" />
        <div class="text">
          <p class="title">EVUE</p>
          <p class="subtitle">
            <star-rating
              v-bind:rating="3.5"
              v-bind:increment="0.1"
              v-bind:max-rating="5"
              v-bind:star-size="15"
              v-bind:read-only="true"
              inactive-color="#9E9E9E"
              active-color="#FFC83D"
            >
            </star-rating>
          </p>
          <p class="subtitle">八零八零八附带上方</p>
        </div>
        <button class="install">安装</button>
      </div>
    </div>
  </div>
</template>
<script>
import { getDataList } from "@/api/app-store";
import StarRating from "vue-star-rating";
export default {
  name: "AppRank",
  components: {
    StarRating,
  },
  data() {
    return {
      tabIndex: 0,
      tabChildIndex: 0,
      tabList: [],
      tabChildList: [],
      dataList: [],
      query: {
        method: "internal.getTabDetail",
        serviceType: 20,
        reqPageNum: 1,
        uri: "0057c0f3380c49dc9731bdba94420d9c",
        maxResults: 25,
        zone: "",
        locale: "zh",
      },
    };
  },
  computed: {},
  methods: {
    getTabList() {
      getDataList(this.query)
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
        });
    },
    getDataList() {
      getDataList()
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
        });
    },
    toggleMenu(uri) {
      console.log(uri);
    },
  },
  created() {
    this.getTabList();
  },
};
</script>
<style lang="scss" scoped>
div.app-container {
  margin: 20px 0px;
  & > div.top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    & > p {
      margin: 0px;
      display: inline-flex;
      align-items: center;
      font-size: 14px;
      & > label {
        cursor: pointer;
        margin: 0px 10px;
        font-size: 18px;
        &:hover {
          color: #4cd1e0;
          text-decoration: underline;
        }
        &.active {
          color: #4cd1e0;
          text-decoration: underline;
        }
      }
      & > span {
        cursor: pointer;
        margin: 0px 10px;
        font-size: 13px;
        &.active {
          color: #4cd1e0;
        }
      }
    }
  }
  & > div.content {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    flex-grow: 1;
    flex-shrink: 0;
    & > div.item {
      flex: 1;
      width: 50%;
      max-width: 50%;
      min-width: 50%;
      cursor: pointer;
      display: inline-flex;
      flex-direction: row;
      box-sizing: border-box;
      border: none;
      margin: 0px;
      padding: 10px 20px;
      & > img {
        width: 80px;
        height: 80px;
      }
      & > button {
        width: 100px;
      }
      & > button.install {
        width: auto;
        min-width: 72px;
        max-width: 100px;
        height: 28px;
        margin: 10px auto;
        padding: 0 12px;
        font-size: 14px;
        font-weight: bolder;
        border-radius: 14px;
        color: #007dff;
        background: rgba(0, 0, 0, 0.05);
        border: 0;
        cursor: pointer;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        z-index: 1;
        outline: none;
      }
      & > div.text {
        flex: 1;
        padding: 15px 0px;
        margin-left: 20px;
        border-bottom: 1px solid #f2f2f2;
        & > p {
          margin: 1px 0px;
        }
        & > p.title {
          line-height: 18px;
        }
        & > p.subtitle {
          color: grey;
          font-size: 12px;
          line-height: 18px;
        }
      }
    }
  }
}
</style>
