14届蓝桥杯web校内模拟赛第二期

凭空消失的TA

 <script src="./element-ui-2.15.10/index.js"></script>

用户名片

第一种方法

body,.user-card{
    
    
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
}

第二种方法

.card,.level,.points,.avatar{
    
    
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
}

芝麻开门

// TODO:待补充代码
  div.innerHTML = template
 
  let body = document.querySelector('body')
  body.append(div)
  let input = document.querySelector('.message-body input')

  let cancel = document.querySelector('#cancel')

  let confirm = document.querySelector('#confirm')


  return new Promise((resolve,reject)=>{
    
    
    cancel.onclick = function(){
    
    
        reject(false)
        body.removeChild(div)
     
    }

    confirm.onclick = function(){
    
    
        resolve(input.value)
        body.removeChild(div)
      
    }
  })

宝贵的一票

$(".add").click(function () {
    
    
     $('.list .row .col-sm-1').remove()
     // TODO 待补充代码
    
     
     $('.list').append(initRender(`选项${
      
      $('.list>.row').length+1}`))
     
     if($('.list>.row').length > 2){
    
    
       $('.list .row').append(` <div class="col-sm-1">
       <!-- 删除图标 -->
       <img class="del-icon" src="./images/x.svg" alt="" />
     </div>`)
     }


     
   });
   // 点击 x 删除逻辑,列表小于 2 项时不显示删除图标
$(document).on("click", ".del-icon", function () {
    
    
     // TODO 待补充代码

     $(this).parent().parent().remove()

     if($('.list>.row').length <= 2){
    
    
       $('.list .row .col-sm-1').remove()
     }

     let length = $('.list>.row').length

     $('.list .row').remove()

     for (let index = 0; index < length; index++) {
    
    
     let initList = initRender(`选项${
      
      index + 1}`);
     $(".list").append(initList);
   }

   if($('.list>.row').length > 2){
    
    
       $('.list .row').append(` <div class="col-sm-1">
       <!-- 删除图标 -->
       <img class="del-icon" src="./images/x.svg" alt="" />
     </div>`)
     }
   
   });

粒粒皆辛苦

