shaogen1995 1 سال پیش
کامیت
134d4a8f26

+ 23 - 0
.gitignore

@@ -0,0 +1,23 @@
+.DS_Store
+node_modules
+/dist
+
+
+# local env files
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?

+ 19 - 0
README.md

@@ -0,0 +1,19 @@
+# pc
+
+## Project setup
+```
+npm install
+```
+
+### Compiles and hot-reloads for development
+```
+npm run serve
+```
+
+### Compiles and minifies for production
+```
+npm run build
+```
+
+### Customize configuration
+See [Configuration Reference](https://cli.vuejs.org/config/).

+ 5 - 0
babel.config.js

@@ -0,0 +1,5 @@
+module.exports = {
+  presets: [
+    '@vue/cli-plugin-babel/preset'
+  ]
+}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 26639 - 0
package-lock.json


+ 28 - 0
package.json

@@ -0,0 +1,28 @@
+{
+  "name": "pc",
+  "version": "0.1.0",
+  "private": true,
+  "scripts": {
+    "serve": "vue-cli-service serve",
+    "build": "vue-cli-service build"
+  },
+  "dependencies": {
+    "core-js": "^3.6.5",
+    "element-ui": "^2.15.14",
+    "vue": "^2.6.11",
+    "vue-router": "^3.2.0"
+  },
+  "devDependencies": {
+    "@vue/cli-plugin-babel": "~4.5.13",
+    "@vue/cli-plugin-router": "~4.5.13",
+    "@vue/cli-service": "~4.5.13",
+    "less": "^3.0.4",
+    "less-loader": "^5.0.0",
+    "vue-template-compiler": "^2.6.11"
+  },
+  "browserslist": [
+    "> 1%",
+    "last 2 versions",
+    "not dead"
+  ]
+}

BIN
public/favicon.ico


+ 34 - 0
public/index.html

@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html lang="">
+
+<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">
+  <!-- 浏览器不使用缓存 -->
+  <meta http-equiv="pragrma" content="no-cache" />
+  <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" />
+  <meta http-equiv="expires" content="0" />
+
+  <link rel="icon" href="./favicon.ico">
+  <title>demo</title>
+  <style>
+    * {
+      margin: 0;
+      padding: 0;
+      box-sizing: border-box;
+      user-select: none;
+    }
+  </style>
+</head>
+
+<body>
+  <noscript>
+    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
+        Please enable it to continue.</strong>
+  </noscript>
+  <div id="app"></div>
+  <!-- built files will be auto injected -->
+</body>
+
+</html>

+ 19 - 0
src/App.vue

@@ -0,0 +1,19 @@
+<template>
+  <div id="app">
+    <Router-view />
+  </div>
+</template>
+<script>
+export default {
+
+};
+</script>
+<style lang="less">
+#app {
+  width: 100vw;
+  height: 100vh;
+  // min-width: 1600px;
+  // min-height: 800px;
+  // overflow: auto;
+}
+</style>

BIN
src/assets/img/ba.png


BIN
src/assets/img/baH.png


BIN
src/assets/img/main.jpg


BIN
src/assets/img/mainH.jpg


BIN
src/assets/img/mainLong.jpg


BIN
src/assets/img/mainLongH.jpg


BIN
src/assets/img/zhou.png


BIN
src/assets/img/zhouH.png


+ 14 - 0
src/main.js

@@ -0,0 +1,14 @@
+import Vue from 'vue'
+import App from './App.vue'
+import router from './router'
+
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+Vue.use(ElementUI);
+
+Vue.config.productionTip = false
+
+new Vue({
+  router,
+  render: h => h(App)
+}).$mount('#app')

+ 18 - 0
src/router/index.js

@@ -0,0 +1,18 @@
+import Vue from 'vue'
+import VueRouter from 'vue-router'
+
+Vue.use(VueRouter)
+
+const routes = [
+  {
+    path: '/',
+    name: 'Home',
+    component: () => import('../views/Home.vue')
+  }
+]
+
+const router = new VueRouter({
+  routes
+})
+
+export default router

