<template>
  <div class="container">
    <div class="list" style="padding-bottom: 30%;">
      <van-swipe-cell v-for="item in caseList" :key="item.id">
        <div class="kj">
          <div class="title">{{ item.title }}</div>
          <div class="ct" @click="handleDetail(item)">
            <img class="al" :src="item.img" alt>
            <div class="ck">查看详情</div>
          </div>
        </div>
        <div slot="right">
          <van-button square type="danger" text="删除" @click="handleDelete" />
        </div>
      </van-swipe-cell>
    </div>
    <!-- <div class="add-btn" @click="$router.push('/caseEdit')"> -->
      <!-- <img src="../../../public/img/add.png" alt="add" /> -->
    <!-- </div> -->
    <div class="main-menuBar">
      <div class="menuBar-menu" @click="menuBarClick('MainSale')">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['1']" />
        <div class="menuBar-title">活动</div>
      </div>
      <div class="menuBar-menu">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['2']" />
        <div class="menuBar-title menuBar-title-ac">案例</div>
      </div>
      <div class="menuBar-menu" @click="menuProfit()">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['3']" />
        <div class="menuBar-title">收益</div>
      </div>
      <div class="menuBar-menu" @click="menuTask()">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['4']" />
        <div class="menuBar-title">任务</div>
      </div>
      <div class="menuBar-menu" @click="menuBarClick('Me')">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['5']" />
        <div class="menuBar-title">我的</div>
      </div>
    </div>
  </div>
</template>

<script>
import { getCaseList } from "@/api/test/active";
import { Dialog } from "vant";
export default {
  data() {
    return {
      caseList: [
        {
          id: 1,
          title: "店主这样使用微信引流，门店营业额竟然直接涨了一倍",
          img: '/img/detail_1.jpg'
        },
        {
          id: 2,
          title: "微信加了很多顾客，但是商品卖不出去，怎么办？",
          img: '/img/detail_2.jpg'
        },
        {
          id: 3,
          title: "技巧｜手把手教你做微信顾客群，店主试过，营业额涨了一倍",
          img: '/img/detail_3.jpg'
        }
      ],
      // 图标
      menuBarInfo: {
        list: {
          main: [
            {
              name: "",
              iconUaUrl: "",
              iconAcUrl: ""
            }
          ]
        },
        icon: {
          now: {
            "1": "",
            "2": "",
            "3": "",
            "4": "",
            "5": ""
          },
          ua: {
            "1": "/mainSale/icon-menuBar-1-ua.png",
            "2": "/mainSale/icon-menuBar-2-ua.png",
            "3": "/mainSale/icon-menuBar-3-ua.png",
            "4": "/mainSale/icon-menuBar-4-ua.png",
            "5": "/mainSale/icon-menuBar-5-ua.png"
          },
          ac: {
            "1": "/mainSale/icon-menuBar-1-ac.png",
            "2": "/mainSale/icon-menuBar-2-ac.png",
            "3": "/mainSale/icon-menuBar-3-ac.png",
            "4": "/mainSale/icon-menuBar-4-ac.png",
            "5": "/mainSale/icon-menuBar-5-ac.png"
          }
        }
      }
    };
  },
  created() {
    this.checkNowMenuBar();
    this.getList();
  },
  methods: {
    handleDelete() {
      console.log("删除");
      Dialog.alert({
        title: "是否真的要删除此文章？",
        message: "文章删除后将从用户的文章列表消失且不可恢复。",
        showCancelButton: true
      })
        .then(() => {
          // on close
        })
        .catch(() => {
          // on cancel
        });
    },
    getList() {
      /*  let data = {

      }
      getCaseList(data).then( res => {
        console.log(res,"案例列表")  
      }) */
    },
    handleDetail(item) {
      this.$router.push({
        path: "caseDetail",
        query: {
          id: item.id,
          title: item.title
        }
      });
    },
    // 导航
    checkNowMenuBar() {
      let inData = "2";
      this.menuBarInfo.icon.now = this.menuBarInfo.icon.ua;
      this.menuBarInfo.icon.now[inData] = this.menuBarInfo.icon.ac[inData];
    },
    menuBarClick(inData) {
      this.$router.push(inData);
    },
    listTaskClick() {
      this.$router.push("Task");
    },
    menuProfit() {
      this.$router.push({ path: "/profitList" });
    },
    menuTask() {
      this.$router.push({ path: "/taskList" });
    }
  }
};
</script>

<style scoped>
.add-btn {
  position: fixed;
  bottom: 75px;
  right: 20px;
  z-index: 10;
  width: 60px;
}
.add-btn img {
  width: 100%;
}
.kj {
  width: 100%;
  height: 229px;
  background: rgba(248, 248, 248, 1);
  padding: 12px;
  margin-bottom: 10px;
}
.container {
  padding: 16px;
}
.title {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: bold;
  color: rgba(45, 71, 106, 1);
}
.ct {
  width: 100%;
  height: 180px;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0px 2px 4px 0px rgba(221, 221, 221, 1);
  border-radius: 10px;
  margin-top: 12px;
  position: relative;
}
.ck {
  position: absolute;
  width: 100%;
  bottom: 0;
  height: 32px;
  line-height: 32px;
  text-align: center;
  background: rgba(117, 178, 253, 0.8);
  border-radius: 0px 0px 10px 10px;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 1);
}
.main-menuBar {
  /*border: 1px solid darkviolet;*/
  box-shadow: inset 0px 1px 2px 0px rgba(221, 221, 221, 1);
  width: 100%;
  height: 82px;
  position: fixed;
  bottom: 0px;
  left: 0px;
  background-color: #fafafa;
  padding: 0px 14px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
.menuBar-menu {
  /*background-color: greenyellow;*/
  width: 48px;
  height: 47px;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}
.menuBar-icon {
  width: 24px;
  height: 24px;
  object-fit: cover;
}
.menuBar-title {
  width: auto;
  height: 12px;
  font-size: 10px;
  font-weight: bold;
  color: rgba(67, 119, 188, 0.4);
  text-align: center;
}
.menuBar-title-ac {
  color: rgba(67, 119, 188, 1);
}
.last {
  margin-bottom: 80px;
}
.al,
.fw,
.jq {
    height: 100%;
    width: 100%;
    border-radius: 10px;
  /* background: url(../../../public/img/cswiper.png) no-repeat; */
  background-size: cover;
}
</style>

<style lang="scss">
.container {
  .van-swipe-cell__right > div {
    height: 100%;
  }
  .van-button {
    height: 100%;
  }
}
</style>