index.vue 17.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
<!--
 * @Date: 2024-08-27 10:06:30
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2024-10-11 11:21:43
 * @FilePath: /hager/src/views/index.vue
 * @Description: 文件描述
-->
<template>
  <div class="hager-container">
    <el-carousel :height="top_img_height" :interval="8000">
      <el-carousel-item v-for="item in 4" :key="item">
        <el-image style="width: 100%; height: 100%;" fit="cover" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></el-image>
      </el-carousel-item>
    </el-carousel>
    <hager-box class="box-n">
      <hager-h1 title="海格全球" sub="Hager Global"></hager-h1>
      <div class="hager-global">
        <p>海格集团是全球领先的电气及智能化鲜决方案和服务提供商,应用领域涵盖住宅,商业建筑,公共建筑和工业。</p>
        <p>海格申气品牌代表了集闭的核心业务,蜀盖配电系统。申缆管理系统。KNX 智能榕制系统和开关面板,楼宇自动化和安防系统。集团旗下还拥有 7 E3 / DC</p>
        <p>海格集团是行业创新领导者之一,我们与来自工业和电气领域的客户一起致力于引领面向未来的主题,如家庭互联、智能建筑技术,能源效率、生活辅助系统,电动交通、
        可再生能源。配电系统是这盛技术得以实现的中枢。也是伴随我们成长的其础产品</p>
        <div :class="['hager-global-info', is_xs ? 'xs' : '']">
          <div class="hager-global-info-item">
            <p class="num"><span>32</span>亿</p>
            <p class="text">2023年销售额32亿欧元</p>
            <p class="text">Sales ot 3.2 billion  2023</p>
          </div>
          <div class="hager-global-info-item">
            <p class="num"><span>32</span>亿</p>
            <p class="text">2023年销售额32亿欧元</p>
            <p class="text">Sales ot 3.2 billion  2023</p>
          </div>
          <div class="hager-global-info-item">
            <p class="num"><span>32</span>亿</p>
            <p class="text">2023年销售额32亿欧元</p>
            <p class="text">Sales ot 3.2 billion  2023</p>
          </div>
          <div class="hager-global-info-item">
            <p class="num"><span>32</span>亿</p>
            <p class="text">2023年销售额32亿欧元</p>
            <p class="text">Sales ot 3.2 billion  2023</p>
          </div>
        </div>
        <div style="display: flex; justify-content: center; margin-top: 1rem;">
          <hager-more></hager-more>
        </div>
      </div>
    </hager-box>
    <hager-box class="box-2n" @screen-width="handleScreenWidth">
      <hager-h1 title="解决方案" sub="Solution"></hager-h1>
      <div v-if="!is_xs" class="hager-solution">
        <div
          @click="goToSolution(item)"
          class="solution-item"
          :style="{ backgroundImage: 'url('+item.src+')' }"
          v-for="(item, index) in solution_list" :key="index">
          <p>{{ item.title }}</p>
        </div>
      </div>
      <div v-else>
        <swiper ref="mySolutionSwiper" class="swiper" :options="swiperOption">
          <swiper-slide
            @click.native="goToSolution(item)"
            class="solution-item xs"
            :style="{ backgroundImage: 'url('+item.src+')' }"
            v-for="(item, index) in solution_list" :key="index">
              <p>{{ item.title }}</p>
          </swiper-slide>
        </swiper>
        <div class="xs-control">
          <div>
            <i class="el-icon-arrow-left" @click="prevSolutionBtn()"></i>
            <i class="el-icon-arrow-right" @click="nextSolutionBtn()"></i>
          </div>
        </div>
      </div>
    </hager-box>
    <hager-box class="box-n">
      <hager-h1 title="产品中心" sub="Product Center"></hager-h1>
      <div :class="['hager-product-center', is_xs ? 'xs' : '']">
        <div v-for="(item, index) in product_list" :key="index" :class="['product-item', is_xs ? 'xs' : '']">
          <el-image style="height: 14rem;" :src="item.src" fit="cover"></el-image>
          <p style="margin-top: 1rem;">{{ item.title }}</p>
        </div>
      </div>
      <div :class="['hager-product-center-more', is_xs ? 'xs' : '']">
        <hager-more></hager-more>
        <div class="xs-control" v-if="is_xs">
          <div><i class="el-icon-arrow-left" @click="prevBtn(product_list)"></i> <i class="el-icon-arrow-right" @click="nextBtn(product_list)"></i></div>
        </div>
      </div>
    </hager-box>
    <hager-box v-if="!is_xs" class="box-2n">
      <hager-h1 title="最新资讯" sub="News"></hager-h1>
      <div class="news-container">
        <el-row :gutter="0" v-for="(item, index) in news_list" :key="index">
          <el-col :span="12" style="height: 25rem;">
            <img class="news-item-img" v-if="index % 2 === 0" :src="item.src" alt="News Image 1">
            <div v-else @click="goToNew(item)" class="news-item">
              <div class="news-item-title">{{ item.title }}</div>
              <p class="news-item-sub">{{ item.sub }}</p>
              <p class="news-item-content">{{ item.content }}</p>
              <i class="el-icon-right"></i>
            </div>
          </el-col>
          <el-col :span="12" style="background-color: #FFF; height: 25rem;">
            <div v-if="index % 2 === 0" @click="goToNew(item)" class="news-item">
              <div class="news-item-title">{{ item.title }}</div>
              <p class="news-item-sub">{{ item.sub }}</p>
              <p class="news-item-content">{{ item.content }}</p>
              <i class="el-icon-right"></i>
            </div>
            <img class="news-item-img" v-else :src="item.src" alt="News Image 1">
          </el-col>
        </el-row>
      </div>
      <div style="display: flex; justify-content: center; margin-top: 2rem;">
        <hager-more></hager-more>
      </div>
    </hager-box>
    <div v-else style="background-color: #f9f9f9; padding-bottom: 1rem;">
      <hager-h1 title="最新资讯" sub="News" style="padding: 2rem;"></hager-h1>
      <div class="news-container xs">
        <el-row :gutter="0" v-for="(item, index) in news_list" :key="index">
          <el-col :span="24">
            <img class="news-item-img xs" :src="item.src" alt="News Image 1">
            <div @click="goToNew(item)" class="news-item xs">
              <div class="news-item-title">{{ item.title }}</div>
              <p class="news-item-sub">{{ item.sub }}</p>
              <p class="news-item-content">{{ item.content }}</p>
              <i class="el-icon-right"></i>
            </div>
          </el-col>
        </el-row>
      </div>
      <div style="display: flex; justify-content: center; margin-top: 2rem;">
        <hager-more></hager-more>
      </div>
    </div>
    <hager-box class="box-n">
      <hager-h1 title="招聘信息" sub="Recruit"></hager-h1>
      <p style="margin: 2rem 0;">心国近心,支注万你。海恰人囫指员光工,然于則行!我们哦这音齐稱央那八我们附行列,共同书与成功的扁草。用你的才罕,刨道九限可能!</p>
      <div style="display: flex; justify-content: center; margin-top: 2rem;">
        <hager-more></hager-more>
      </div>
    </hager-box>
  </div>
