liuYb 6 년 전
부모
커밋
631b4123a1
5개의 변경된 파일358개의 추가작업 그리고 39개의 파일을 삭제
  1. 51 0
      package-lock.json
  2. 1 0
      package.json
  3. BIN
      src/assets/banner3.png
  4. 252 0
      src/components/carousel.vue
  5. 54 39
      src/views/Home.vue

+ 51 - 0
package-lock.json

@@ -2847,6 +2847,17 @@
       "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
       "dev": true
     },
+    "clone-deep": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
+      "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
+      "dev": true,
+      "requires": {
+        "is-plain-object": "^2.0.4",
+        "kind-of": "^6.0.2",
+        "shallow-clone": "^3.0.0"
+      }
+    },
     "co": {
       "version": "4.6.0",
       "resolved": "https://registry.npm.taobao.org/co/download/co-4.6.0.tgz",
@@ -9837,6 +9848,37 @@
       "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=",
       "dev": true
     },
+    "sass-loader": {
+      "version": "8.0.0",
+      "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-8.0.0.tgz",
+      "integrity": "sha512-+qeMu563PN7rPdit2+n5uuYVR0SSVwm0JsOUsaJXzgYcClWSlmX0iHDnmeOobPkf5kUglVot3QS6SyLyaQoJ4w==",
+      "dev": true,
+      "requires": {
+        "clone-deep": "^4.0.1",
+        "loader-utils": "^1.2.3",
+        "neo-async": "^2.6.1",
+        "schema-utils": "^2.1.0",
+        "semver": "^6.3.0"
+      },
+      "dependencies": {
+        "schema-utils": {
+          "version": "2.2.0",
+          "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.2.0.tgz",
+          "integrity": "sha512-5EwsCNhfFTZvUreQhx/4vVQpJ/lnCAkgoIHLhSpp4ZirE+4hzFvdJi0FMub6hxbFVBJYSpeVVmon+2e7uEGRrA==",
+          "dev": true,
+          "requires": {
+            "ajv": "^6.10.2",
+            "ajv-keywords": "^3.4.1"
+          }
+        },
+        "semver": {
+          "version": "6.3.0",
+          "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+          "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+          "dev": true
+        }
+      }
+    },
     "sax": {
       "version": "1.2.4",
       "resolved": "https://registry.npm.taobao.org/sax/download/sax-1.2.4.tgz",
@@ -10052,6 +10094,15 @@
         "safe-buffer": "^5.0.1"
       }
     },
