Przeglądaj źródła

第一次上传

xsh 4 lat temu
commit
e6715434b9

+ 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?

+ 24 - 0
README.md

@@ -0,0 +1,24 @@
+# ear_client
+
+## Project setup
+```
+npm install
+```
+
+### Compiles and hot-reloads for development
+```
+npm run serve
+```
+
+### Compiles and minifies for production
+```
+npm run build
+```
+
+### Lints and fixes files
+```
+npm run lint
+```
+
+### 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'
+  ]
+}

Plik diff jest za duży
+ 12074 - 0
package-lock.json


+ 47 - 0
package.json

@@ -0,0 +1,47 @@
+{
+  "name": "ear_client",
+  "version": "0.1.0",
+  "private": true,
+  "scripts": {
+    "serve": "vue-cli-service serve",
+    "build": "vue-cli-service build",
+    "lint": "vue-cli-service lint"
+  },
+  "dependencies": {
+    "core-js": "^3.6.5",
+    "element-ui": "^2.15.3",
+    "vue": "^2.6.11",
+    "vue-router": "^3.2.0",
+    "vuex": "^3.4.0"
+  },
+  "devDependencies": {
+    "@vue/cli-plugin-babel": "~4.5.0",
+    "@vue/cli-plugin-eslint": "~4.5.0",
+    "@vue/cli-plugin-router": "~4.5.0",
+    "@vue/cli-plugin-vuex": "~4.5.0",
+    "@vue/cli-service": "~4.5.0",
+    "babel-eslint": "^10.1.0",
+    "eslint": "^6.7.2",
+    "eslint-plugin-vue": "^6.2.2",
+    "vue-template-compiler": "^2.6.11"
+  },
+  "eslintConfig": {
+    "root": true,
+    "env": {
+      "node": true
+    },
+    "extends": [
+      "plugin:vue/essential",
+      "eslint:recommended"
+    ],
+    "parserOptions": {
+      "parser": "babel-eslint"
+    },
+    "rules": {}
+  },
+  "browserslist": [
+    "> 1%",
+    "last 2 versions",
+    "not dead"
+  ]
+}

BIN
public/favicon.ico


+ 17 - 0
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><%= htmlWebpackPlugin.options.title %></title>
+  </head>
+  <body style="margin: 0; padding: 0;">
+    <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>

+ 28 - 0
src/App.vue

@@ -0,0 +1,28 @@
+<template>
+  <div id="app">
+    <router-view/>
+  </div>
+</template>
+
+<style>
+#app {
+  font-family: Avenir, Helvetica, Arial, sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+  /*text-align: center;*/
+  color: #2c3e50;
+}
+
+#nav {
+  padding: 30px;
+}
+
+#nav a {
+  font-weight: bold;
+  color: #2c3e50;
+}
+
+#nav a.router-link-exact-active {
+  color: #42b983;
+}
+</style>

BIN
src/assets/logo.png


BIN
src/assets/u18.png


BIN
src/assets/u19.png


BIN
src/assets/u20.png


Plik diff jest za duży
+ 6 - 0
src/assets/u3.svg


+ 37 - 0
src/components/sideMenu.vue

