shaogen1995 3 лет назад
Родитель
Сommit
157a3606d2

+ 23 - 0
web/.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
web/README.md

@@ -0,0 +1,19 @@
+# web
+
+## 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
web/babel.config.js

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

Разница между файлами не показана из-за своего большого размера
+ 26103 - 0
web/package-lock.json


+ 28 - 0
web/package.json

@@ -0,0 +1,28 @@
+{
+  "name": "web",
+  "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.8",
+    "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
web/public/favicon.ico


+ 17 - 0
web/public/index.html

@@ -0,0 +1,17 @@
+<!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">
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+    <title>江门市传统村落一张图</title>
+  </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>

+ 15 - 0
web/src/App.vue

@@ -0,0 +1,15 @@
+<template>
+  <div id="app">
+    <Router-view/>
+  </div>
+</template>
+<style lang='less' scoped>
+#app{
+  width: 100vw;
+  height: 100vh;
+  min-width: 1800px;
+  min-height: 900px;
+  overflow: hidden;
+}
+</style>
+

+ 11 - 0
web/src/assets/css/base.css

@@ -0,0 +1,11 @@
+* {
+  margin: 0;
+  padding: 0;
+  box-sizing: border-box;
+}
+ul li {
+  list-style: none;
+}
+body{
+  font-family: 'Source Han Serif CN-Bold';
+}

BIN
web/src/assets/img/bg.jpg


BIN
web/src/assets/img/detail.png


BIN
web/src/assets/img/gaikuang.png


BIN
web/src/assets/img/zhuans1.png


BIN
web/src/assets/img/zhuans2.png


+ 13 - 0
web/src/main.js

@@ -0,0 +1,13 @@
+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';
+import './assets/css/base.css'
+Vue.use(ElementUI);
+Vue.config.productionTip = false
+
+new Vue({
+  router,
+  render: h => h(App)
+}).$mount('#app')

+ 18 - 0
web/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

+ 477 - 0
web/src/views/Home.vue

