魏熙美 5 年前
父节点
当前提交
c7f9db9285

+ 0
- 1
package.json 查看文件

22
     "tinymce": "^5.0.12",
22
     "tinymce": "^5.0.12",
23
     "vue": "^2.6.6",
23
     "vue": "^2.6.6",
24
     "vue-amap": "^0.5.9",
24
     "vue-amap": "^0.5.9",
25
-    "vue-echarts": "^4.0.1",
26
     "vue-router": "^3.0.2",
25
     "vue-router": "^3.0.2",
27
     "vuex": "^3.1.0",
26
     "vuex": "^3.1.0",
28
     "wangeditor": "^3.1.1"
27
     "wangeditor": "^3.1.1"

+ 49
- 0
src/components/SelectBuilding.vue 查看文件

1
+<template>
2
+  <el-select v-model="val" filterable placeholder="请选择">
3
+    <el-option
4
+      v-for="item in buildings"
5
+      :key="item.buildingId"
6
+      :label="item.buildingName"
7
+      :value="item.buildingId">
8
+    </el-option>
9
+  </el-select>
10
+</template>
11
+
12
+<script>
13
+import { mapState, mapActions } from 'vuex'
14
+
15
+export default {
16
+  name: 'SelectBuilding',
17
+  props: [ 'value' ],
18
+  data () {
19
+    return {
20
+      cacheVal: null,
21
+    }
22
+  },
23
+  computed: {
24
+    ...mapState({
25
+      buildings: s => s.buildings || [],
26
+    }),
27
+    val: {
28
+      get() {
29
+        return this.value || this.cacheVal
30
+      },
31
+      set (nw) {
32
+        this.cacheVal = nw
33
+        this.$emit('input', nw)
34
+      }
35
+    },
36
+  },
37
+  created () {
38
+    if (!this.buildings || !this.buildings.length) {
39
+      this.getBuildings()
40
+    }
41
+  },
42
+  methods: {
43
+    ...mapActions([
44
+      'getBuildings',
45
+    ]),
46
+  },
47
+}
48
+</script>
49
+

+ 0
- 88
src/components/charts/VisitingDayLine.vue 查看文件

1
-<template>
2
-  <v-chart class="x-chart" :options="options" autoresize></v-chart>
3
-</template>
4
-
5
-<script>
6
-import 'echarts/lib/chart/line'
7
-import 'echarts/lib/component/title'
8
-import 'echarts/lib/component/dataZoom'
9
-import 'echarts/lib/component/tooltip'
10
-
11
-export default {
12
-  name: 'visiting-day-line',
13
-  components: {
14
-    // vChart: () => import('vue-echarts'),
15
-  },
16
-  props: [
17
-    'source',
18
-  ],
19
-  data () {
20
-    return {
21
-      opts: {
22
-        title: { text: '日访问量' },
23
-        tooltip: {
24
-          formatter: (params, ticket, callback) => {
25
-            const { visiteDate, amount } = params.data
26
-            const tip = `${visiteDate}: ${amount}`
27
-            callback(ticket, tip)
28
-            return tip
29
-          }
30
-        },
31
-        xAxis: { type: 'category' },
32
-        yAxis: { name: '人/日' },
33
-        series: [
34
-          {
35
-            type: 'line',
36
-            smooth: true,
37
-            encode: {
38
-              x: 'visiteDate',
39
-              y: 'amount',
40
-            },
41
-          },
42
-        ],
43
-        dataZoom: [
44
-          {
45
-            type: 'inside',
46
-            show: true,
47
-            start: 0,
48
-            end: 100,
49
-          },
50
-          // {
51
-          //   type: 'slider',
52
-          //   show: true,
53
-          //   start: 0,
54
-          //   end: 100,
55
-          // }
56
-        ],
57
-        dataset: {
58
-          sourceHeader: false,
59
-          dimensions: ['visiteDate', 'amount'],
60
-        },
61
-      }
62
-    }
63
-  },
64
-  computed: {
65
-    options () {
66
-      return {
67
-        ...this.opts,
68
-        title: {
69
-          ...this.opts.title,
70
-        },
71
-        dataset: {
72
-          ...this.opts.dataset,
73
-          source: this.source || [],
74
-        }
75
-      }
76
-    }
77
-  }
78
-}
79
-</script>
80
-
81
-<style lang="scss" scoped>
82
-.x-chart {
83
-  margin: 0 auto;
84
-  width: 100%;
85
-  height: 100%;
86
-}
87
-</style>
88
-

+ 0
- 93
src/components/charts/VisitingDayTable.vue 查看文件