</template>

<script>
import mixin from '@/common/mixin';
import hagerBox from '@/components/common/hagerBox';
import hagerH1 from '@/components/common/hagerH1.vue';
import hagerMore from '@/components/hagerMore.vue';

export default {
  mixins: [mixin.init],
  components: { hagerBox, hagerH1, hagerMore },
  data () {
    return {
      news_list: [{
        src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀',
        content: '11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整',
        sub: 'o Ehe gy aha oid asto Ehe gy aha oid asto Ehe gy aha oid ast'
      }, {
        src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀',
        content: '11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整',
        sub: 'o Ehe gy aha oid asto Ehe gy aha oid asto Ehe gy aha oid ast'
      }, {
        src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀',
        content: '11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整',
        sub: 'o Ehe gy aha oid asto Ehe gy aha oid asto Ehe gy aha oid ast'
      }],
      // is_xs: false,
      screen_width: 0,
      solution_list: [{
        src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        title: '1住宅解决方案'
      }, {
        src: 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg',
        title: '2住宅解决方案'
      }, {
        src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        title: '3住宅解决方案'
      }, {
        src: 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg',
        title: '4住宅解决方案'
      }],
      product_list: [{
        src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        title: '三型特决井天'
      }, {
        src: 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg',
        title: '三型特决井天'
      }, {
        src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        title: '三型特决井天'
      }, {
        src: 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg',
        title: '三型特决井天'
      }],
      swiperOption: {
        // slidesPerView: 3,
        spaceBetween: 50,
        preventClicks : false,
        slideToClickedSlide: false,
        breakpoints: {
          1024: {
            slidesPerView: 4,
            spaceBetween: 40
          },
          768: {
            slidesPerView: 3,
            spaceBetween: 30
          },
          640: {
            slidesPerView: 2,
            spaceBetween: 20
          },
          320: {
            slidesPerView: 2,
            spaceBetween: 10
          },
          160: {
            slidesPerView: 1,
            spaceBetween: 0
          }
        }
      }
    }
  },
  async mounted () {
    // const container = document.querySelector('.container');
    // const boxes = container.querySelectorAll('.box');

    // // 如果超过11个项目,设置最后一个为特殊样式
    // if (boxes.length > 11) {
    //   boxes[boxes.length - 1].classList.add('other');
    // }
  },
  watch: {
    // 监听$route对象的变化
    $route(to, from) {
      console.log('路由变化了:', to.path);
      // 在此处执行你想要的逻辑
    }
  },
  methods: {
    goToNew (v) {
      this.$router.push({
        path: '/news/detail'
      });
    },
    goToSolution (v) {
      this.$router.push({
        path: '/solution/detail'
      });
    },
    handleScreenWidth(width) {
      this.screen_width = width;
    },
    prevSolutionBtn () {
      this.$refs.mySolutionSwiper.$swiper.slidePrev();
    },
    nextSolutionBtn () {
      this.$refs.mySolutionSwiper.$swiper.slideNext();
    },
  },
}
</script>

