wuhongyu 5 年之前
父節點
當前提交
0c09ca30c3
共有 5 個文件被更改,包括 100 次插入102 次删除
  1. 1 0
      package.json
  2. 1 1
      src/layout/common/top.vue
  3. 0 98
      src/layout/index/dynamic.vue
  4. 95 0
      src/layout/index/top-right.vue
  5. 3 3
      src/views/index.vue

+ 1 - 0
package.json

@@ -10,6 +10,7 @@
   "dependencies": {
     "axios": "^0.19.2",
     "core-js": "^3.6.4",
+    "echarts": "^4.8.0",
     "element-ui": "^2.13.2",
     "jsonwebtoken": "^8.5.1",
     "lodash": "^4.17.15",

+ 1 - 1
src/layout/common/top.vue

@@ -6,7 +6,7 @@
           <span class="date">{{ data }}</span>
         </el-col>
         <el-col :span="12" class="login">
-          <span v-if="user == null">
+          <span v-if="user.type == null">
             <el-button size="mini" @click="$router.push({ path: '/login' })">登录</el-button>
             <el-button size="mini" @click="$router.push({ path: '/register' })">注册</el-button>
           </span>

+ 0 - 98
src/layout/index/dynamic.vue

@@ -1,98 +0,0 @@
-<template>
-  <div id="dynamic">
-    <el-col :span="24" class="maintoplefttitle"> </el-col>
-    <el-col :span="24">
-      <el-col :span="12" class="leftcontext">
-        统计图
-      </el-col>
-    </el-col>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'dynamic',
-  props: {},
-  components: {},
-  data: () => ({}),
-  created() {},
-  computed: {},
-  methods: {},
-};
-</script>
-
-<style lang="less" scoped>
-.main .maintopleft .maintoplefttitle {
-  padding: 20px;
-  // border-bottom: 1px dashed #ccc;
-}
-.main .maintopleft .maintoplefttitle span:first-child {
-  font-weight: 1000;
-  padding: 10px 5px 0 0px;
-  font-size: 20px;
-  color: #005293;
-}
-
-.main .maintopleft .maintoplefttitle span:nth-child(2) {
-  font-size: 20px;
-  color: #005293;
-  padding: 0 10px 0 0;
-}
-.main .maintopleft .maintoplefttitle span:nth-child(3) {
-  font-size: 20px;
-  color: #005293;
-  float: right;
-}
-
-.maintopleft .leftcontext {
-  padding: 0 20px 0 20px;
-  font-size: 16px;
-}
-
-.maintopright {
-  height: 300px;
-  background-color: #fff;
-  width: 595px;
-}
-
-.maintopright .leftcontext {
-  padding: 0 20px 0 20px;
-}
-
-.main .maintopright .maintoplefttitle {
-  padding: 20px;
-  // border-bottom: 1px dashed #ccc;
-}
-.main .maintopright .maintoplefttitle span:first-child {
-  font-weight: 1000;
-  padding: 10px 5px 0 0px;
-  font-size: 20px;
-  color: #005293;
-}
-
-.main .maintopright .maintoplefttitle span:nth-child(2) {
-  font-size: 20px;
-  color: #005293;
-  padding: 0 10px 0 0;
-}
-.main .maintopright .maintoplefttitle span:nth-child(3) {
-  font-size: 20px;
-  color: #005293;
-  float: right;
-}
-
-.maintopright .leftcontext {
-  padding: 0 20px 0 20px;
-  font-size: 16px;
-}
-
-.maintopright .leftcontext p {
-  margin: 0;
-  padding: 0;
-}
-
-.maintopright .leftcontext p span:first-child {
-  font-weight: 1000;
-  padding: 5px;
-}
-</style>

+ 95 - 0
src/layout/index/top-right.vue

@@ -0,0 +1,95 @@
+<template>
+  <div id="top-right">
+    <div id="chart" class="" style="height:450px;margin:40px 0 0 0"></div>
+  </div>
+</template>
+
+<script>
+import echarts from 'echarts/lib/echarts';
+import 'echarts/lib/chart/bar';
+import 'echarts/lib/chart/pie';
+import 'echarts/lib/chart/line';
+import 'echarts/lib/component/title';
+import 'echarts/lib/component/legend';
+import 'echarts/lib/component/toolbox';
+import 'echarts/lib/component/markPoint';
+import 'echarts/lib/component/tooltip';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('news');
+// const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
+export default {
+  name: 'top-right',
+  props: {},
+  components: {},
+  data: () => {
+    return {
+      myChart: null,
+    };
+  },
+  created() {
+    this.init();
+  },
+  methods: {
+    ...mapActions(['query']),
+    // ...personalRoom(['countRoom']),
+    async init() {
+      let res = await this.query();
+      console.log(res.data);
+
+      // let rooms = await this.countRoom();
+      if (this.$checkRes(res)) {
+        let arr = res.data.filter(f => f.status != '3');
+        console.log(arr);
+
+        let s1 = res.data.filter(f => f.status == '1'); //达成意向
+        console.log(s1);
+        let s2 = res.data.filter(f => f.status == '2'); //对接完成
+        console.log(s2);
+
+        let s3 = res.data.filter(f => f.status == '0'); //正在洽谈
+        this.myChart = echarts.init(document.getElementById('chart'));
+        const option = {
+          title: { text: '交易情况', left: 'center' },
+          tooltip: { trigger: 'axis' },
+          legend: {
+            data: ['正在洽谈', '达成意向', '对接完成'],
+          },
+          xAxis: {
+            type: 'category',
+            data: ['正在洽谈', '达成意向', '对接完成'],
+          },
+          yAxis: {},
+          series: [
+            {
+              name: '交易情况',
+              label: {
+                show: true,
+                position: 'top',
+              },
+              type: 'bar',
+              data: [
+                { name: '正在洽谈', value: s3.length, itemStyle: { color: '#7cb5ec' } },
+                { name: '达成意向', value: s1.length, itemStyle: { color: '#ffa94b' } },
+                { name: '对接完成', value: s2.length, itemStyle: { color: '#346da4' } },
+              ],
+              animationType: 'scale',
+            },
+          ],
+        };
+        this.myChart.setOption(option);
+      }
+    },
+  },
+  computed: {
+    ...mapState(['top-right']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 3 - 3
src/views/index.vue

@@ -12,7 +12,7 @@
       <el-col :span="24" class="main">
         <div class="w_1200">
           <el-col :span="12" class="maintopleft">
-            <dynamic></dynamic>
+            <top-right></top-right>
           </el-col>
           <el-col :span="12" class="maintopright">
             <jobs :jobsList="jobsList"></jobs>
@@ -45,7 +45,7 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: news } = createNamespacedHelpers('news');
 import top from '@/layout/common/top.vue';
 import menus from '@/layout/common/menus.vue';
-import dynamic from '@/layout/index/dynamic.vue';
+import topRight from '@/layout/index/top-right.vue';
 import jobs from '@/layout/index/jobs.vue';
 import notice from '@/layout/index/notice.vue';
 import service from '@/layout/index/service.vue';
@@ -58,7 +58,7 @@ export default {
   components: {
     top,
     menus,
-    dynamic,
+    topRight,
     jobs,
     notice,
     service,