1
-<template>
2
-  <div>
3
-    <h3 style="margin: 0">访客记录</h3>
4
-    <el-table
5
-      :data="dataSet"
6
-      stripe
7
-      style="width: 100%">
8
-      <el-table-column
9
-        label="日期"
10
-        width="180">
11
-        <template slot-scope="scope">
12
-          <span>{{formatDate(scope.row.visiteDate)}}</span>
13
-        </template>
14
-      </el-table-column>
15
-      <el-table-column
16
-        prop="name"
17
-        label="姓名"
18
-        width="180">
19
-      </el-table-column>
20
-      <el-table-column
21
-        prop="carStyle"
22
-        label="车辆">
23
-      </el-table-column>
24
-      <el-table-column
25
-        prop="deviceName"
26
-        label="采集设备">
27
-      </el-table-column>
28
-    </el-table>
29
-    <el-pagination
30
-      small
31
-      style="margin-top:10px;"
32
-      layout="prev, pager, next"
33
-      :page-size="pageNavi.size"
34
-      :total="pageNavi.total"
35
-      :current-page="pageNavi.current"
36
-      @current-change="changePage"
37
-    >
38
-    </el-pagination>
39
-  </div>
40
-</template>
41
-
42
-<script>
43
-import dayjs from 'dayjs'
44
-
45
-export default {
46
-  name: 'visiting-day-table',
47
-  props: [
48
-    'source',
49
-    'page',
50
-  ],
51
-  data() {
52
-    return {
53
-      sampleData: [
54
-        { visiteDate: '2019-02-15 17:00', name: '张一', carStyle: '奔驰', channel: '搜房' },
55
-        { visiteDate: '2019-02-15 16:40', name: '张二', carStyle: '奔驰', channel: '搜房' },
56
-        { visiteDate: '2019-02-15 16:30', name: '张三', carStyle: '奔驰', channel: '搜房' },
57
-        { visiteDate: '2019-02-15 15:50', name: '张四', carStyle: '奔驰', channel: '搜房' },
58
-        { visiteDate: '2019-02-15 15:40', name: '张五', carStyle: '奔驰', channel: '搜房' },
59
-        { visiteDate: '2019-02-15 15:20', name: '张六', carStyle: '奔驰', channel: '搜房' },
60
-        { visiteDate: '2019-02-15 15:10', name: '张七', carStyle: '奔驰', channel: '搜房' },
61
-        { visiteDate: '2019-02-15 15:00', name: '张八', carStyle: '奔驰', channel: '搜房' },
62
-      ],
63
-      defPage: {
64
-        current: 1,
65
-        size: 10,
66
-        total: 0,
67
-      }
68
-    }
69
-  },
70
-  computed: {
71
-    pageNavi () {
72
-      return {
73
-        ...this.defPage,
74
-        ...(this.page || {})
75
-      }
76
-    },
77
-    dataSet () {
78
-      return this.source || this.sampleData
79
-    }
80
-  },
81
-  methods: {
82
-    changePage (nwPg) {
83
-      this.$emit('page-change', nwPg)
84
-    },
85
-    formatDate(dt) {
86
-      if (!dt || dt.indexOf('0001-') > -1) return ''
87
-
88
-      return dayjs(dt).format('YYYY-MM-DD HH:mm')
89
-    }
90
-  }
91
-}
92
-</script>
93
-

+ 33
- 17
src/components/charts/XLine.vue 查看文件

1
 <template>
1
 <template>
2
-   <div ref="thirdChart" ></div>
2
+  <div ref="echart" ></div>
3
 </template>
3
 </template>
4
 <script>
4
 <script>
5
 import Echarts from "echarts";
5
 import Echarts from "echarts";