@@ -0,0 +1,37 @@
+<template>
+  <div>
+    <el-menu
+      :default-active="defaultUrl"
+      background-color="#EAEDF1"
+      :unique-opened="true"
+      @select="onSelect">
+      <template v-for="item in menuItem">
+        <el-submenu v-show="navIndex === item.parentId" :key="item.id" :index="item.id">
+          <template slot="title">
+            <span>{{item.name}}</span>
+          </template>
+          <el-menu-item v-for="list in item.children" :key="list.id" :index="list.url">{{list.name}}</el-menu-item>
+        </el-submenu>
+      </template>
+    </el-menu>
+  </div>
+</template>
+<script>
+export default {
+  name: "sideMenu",
+  props: ['navIndex', 'defaultUrl', 'menuItem'],
+  data() {
+    return {
+    }
+  },
+  methods: {
+    onSelect(index) {
+      this.$router.push(index);
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 15 - 0
src/main.js

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

+ 45 - 0
src/router/childrenRouters.js

@@ -0,0 +1,45 @@
+const childrenRouters = [
+  /* 牧场概况 */
+  {
+    path: '/',
+    name: 'Home',
+    component: () => import('../views/pastureData/Home.vue'),
+    meta: {
+      title: '牧场概况',
+    }
+  },
+  {
+    path: '/hand',
+    name: 'band',
+    component: () => import('../views/pastureData/hand.vue'),
+    meta: {
+      title: '存栏走势'
+    }
+  },
+  {
+    path: '/dayData',
+    name: 'dayData',
+    component: () => import('../views/pastureData/dayData.vue'),
+    meta: {
+      title: '每日数据'
+    }
+  },
+  {
+    path: '/collectData',
+    name: 'collectData',
+    component: () => import('../views/collectData/collectData.vue'),
+    meta: {
+      title: '汇总数据'
+    }
+  },
+  {
+    path: '/deviceAdmin',
+    name: 'deviceAdmin',
+    component: () => import('../views/deviceAdmin/deviceAdmin.vue'),
+    meta: {
+      title: '设备管理'
+    }
+  }
+]
+
+export default childrenRouters;

+ 23 - 0
src/router/index.js

@@ -0,0 +1,23 @@
+import Vue from 'vue'
+import VueRouter from 'vue-router'
+import childrenRouters from "./childrenRouters";
+
+Vue.use(VueRouter)
+var mainRouterChildren = []; // eslint-disable-line no-unused-vars
+
+mainRouterChildren = mainRouterChildren.concat(childrenRouters);
+
+const routes = [
+  {
+    path: '/',
+    name: 'MainLayout',
+    component: () => import('../views/MainLayout.vue'),
+    children: mainRouterChildren
+  },
+]
+
+const router = new VueRouter({
+  routes
+})
+
+export default router

+ 15 - 0
src/store/index.js

@@ -0,0 +1,15 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+
+Vue.use(Vuex)
+
+export default new Vuex.Store({
+  state: {
+  },
+  mutations: {
+  },
+  actions: {
+  },
+  modules: {
+  }
+})

+ 216 - 0
src/views/MainLayout.vue

@@ -0,0 +1,216 @@
+<template>
+  <div class="layout">
+    <el-container>
+      <el-header style="height: 180px; background-color: #438EB9">
+        <h1 class="font-h1">浙江省数字畜牧应用系统养殖管理模块</h1>
+        <div class="menu">
+          <div class="menu-item">
+            <div class="item_box" v-for="item in menuList" :key="item.id" @click="jump(item.id)">
+              <img :src="item.img" alt="" style="height: 50px">
+              <div :class="['line', navIndex === item.id ? 'active' : '']">{{item.name}}</div>
+            </div>
+          </div>
+        </div>
+      </el-header>
+      <el-container style="height: calc(100vh - 180px);">
+        <el-aside width="230px" style="background-color: #EAEDF1">
+          <sideMenu :navIndex="navIndex" :defaultUrl="defaultUrl" :menuItem="menuItem"></sideMenu>
+        </el-aside>
+        <el-main style="background-color: #F9F9F9">
+          <div class="header_title">{{title}}</div>
+          <div class="overY">
+            <router-view></router-view>
+          </div>
+        </el-main>
+      </el-container>
+    </el-container>
+  </div>
+</template>
+
+<script>
+import sideMenu from "../components/sideMenu";
+export default {
+  name: "MainLayout",
+  components: {
+    sideMenu
+  },
+  data() {
+    return {
+      menuList: [
+        {
+          id: 1,
+          img: require('../assets/u19.png'),
+          name: '数据'
+        },
+        {
+          id: 2,
+          img: require('../assets/u20.png'),
+          name: '汇总数据'
+        },
+        {
+          id: 3,
+          img: require('../assets/u18.png'),
+          name: '设备管理'
+        }
+      ],
+      menuItem: [
+        {
+          id: '1',
+          name: '数据',
+          parentId: 1,
+          children: [
+            {
+              id: "10",
+              name: '牧场概况',
+              url: '/'
+            },
+            {
+              id: "20",
+              name: '存栏走势',
+              url: '/hand'
+            },
+            {
+              id: '30',
+              name: '每日数据',
+              url: '/dayData'
+            }
+          ]
+        },
+        {
+          id: '2',
+          name: '汇总数据',
+          parentId: 2,
+          children: [
+            {
+              id: '21',
+              name: '汇总数据',
+              url: '/collectData'
+            }
+          ]
+        },
+        {
+          id: '3',
+          name: '设备管理',
+          parentId: 3,
+          children: [
+            {
+              id: '31',
+              name: '设备管理',
+              url: '/deviceAdmin'
+            }
+          ]
+        }
+      ],
+      navIndex: 1,
+      title: '',
+      defaultUrl: '',
+    }
+  },
+  watch: {
+    $route(newVal) {
+      this.title = newVal.meta.title;
+    }
+  },
+  methods: {
+    jump(id){
+      this.navIndex = id;
+      this.$router.push(this.menuItem[id - 1].children[0].url);
+      this.defaultUrl = this.menuItem[id - 1].children[0].url;
+    }
+  },
+  mounted() {
+    console.log(this.$route);
+    this.title = this.$route.meta.title;
+    this.defaultUrl = this.$route.path;
+  }
+}
+</script>
+
+<style scoped>
+  /deep/.el-header {
+    padding: 0;
+  }
+  /deep/.el-main {
+    padding: 0;
+  }
+  .layout {
+    width: 100%;
+    height: 100vh;
+    overflow: hidden;
+  }
+  .font-h1 {
+    font-size: 36px;
+    padding-left: 200px;
+    background-image:-webkit-linear-gradient(bottom,#A0ADB6, #F1F3F4);
+    -webkit-background-clip:text;
+    -webkit-text-fill-color:transparent;
+    margin: 20px auto;
+  }
+  .menu {
+    width: 100%;
+    height: 93px;
+    background-image: url('../assets/u3.svg');
+    background-size: 100% 100%;
+  }
+  .menu-item {
+    width: 800px;
+    height: 100%;
+    margin: 0 auto;
+    display: flex;
+    justify-content: space-between;
+  }
+  .item_box {
+    width: 150px;
+    height: 100%;
+    text-align: center;
+    cursor: pointer;
+  }
+  .item_box:hover .line {
+    background-color: #4098CA;
+    color: white;
+  }
+  .line {
+    line-height: 30px;
+    color: #4098CA;
+  }
+  .active {
+    background-color: #4098CA;
+    color: white;
+  }
+  .header_title {
+    height: 50px;
+    background-color: #F3F3F3;
+    border-bottom: 1px solid #ddd;
+    border-top: 1px solid #ddd;
+  }
+  .overY {
+    height: calc(100vh - 180px - 52px);
+    overflow-y: scroll;
+  }
+  .overY::-webkit-scrollbar {
+    /*滚动条整体样式*/
+    width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
+    height: 1px;
+  }
+  .overY::-webkit-scrollbar-thumb {
+    /*滚动条里面小方块*/
+    border-radius: 8px;
+    background-color: #535353;
+    background-image: -webkit-linear-gradient(
+        45deg,
+        rgba(255, 255, 255, 0.2) 25%,
+        transparent 25%,
+        transparent 50%,
+        rgba(255, 255, 255, 0.2) 50%,
+        rgba(255, 255, 255, 0.2) 75%,
+        transparent 75%,
+        transparent
+    );
+  }
+  .overY::-webkit-scrollbar-track {
+    /*滚动条里面轨道*/
+    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
+    /*background   : #ededed;*/
+    border-radius: 10px;
+  }
+</style>

+ 13 - 0
src/views/collectData/collectData.vue

@@ -0,0 +1,13 @@
+<template>
+  <div>汇总数据</div>
+</template>
+
+<script>
+export default {
+  name: "collectData"
+}
+</script>
+
+<style scoped>
+
+</style>

+ 13 - 0
src/views/deviceAdmin/deviceAdmin.vue

@@ -0,0 +1,13 @@
+<template>
+  <div>设备管理</div>
+</template>
+
+<script>
+export default {
+  name: "deviceAdmin"
+}
+</script>
+
+<style scoped>
+
+</style>

+ 13 - 0
src/views/pastureData/Home.vue

@@ -0,0 +1,13 @@
+<template>
+  <div> 11111</div>
+</template>
+
+<script>
+export default {
+  name: "Home"
+}
+</script>
+
+<style scoped>
+
+</style>

+ 13 - 0
src/views/pastureData/dayData.vue

@@ -0,0 +1,13 @@
+<template>
+  <div>每日数据</div>
+</template>
+
+<script>
+export default {
+  name: "dayData"
+}
+</script>
+
+<style scoped>
+
+</style>

+ 13 - 0
src/views/pastureData/hand.vue

@@ -0,0 +1,13 @@
+<template>
+  <div>存栏走势</div>
+</template>
+
+<script>
+export default {
+  name: "hand"
+}
+</script>
+
+<style scoped>
+
+</style>