<template>
  <div class="app-container">
    <div style="width: 100%; margin: 20px auto; height: 260px">
      <!-- Using the slider component -->
      <slider ref="slider" :options="options">
        <!-- slideritem wrapped package with the components you need -->
        <slideritem
          v-for="(item, index) in someList"
          :key="index"
          :style="item.style"
          >
            <img :src="item.src" style="width: 100%;height: auto;" />
          </slideritem
        >
        <!-- Customizable loading -->
        <div slot="loading">loading...</div>
      </slider>
    </div>
    <div class="category-content">
      <div class="top">
        <label>精品应用</label>
        <p><span>查看更多</span><i class="iconfont icon-jiantouyou"></i></p>
      </div>
      <div class="content">
        <div class="item" @click="toApp">
          <img src="../../assets/images/com.qq.weixin.deepin.svg" />
          <span>微聊</span>
          <button>安装</button>
        </div>
        <div class="item" @click="toApp">
          <img src="../../assets/images/dde-calendar.svg" />
          <span>日历</span>
          <button>安装</button>
        </div>
        <div class="item" @click="toApp">
          <img src="../../assets/images/deepin-calculator.svg" />
          <span>计算器</span>
          <button>安装</button>
        </div>
        <div class="item" @click="toApp">
          <img src="../../assets/images/deepin-album.svg" />
          <span>相册</span>
          <button>安装</button>
        </div>
        <div class="item" @click="toApp">
          <img src="../../assets/images/deepin-music.svg" />
          <span>音乐播放器</span>
          <button>安装</button>
        </div>
        <div class="item" @click="toApp">
          <img src="../../assets/images/deepin-phone-master.svg" />
          <span>手表管家</span>
          <button>安装</button>
        </div>
        <div class="item" @click="toApp">
          <img src="../../assets/images/deepin-voice-recorder.svg" />
          <span>录音机</span>
          <button>安装</button>
        </div>
        <div class="item" @click="toApp">
          <img src="../../assets/images/desktop-ai-assistant.svg" />
          <span>语音助手</span>
          <button>安装</button>
        </div>
      </div>
    </div>
    <div class="list-content">
      <div class="top">
        <label>大家都在用</label>
        <p><span>查看更多</span><i class="iconfont icon-jiantouyou"></i></p>
      </div>
      <div class="content">
        <div class="item">
          <img src="../../assets/images/alipay.svg" alt="icon" />
          <div class="text">
            <p class="title">支付宝</p>
            <p class="subtitle">
              <star-rating
                v-bind:rating="4.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/deepin-voice-note.svg" alt="icon" />
          <div class="text">
            <p class="title">语音记事本</p>
            <p class="subtitle">
              <star-rating
                v-bind:rating="3.7"
                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/dde-introduction.svg" alt="icon" />
          <div class="text">
            <p class="title">客服反馈</p>
            <p class="subtitle">
              <star-rating
                v-bind:rating="3.0"
                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/deepin-camera.svg" alt="icon" />
          <div class="text">
            <p class="title">相机</p>
            <p class="subtitle">
              <star-rating
                v-bind:rating="4.0"
                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/deepin-draw.svg" alt="icon" />
          <div class="text">
            <p class="title">画板</p>
            <p class="subtitle">
              <star-rating
                v-bind:rating="3.1"
                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/deepin-movie.svg" alt="icon" />
          <div class="text">
            <p class="title">视频</p>
            <p class="subtitle">
              <star-rating
                v-bind:rating="3.7"
                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>
  </div>
</template>
<script>
import { slider, slideritem } from "vue-concise-slider";
import StarRating from "vue-star-rating";
export default {
  name: "Gallery",
  data() {
    return {
      //data list [array]
      someList: [
        {
          html: "slide1",
          src: "http://www.qingyy.net/Public/attached/2017/12/05/5a25f71cc3e68.png",
          style: {
            background: "#1bbc9b",
          },
        },
        {
          html: "slide2",
          src: "http://www.qingyy.net/Public/attached/2017/12/05/5a25f71cc3e68.png",
          style: {
            background: "#4bbfc3",
          },
        },
        {
          html: "slide3",
          src: "http://www.qingyy.net/Public/attached/2017/12/05/5a25f71cc3e68.png",
          style: {
            background: "#7baabe",
          },
        },
      ],
      //Slider configuration [obj]
      options: {
        loop: true,
        speed: 300,
        autoplay: "1000",
        currentPage: 0,
      },
    };
  },
  components: {
    slider,
    slideritem,
    StarRating,
  },
  computed: {},
  methods: {
    toApp() {
        this.$router.push({ path: "/application" })
    },
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  mounted() {},
  created() {},
};
</script>
<style lang="scss" scoped>
div.category-content,
div.list-content {
  & > div.top {
    display: flex;
    justify-content: space-between;
    & > label {
      margin: 0px;
      font-size: 20px;
    }
    & > p {
      cursor: pointer;
      margin: 0px;
      display: inline-flex;
      align-items: center;
      font-size: 14px;
      & > img {
        width: 20px;
        height: 20px;
      }
    }
  }
  & > div.content {
    display: flex;
    flex-direction: row;
    flex-grow: 1;
    margin: 20px 0px;
    & > div.item {
      flex: 1;
      cursor: pointer;
      margin: 15px 0px;
      display: inline-flex;
      flex-direction: column;
      border-bottom: 1px solid #f2f2f2;
      & > img {
        width: 80px;
        height: 80px;
        margin: 0px auto;
        display: inline-block;
        transition: all 0.6s;
      }
      & > img:hover {
        transform: scale(1.3);
      }
      & > span {
        font-size: 15px;
        text-align: center;
        margin: 10px 0px;
      }
      & > button {
        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.list-content {
  & > 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>