<style lang="less">
.el-carousel__item .item {
  opacity: 0.75;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}

.el-carousel__indicator.is-active button {
  background-color: #EE6D10;
}

.hager-container {
  .box-n {
    background-color: #fff;
    padding: 2rem 0;
  }
  .box-2n {
    background-color: #f1f1f1;
    padding: 2rem 0;
  }
  .hager-global {
    padding: 2rem 0;
    p {
      line-height: 2;
    }
    .hager-global-info {
      display: flex;
      justify-content: space-between;
      padding: 2rem;
      align-items: center;
      text-align: center;
      &.xs {
        flex-direction: column;
      }
      .hager-global-info-item {
        .num {
          color: @primary-color;
          font-size: 1.5rem;
          font-weight: bold;
          span {
            font-size: 3rem;
          }
        }
      }
    }
  }
  .hager-solution {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 一行显示4个 */
    gap: 1.5rem; /* 每个项目之间的间距 */
    &.xs {
      display: flex;
      overflow: hidden; /* 超出部分隐藏 */
      width: calc(100vw - 1rem); /* 容器宽度适应屏幕 */
      gap: 1rem;
    }
  }
  .solution-item {
    position: relative;
    height: 12rem;
    padding: 1.5rem;
    text-align: center;
    color: #FFF;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease-in-out;
    &:hover {
      // transform: scale(1.05);
      // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
      cursor: pointer;
    }
    &.other {
      display: flex;
      background-color: #e0f7ff; /* 特殊的样式 */
      color: @secondary-color;
      font-weight: bold;
      // line-height: 8rem;
      background-image: none;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
    }
    p {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 2rem;
      background-color: rgba(0, 0, 0, 0.2);
      line-height: 2rem;
      border-bottom-left-radius: 8px;
      border-bottom-right-radius: 8px;
    }
    &.xs {
      padding: 0;
      margin-top: 1rem;
    }
  }
  .xs-control {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    i {
      font-size: 1.35rem;
      color: #EE6D10;
      &:hover {
        cursor: pointer;
      }
    }
  }
  .news-container {
    margin-top: 2rem;
    &.xs {
      margin: 0;
    }
    .news-item-img {
      width: 100%;
      height: 100%;
      border-radius: 5px;
      object-fit: cover;
      &.xs {
        border-radius: 0;
      }
    }
    .news-item {
      padding: 3rem;
      &.xs {
        padding: 2rem;
      }
      &:hover {
        cursor: pointer;
      }
      .news-item-title {
        font-weight: bold;
        font-size: 1.35rem;
        color: @secondary-color;
        display: -webkit-box;        /* 结合其他属性进行多行文本处理 */
        -webkit-line-clamp: 1;       /* 设置显示的行数 */
        -webkit-box-orient: vertical; /* 垂直排列 */
        overflow: hidden;            /* 超出部分隐藏 */
        text-overflow: ellipsis;     /* 使用省略号替代超出的文本 */
      }
      .news-item-sub {
        color: @primary-color;
        margin-top: 0.25rem;
      }
      .news-item-content {
        margin: 2rem 0;
      }
      i {
        color: @primary-color;
        font-size: 1.5rem;
      }
    }
  }

  .hager-product-center {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 一行显示4个 */
    gap: 1.5rem; /* 每个项目之间的间距 */
    &.xs {
      display: flex;
      overflow: hidden; /* 超出部分隐藏 */
      width: calc(100vw - 1rem); /* 容器宽度适应屏幕 */
      gap: 1rem;
    }
    .product-item {
      height: auto;
      padding: 1.5rem;
      text-align: center;
      color: #333;
      border-radius: 8px;
      background-color: #f3f3f3;
      // transition: transform 0.3s ease-in-out;
      &:hover {
        cursor: pointer;
        // transform: scale(1.05);
        // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
      }
      &.xs {
        flex: 0 0 50vw; /* 每个子元素宽度为屏幕宽度的一半 (显示2个元素) */
        // padding: 0 20px;
        // box-sizing: border-box;
      }
    }
  }

  .hager-product-center-more {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    &.xs {
      justify-content: space-between;
      padding-left: 20%;
    }
  }
}
</style>