6
+
6
 export default {
7
 export default {
7
   name: "XLine",
8
   name: "XLine",
8
-  props: ["value"],
9
+  props: {
10
+    value: {
11
+      type: Object,
12
+      default: () => {},
13
+    },
14
+  },
9
   data() {
15
   data() {
10
     return {
16
     return {
11
       chart: undefined,
17
       chart: undefined,
12
       defaultOpts: {
18
       defaultOpts: {
13
-        //  dataset: {
14
-        //   dimensions: ['date', 'userCount', 'authorizationCount'],
15
-        //   source,
16
-        // },
17
         title: {
19
         title: {
18
           text: "新增用户"
20
           text: "新增用户"
19
         },
21
         },
54
     };
56
     };
55
   },
57
   },
56
   watch: {
58
   watch: {
57
-    value (val) {
58
-      this.renderChart(val)
59
+    value: {
60
+      handler(val) {
61
+        this.renderChart(val)
62
+      },
63
+      immediate: true,
64
+      deep: true,
59
     },
65
     },
60
   },
66
   },
61
   mounted() {
67
   mounted() {
62
-    if (!this.chart) {
63
-      this.chart = Echarts.init(this.$refs.thirdChart);
64
-      this.renderChart(this.value)
65
-    }
68
+    this.renderChart(this.value || {})
66
   },
69
   },
67
   methods: {
70
   methods: {
71
+    initChats () {
72
+      if (!this.chart && this.$refs.echart) {
73
+        this.chart = Echarts.init(this.$refs.echart);
74
+      }
75
+
76
+      if (this.chart) {
77
+        return Promise.resolve(this.chart)
78
+      } else {
79
+        return Promise.reject()
80
+      }
81
+    },
68
     renderChart(val) {
82
     renderChart(val) {
69
-      // 绘制图表
70
-      this.chart.setOption({
71
-        ...this.defaultOpts,
72
-        ...val
73
-      });
83
+      this.initChats().then((echart) => {
84
+        // 绘制图表
85
+        echart.setOption({
86
+          ...this.defaultOpts,
87
+          ...val
88
+        });
89
+      })
74
     }
90
     }
75
   }
91
   }
76
 };
92
 };

+ 5
- 1
src/config/api.js 查看文件

340
       userResource: {
340
       userResource: {
341
           method:'get',
341
           method:'get',
342
           url: `${commPrefix}/selectUserResource`
342
           url: `${commPrefix}/selectUserResource`
343
-      }
343
+      },
344
+      newsUserCount: {
345
+          method:'get',
346
+          url: `${commPrefix}/selectNewsUserCount`
347
+      },
344
   },
348
   },
345
 }
349
 }
346
 export default apis
350
 export default apis

+ 2
- 0
src/main.js 查看文件

5
 import XMRightLay from '@/components/XMRightLay.vue'
5
 import XMRightLay from '@/components/XMRightLay.vue'
6
 import XMSearchForm from '@/components/XMSearchForm.vue'
6
 import XMSearchForm from '@/components/XMSearchForm.vue'
7
 import RichEditor from '@/components/RichEditor.vue'
7
 import RichEditor from '@/components/RichEditor.vue'
8
+import SelectBuilding from '@/components/SelectBuilding'
8
 
9
 
9
 import App from './App.vue'
10
 import App from './App.vue'
10
 import router from './router'
11
 import router from './router'
27
 Vue.component('xm-rtl', XMRightLay)
28
 Vue.component('xm-rtl', XMRightLay)
28
 Vue.component('xm-search', XMSearchForm)
29
 Vue.component('xm-search', XMSearchForm)
29
 Vue.component('rich-editor', RichEditor)
30
 Vue.component('rich-editor', RichEditor)
31
+Vue.component('select-building', SelectBuilding)
30
 Vue.use(VueAMap)
32
 Vue.use(VueAMap)
31
 
33
 
32
 VueAMap.initAMapApiLoader({
34
 VueAMap.initAMapApiLoader({

+ 20
- 1
src/store/system.js 查看文件

10
     },
10
     },
11
     menus: [],
11
     menus: [],
12
     user: {},
12
     user: {},
13
+    buildings: [],
13
   },
14
   },
14
   mutations: {
15
   mutations: {
15
     updateUser(state, user) {
16
     updateUser(state, user) {
17
         ...state.user,
18
         ...state.user,
18
         ...user,
19
         ...user,
19
       }
20
       }
21
+    },
22
+    updateBuildings(state, buildings) {
23
+      state.buildings = buildings || []
20
     }
24
     }
21
   },
25
   },
22
   actions: {
26
   actions: {
54
         localStorage.removeItem('x-token')
58
         localStorage.removeItem('x-token')
55
         commit('updateUser', {})
59
         commit('updateUser', {})
56
       })
60
       })
57
-    }
61
+    },
62
+    getBuildings ({ commit }) {
63
+      return new Promise((resolve, reject) => {
64
+        request({
65
+          ...apis.building.list,
66
+          params: { pageSize: 999 },
67
+        }).then((data) => {
68
+          commit('updateBuildings',  data.records)
69
+          resolve(data)
70
+        }).catch(({ message }) => {
71
+          if (typeof message === 'string') {
72
+            reject(message)
73
+          }
74
+        })
75
+      })
76
+    },
58
   }
77
   }
59
 }
78
 }

+ 2
- 2
src/views/carouselFigure/advertisementEdit.vue 查看文件

25
       <el-form-item label="标题:">
25
       <el-form-item label="标题:">
26
         <el-input v-model="form.title"></el-input>
26
         <el-input v-model="form.title"></el-input>
27
       </el-form-item>
27
       </el-form-item>
28
-      <el-form-item label="发布位置:">
28
+      <!-- <el-form-item label="发布位置:">
29
         <el-select v-model="form.showPosition" placeholder="请选择">
29
         <el-select v-model="form.showPosition" placeholder="请选择">
30
           <el-option v-for="(item,i) in showPositionList" :key="i" :label="item.name" :value="item.value"></el-option>
