ZZW 1 год назад
Родитель
Сommit
8f817e2011

+ 39 - 0
display_model_for_smartagriculture/src/router/index.js

@@ -0,0 +1,39 @@
+import index from "../pages/index.vue";
+import crop from "../pages/crop.vue";
+import environment from "../pages/environment.vue";
+import device from "../pages/device.vue";
+import market from "../pages/market.vue";
+import {createRouter, createWebHashHistory} from "vue-router";
+
+const routes = [
+    {
+        path: '/',
+        component: index
+    },
+    {
+        path: '/index',
+        component: index
+    },
+    {
+        path: '/crop',
+        component: crop
+    },
+    {
+        path: '/environment',
+        component: environment
+    },
+    {
+        path: '/device',
+        component: device
+    },
+    {
+        path: '/market',
+        component: market
+    }
+]
+const router = createRouter({
+    // 4. 内部提供了 history 模式的实现。为了简单起见,我们在这里使用 hash 模式。
+    history: createWebHashHistory(),
+    routes, // `routes: routes` 的缩写
+})
+export default router

+ 43 - 45
display_model_for_smartagriculture/src/utils/request.js

@@ -1,45 +1,43 @@
-// import axios from 'axios'
-// import
-// // 创建可一个新的axios对象
-// const request = axios.create({
-//     baseURL: process.env.VUE_APP_BASEURL,   // 后端的接口地址  ip:port
-//     timeout: 30000                          // 30s请求超时
-// })
-//
-// // request 拦截器
-// // 可以自请求发送前对请求做一些处理
-// // 比如统一加token,对请求参数统一加密
-// request.interceptors.request.use(config => {
-//     config.headers['Content-Type'] = 'application/json;charset=utf-8';        // 设置请求头格式
-//     let user = JSON.parse(localStorage.getItem("xm-user") || '{}')  // 获取缓存的用户信息
-//     config.headers['token'] = user.token  // 设置请求头
-//
-//     return config
-// }, error => {
-//     console.error('request error: ' + error) // for debug
-//     return Promise.reject(error)
-// });
-//
-// // response 拦截器
-// // 可以在接口响应后统一处理结果
-// request.interceptors.response.use(
-//     response => {
-//         let res = response.data;
-//
-//         // 兼容服务端返回的字符串数据
-//         if (typeof res === 'string') {
-//             res = res ? JSON.parse(res) : res
-//         }
-//         if (res.code === '401') {
-//
-//         }
-//         return res;
-//     },
-//     error => {
-//         console.error('response error: ' + error) // for debug
-//         return Promise.reject(error)
-//     }
-// )
-//
-//
-// export default request
+import axios from 'axios'
+
+// 创建可一个新的axios对象
+const request = axios.create({
+    baseURL: "https://69b89r4952.yicp.fun",   // 后端的接口地址  ip:port // process.env.VUE_APP_BASEURL
+    timeout: 30000                          // 30s请求超时
+})
+
+// request 拦截器
+// 可以自请求发送前对请求做一些处理
+// 比如统一加token,对请求参数统一加密
+request.interceptors.request.use(config => {
+    config.headers['Content-Type'] = 'application/json;charset=utf-8';        // 设置请求头格式
+    let user = JSON.parse(localStorage.getItem("xm-user") || '{}')  // 获取缓存的用户信息
+    config.headers['token'] = user.token  // 设置请求头
+
+    return config
+}, error => {
+    console.error('request error: ' + error) // for debug
+    return Promise.reject(error)
+});
+
+// response 拦截器
+// 可以在接口响应后统一处理结果
+request.interceptors.response.use(
+    response => {
+        let res = response.data;
+
+        // 兼容服务端返回的字符串数据
+        if (typeof res === 'string') {
+            res = res ? JSON.parse(res) : res
+        }
+
+        return res;
+    },
+    error => {
+        console.error('response error: ' + error) // for debug
+        return Promise.reject(error)
+    }
+)
+
+
+export default request

+ 93 - 0
vue/package-lock.json

@@ -11,6 +11,7 @@
         "axios": "^1.5.1",
         "core-js": "^3.8.3",
         "echart": "^0.1.3",
+        "echarts": "^5.5.0",
         "element-china-area-data": "^6.1.0",
         "element-ui": "^2.15.14",
         "highcharts": "^11.4.1",
