guhongwei 5 éve
szülő
commit
beae57eac3

+ 2 - 0
src/store/index.js

@@ -25,6 +25,7 @@ import maarkettype from '@common/store/market/markettype';
 import comment from '@common/store/live/comment';
 import tranaudit from '@common/store/market/tranaudit';
 import expertsuser from '@common/store/market/exportuser';
+import users from './user';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -55,5 +56,6 @@ export default new Vuex.Store({
     comment,
     tranaudit,
     expertsuser,
+    users,
   },
 });

+ 39 - 0
src/store/user.js

@@ -0,0 +1,39 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  interface: `/api/market/user`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit = 10, ...info } = {}) {
+    const res = await this.$axios.$get(api.interface, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.interface}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.interface}/${id}`, { ...info });
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
+    return res;
+  },
+};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 2 - 2
src/views/dynamic/parts/top-right.vue

@@ -37,9 +37,9 @@ export default {
       let rooms = await this.countRoom();
       if (this.$checkRes(res)) {
         let arr = res.data.filter(f => f.status != '3');
-        let taking = rooms.errcode == 0 ? rooms.total : 0;
         let s1 = res.data.filter(f => f.status == '1'); //达成意向
         let s2 = res.data.filter(f => f.status == '2'); //对接完成
+        let s3 = res.data.filter(f => f.status == '0'); //正在洽谈
         this.myChart = echarts.init(document.getElementById('chart'));
         const option = {
           title: { text: '交易情况', left: 'center' },
@@ -61,7 +61,7 @@ export default {
               },
               type: 'bar',
               data: [
-                { name: '正在洽谈', value: taking, itemStyle: { color: '#7cb5ec' } },
+                { name: '正在洽谈', value: s3.length, itemStyle: { color: '#7cb5ec' } },
                 { name: '达成意向', value: s1.length, itemStyle: { color: '#ffa94b' } },
                 { name: '对接完成', value: s2.length, itemStyle: { color: '#346da4' } },
               ],

+ 0 - 102
src/views/dynamic/parts/userTwo copy.vue

@@ -1,102 +0,0 @@
-<template>
-  <div id="userTwo">
-    <el-row>
-      <el-col :span="24" class="userTwo">
-        <el-col :span="12" class="left">
-          <el-col :span="24" class="one">
-            <el-image style="width:166px;height:166px;" :src="dynamic1"></el-image>
-            <p>企业注册数量</p>
-            <p>{{ detail.num1 }}</p>
-          </el-col>
-          <el-col :span="24" class="one two">
-            <el-image style="width:166px;height:166px;" :src="dynamic2"></el-image>
-            <p>个人注册数量</p>
-            <p>{{ detail.num2 }}</p>
-          </el-col>
-        </el-col>
-        <el-col :span="12" class="left right">
-          <el-col :span="24" class="one">
-            <el-image style="width:166px;height:166px;" :src="dynamic3"></el-image>
-            <p>在线人数</p>
-            <p>{{ detail.num3 }}</p>
-          </el-col>
-          <el-col :span="24" class="one two">
-            <el-image style="width:166px;height:166px;" :src="dynamic4"></el-image>
-            <p>企业项目数量</p>
-            <p>{{ detail.num4 }}</p>
-          </el-col>
-        </el-col>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'userTwo',
-  props: {},
-  components: {},
-  data: () => ({
-    dynamic1: require('@/assets/dynamic1.png'),
-    dynamic2: require('@/assets/dynamic2.png'),
-    dynamic3: require('@/assets/dynamic3.png'),
-    dynamic4: require('@/assets/dynamic4.png'),
-    detail: {
-      num1: 1,
-      num2: 2,
-      num3: 3,
-      num4: 4,
-    },
-  }),
-  created() {},
-  computed: {},
-  methods: {},
-};
-</script>
-
-<style lang="less" scoped>
-.userTwo {
-  float: left;
-  width: 100%;
-}
-.userTwo .left {
-  width: 50%;
-}
-.userTwo .left .one {
-  float: left;
-  width: 212px;
-  height: 212px;
-  overflow: hidden;
-  border-radius: 10px;
-  box-shadow: 0 0 5px #ccc;
-  text-align: center;
-  padding: 20px 0;
-  position: relative;
-  margin: 40px 0 0 15px;
-}
-
-.userTwo .left .one p:nth-child(2) {
-  position: absolute;
-  top: 80px;
-  font-size: 14px;
-  color: #346da4;
-  font-weight: bold;
-  left: 60px;
-  text-align: center;
-  width: 86px;
-}
-.userTwo .left .one p:nth-child(3) {
-  position: absolute;
-  top: 110px;
-  left: 60px;
-  font-size: 14px;
-  color: #346da4;
-  font-weight: bold;
-  text-align: center;
-  width: 86px;
-}
-.userTwo .right {
-  width: 50%;
-  margin: 110px 0 0 0;
-}
-</style>

+ 35 - 5
src/views/dynamic/parts/userTwo.vue

@@ -22,13 +22,13 @@
         <el-col :span="12" class="right">
           <el-col class="box" :span="20" style="margin:50px 10px 10px 15px;">
             <el-col :span="24" class="three one">
-              <p>在线人数</p>
+              <p>专家注册数量</p>
               <p>{{ detail.num3 }}</p>
             </el-col>
           </el-col>
           <el-col class="box" :span="20">
             <el-col :span="24" class="four one">
-              <p>企业项目数量</p>
+              <p>发布需求数量</p>
               <p>{{ detail.num4 }}</p>
             </el-col>
           </el-col>
@@ -39,6 +39,10 @@
 </template>
 
 <script>
+import { mapState, mapActions, createNamespacedHelpers } from 'vuex';
+const { mapActions: users } = createNamespacedHelpers('users');
+const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
+const { mapActions: marketproduct } = createNamespacedHelpers('marketproduct');
 export default {
   name: 'userTwo',
   props: {},
@@ -55,9 +59,35 @@ export default {
       num4: 4,
     },
   }),
-  created() {},
-  computed: {},
-  methods: {},
+  created() {
+    this.searchInfo();
+  },
+  methods: {
+    ...users({ userQuery: 'query' }),
+    ...expertsuser({ expertsuserQurty: 'query' }),
+    ...marketproduct({ marketproductQuery: 'query' }),
+    async searchInfo({} = {}) {
+      // 个人,企业
+      let res = await this.userQuery();
+      let s1 = res.data.filter(f => f.role == '2');
+      let s2 = res.data.filter(f => f.role == '3');
+      // 专家
+      let exportNum = await this.expertsuserQurty();
+      // 发布需求
+      let productNum = await this.marketproductQuery();
+      let listData = { num1: s1.length, num2: s2.length, num3: exportNum.data.length, num4: productNum.data.length };
+      this.$set(this, `detail`, listData);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
 };
 </script>