+ 26 - 0
src/utils/api.js

@@ -0,0 +1,26 @@
+
+// export const baseURL = 'http://project.4dage.com:8036' //线上地址
+//export const baseURL ='http://192.168.20.55:8036' //本地地址
+
+// 本地化加上
+export const baseURL ='' //甲方有服务器的打包地址
+
+export const addNumAPI = (type) => {
+  fetch(`${baseURL}/api/visit/saveType`, {
+    method: "post",
+    body: JSON.stringify({
+      moduleType: "web",
+      type,
+    }),
+    headers: {
+      appId:
+        "E9A27605CEB3FFAF48F4D7B86858A03D9868419F60B5A45027FB6E6867F4EDA9",
+      "Content-Type": "application/json",
+    },
+  })
+    .then((res) => res.text()) //请求得到的数据转换为text
+    .then((res) => {
+    });
+}
+
+

+ 28 - 0
src/utils/request.js

@@ -0,0 +1,28 @@
+import {
+  baseURL
+} from "@/utils/api";
+
+import axios from 'axios'
+const http = axios.create({
+  baseURL, // build
+  timeout: 5000
+})
+
+// 请求拦截器
+http.interceptors.request.use(function (config) {
+  config.headers.appId = 'E9A27605CEB3FFAF48F4D7B86858A03D9868419F60B5A45027FB6E6867F4EDA9'
+  return config
+}, function (error) {
+  // 对请求错误做些什么
+  return Promise.reject(error)
+})
+
+// 添加响应拦截器
+http.interceptors.response.use(function (response) {
+  return response.data
+}, function (error) {
+  // 对响应错误做点什么
+  return Promise.reject(error)
+})
+
+export default http

+ 333 - 0
src/views/Home.vue