@@ -21,6 +22,8 @@
         "@vue/cli-plugin-babel": "~5.0.0",
         "@vue/cli-plugin-router": "~5.0.0",
         "@vue/cli-service": "~5.0.0",
+        "sass": "^1.76.0",
+        "sass-loader": "^14.2.1",
         "vue-template-compiler": "^2.6.14"
       }
     },
@@ -4815,6 +4818,20 @@
         "mock": "bin/mock"
       }
     },
+    "node_modules/echarts": {
+      "version": "5.5.0",
+      "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.5.0.tgz",
+      "integrity": "sha512-rNYnNCzqDAPCr4m/fqyUFv7fD9qIsd50S6GDFgO1DxZhncCsNsG7IfUlAlvZe5oSEQxtsjnHiUuppzccry93Xw==",
+      "dependencies": {
+        "tslib": "2.3.0",
+        "zrender": "5.5.0"
+      }
+    },
+    "node_modules/echarts/node_modules/tslib": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
+      "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
+    },
     "node_modules/ee-first": {
       "version": "1.1.1",
       "resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz",
@@ -5850,6 +5867,12 @@
         "node": ">= 4"
       }
     },
+    "node_modules/immutable": {
+      "version": "4.3.5",
+      "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.5.tgz",
+      "integrity": "sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==",
+      "dev": true
+    },
     "node_modules/import-fresh": {
       "version": "3.3.0",
       "resolved": "https://registry.npmmirror.com/import-fresh/-/import-fresh-3.3.0.tgz",
@@ -8578,6 +8601,63 @@
       "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
       "dev": true
     },
+    "node_modules/sass": {
+      "version": "1.76.0",
+      "resolved": "https://registry.npmjs.org/sass/-/sass-1.76.0.tgz",
+      "integrity": "sha512-nc3LeqvF2FNW5xGF1zxZifdW3ffIz5aBb7I7tSvOoNu7z1RQ6pFt9MBuiPtjgaI62YWrM/txjWlOCFiGtf2xpw==",
+      "dev": true,
+      "dependencies": {
+        "chokidar": ">=3.0.0 <4.0.0",
+        "immutable": "^4.0.0",
+        "source-map-js": ">=0.6.2 <2.0.0"
+      },
+      "bin": {
+        "sass": "sass.js"
+      },
+      "engines": {
+        "node": ">=14.0.0"
+      }
+    },
+    "node_modules/sass-loader": {
+      "version": "14.2.1",
+      "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-14.2.1.tgz",
+      "integrity": "sha512-G0VcnMYU18a4N7VoNDegg2OuMjYtxnqzQWARVWCIVSZwJeiL9kg8QMsuIZOplsJgTzZLF6jGxI3AClj8I9nRdQ==",
+      "dev": true,
+      "dependencies": {
+        "neo-async": "^2.6.2"
+      },
+      "engines": {
+        "node": ">= 18.12.0"
+      },
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/webpack"
+      },
+      "peerDependencies": {
+        "@rspack/core": "0.x || 1.x",
+        "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
+        "sass": "^1.3.0",
+        "sass-embedded": "*",
+        "webpack": "^5.0.0"
+      },
+      "peerDependenciesMeta": {
+        "@rspack/core": {
+          "optional": true
+        },
+        "node-sass": {
+          "optional": true
+        },
+        "sass": {
+          "optional": true
+        },
+        "sass-embedded": {
+          "optional": true
+        },
+        "webpack": {
+          "optional": true
+        }
+      }
+    },
     "node_modules/schema-utils": {
       "version": "2.7.1",
       "resolved": "https://registry.npmmirror.com/schema-utils/-/schema-utils-2.7.1.tgz",
@@ -10184,6 +10264,19 @@
       "engines": {
         "node": ">= 4.0.0"
       }
+    },
+    "node_modules/zrender": {
+      "version": "5.5.0",
+      "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.5.0.tgz",
+      "integrity": "sha512-O3MilSi/9mwoovx77m6ROZM7sXShR/O/JIanvzTwjN3FORfLSr81PsUGd7jlaYOeds9d8tw82oP44+3YucVo+w==",
+      "dependencies": {
+        "tslib": "2.3.0"
+      }
+    },
+    "node_modules/zrender/node_modules/tslib": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
+      "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
     }
   }
 }

