<template src="./templateSlide.html">

</template>

<script>
import util from "../../utils/util";
import { loginService } from "@/services";
import { Toast } from "mint-ui";
    export default {
        data() {
            var serverUrl="http://skyforest.static.elab-plus.com/";
            return {
                serverUrl:serverUrl,
                urlList:[],
                tagList:'',
                project_id:''
                // titleList:[
                //     {title:'首选推荐',text:'按标签推荐最佳模板'},{title:'其他推荐',text:'按标签推荐备选模板'},{title:'其他推荐',text:'按标签推荐备选模板'}
                // ]
            }
        },
        mounted() {
            this.tagList=localStorage.getItem('_tagList');
            localStorage.removeItem('_project_id');
            localStorage.removeItem('_tempId');
            this.tagList =  this.tagList.split(",");
            // console.log( this.tagList);
            this.$nextTick(function() {
			    this.init();
            });
        },
        methods: {
            async init(){
                let data={
                    tagids:this.tagList,
                    project_id:localStorage.getItem('_projectId')

                };
                console.log(data);
                let result = await loginService.getTemplateByTag(data);
                 if (result.data.success) {
                    //  console.log(result.data.list);
                     this.urlList=result.data.list;
                 }else{
                     Toast(result.data.message)
                 }
            },
            updateTemp(index){
                // debugger
                // console.log(index);
                // $('.badge').css('display','none');
                // $('.badge').eq(index).css('display','block');
                localStorage.setItem('_tempId', this.urlList[index].id);
                localStorage.setItem('_project_id', this.urlList[index].project_id);
                this.$router.push({ name: "updateTemp" ,query:{flag:this.urlList[index].id} });
            },
            blankTemp(){
                 this.$router.push({ name: "updateTemp",query:{flag:'0'} });

            }
        }
    }
</script>

<style lang="scss" scoped>
  @import "./templateSlide.scss"
</style>
<style>
.el-carousel__item h1{
    line-height: 50px !important;
    font-size: 45px !important;
}
.el-carousel__item h3{
     line-height:50px !important;
     font-size: 24px !important;
     color:#fff !important;
}
.el-carousel__item .title{
    background: rgba(0, 0, 0, .0) !important;
    height: 200px !important;;
    width: 100% !important;
}
.el-carousel__item .selectImg{
    height: 650px !important;
    width: 52% !important;
    margin:0 auto !important;
    margin-left:24% !important;
}
.el-carousel__item{
    background: none !important;
}
.el-carousel__mask{
    background: none !important;
    opacity:0;
}
</style>