+    "shallow-clone": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
+      "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
+      "dev": true,
+      "requires": {
+        "kind-of": "^6.0.2"
+      }
+    },
     "shebang-command": {
       "version": "1.2.0",
       "resolved": "https://registry.npm.taobao.org/shebang-command/download/shebang-command-1.2.0.tgz",

+ 1 - 0
package.json

@@ -27,6 +27,7 @@
     "babel-eslint": "^10.0.1",
     "eslint": "^5.16.0",
     "eslint-plugin-vue": "^5.0.0",
+    "sass-loader": "^8.0.0",
     "stylus": "^0.54.5",
     "stylus-loader": "^3.0.2",
     "vue-template-compiler": "^2.6.10",

BIN
src/assets/banner3.png


+ 252 - 0
src/components/carousel.vue

@@ -0,0 +1,252 @@
+<template>
+  <!-- <div id="dataCenter"> -->
+    <div class="window" :style="{width:screenWidth+'px'}" @mouseover="stop" @mouseleave="play">
+      <ul class="container" :style="containerStyle">
+        <li>
+          <!-- 把最后一张图放在最开始   -->
+          <img :style="{width:screenWidth+'px'}" :src="sliders[sliders.length - 1].img" alt="">
+        </li>
+        <li  v-for="(item, index) in sliders" :key="index">
+          <img :style="{width:screenWidth+'px'}" :src="item.img" alt="">
+        </li>
+        <li>
+          <!-- 把第一张图放在最后  @click="amplification(index)" -->
+          <img :style="{width:screenWidth+'px'}" :src="sliders[0].img" alt="">
+        </li>
+      </ul>
+       <!-- 左右切换按钮 -->
+      <ul class="direction">
+        <li class="left" @click="move(screenWidth, 1, speed)">
+            <img src="..\assets\back1.png" alt=""/>
+          <!-- <svg class="icon" width="30px" height="30.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M481.233 904c8.189 0 16.379-3.124 22.628-9.372 12.496-12.497 12.496-32.759 0-45.256L166.488 512l337.373-337.373c12.496-12.497 12.496-32.758 0-45.255-12.498-12.497-32.758-12.497-45.256 0l-360 360c-12.496 12.497-12.496 32.758 0 45.255l360 360c6.249 6.249 14.439 9.373 22.628 9.373z"  /></svg> -->
+        </li>
+        <li class="right" @click="move(screenWidth, -1, speed)">
+            <img src="..\assets\back2.png" alt=""/>
+          <!-- <svg class="icon" width="30px" height="30.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M557.179 904c-8.189 0-16.379-3.124-22.628-9.372-12.496-12.497-12.496-32.759 0-45.256L871.924 512 534.551 174.627c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0l360 360c12.496 12.497 12.496 32.758 0 45.255l-360 360c-6.249 6.249-14.439 9.373-22.628 9.373z"  /></svg> -->
+        </li>
+      </ul>
+      <!-- // 小圆点
+      <ul class="dots">
+        <li v-for="(dot, i) in sliders" :key="i"
+        :class="{dotted: i === (currentIndex-1)}"
+        @click = jump(i+1)
+        >
+        </li>
+      </ul> -->
+    </div>
+    <!-- <div class="mask-div" @click="maskFun()" v-if="maskBol">
+      <img :style="{width:screenWidth+'px'}" :src="sliders[imgNumber].img" alt="" class="mask-img">
+    </div> -->
+  <!-- </div> -->
+</template>
+<script>
+/* eslint-disable */ 
+import img1 from "../assets/banner.png";
+import img2 from "../assets/banner2.png";
+
+export default {
+  name: 'Carousel',
+  props: {
+    initialSpeed: {
+      type: Number,
+      default: 10
+    }, // 图片移动速度
+    initialInterval: {
+      type: Number,
+      default: 3
+    } // 如果是一个组件 接受外部传入的切换周期
+  },
+  data () {
+     
+    return {
+      sliders: [
+        {
+          img: img1
+        },
+        {
+          img: 'http://img.hb.aicdn.com/22ded455284aab361b8d2056e82f74a891a019704296a-PSraEB_fw658'
+        },
+        {
+          img: img2
+        }
+      ], // 放图片的数组
+      screenWidth: 1920, // 图片宽度
+      currentIndex: 1, // 原点起始位置
+      distance: 0, // 外层嵌套的初始移动距离
+      transitionEnd: true, // 防止多次快速点击切换出现问题的闸门
+      speed: this.initialSpeed,
+      timer: null, // 定时器
+      imgNumber: 0, // 点击放大的图片
+      maskBol: false
+    }
+  },
+  computed: {
+    containerStyle () {
+      return {
+        transform: `translate3d(${this.distance}px, 0, 0)`
+      }
+    },
+    interval () {
+      return this.initialInterval * 1000
+    }
+  },
+  created () {
+   
+    this.init()
+  },
+  methods: {
+    init () {
+      this.play(),
+      this.distance= -document.body.clientWidth,
+      this.screenWidth=document.body.clientWidth // 屏幕尺寸
+    },
+    move (offset, direction, speed) { // 移动一次的距离, 向左还是向右移动, 图片移动速度
+      if (!this.transitionEnd) return
+      this.transitionEnd = false
+      direction === -1 ? this.currentIndex += offset / this.screenWidth : this.currentIndex -= offset / this.screenWidth
+      if (this.currentIndex > this.sliders.length) this.currentIndex = 1
+      if (this.currentIndex < 1) this.currentIndex = this.sliders.length
+
+      const destination = this.distance + offset * direction
+      this.animate(destination, direction, speed)
+    },
+    animate (des, direc, speed) { // 实际移动距离 想左还是向右 移动速度 负右正左
+      if (this.temp) {
+        window.clearInterval(this.temp)
+        this.temp = null
+      }
+      this.temp = window.setInterval(() => {
+        if ((direc === -1 && des < this.distance) || (direc === 1 && des > this.distance)) {
+          this.distance += speed * direc
+        } else {
+          this.transitionEnd = true
+          window.clearInterval(this.temp)
+          this.distance = des
+          let allWidth = this.sliders.length * this.screenWidth
+          if (des < -allWidth) this.distance = -this.screenWidth
+          if (des > -this.screenWidth) this.distance = -allWidth
+        }
+      }, 10)
+    },
+    jump (index) {
+      const direction = index - this.currentIndex >= 0 ? -1 : 1
+      const offset = Math.abs(index - this.currentIndex) * this.screenWidth
+      const jumpSpeed = Math.abs(index - this.currentIndex) === 0 ? this.speed : Math.abs(index - this.currentIndex) * this.speed
+      this.move(offset, direction, jumpSpeed)
+    },
+    // 自动播放函数
+    play () {
+      console.log(this.screenWidth)
+      if (!this.maskBol) {
+        if (this.timer) {
+          window.clearInterval(this.timer)
+          this.timer = null
+        }
+        this.timer = window.setInterval(() => {
+          this.move(this.screenWidth, -1, this.speed)
+        }, this.interval)
+      }
+    },
+    stop () {
+      window.clearInterval(this.timer)
+      this.timer = null
+    },
+    amplification (index) {
+      this.imgNumber = index
+      this.maskBol = true
+      this.stop()
+    },
+    maskFun () {
+      this.maskBol = false
+      this.play()
+    }
+  }
+}
+</script>
+<style lang="stylus">
+*{
+    box-sizing: border-box;
+    margin:0;
+    padding:0;
+  }
+  ol,ul{
+    list-style: none;
+    padding 0px;
+  }
+  .container li{
+      width: 100%;
+  }
+//   #dataCenter{
+    // text-align: center;
+    .window{
+      position:relative;
+    //   width:600px;
+    //   width: 1440px;
+      height:400px;
+      margin:0 auto;
+      overflow:hidden;
+      .container{
+        display:flex;
+        position:absolute;
+        width: 100%;
+        margin 0 !important
+        padding 0 !important
+      }
+      .left, .right{
+        position:absolute;
+        top:47%;
+        // transform:translateY(-50%);
+         width:32px;
+         height:32px;
+        // background-color:rgba(0,0,0,.3);
+        // border-radius:50%;
+        // cursor:pointer;
+      }
+      .left{
+        left:6.9%;
+        // padding-left:12px;
+        // padding-top:10px;
+      }
+      .right{
+        right:6.9%;
+        // padding-right:12px;
+        // padding-top:10px;
+      }
+     .container img{
+        user-select: none;
+        width 100%
+        height 400px
+      }
+    }
+    // .dots{
+    //     position:absolute;
+    //     bottom:10px;
+    //     left:50%;
+    //     transform:translateX(-50%);
+    //   }
+    // .dots li{
+    //   display:inline-block;
+    //   width:15px;
+    //   height:15px;
+    //   margin:0 3px;
+    //   border:1px solid white;
+    //   border-radius:50%;
+    //   background-color:#333;
+    //   cursor:pointer;
+    // }
+    // .dots .dotted{
+    //   background-color:orange;
+    // }
+    // .mask-div{
+    //   width: 100vw;
+    //   height: 100vh;
+    //   background-color: rgba(0,0,0,.7);
+    //   position: fixed;
+    //   top: 0;
+    //   left: 0;
+    //   .mask-img{
+    //     margin-top: calc(50vh - 200px);
+    //   }
+    // }
+//   }
+</style>

+ 54 - 39
src/views/Home.vue

@@ -1,47 +1,51 @@
 <template>
   <div class="home">
-    <div id="banner">
+    <carousel></carousel>
+    <!-- <div id="banner">
       <div id="u1" data-label="公司简介轮播图">
         <div class="slide" v-on:mouseover="stop()" v-on:mouseout="move()">
           <div class="slideshow">
-            <transition-group enter-active-class="animated bounceInLeft" leave-active-class="animated bounceOutRight"
+            <transition-group
               tag="ul"
               name="image"
               style="width: 100%; padding:0px;max-height: 400px;overflow:hidden"
             >
-              <li v-for="(item, index) in imgArray" v-show="index === mark" :key="item">
-                <img :src="item" v-show="index === mark" style="width: 100%; padding:0px" />
-                <!-- height: 400px; -->
+              <li
+                v-for="(item, index) in imgArray"
+                v-show="index === mark"
+                :key="item"
+              >
+                <img
+                  :src="item"
+                  v-show="index === mark"
+                  style="width: 100%; padding:0px"
+                />
               </li>
             </transition-group>
           </div>
-          <!-- <div class="bullet">
-            <span
-              v-for="(item, index) in imgArray"
-              :class="{ active: index === mark }"
-              @click="change(index)"
-              :key="item"
-            ></span>
-          </div> -->
         </div>
       </div>
-    </div>
+    </div> -->
 
     <div id="sale">
       <p class="saletitle">致力于互联网创新技术服务</p>
       <p class="salecontent">技术更跨界、创意更自由、服务更贴心</p>
       <div style="display:flex;justify-content:space-between; flex-wrap:wrap;">
-        <div v-for="(item,index) in saleArray" :key="index">
+        <div v-for="(item, index) in saleArray" :key="index">
           <div id="box1">
             <div id="box1-Up">
               <img :src="item.src" alt style="margin-top: 38px !important;" />
-              <p style="margin-top: 20px !important;margin-bottom:20px;">{{item.title}}</p>
+              <p style="margin-top: 20px !important;margin-bottom:20px;">
+                {{ item.title }}
+              </p>
             </div>
             <div id="box1-Dn">
               <ul>
-                <li v-for="(itemson,index) in item.content" :key="index">
+                <li v-for="(itemson, index) in item.content" :key="index">
                   <div class="yuandian"></div>
-                  <span style="display:block;text-align:left">{{itemson.con}}</span>
+                  <span style="display:block;text-align:left">{{
+                    itemson.con
+                  }}</span>
                 </li>
               </ul>
             </div>
@@ -88,7 +92,10 @@
       <div id="exploit">
         <p class="saletitle">全新的开发模式</p>
         <p class="salecontent">高效、快速、减少花费</p>
-        <div id="exploit-Box" style="display:flex;justify-content:space-between; flex-wrap:wrap;">
+        <div
+          id="exploit-Box"
+          style="display:flex;justify-content:space-between; flex-wrap:wrap;"
+        >
           <!-- margin-right:120px; -->
           <div id="box2">
             <div id="box2-Up">
@@ -167,25 +174,33 @@
 
     <div id="train">
       <p id="train-title1">灵活的人才培养方案</p>
-      <p id="train-content1">免费的实习生培训计划、严格的实习生管理制度、真实的项目实战锻炼</p>
+      <p id="train-content1">
+        免费的实习生培训计划、严格的实习生管理制度、真实的项目实战锻炼
+      </p>
       <div id="train-pic">
         <div class="train-pic-con">
           <img src="..\assets\量身打造.png" alt />
           <div class="duanhengxian"></div>
           <p>量身打造</p>
-          <p>面向互联网所需众多岗位,上班时间根据实习生自身情况决定,通过考核后在校也能办公。</p>
+          <p>
+            面向互联网所需众多岗位,上班时间根据实习生自身情况决定,通过考核后在校也能办公。
+          </p>
         </div>
         <div class="train-pic-con">
           <img src="..\assets\严格.png" alt />
           <div class="duanhengxian"></div>
           <p>严格管理</p>
-          <p>周六公司固定例会时间,多方位知识面为实习生开拓视野,每天工作时间实时线上记录打卡。</p>
+          <p>
+            周六公司固定例会时间,多方位知识面为实习生开拓视野,每天工作时间实时线上记录打卡。
+          </p>
         </div>
         <div class="train-pic-con">
           <img src="..\assets\严格管理.png" alt />
           <div class="duanhengxian"></div>
           <p>严格管理</p>
-          <p>知识培训外加真实项目实践,并有一对一导师指导,让实习生快速成长,独当一面。</p>
+          <p>
+            知识培训外加真实项目实践,并有一对一导师指导,让实习生快速成长,独当一面。
+          </p>
         </div>
       </div>
     </div>
@@ -576,23 +591,23 @@ div#box3-Right ul :nth-child(2) {
 .slideshow ul li {
   list-style: none;
 }
-/* .active {
-  background: red !important;
-} */
-/* .image-enter-active {
-  transform: translateX(-100%);
-  transition: all 1.5s ease;
+.image-enter-to {
+  transition: all 1s ease;
+  transform: translateX(0);
 }
+
 .image-leave-active {
-  transform: translateX(100%);
-  transition: all 1.5s ease;
+  transition: all 1s ease;
+  transform: translateX(-100%);
 }
+
 .image-enter {
   transform: translateX(100%);
 }
+
 .image-leave {
   transform: translateX(0);
-} */
+}
 </style>
 
 <script>
@@ -601,22 +616,25 @@ div#box3-Right ul :nth-child(2) {
 
 import img1 from "../assets/banner.png";
 import img2 from "../assets/banner2.png";
+import img3 from "../assets/banner3.png";
 import HelloWorld from "@/components/HelloWorld.vue";
 import HomeFooter from "../components/footer.vue";
+import Carousel from "@/components/carousel.vue";
 
-import animated from 'animate.css';
+import animated from "animate.css";
 
 export default {
   name: "home",
   components: {
-    HomeFooter
+    HomeFooter,
+    Carousel
   },
   data() {
     return {
       timer: null, //定时器
       mark: 0, //比对图片索引的变量
       //轮播图数据
-      imgArray: [img1, img2],
+      imgArray: [img1, img2,img3],
       saleArray: [
         {
           src: require("../assets/1.png"),
@@ -661,16 +679,13 @@ export default {
   methods: {
     autoPlay() {
       this.mark++;
-      if (this.mark === 2) {
+      if (this.mark === this.imgArray.length) {
         this.mark = 0;
       }
     },
     play() {
       this.timer = setInterval(this.autoPlay, 1500);
     },
-    change(i) {
-      this.mark = i;
-    },
     stop() {
       clearInterval(this.timer);
     },