+ 3 - 0
vue/package.json

@@ -10,6 +10,7 @@
     "axios": "^1.5.1",
     "core-js": "^3.8.3",
     "echart": "^0.1.3",
+    "echarts": "^5.5.0",
     "element-china-area-data": "^6.1.0",
     "element-ui": "^2.15.14",
     "highcharts": "^11.4.1",
@@ -20,6 +21,8 @@
     "@vue/cli-plugin-babel": "~5.0.0",
     "@vue/cli-plugin-router": "~5.0.0",
     "@vue/cli-service": "~5.0.0",
+    "sass": "^1.76.0",
+    "sass-loader": "^14.2.1",
     "vue-template-compiler": "^2.6.14"
   },
   "browserslist": [

+ 3 - 1
vue/src/utils/request.js

@@ -1,5 +1,7 @@
+
+
+
 import axios from 'axios'
-import router from "@/router";
 
 // 创建可一个新的axios对象
 const request = axios.create({

+ 492 - 9
vue/src/views/manager/AI/CorpGrown.vue

@@ -1,15 +1,498 @@
+<template>
+  <div class="home">
+    <el-row :gutter="20">
+      <!--  -->
+      <el-col :span="8">
+        <el-card shadow="hover">
+          <div slot="header" class="user-info">
+            <img class="user-img" src="src/assets/imgs/logo.png" />
+            <ul>
+              <li>Admin</li>
+              <li>超级管理员</li>
+            </ul>
+          </div>
+          <ul class="login-info">
+            <li>上次登录时间:<span>2008-12-12</span></li>
+            <li>上次登录地址:<span>日本-我孙子市</span></li>
+          </ul>
+        </el-card>
+        <el-card class="table" shadow="always">
+          <el-table :data="tableData" style="width: 100%">
+            <el-table-column
+                v-for="(val, key) in label"
+                :key="key"
+                :prop="key"
+                :label="val"
+            >
+            </el-table-column>
+          </el-table>
+        </el-card>
+      </el-col>
+      <!--  -->
+      <el-col :span="16">
+        <div class="num">
+          <el-card
+              v-for="(item, index) in countData"
+              :key="index"
+              shadow="always"
+              body-style="padding: 0;display: flex;"
+          >
+            <i
+                :class="'el-icon-' + item.icon"
+                :style="'background:' + item.color"
+            ></i>
+            <ul>
+              <li>
+                ¥<span>{{ item.value }}</span>
+              </li>
+              <li>{{ item.name }}</li>
+            </ul>
+          </el-card>
+        </div>
+        <el-card style="width: 100%; height: 300px; margin-bottom: 20px">
+          <div id="line"></div>
+        </el-card>
+        <div class="bar-pie">
+          <el-card style="width: 49%; height: 300px">
+            <div id="bar"></div>
+          </el-card>
+          <el-card style="width: 49%; height: 300px">
+            <div id="pie"></div>
+          </el-card>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
 <script>
+import * as echarts from "echarts";
+
 export default {
-  name: "CorpGrown"
-}
-</script>
+  data() {
+    return {
+      label: {
+        name: "品牌",
+        todayBuy: "今日购买",
+        monthBuy: "本月购买",
+        totalBuy: "总购买",
+      },
+      tableData: [
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+        {
+          name: "巴黎世家",
+          todayBuy: 1450,
+          monthBuy: 7500,
+          totalBuy: 85000,
+        },
+      ],
+      countData: [
+        {
+          name: "今日支付订单",
+          value: "1234",
+          icon: "success",
+          color: "#2ec7c9",
+        },
+        {
+          name: "今日收藏订单",
+          value: "210",
+          icon: "star-on",
+          color: "#ffb980",
+        },
+        {
+          name: "今日未支付订单",
+          value: "1234",
+          icon: "s-goods",
+          color: "#5ab1ef",
+        },
+        {
+          name: "本月支付订单",
+          value: "1234",
+          icon: "success",
+          color: "#2ec7c9",
+        },
+        {
+          name: "本月收藏订单",
+          value: "210",
+          icon: "star-on",
+          color: "#ffb980",
+        },
+        {
+          name: "本月未支付订单",
+          value: "1234",
+          icon: "s-goods",
+          color: "#5ab1ef",
+        },
+      ],
+    };
+  },
+  mounted() {
+    // 基于准备好的dom,初始化echarts实例
+    var bar = echarts.init(document.getElementById("bar"));
+    var pie = echarts.init(document.getElementById("pie"));
+    var line = echarts.init(document.getElementById("line"));
+    // 绘制图表
+    line.setOption({
+      title: {
+        text: "一些数据",
+        // subtext: 'Demo 虚构数据',
+        x: "center",
+      },
+      legend: {
+        // 图例配置选项
+        orient: "horizontal", //图例布局方式:水平 'horizontal' 、垂直 'vertical'
+        x: "left", // 横向放置位置,选项:'center'、'left'、'right'、'number'(横向值 px)
+        y: "top", // 纵向放置位置,选项:'top'、'bottom'、'center'、'number'(纵向值 px)
+        data: ["猜想", "预期", "实际"],
+      },
+      grid: {
+        // 图表距离边框的距离,可用百分比和数字(px)配置
+        top: "20%",
+        left: "3%",
+        right: "10%",
+        bottom: "5%",
+        containLabel: true,
+      },
 
-<template>
-<div>
-  作物生长分析
-</div>
-</template>
+      tooltip: {
+        // tooltip 用于控制鼠标滑过或点击时的提示框
+        trigger: "axis",
+        axisPointer: {
+          // 坐标轴指示器配置项。
+          type: "cross", // 'line' 直线指示器  'shadow' 阴影指示器  'none' 无指示器  'cross' 十字准星指示器。
+          axis: "auto", // 指示器的坐标轴。
+          snap: true, // 坐标轴指示器是否自动吸附到点上
+        },
+        showContent: true,
+      },
+      toolbox: {
+        // 右上角的工具框
+        feature: {
+          saveAsImage: {}, //下载按钮
+        },
+      },
 
-<style scoped>
+      xAxis: {
+        name: "月份",
+        type: "category",
+        axisLine: {
+          lineStyle: {
+            // X 轴颜色配置
+            color: "#3366CC",
+          },
+        },
+        axisLabel: {
+          rotate: 45, // X 轴标签文字旋转角度
+          interval: 0, //设置 X 轴数据间隔几个显示一个,为0表示都显示
+        },
+        boundaryGap: false, //数据从 Y 轴起始
+        data: [
+          "1月",
+          "2月",
+          "3月",
+          "4月",
+          "5月",
+          "6月",
+          "7月",
+          "8月",
+          "9月",
+          "10月",
+          "11月",
+          "12月",
+        ],
+      },
 
+      yAxis: {
+        name: "人次",
+        type: "value",
+        min: 0, // 配置 Y 轴刻度最小值
+        max: 4000, // 配置 Y 轴刻度最大值
+        splitNumber: 7, // 配置 Y 轴数值间隔
+        axisLine: {
+          lineStyle: {
+            // Y 轴颜色配置
+            color: "#3366CC",
+          },
+        },
+      },
+
+      series: [
+        {
+          name: "猜想",
+          data: [454, 226, 891, 978, 901, 581, 400, 543, 272, 955, 1294, 1581],
+          type: "line",
+          symbolSize: function (value) {
+            // 点的大小跟随数值增加而变大
+            return value / 150;
+          },
+          symbol: "circle",
+          itemStyle: {
+            normal: {
+              label: {
+                show: true,
+              },
+              lineStyle: {
+                color: "rgba(0,0,0,0)", // 折线颜色设置为0,即只显示点,不显示折线
+              },
+            },
+          },
+        },
+
+        {
+          name: "预期",
+          data: [
+            2455, 2534, 2360, 2301, 2861, 2181, 1944, 2197, 1745, 1810, 2283,
+            2298,
+          ],
+          type: "line",
+          symbolSize: 8, //设置折线上圆点大小
+          itemStyle: {
+            normal: {
+              label: {
+                show: true, // 在折线拐点上显示数据
+              },
+              lineStyle: {
+                width: 3, // 设置虚线宽度
+                type: "dotted", // 虚线'dotted' 实线'solid'
+              },
+            },
+          },
+        },
+
+        {
+          name: "实际",
+          data: [
+            1107, 1352, 1740, 1968, 1647, 1570, 1343, 1757, 2547, 2762, 3170,
+            3665,
+          ],
+          type: "line",
+          symbol: "circle", // 实心圆点
+          smooth: 0.5, // 设置折线弧度
+        },
+      ],
+      color: ["#3366CC", "#FFCC99", "#99CC33"], // 三个折线的颜色
+    });
+    pie.setOption({
+      title: {
+        left: "center",
+        text: "营业总收入季度分布图",
+        textStyle: {
+          color: "#6d6",
+        },
+      },
+      toolbox: {
+        feature: {
+          saveAsImage: {},
+        },
+      },
+      tooltip: {},
+      legend: {
+        left: "left",
+        top: "10",
+        orient: "vertical",
+        data: ["一季度", "二季度", "三季度", "四季度"],
+      },
+      dataset: {
+        source: [
+          ["quarter", "一季度", "二季度", "三季度", "四季度"],
+          ["完美世界", 25.74, 25.7, 29.18, 21.58],
+        ],
+      },
+      series: [
+        {
+          name: "完美世界",
+          type: "pie",
+          seriesLayoutBy: "row",
+          encode: {
+            itemName: 0, //数据项名称,在legend中展示
+            value: 1,
+          },
+          label: {
+            show: true,
+          },
+          // roseType: "area", //设置玫瑰图
+        },
+      ],
+    });
+    bar.setOption({
+      title: {
+        text: "本月售卖情况",
+      },
+      color: ["#9462e5", "#e1bb22"],
+      tooltip: {},
+      legend: {
+        data: ["销量", "退货"],
+      },
+      xAxis: {
+        data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
+      },
+      yAxis: {
+        axisLine: {
+          show: true, //显示y轴最左边边框线
+        },
+      },
+      toolbox: {
+        feature: {
+          saveAsImage: {},
+        },
+      },
+      series: [
+        {
+          name: "销量",
+          type: "bar",
+          data: [550, 120, 336, 110, 430, 420],
+        },
+        {
+          name: "退货",
+          type: "bar",
+          data: [155, 20, 36, 30, 90, 140],
+        },
+      ],
+    });
+    window.addEventListener("resize", function () {
+      // 让我们的图表调用 resize这个方法
+      bar.resize();
+      line.resize();
+      pie.resize();
+    });
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.home {
+  width: 100%;
+  height: 100%;
+  .user-info {
+    display: flex;
+    align-items: center;
+    .user-img {
+      width: 150px;
+      height: 150px;
+      border-radius: 100%;
+      margin-right: 40px;
+    }
+    & li:nth-child(1) {
+      font-size: 30px;
+    }
+    & li:nth-child(2) {
+      margin-top: 10px;
+      font-size: 16px;
+      color: rgb(153, 153, 153);
+    }
+  }
+  .login-info {
+    font-size: 14px;
+    color: rgb(153, 153, 153);
+    li {
+      margin: 5px;
+      span {
+        margin-left: 50px;
+      }
+    }
+  }
+  .table {
+    margin-top: 30px;
+  }
+  .num {
+    width: 100%;
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: space-between;
+    .el-card {
+      width: 32%;
+      height: 90px;
+      margin-bottom: 20px;
+      border: none;
+      i {
+        width: 90px;
+        height: 100%;
+        line-height: 90px;
+        text-align: center;
+        font-size: 30px;
+        color: #fff;
+      }
+      ul {
+        display: flex;
+        flex-direction: column;
+        justify-content: center;
+        margin-left: 20px;
+        li:nth-child(1) {
+          font-size: 30px;
+          color: #000;
+          margin-bottom: 5px;
+        }
+        li:nth-child(2) {
+          font-size: 15px;
+          color: rgb(148, 148, 148);
+        }
+      }
+    }
+  }
+  #line {
+    width: 100%;
+    height: 280px;
+  }
+  .bar-pie {
+    width: 100%;
+    display: flex;
+    justify-content: space-between;
+
+    #pie {
+      width: 100%;
+      height: 280px;
+    }
+    #bar {
+      width: 100%;
+      height: 280px;
+    }
+  }
+}
 </style>