30
           <el-option v-for="(item,i) in showPositionList" :key="i" :label="item.name" :value="item.value"></el-option>
31
         </el-select>
31
         </el-select>
32
-      </el-form-item>
32
+      </el-form-item> -->
33
       <el-form-item label="类型:">
33
       <el-form-item label="类型:">
34
         <el-select v-model="form.contentType" placeholder="请选择">
34
         <el-select v-model="form.contentType" placeholder="请选择">
35
           <el-option v-for="(t,i) in contentTypeList" :key="i" :label="t.name" :value="t.value"></el-option>
35
           <el-option v-for="(t,i) in contentTypeList" :key="i" :label="t.name" :value="t.value"></el-option>

+ 9
- 2
src/views/consultant/edit.vue 查看文件

29
           </el-select>
29
           </el-select>
30
         </el-form-item>
30
         </el-form-item>
31
         <el-form-item label="图片:">
31
         <el-form-item label="图片:">
32
-          <el-upload class="avatar-uploader" :action="upFileUrl" name="file" :show-file-list="false" :before-upload="beforeImgUpload" :on-success="handleAvatarSuccess">
32
+          <el-upload class="avatar-uploader" :headers="uploadHeaders" :action="upFileUrl" name="file" :show-file-list="false" :before-upload="beforeImgUpload" :on-success="handleAvatarSuccess">
33
             <img v-if="detail.photo" :src="detail.photo" class="avatar">
33
             <img v-if="detail.photo" :src="detail.photo" class="avatar">
34
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
34
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
35
           </el-upload>
35
           </el-upload>
88
   computed: {
88
   computed: {
89
     ...mapBuildingState({
89
     ...mapBuildingState({
90
       buildings: x => x.buildings
90
       buildings: x => x.buildings
91
-    })
91
+    }),
92
+    uploadHeaders() {
93
+      const token = localStorage.getItem("x-token") || "";
94
+
95
+      return {
96
+        Authorization: `Bearer ${token}`
97
+      };
98
+    }
92
   },
99
   },
93
   methods: {
100
   methods: {
94
     ...mapBuildingActions(["getBuildings"]),
101
     ...mapBuildingActions(["getBuildings"]),

+ 2
- 2
src/views/index.js 查看文件

20
     },
20
     },
21
     children:[
21
     children:[
22
       {
22
       {
23
-        path: 'indexEcharts',
24
-        name: 'indexEcharts',
23
+        path: 'index',
24
+        name: 'index',
25
         component: () => import('./indexEcharts/index.vue'),
25
         component: () => import('./indexEcharts/index.vue'),
26
         meta: {
26
         meta: {
27
           menuShow: false,
27
           menuShow: false,

+ 1
- 1
src/views/indexEcharts/behaviorAnalysis.vue 查看文件

23
         </ul>
23
         </ul>
24
       </div>
24
       </div>
25
     </div>
25
     </div>
26
-  <p>用户行为 最近一个月 
26
+  <p>最近一周 最近一个月 
27
     <el-date-picker
27
     <el-date-picker
28
       v-model="value"
28
       v-model="value"
29
       type="daterange"
29
       type="daterange"

+ 126
- 133
src/views/indexEcharts/index.vue 查看文件

20
       </div>
20
       </div>
21
     </el-col>
21
     </el-col>
22
   </el-row>
22
   </el-row>
23
+  <select-building></select-building>
23
   <p class="title under-line" @click="toUserSource()">用户来源</p>
24
   <p class="title under-line" @click="toUserSource()">用户来源</p>
24
   <span class="title-desc under-line" @click="toUserSource()">最近7天</span>
25
   <span class="title-desc under-line" @click="toUserSource()">最近7天</span>
25
   <el-row :gutter="20" :style="{ height: '560px',margin:'20px 0',border:'1px solid #eee',borderRadius:'5px'}">
26
   <el-row :gutter="20" :style="{ height: '560px',margin:'20px 0',border:'1px solid #eee',borderRadius:'5px'}">
34
   </el-row>
35
   </el-row>
35
   <p class="title under-line" @click="toBehaviorAnalysis()">用户行为</p>
36
   <p class="title under-line" @click="toBehaviorAnalysis()">用户行为</p>
36
   <span class="title-desc under-line" @click="toBehaviorAnalysis()">最近7天</span>
37
   <span class="title-desc under-line" @click="toBehaviorAnalysis()">最近7天</span>
37
-  <div class="grid-content" ref="thirdChart"  id="thirdChart"  :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}" ></div>
38
-  <el-row :gutter="20">
38
+  <!-- <div class="grid-content" ref="thirdChart"  id="thirdChart"  :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}" ></div> -->
39
+   <x-line :style="{height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}"  :value="lineSeting"></x-line>
40
+ <el-row :gutter="20">
39
     <el-col :span="12">
41
     <el-col :span="12">
40
-      <div class="grid-content" ref="fourthChart"  id="fourthChart"  :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}" >
41
-      </div>
42
+      <div class="grid-content" ref="fourthChart"  id="fourthChart"  :style="{height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}" ></div>
42
     </el-col>
43
     </el-col>
43
     <el-col :span="12">
44
     <el-col :span="12">
44
       <div class="grid-content" ref="fifthChart"  id="fifthChart"  :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}" >
45
       <div class="grid-content" ref="fifthChart"  id="fifthChart"  :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}" >
56
   <p class="title under-line" @click="toNewUsers()">新增用户</p>
57
   <p class="title under-line" @click="toNewUsers()">新增用户</p>
57
   <span class="title-desc under-line" @click="toNewUsers()">最近7天</span>
58
   <span class="title-desc under-line" @click="toNewUsers()">最近7天</span>
58
   <el-table :data="tableData"  border  center  style="width: 100%">
59
   <el-table :data="tableData"  border  center  style="width: 100%">
59
-    <el-table-column label=date prop="name" ></el-table-column>
60
+    <el-table-column v-for="(item, index) in tableTitle" :key="index" :label="item" :prop="index == 0 ? 'label': item"></el-table-column>
60
   </el-table>
61
   </el-table>
61
   <p class="title">意向客户</p>
62
   <p class="title">意向客户</p>
62
   <el-table :data="tableData2"  border  center  style="width: 100%">
63
   <el-table :data="tableData2"  border  center  style="width: 100%">
79
 } = createNamespacedHelpers("indexEcharts");