// TODO: 待补充代码

      let arr =  [
              ["全部"],
              ["小麦"],
              ["大豆"],
              ["马铃薯"],
              ["玉米"],
            ]


      //请求数据

      axios({
    
    
        method:'get',
        url:'./data.json'
      }).then(res=>{
    
    

        let data = res.data.data
        console.log(data);

        //处理数据
        for (const key in data) {
    
    
          arr[0].push(key)
          arr[1].push(data[key].wheat)
          arr[2].push(data[key].soybean)
          arr[3].push(data[key].potato)
          arr[4].push(data[key].corn)
        }

        option.dataset.source = arr
        myChart.setOption(option);

618活动

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>618 活动</title>
    <link rel="stylesheet" href="css/style.css" />
</head>

<body>
    <!-- TODO:待补充代码 -->
    <div class="active">
        <div class="first">
            <div class="first-bac">
                <div class="first-img">
                    <img src="./images/neirong.png" alt="">
                </div>
            </div>

            <div class="first-bac2">
                <div class=first-title1>
                    <img src="./images/title1.png" alt="">
                </div>

                <div class="quan">
                    <div><img src="./images/quan1.png" alt=""></div>
                    <div><img src="./images/quan2.png" alt=""></div>
                    <div><img src="./images/quan3.png" alt=""></div>
                    <div><img src="./images/quan4.png" alt=""></div>
                    <div><img src="./images/quan5.png" alt=""></div>
                </div>
            </div>
        </div>
        <div class="two">
            <div class="two-bac">
                <div class="bac-center">

                    <div class="center">
                        <div class="top">
                            <div class="top-center">
                                <div class="top-center-left">
                                    <img src="./images/pic.png" alt="">
                                </div>
                                <div class="top-center-center">
                                    <img src="./images/arrow.png" alt="">
                                </div>
                                <div class="top-center-right">
                                    <div class="title">
                                        <div></div>
                                        <p><span>小白必学</span>夯实基础:400+编程实验课</p>
                                    </div>

                                    <div class="title">
                                        <div></div>
                                        <p><span>保研必备</span>备战必备:50+精品课</p>
                                    </div>

                                    <div class="title">
                                        <div></div>
                                        <p><span>实习就业</span>专项突破:47大热招岗位学习路径</p>
                                    </div>

                                    <div class="title">
                                        <div></div>
                                        <p><span>职场新人</span>软技能提升:20讲简历面试指导课</p>
                                    </div>

                                    <div class="title">
                                        <div></div>
                                        <p><span>冲击高薪</span>职场提升:200+企业实战项目</p>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="footer">
                            <div class="footer-one">
                                <p>立刻购买</p>
                            </div>
                            <div class="footer-two">完成学生认证,立享5折>></div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>

</body>

</html>
* {
    
    
    margin: 0;
    padding: 0;
}


.first {
    
    

    height: 898px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.first-bac {
    
    
    width: 1920px;
    height: 506px;


    background: url('../images/banner-bg.png') no-repeat;
    background-size: 100%;

    overflow: hidden;

}

.first-img {
    
    
    display: flex;
    justify-content: center;

    height: 499px;
    padding-top: 60px;
    z-index: 20;
}

.first-img img {
    
    
    width: 620px;
    height: 499px;
    z-index: 0;

}

.first-bac2 {
    
    
    height: 462px;
    width: 1990px;

    background: url('../images/stage.png') no-repeat;
    background-size: 100%;
    margin: -40px -35px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
}

.first-title1 {
    
    
    width: 646px;
    height: 72px;
    margin-top: 57px;
}

.first-title1 img {
    
    
    width: 100%;
    height: 100%;
}

.quan {
    
    
    height: 180px;
    display: flex;
    justify-content: space-around;
}

.quan div {
    
    
    margin-left: 20px;
}

.quan img {
    
    
    width: 100%;
    height: 100%;

}

.two {
    
    
    width: 100%;
    height: 1030px;
    margin-top: -58px;
    display: flex;
    justify-content: center;
}

.two-bac {
    
    
    width: 1920px;
    height: 100%;
    background: #290897;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.bac-center {
    
    
    width: 1200px;
    height: 789px;
    background: url('../images/bg.png') no-repeat;
    background-size: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 80px;
}

.center {
    
    
    width: 1120px;
    height: 616px;
    background: #FFF9E0;
    border-radius: 10px;
    margin-top: 48px;
    display: flex;
    flex-direction: column;
}

.top {
    
    
    height: 438px;
    display: flex;
    justify-content: center;
    align-items: center;

}

.top-center {
    
    
    width: 1030px;
    height: 342px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}



.top-cecter-left {
    
    
    width: 328px;
    height: 342px;
}

.top-center-center {
    
    
    width: 86px;
    height: 60px;
}

.top-center-right {
    
    
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    margin-left: 40px;
}

.title {
    
    
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-start;

}

.title div {
    
    
    width: 50px;
    height: 50px;
    background: url('../images/free.png');
}

.title p {
    
    
    font-family: PingFangSC-Medium;
    font-size: 24px;
    color: #AA544C;
    letter-spacing: 0;
    line-height: 33px;
    font-weight: 500;
}

.title p span {
    
    
    font-family: PingFangSC-Semibold;
    font-size: 24px;
    color: #FF5B13;
    letter-spacing: 0;
    line-height: 33px;
    font-weight: 600;
}

.footer {
    
    
    width: 100%;
    height: 256px;
    background: url('../images/coupon.png') no-repeat;
    background-size: 100% 100% 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;

}

.footer-one {
    
    
    background-image: linear-gradient(180deg, #F4BF60 0%, #F88822 100%);
    border-radius: 41.5px;
    width: 270px;
    height: 73px;
    margin: 30px 30px;

}

.footer-one p {
    
    
    font-family: PingFangSC-Semibold;
    font-size: 40px;
    color: #FFFFFF;
    letter-spacing: 4px;
    font-weight: 600;
    text-align: center;
    line-height: 73px;
}

.footer-two {
    
    
    font-family: PingFangSC-Regular;
    font-size: 20px;
    color: #FFFFFF;
    letter-spacing: 0;
    line-height: 36px;
    font-weight: 400;
    margin: -16px 40px;
}

咨询接口

// TODO: 待补充代码
let http = require('http');


http.createServer((req,res)=>{
    
    

    res.setHeader("Content-type", "text/html;charset=utf8");

    let arr = [
        {
    
    
          "channelId": "5572a108b3cdc86cf39001cd",
          "name": "国内焦点"
        },
        {
    
    
          "channelId": "5572a108b3cdc86cf39001ce",
          "name": "国际焦点"
        }
      ]


      if(req.url=='/news'&& req.method == 'GET'){
    
    

        res.end(JSON.stringify(arr))
      }else{
    
    
        res.end('404')
      }

}).listen(8080)

绝美宋词


<div class="search-form">
    <input type="text" id="search" class="search" placeholder="词牌名 词句 词人" v-model="search" @input="getSearch"/>
    <ul class="suggestions">
      <!-- 每一首完整词句用一个 li 包裹 -->
        <li v-for="(a,index) in arr2" :key="index">
          <span class="poet" v-html="getStyle(a.poetry_content)"></span>
          <span class="title" v-html="getStyle2(a.title,a.author)"></span>
        </li>
    </ul>
</div>
let vm = new Vue({
    
    
      el:'#app',
      // TODO:待补充代码
      
      data(){
    
    
        return{
    
    
          arr1:[],
          arr2:[],
          search:''
        }
      },
      created(){
    
    
        axios({
    
    
          method:'get',
          url:'./data.json'
        }).then(res=>{
    
    
          this.arr1 = res.data
          console.log(res.data);
        })
      },
      methods:{
    
    
        getSearch(){
    
    

          if(this.search == '') return

          this.arr2 = this.arr1.filter(item=>{
    
    

            if(item.author.includes(this.search) || item.title.includes(this.search)|| item.poetry_content.includes(this.search)){
    
    
              return item
            }
          })
        },
        getStyle(...args){
    
    
          let reg = new RegExp(this.search,'g');

          if(args.length == 1){
    
    
              let str = args[0].replace(reg,(word)=>{
    
    
              return `<span class="highlight">${
      
      word}</span>`
            })

            return str
          }else{
    
    
            let str1=args[0].replace(reg,(word)=>{
    
    
              return `<span class="highlight">${
      
      word}</span>`
            })
            let str2=args[1].replace(reg,(word)=>{
    
    
              return `<span class="highlight">${
      
      word}</span>`
            })
            
            
            return str1+'-'+str2
          }
        },
        
      }
    })

平地起高楼

function convertToTree(regions, rootId = "0") {
    
    
  // TODO: 在这里写入具体的实现逻辑
  // 将平铺的结构转化为树状结构,并将 rootId 下的所有子节点数组返回
  // 如果不存在 rootId 下的子节点,则返回一个空数组
  let arr = []
  regions.forEach(item=>{
    
    

    if(item.pid == rootId){
    
    
      arr.push(item)

      item.children = convertToTree(regions,item.id)
    }
  })

  return arr
}

module.exports = convertToTree; // 检测需要,请勿删除

收快递了(检测通不过,但是能完成基本的效果)

function findRegion(regions, regionName) {
    
    
  // TODO: 在这里写入具体的实现逻辑
  // 需要从树状结构的行政信息中,遍历找到目标区域的行政信息,如输入:成都市,返回 [四川省,成都市]
  // 如果所输入的位置信息不存在,则返回 null
  let arr = []
  

    if(regions[0].name == regionName){
    
    
      arr.push(regionName)
      return
    }else{
    
    

      regions[0].children.forEach(item=>{
    
    

        if(item.name == regionName){
    
    
          arr.push(regions[0].name)
          arr.push(regionName)
          return
        }else{
    
    

          item.children.forEach(el =>{
    
    
            
            if(el.name == regionName){
    
    

              arr.push(regions[0].name)
              arr.push(item.name)
              arr.push(regionName)
              return
            }

          })
        }

      })
    }

    if(arr.length == 0 || arr.length >3){
    
    
      return null
    }else{
    
    
      return arr
    }
    

 
}

module.exports = findRegion; // 检测需要,请勿删除

猜你喜欢

转载自blog.csdn.net/weixin_61485030/article/details/129915029
今日推荐