@@ -0,0 +1,477 @@
+<!--  -->
+<template>
+  <div class="home">
+    <div>等待地图接口开发......</div>
+    <!-- 右侧菜单 -->
+    <div class="mean" :class="{ meanShow: arrowsShow }">
+      <!-- 背景装饰 -->
+      <div class="zhuangs"></div>
+      <div class="zhuangs zhuangs2"></div>
+      <!-- 左边箭头 -->
+      <div class="arrows" @click="arrowsShow = !arrowsShow">
+        <i class="el-icon-arrow-left" v-if="arrowsShow"></i>
+        <i class="el-icon-arrow-right" v-else></i>
+      </div>
+      <div class="top">
+        <p>江门市中国传统村落</p>
+        <p>一张图</p>
+      </div>
+      <!-- 搜索 -->
+      <div class="search" @keyup.enter="mySearch">
+        <div class="searchBtn" @click="mySearch"></div>
+        <el-input
+          placeholder="搜索村落名称..."
+          suffix-icon="el-icon-search"
+          v-model="name"
+        >
+        </el-input>
+      </div>
+      <!-- 下面内容 -->
+      <div class="main">
+        <div class="mainTop">
+          <div :class="{ active: mainInd === 0 }" @click="mainInd = 0">
+            浏览统计
+          </div>
+          <div :class="{ active: mainInd === 1 }" @click="mainInd = 1">
+            区域筛选
+          </div>
+        </div>
+        <!-- 浏览统计盒子 -->
+        <div class="mainBox1" v-show="mainInd === 0">
+          <!-- 浏览概况 -->
+          <div class="browse">
+            <h3>浏览概况</h3>
+            <div class="browseNum">
+              <div>
+                <p>累计浏览量</p>
+                <span>1000</span>
+              </div>
+              <div>
+                <p>今日浏览量</p>
+                <span>500</span>
+              </div>
+            </div>
+          </div>
+          <!-- 详情统计 -->
+          <div class="details">
+            <h3>详情统计</h3>
+            <div class="detailsNum">
+              <div
+                class="row"
+                :title="item.name + ' ' + item.num"
+                v-for="item in numData"
+                :key="item.id"
+              >
+                <div class="rowLeft">{{ item.name }}</div>
+                <div class="rowRight">
+                  <div class="plan">
+                    <div :style="`width:${(item.num / maxNum) * 100}%`"></div>
+                  </div>
+                </div>
+                <div class="rowNum">{{ item.num }}</div>
+              </div>
+            </div>
+          </div>
+        </div>
+        <!-- 区域筛选盒子 -->
+        <div class="mainBox2" v-show="mainInd === 1">
+          <div class="box2Row" v-for="item in mapData" :key="item.id">
+            <div class="ll" @click="cutInd(item.id)">
+              <div>{{ item.name }}</div>
+              <div class="bs">{{ item.son.length }}</div>
+            </div>
+            <div
+              @click="cutInd(item.id)"
+              class="rr"
+              :class="
+                item.id === mapDataInd
+                  ? 'el-icon-arrow-up'
+                  : 'el-icon-arrow-down'
+              "
+            ></div>
+            <div class="sonBox">
+              <div
+                @click="$router.push()"
+                :class="{ active: item.id === mapDataInd }"
+                v-for="val in item.son"
+                :key="val.id"
+              >
+                · {{ val.name }}
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "home",
+  components: {},
+  data() {
+    //这里存放数据
+    return {
+      arrowsShow: false,
+      name: "",
+      mainInd: 0,
+      numData: [
+        { id: 1, name: "东宁村", num: 253 },
+        { id: 2, name: "东宁村", num: 353 },
+        { id: 3, name: "东宁村", num: 553 },
+        { id: 4, name: "东宁村", num: 153 },
+        { id: 5, name: "东宁村", num: 252 },
+        { id: 6, name: "东宁村", num: 212 },
+        { id: 7, name: "东宁村", num: 233 },
+        { id: 8, name: "东宁村", num: 298 },
+        { id: 9, name: "东宁村", num: 256 },
+        { id: 10, name: "东宁村", num: 353 },
+        { id: 11, name: "东宁村", num: 643 },
+        { id: 12, name: "马降龙村", num: 243 },
+      ],
+      // 数据最大值
+      maxNum: 0,
+      // 区域筛选的数据
+      mapDataInd: 1000,
+      mapData: [
+        {
+          id: 1000,
+          name: "蓬江区",
+          son: [
+            { id: 1001, name: "良溪村" },
+            { id: 1002, name: "卢边村" },
+          ],
+        },
+        {
+          id: 2000,
+          name: "江海区",
+          son: [
+            { id: 2001, name: "良溪村" },
+            { id: 2002, name: "卢边村" },
+            { id: 2003, name: "XX村" },
+          ],
+        },
+        {
+          id: 3000,
+          name: "新会区",
+          son: [
+            { id: 3001, name: "良溪村" },
+            { id: 3002, name: "卢边村" },
+          ],
+        },
+      ],
+    };
+  },
+  //监听属性 类似于data概念
+  computed: {},
+  //监控data中的数据变化
+  watch: {},
+  //方法集合
+  methods: {
+    cutInd(id){
+      if(this.mapDataInd===id) this.mapDataInd=null
+      else this.mapDataInd=id
+    },
+    mySearch() {
+      console.log("点击了搜索");
+    },
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    let arr = [];
+    this.numData.forEach((v) => {
+      arr.push(v.num);
+    });
+    this.maxNum = arr.reduce((a, b) => (a > b ? a : b));
+  },
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
+  beforeCreate() {}, //生命周期 - 创建之前
+  beforeMount() {}, //生命周期 - 挂载之前
+  beforeUpdate() {}, //生命周期 - 更新之前
+  updated() {}, //生命周期 - 更新之后
+  beforeDestroy() {}, //生命周期 - 销毁之前
+  destroyed() {}, //生命周期 - 销毁完成
+  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+};
+</script>
+<style lang='less' scoped>
+.home {
+  position: relative;
+  width: 100%;
+  height: 100%;
+  background: url("../assets/img/bg.jpg");
+  background-size: cover;
+  .mean {
+    transform: translateX(0);
+    transition: all 0.3s;
+    color: #fff;
+    padding: 20px;
+    z-index: 99;
+    position: absolute;
+    top: 0;
+    right: 0;
+    width: 400px;
+    height: 100%;
+    .zhuangs {
+      z-index: -1;
+      position: absolute;
+      bottom: 10px;
+      left: 0;
+      width: 307px;
+      height: 124px;
+      background: url("../assets/img/zhuans2.png");
+      background-size: 100% 100%;
+    }
+    .zhuangs2 {
+      top: 36%;
+      bottom: auto;
+      left: auto;
+      right: 0;
+      background: url("../assets/img/zhuans1.png");
+      background-size: 100% 100%;
+    }
+    &::before {
+      content: "";
+      position: absolute;
+      left: 0;
+      top: 0;
+      width: 100%;
+      height: 100%;
+      background: rgba(202, 185, 153, 0.9);
+      backdrop-filter: blur(4px);
+      z-index: -2;
+    }
+    .arrows {
+      padding-left: 2px;
+      cursor: pointer;
+      border-radius: 20px 0 0 20px;
+      overflow: hidden;
+      position: absolute;
+      top: 50%;
+      left: -20px;
+      transform: translateY(-50%);
+      width: 20px;
+      height: 80px;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      &::before {
+        content: "";
+        position: absolute;
+        left: 0;
+        top: 0;
+        width: 100%;
+        height: 100%;
+        background: rgba(202, 185, 153, 0.9);
+        backdrop-filter: blur(4px);
+        z-index: -1;
+      }
+      & > i {
+        color: #fff;
+        font-size: 20px;
+      }
+    }
+    .top {
+      & > p {
+        text-align: center;
+        font-size: 30px;
+      }
+    }
+    .search {
+      position: relative;
+      margin: 15px 0;
+      .searchBtn {
+        cursor: pointer;
+        z-index: 10;
+        position: absolute;
+        top: 0;
+        right: 0;
+        width: 40px;
+        height: 40px;
+      }
+      /*修改提示文字的颜色*/
+      /deep/input::-webkit-input-placeholder {
+        /* WebKit browsers */
+        color: #c9a774;
+      }
+      /deep/input:-moz-placeholder {
+        /* Mozilla Firefox 4 to 18 */
+        color: #c9a774;
+      }
+      /deep/input::-moz-placeholder {
+        /* Mozilla Firefox 19+ */
+        color: #c9a774;
+      }
+      /deep/input:-ms-input-placeholder {
+        /* Internet Explorer 10+ */
+        color: #c9a774;
+      }
+      /deep/.el-input__inner {
+        border-radius: 20px;
+        background-color: #efeee8;
+        color: #c9a774;
+      }
+      /deep/.el-input__inner:focus {
+        border-color: #c9a774;
+      }
+      /deep/.el-input__suffix {
+        color: #c9a774;
+        font-size: 20px;
+      }
+    }
+    .main {
+      .mainTop {
+        display: flex;
+        height: 40px;
+        color: #e8e0d1;
+        border-bottom: 1px solid #e8e0d1;
+        padding: 0 40px;
+        justify-content: space-between;
+        font-size: 22px;
+        & > div {
+          cursor: pointer;
+          padding: 0 15px;
+        }
+        .active {
+          font-weight: 700;
+          color: #fff;
+          border-bottom: 3px solid #fff;
+        }
+      }
+      .mainBox1 {
+        padding: 20px 5px 0 10px;
+        color: #fff;
+        .browse {
+          & > h3 {
+            background: url("../assets/img/gaikuang.png") no-repeat left center;
+            padding-left: 45px;
+            height: 40px;
+            line-height: 40px;
+            font-size: 18px;
+          }
+          .browseNum {
+            display: flex;
+            margin-top: 15px;
+            & > div {
+              width: 50%;
+              text-align: center;
+              & > p {
+                color: #e8e0d1;
+                text-align: center;
+                font-size: 16px;
+                margin-bottom: 5px;
+              }
+              & > span {
+                font-size: 30px;
+              }
+            }
+          }
+        }
+        .details {
+          margin-top: 10px;
+          & > h3 {
+            background: url("../assets/img/detail.png") no-repeat left center;
+            padding-left: 45px;
+            height: 40px;
+            line-height: 40px;
+            font-size: 18px;
+          }
+          .detailsNum {
+            width: 100%;
+            height: 490px;
+            padding-top: 15px;
+            .row {
+              cursor: pointer;
+              height: 40px;
+              display: flex;
+              .rowLeft {
+                border-right: 1px solid #e8e0d1;
+                text-align: center;
+                line-height: 40px;
+                width: 90px;
+              }
+              .rowRight {
+                width: calc(100% - 170px);
+                position: relative;
+                .plan {
+                  position: absolute;
+                  left: 0;
+                  top: 13px;
+                  width: 100%;
+                  height: 14px;
+                  background-color: rgba(232, 224, 209, 0.8);
+                  & > div {
+                    position: absolute;
+                    left: 0;
+                    top: 0;
+                    height: 100%;
+                    background-color: #fff;
+                  }
+                }
+              }
+              .rowNum {
+                padding-left: 5px;
+                width: 80px;
+                line-height: 40px;
+                text-align: center;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                white-space: nowrap;
+              }
+            }
+          }
+        }
+      }
+      .mainBox2 {
+        padding: 30px 5px 0 10px;
+        color: #fff;
+        .box2Row {
+          margin-bottom: 20px;
+          position: relative;
+          .ll {
+            cursor: pointer;
+            font-size: 18px;
+            display: flex;
+            .bs {
+              line-height: 24px;
+              font-size: 16px;
+              width: 24px;
+              text-align: center;
+              margin-left: 8px;
+              background-color: #9f171c;
+            }
+          }
+          .rr {
+            cursor: pointer;
+            font-size: 20px;
+            height: 24px;
+            line-height: 24px;
+            position: absolute;
+            top: 0;
+            right: 0;
+          }
+          .sonBox {
+            padding-left: 15px;
+            & > div {
+              overflow: hidden;
+              height: 0;
+              cursor: pointer;
+              margin-top: 0px;
+              transition: all 0.3s;
+            }
+            .active {
+              height: auto;
+              margin-top: 15px;
+            }
+          }
+        }
+      }
+    }
+  }
+  .meanShow {
+    transform: translateX(400px);
+  }
+}
+</style>