<template> <div> <div class="card" v-if="cateList.length != 0"> <!-- <div class="card_title"> <div>星期一</div> <span>2021年3月12</span> </div> --> <div class="card_con" v-for="(v, i) in cateList" :key="i"> <div class="card_L"></div> <div class="card_R"> <div class="card_R_text"> <div class="text_title"> {{ v.categoryName }}- <span v-if="v.type == 1">青铜级</span> <span v-if="v.type == 2">黄金级</span> <span v-if="v.type == 3">铂金级</span> </div> <!-- <div class="text_grey">用时:20:21</div> <div class="text_grey">错误:3题</div> --> </div> <div class="card_R_btn"> <div class="btn" @click="toAns(v)">答题</div> </div> </div> </div> </div> <van-empty v-else description="暂无数据" /> </div> </template> <script> export default { data() { return { cateList: [], }; }, methods: { //获取类型 getType() { this.yxAxios .get( `${this.kqUrl}/item/getItemCategory?travelerNum=` + localStorage.getItem("travelerNum") + "&type=" + this.$route.query.type ) .then((res) => { if (res.data.code == 200) { this.cateList = res.data.data; } else { this.$toast.fail(res.data.message); } }); }, //开始答题 toAns(val) { this.$router.push({ name: "ans_question", query: { categoryId: val.itemCategoryId, index: this.$route.query.index, }, }); }, }, mounted() { this.getType(); }, }; </script> <style lang="scss" scoped> .card { padding: 3vw 5vw; box-sizing: border-box; .card_title { display: flex; align-items: center; color: #333333; font-size: 35px; font-weight: 700; margin: 20px 0; span { color: #999999; font-size: 30px; margin-left: 30px; } } .card_con { display: flex; .card_L { width: 5px; margin-left: 5vw; background-color: #f5f6fa; } .card_R { width: 80%; height: 210px; margin: 50px 0 50px 10vw; background-color: #f6f9fd; padding: 30px; box-sizing: border-box; display: flex; justify-content: space-between; .card_R_text { width: 80%; display: flex; align-content: space-between; flex-wrap: wrap; margin-left: 10px; .text_title { width: 100%; font-size: 30px; color: #333333; } .text_grey { width: 100%; font-size: 28px; color: #999999; } } .card_R_btn { width: 25%; display: flex; align-items: center; .btn { width: 150px; height: 60px; background-color: #6673ff; color: #fff; font-size: 28px; border-radius: 28px; display: flex; align-items: center; justify-content: center; letter-spacing: 2px; } } } } } </style>