@@ -0,0 +1,333 @@
+<template>
+  <div class="home">
+    <div
+      :class="`leftBxo ${isMove ? '' : isRow === '横' ? '' : 'leftBxoCenter'}`"
+    >
+      <!-- 左侧加号 -->
+      <div class="addIcon" @click="lookBigImg">+</div>
+
+      <!--  ---------竖------- 大盒子 -->
+      <div
+        v-if="isRow === '竖'"
+        @mousedown="isFlag = true"
+        @mouseup="isFlag = false"
+        @mouseleave="isFlag = false"
+        @mousemove="mousemoveFu"
+        :class="`imgBox ${isMove ? '' : 'imgBoxMove'}`"
+        :style="`clip-path: rect(0 100% ${zhouMove}% 0);
+        transform: translateY(${moveLoc}px)
+        `"
+      >
+        <!-- 画轴的移动 -->
+        <img
+          class="zhou"
+          src="../assets/img/zhou.png"
+          alt=""
+          :style="`bottom:${100 - zhouMove}%`"
+        />
+
+        <img src="../assets/img/mainLong.jpg" alt="" />
+      </div>
+
+      <!-- ------------横----------大盒子 -->
+      <div
+        v-else
+        @mousedown="isFlag = true"
+        @mouseup="isFlag = false"
+        @mouseleave="isFlag = false"
+        @mousemove="mousemoveFu"
+        :class="`imgBoxHH ${isMove ? '' : 'imgBoxHHMove'}`"
+        :style="`clip-path: rect(0 ${zhouMove}% 100% 0);
+        transform: translateX(${moveLoc}px) translateY(-50%)
+        `"
+      >
+        <!-- 画轴的移动 -->
+        <img
+          class="zhou"
+          src="../assets/img/zhouH.png"
+          alt=""
+          :style="`right:${100 - zhouMove}%`"
+        />
+
+        <img src="../assets/img/mainLongH.jpg" alt="" />
+      </div>
+
+      <!-- 右侧小盒子 -->
+      <div v-if="isMove" class="smImgBox">
+        <div
+          class="smImgBoxMain"
+          :style="`width:${imgWidth / 5}px; height:${imgHeight / 5}px`"
+        >
+          <div
+            v-if="isRow === '竖'"
+            @mousedown="isFlag = true"
+            @mouseup="isFlag = false"
+            @mouseleave="isFlag = false"
+            @mousemove="(e) => mousemoveFu(e, true)"
+            class="smBoxBor"
+            :style="`height:${pageHeight / 5}px;transform: translateY(${
+              -moveLoc / 5
+            }px)`"
+          ></div>
+
+          <div
+            v-else
+            @mousedown="isFlag = true"
+            @mouseup="isFlag = false"
+            @mouseleave="isFlag = false"
+            @mousemove="(e) => mousemoveFu(e, true)"
+            class="smBoxBorHH"
+            :style="`width:${leftBoxWidth / 5}px;transform: translateX(${
+              -moveLoc / 5
+            }px)`"
+          ></div>
+          <img
+            :src="
+              require(`@/assets/img/mainLong${isRow === '竖' ? '' : 'H'}.jpg`)
+            "
+            alt=""
+          />
+        </div>
+      </div>
+    </div>
+    <!-- 大图预览 -->
+    <ElImageViewer
+      v-if="showViewer"
+      :on-close="
+        () => {
+          showViewer = false;
+        }
+      "
+      :url-list="showBig"
+    />
+  </div>
+</template>
+
+<script>
+import ElImageViewer from "element-ui/packages/image/src/image-viewer";
+
+export default {
+  components: { ElImageViewer },
+  data() {
+    return {
+      // 竖轴还是横轴
+      isRow: "竖",
+
+      // 画作是否超过了屏幕(可以拖动)
+      isMove: false,
+      // 画作的真实高度
+      imgWidth: 0,
+      imgHeight: 0,
+      // 屏幕的高度
+      pageHeight: 0,
+      // 预览大图
+      showViewer: false,
+      showBig: [
+        "https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
+      ],
+      // 画轴移动
+      zhouMove: 3,
+      tiemrr: -1,
+      // 画轴拖动
+      isFlag: false,
+      moveLoc: 0,
+
+      // 横轴左侧大盒子的宽度
+      leftBoxWidth: 0,
+    };
+  },
+  computed: {},
+  watch: {},
+  methods: {
+    // 查看大图
+    lookBigImg() {
+      this.showViewer = true;
+    },
+
+    // 鼠标拖动
+    mousemoveFu(e, flag) {
+      let ev = e || event;
+      if (this.isFlag && this.isMove) {
+        if (this.isRow === "竖") {
+          // 最大能往下移动的距离
+          const maxNum = this.imgHeight - window.innerHeight;
+
+          // 向上是负  向下是正
+          let temp = this.moveLoc + ev.movementY * (flag ? -5 : 1);
+
+          if (-temp < 0) temp = 0;
+          else if (-temp >= maxNum) temp = -maxNum;
+
+          this.moveLoc = temp;
+        } else {
+          // 最大能往右移动的距离
+          const maxNum = this.imgWidth - this.leftBoxWidth;
+          // 向左是负 向右是正
+          let temp = this.moveLoc + ev.movementX * (flag ? -5 : 1);
+          if (-temp < 0) temp = 0;
+          else if (-temp >= maxNum) temp = -maxNum;
+          this.moveLoc = temp;
+        }
+      }
+    },
+  },
+  created() {},
+  mounted() {
+    // 判断画轴有没有超过屏幕
+    const pageHeight = window.innerHeight;
+    this.pageHeight = pageHeight;
+
+    setTimeout(() => {
+      if (this.isRow === "竖") {
+        const dom = document.querySelector(".imgBox");
+        if (dom.offsetHeight > pageHeight) {
+          this.isMove = true;
+          this.imgWidth = dom.offsetWidth;
+          this.imgHeight = dom.offsetHeight;
+        }
+      } else {
+        const leftBoxWidthDom = document.querySelector(".leftBxo");
+        const leftBoxWidthDomWidth = leftBoxWidthDom.offsetWidth;
+        this.leftBoxWidth = leftBoxWidthDomWidth;
+        const dom = document.querySelector(".imgBoxHH");
+        if (dom.offsetWidth > leftBoxWidthDomWidth) {
+          this.isMove = true;
+          this.imgWidth = dom.offsetWidth;
+          this.imgHeight = dom.offsetHeight;
+        }
+      }
+    }, 200);
+    this.tiemrr = setInterval(() => {
+      if (this.zhouMove >= 99) clearInterval(this.tiemrr);
+      this.zhouMove = this.zhouMove + 1;
+    }, 30);
+  },
+  beforeCreate() {}, //生命周期 - 创建之前
+  beforeMount() {}, //生命周期 - 挂载之前
+  beforeUpdate() {}, //生命周期 - 更新之前
+  updated() {}, //生命周期 - 更新之后
+  beforeDestroy() {}, //生命周期 - 销毁之前
+  destroyed() {}, //生命周期 - 销毁完成
+  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+};
+</script>
+<style lang="less" scoped>
+.home {
+  width: 100vw;
+  height: 100vh;
+  overflow: hidden;
+  .leftBxo {
+    background-color: aquamarine;
+    width: 60%;
+    height: 100%;
+    position: relative;
+    text-align: center;
+    position: relative;
+    overflow: hidden;
+    .addIcon {
+      position: absolute;
+      bottom: 50px;
+      left: 50px;
+      cursor: pointer;
+      font-size: 30px;
+    }
+
+    // 竖大盒子
+    .imgBox {
+      cursor: grab;
+      height: auto;
+      overflow: hidden;
+      width: 46%;
+      padding: 5% 3%;
+      white-space: nowrap;
+      display: inline-block;
+      background-image: url("../assets/img/ba.png");
+      background-size: 100% 100%;
+      position: relative;
+
+      .zhou {
+        position: absolute;
+        bottom: 100%;
+        left: 0;
+        width: 100%;
+      }
+      & > img {
+        pointer-events: none;
+        width: 100%;
+        display: inline-block;
+      }
+    }
+    .imgBoxMove {
+      cursor: default;
+      display: flex;
+      align-items: center;
+      margin: 0 auto;
+    }
+
+    // 横大盒子
+    .imgBoxHH {
+      cursor: grab;
+      width: auto;
+      overflow: hidden;
+      height: 55%;
+      padding: 3% 5%;
+      white-space: nowrap;
+      display: inline-block;
+      background-image: url("../assets/img/baH.png");
+      background-size: 100% 100%;
+      position: relative;
+      top: 50%;
+      .zhou {
+        position: absolute;
+        right: 100%;
+        top: 0;
+        height: 100%;
+      }
+      & > img {
+        pointer-events: none;
+        height: 100%;
+        display: inline-block;
+      }
+    }
+    .imgBoxHHMove {
+      cursor: default;
+    }
+
+    .smImgBox {
+      position: absolute;
+      bottom: 5px;
+      right: 5px;
+      background-color: rgba(0, 0, 0, 0.5);
+      padding: 10px 20px;
+      .smImgBoxMain {
+        overflow: hidden;
+        position: relative;
+        .smBoxBor {
+          cursor: grab;
+          position: absolute;
+          top: 0;
+          left: 0;
+          width: 100%;
+          border: 1px solid #fff;
+        }
+        .smBoxBorHH {
+          cursor: grab;
+          position: absolute;
+          top: 0;
+          left: 0;
+          height: 100%;
+          border: 1px solid #fff;
+        }
+        & > img {
+          height: 100%;
+          width: 100%;
+        }
+      }
+    }
+  }
+  .leftBxoCenter {
+    display: flex;
+    align-items: center;
+  }
+}
+</style>

+ 3 - 0
vue.config.js

@@ -0,0 +1,3 @@
+module.exports = {
+  publicPath: './'
+}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 8704 - 0
yarn.lock