80
 } = createNamespacedHelpers("indexEcharts");
80
 
81
 
81
 export default {
82
 export default {
82
-  components: {},
83
+  components: {
84
+    XLine: () => import('@/components/charts/XLine.vue'),
85
+  },
83
   data() {
86
   data() {
84
     return {
87
     return {
88
+      // 新增用户
85
       tableData: [
89
       tableData: [
86
-        {
87
-          date: "2016-05-02",
88
-          name: "15"
89
-        },
90
-        {
91
-          date: "2016-05-04",
92
-          name: "16"
93
-        },
94
-        {
95
-          date: "2016-05-01",
96
-          name: "17"
97
-        },
98
-        {
99
-          date: "2016-05-03",
100
-          name: "18"
101
-        }
90
+        { label: '新增用户', },
91
+        { label: '授权注册', }
102
       ],
92
       ],
103
-      tableData2: [
104
-        {
105
-          num: "98",
106
-          name: "王晓红",
107
-          phone: "15742389456",
108
-          building: "香颂.蔚澜半岛"
109
-        },
110
-        {
111
-          num: "99",
112
-          name: "王晓红2",
113
-          phone: "15742389456",
114
-          building: "香颂.蔚澜半岛"
93
+      tableTitle: [ '类型' ],
94
+      tableData2: [ ],
95
+      userBehavior: [], // 用户行为
96
+      lineSeting: {
97
+        dataset: {
98
+          dimensions: ['date', 'activity', 'activityCount'],
99
+          source: [],
115
         },
100
         },
116
-        {
117
-          num: "88",
118
-          name: "王晓红3",
119
-          phone: "15742389456",
120
-          building: "香颂.蔚澜半岛"
121
-        },
122
-        {
123
-          num: "94",
124
-          name: "王晓红4",
125
-          phone: "15742389456",
126
-          building: "香颂.蔚澜半岛"
127
-        }
128
-      ],
129
-      userBehavior: [] // 用户行为
101
+      },
130
     };
102
     };
131
   },
103
   },
132
   computed: {
104
   computed: {
138
     ...mapIndexEchartsActions(["getIndexEcharts", "setDetailNull"]),
110
     ...mapIndexEchartsActions(["getIndexEcharts", "setDetailNull"]),
139
     initPage() {
111
     initPage() {
140
       this.setDetailNull();
112
       this.setDetailNull();
141
-      this.getIndexEcharts();
113
+      this.getIndexEcharts().then(x => {
114
+        this.lineSeting.dataset.source = this.echartsInfo.selectUserBehavior
115
+        const data = this.echartsInfo.selectNewsUserCount
116
+        this.tableData = (data || []).reduce((acc, item, index) => {
117
+          const { date, userCount, authorizationCount } = item
118
+          const row2 = {
119
+            ...acc[0],
120
+            [`${date}`]: userCount,
121
+          }
122
+          const row3 = {
123
+            ...acc[1],
124
+            [`${date}`]: authorizationCount,
125
+          }
126
+
127
+          this.tableTitle = this.tableTitle.concat(`${date}`)
128
+
129
+          return [row2, row3];          
130
+        }, this.tableData)
131
+      });;
142
     },
132
     },
143
     toNewUsers() {
133
     toNewUsers() {
144
       this.$router.push({ name: "newUsers" });
134
       this.$router.push({ name: "newUsers" });
166
       };
156
       };
167
       // 绘制图表
157
       // 绘制图表
168
       firstChart.setOption({
158
       firstChart.setOption({
169
-        color: ["#ff580f", "#ffb400"],
159
+        color: ["#3688f8", "#7974ce"],
170
         backgroundColor: "#fff",
160
         backgroundColor: "#fff",
171
         tooltip: {
161
         tooltip: {
172
           trigger: "axis"
162
           trigger: "axis"
244
       let secondChart = Echarts.init(this.$refs.secondChart);
234
       let secondChart = Echarts.init(this.$refs.secondChart);
245
       // 绘制图表
235
       // 绘制图表
246
       secondChart.setOption({
236
       secondChart.setOption({
237
+        color: ["#7974ce","#f5749d","#3688f8"],
247
         tooltip: {
238
         tooltip: {
248
           trigger: "item",
239
           trigger: "item",
249
           formatter: "{a} <br/>{b} : {c} ({d}%)"
240
           formatter: "{a} <br/>{b} : {c} ({d}%)"
255
         },
246
         },
256
         series: [
247
         series: [
257
           {
248
           {
258
-            name: "访问来源",
249
+            name: "用户来源",
259
             type: "pie",
250
             type: "pie",
260
             radius: "55%",
251
             radius: "55%",
261
             center: ["50%", "60%"],
252
             center: ["50%", "60%"],
262
-            label: {
263
-              normal: {
264
-                position: "inner"
265
-              }
266
-            },
253
+            // label: {
254
+            //   normal: {
255
+            //     position: "inner"
256
+            //   }
257
+            // },
267
             data: [
258
             data: [
268
               { value: 15, name: "自主进入" },
259
               { value: 15, name: "自主进入" },
269
               { value: 30, name: "来源全民经纪人" },
260
               { value: 30, name: "来源全民经纪人" },
280
         ]
271
         ]
281
       });
272
       });
282
       // 折线图
273
       // 折线图
283
-      let thirdChart = Echarts.init(this.$refs.thirdChart);
274
+      // let thirdChart = Echarts.init(this.$refs.thirdChart);
284
       // 绘制图表
275
       // 绘制图表
285
-      thirdChart.setOption({
286
-        title: {
287
-          text: "访问人数"
288
-        },
289
-        color: ["#000", "green", "#5793f3", "#d14a61", "#241bba", "orange"],
290
-        tooltip: {
291
-          trigger: "axis"
292
-        },
293
-        legend: {
294
-          data: ["首页", "项目", "咨询", "名片", "活动", "资讯"]
295
-        },
296
-        grid: {
297
-          left: "3%",
298
-          right: "4%",
299
-          bottom: "3%",
300
-          containLabel: true
301
-        },
302
-        toolbox: {},
303
-        xAxis: {
304
-          type: "category",
305
-          boundaryGap: false,
306
-          data: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
307
-        },
308
-        yAxis: {
309
-          type: "value"
310
-        },
311
-        series: [
312
-          {
313
-            name: "首页",
314
-            type: "line",
315
-            stack: "1",
316
-            data: []
317
-          },
318
-          {
319
-            name: "项目",
320
-            type: "line",
321
-            stack: "2",
322
-            data: [220, 182, 191, 234, 290, 330, 310]
323
-          },
324
-          {
325
-            name: "咨询",
326
-            type: "line",
327
-            stack: "3",
328
-            data: [150, 232, 201, 154, 190, 330, 410]
329
-          },
330
-          {
331
-            name: "名片",
332
-            type: "line",
333
-            stack: "4",
334
-            data: [320, 332, 301, 334, 390, 330, 320]
335
-          },
336
-          {
337
-            name: "活动",
338
-            type: "line",
339
-            stack: "5",
340
-            data: [820, 932, 901, 544, 1290, 1330, 1320]
341
-          },
342
-          {
343
-            name: "资讯",
344
-            type: "line",
345
-            stack: "6",
346
-            data: [400, 500, 201, 934, 1290, 1423, 777]
347
-          }
348
-        ]
349
-      });
276
+      // thirdChart.setOption({
277
+      //   title: {
278
+      //     text: "访问人数"
279
+      //   },
280
+      //   color: ["#ed3a3d", "#e613d2", "#2ed9f7", "#0ab662", "#165cf8", "#8854b9"],
281
+      //   tooltip: {
282
+      //     trigger: "axis"
283
+      //   },
284
+      //   legend: {
285
+      //     data: ["首页", "项目", "咨询", "名片", "活动", "资讯"]
286
+      //   },
287
+      //   grid: {
288
+      //     left: "3%",
289
+      //     right: "4%",
290
+      //     bottom: "3%",
291
+      //     containLabel: true
292
+      //   },
293
+      //   toolbox: {},
294
+      //   xAxis: {
295
+      //     type: "category",
296
+      //     boundaryGap: false,
297
+      //     data: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
298
+      //   },
299
+      //   yAxis: {
300
+      //     type: "value"
301
+      //   },
302
+      //   series: [
303
+      //     {
304
+      //       name: "首页",
305
+      //       type: "line",
306
+      //       stack: "1",
307
+      //       data: []
308
+      //     },
309
+      //     {
310
+      //       name: "项目",
311
+      //       type: "line",
312
+      //       stack: "2",
313
+      //       data: [220, 182, 191, 234, 290, 330, 310]
314
+      //     },
315
+      //     {
316
+      //       name: "咨询",
317
+      //       type: "line",
318
+      //       stack: "3",
319
+      //       data: [150, 232, 201, 154, 190, 330, 410]
320
+      //     },
321
+      //     {
322
+      //       name: "名片",
323
+      //       type: "line",
324
+      //       stack: "4",
325
+      //       data: [320, 332, 301, 334, 390, 330, 320]
326
+      //     },
327
+      //     {
328
+      //       name: "活动",
329
+      //       type: "line",
330
+      //       stack: "5",
331
+      //       data: [820, 932, 901, 544, 1290, 1330, 1320]
332
+      //     },
333
+      //     {
334
+      //       name: "资讯",
335
+      //       type: "line",
336
+      //       stack: "6",
337
+      //       data: [400, 500, 201, 934, 1290, 1423, 777]
338
+      //     }
339
+      //   ]
340
+      // });
350
       // 柱状图
341
       // 柱状图
351
       let fourthChart = Echarts.init(this.$refs.fourthChart);
342
       let fourthChart = Echarts.init(this.$refs.fourthChart);
352
       // 绘制图表
343
       // 绘制图表
366
         title: {
357
         title: {
367
           text: "活跃用户数"
358
           text: "活跃用户数"
368
         },
359
         },
369
-        color: ["#3398DB"],
360
+        color: ["#7571cf"],
370
         tooltip: {
361
         tooltip: {
371
           trigger: "axis",
362
           trigger: "axis",
372
           axisPointer: {
363
           axisPointer: {
410
         title: {
401
         title: {
411
           text: "转化率"
402
           text: "转化率"
412
         },
403
         },
404
+        color:["#6a96f7","#f5749d"],
413
         tooltip: {
405
         tooltip: {
414
           trigger: "item",
406
           trigger: "item",
415
           formatter: "{a} <br/>{b}: {c} ({d}%)"
407
           formatter: "{a} <br/>{b}: {c} ({d}%)"
421
         },
413
         },
422
         series: [
414
         series: [
423
           {
415
           {
424
-            name: "访问来源",
416
+            name: "转化率",
425
             type: "pie",
417
             type: "pie",
426
-            radius: ["50%", "70%"],
418
+            radius: ["40%", "56%"],
427
             avoidLabelOverlap: false,
419
             avoidLabelOverlap: false,
428
             label: {
420
             label: {
429
               normal: {
421
               normal: {
452
         title: {
444
         title: {
453
           text: "性别比例"
445
           text: "性别比例"
454
         },
446
         },
447
+        color:["#6a96f7","#f5749d"],
455
         tooltip: {
448
         tooltip: {
456
           trigger: "item",
449
           trigger: "item",
457
           formatter: "{a} <br/>{b}: {c} ({d}%)"
450
           formatter: "{a} <br/>{b}: {c} ({d}%)"
463
         },
456
         },
464
         series: [
457
         series: [
465
           {
458
           {
466
-            name: "访问来源",
459
+            name: "性别比例",
467
             type: "pie",
460
             type: "pie",
468
-            radius: ["50%", "70%"],
461
+            radius: ["40%", "56%"],
469
             avoidLabelOverlap: false,
462
             avoidLabelOverlap: false,
470
             label: {
463
             label: {
471
               normal: {
464
               normal: {
507
         },
500
         },
508
         series: [
501
         series: [
509
           {
502
           {
510
-            name: "访问来源",
503
+            name: "城市分布",
511
             type: "pie",
504
             type: "pie",
512
             radius: "55%",
505
             radius: "55%",
513
             center: ["50%", "60%"],
506
             center: ["50%", "60%"],
514
-            label: {
515
-              normal: {
516
-                position: "inner"
517
-              }
518
-            },
507
+            // label: {
508
+            //   normal: {
509
+            //     position: "inner"
510
+            //   }
511
+            // },
519
             data: [
512
             data: [
520
               { value: 21, name: "合肥" },
513
               { value: 21, name: "合肥" },
521
               { value: 90, name: "南京" },
514
               { value: 90, name: "南京" },

+ 25
- 33
src/views/indexEcharts/newUsers.vue 查看文件

1
 <template>
1
 <template>
2
 <div>
2
 <div>
3
-
4
-  <p class="title">用户行为 最近一个月 
3
+  <p class="title"><span @click="choose(list.id)" :class="active==list.id?'active':''" v-for="(list,index) in dateList" :key="index" >{{list.date}}</span>  
5
     <el-date-picker
4
     <el-date-picker
6
       v-model="value"
5
       v-model="value"
7
       type="daterange"
6
       type="daterange"
8
       start-placeholder="开始日期"
7
       start-placeholder="开始日期"
9
       end-placeholder="结束日期"
8
       end-placeholder="结束日期"
9
+      @change="changeDate"
10
       default-value="2019-08-08">
10
       default-value="2019-08-08">
11
     </el-date-picker></p>
11
     </el-date-picker></p>
12
   <x-line :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}"  :value="lineSeting"></x-line>
12
   <x-line :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}"  :value="lineSeting"></x-line>
13
-   <el-table :data="tableData"  border  center  style="width: 100%">
13
+  <el-table :data="tableData"  border  center  style="width: 100%">
14
     <el-table-column v-for="(item, index) in tableTitle" :key="index" :label="item" :prop="index == 0 ? 'label': item"></el-table-column>
14
     <el-table-column v-for="(item, index) in tableTitle" :key="index" :label="item" :prop="index == 0 ? 'label': item"></el-table-column>
15
   </el-table>
15
   </el-table>
16
 
16
 
33
   data() {
33
   data() {
34
     return {
34
     return {
35
       value: "",
35
       value: "",
36
+      dateList:[
37
+        {date:'最近一周',id:1},
38
+        {date:'最近一个月',id:2},
39
+      ],
40
+      active:1,
36
       lineSeting: {
41
       lineSeting: {
37
         dataset: {
42
         dataset: {
38
           dimensions: ['date', 'userCount', 'authorizationCount'],
43
           dimensions: ['date', 'userCount', 'authorizationCount'],
44
         { label: '授权注册', }
49
         { label: '授权注册', }
45
       ],
50
       ],
46
       tableTitle: [ '类型' ],
51
       tableTitle: [ '类型' ],
47
-      tableData2: [
48
-        {
49
-          num: "98",
50
-          name: "王晓红",
51
-          phone: "15742389456",
52
-          building: "香颂.蔚澜半岛"
53
-        },
54
-        {
55
-          num: "99",
56
-          name: "王晓红2",
57
-          phone: "15742389456",
58
-          building: "香颂.蔚澜半岛"
59
-        },
60
-        {
61
-          num: "88",
62
-          name: "王晓红3",
63
-          phone: "15742389456",
64
-          building: "香颂.蔚澜半岛"
65
-        },
66
-        {
67
-          num: "94",
68
-          name: "王晓红4",
69
-          phone: "15742389456",
70
-          building: "香颂.蔚澜半岛"
71
-        }
72
-      ]
73
     };
52
     };
74
   },
53
   },
75
   computed: {
54
   computed: {
79
   },
58
   },
80
   methods: {
59
   methods: {
81
     ...mapIndexEchartsActions(["getNewsUserCount"]),
60
     ...mapIndexEchartsActions(["getNewsUserCount"]),
61
+    choose(id){
62
+      this.active = id;
63
+    },
64
+    changeDate(){
65
+      console.log(this.value,"value");
66
+      if(this.value!=''){
67
+        this.active = '3'
68
+      }
69
+    },
82
     initPage() {
70
     initPage() {
83
       this.getNewsUserCount().then(x => {
71
       this.getNewsUserCount().then(x => {
84
         const data = this.newsUserCount.selectNewsUserCount
72
         const data = this.newsUserCount.selectNewsUserCount
100
 
88
 
101
           return [row2, row3];          
89
           return [row2, row3];          
102
         }, this.tableData)
90
         }, this.tableData)
103
-
104
-
105
-        window.console.log(this.tableData, '-------')
106
       });
91
       });
107
     },
92
     },
108
   },
93
   },
109
   mounted() {
94
   mounted() {
110
     this.initPage();
95
     this.initPage();
111
-    // this.drawLine();
112
   
96
   
113
   }
97
   }
114
 };
98
 };
118
 p {
102
 p {
119
   margin: 0;
103
   margin: 0;
120
 }
104
 }
105
+.title{
106
+  span{
107
+    margin-right: 15px;
108
+  }
109
+  .active{
110
+    color: #044281;
111
+  }
112
+}
121
 </style>
113
 </style>
122
 
114
 
123
 
115