瀏覽代碼

数据资源目录前台首页接口联调

chaihaorui 1 年之前
父節點
當前提交
b57e106c40
共有 3 個文件被更改,包括 122 次插入64 次删除
  1. 18 22
      src/api/homepage/homepage.js
  2. 64 21
      src/pages/homepage/components/cardWrap.vue
  3. 40 21
      src/pages/homepage/components/searchPage.vue

+ 18 - 22
src/api/homepage/homepage.js

@@ -1,28 +1,32 @@
1
-// 文章
1
+// 前台首页
2 2
 import axios from "@/util/ajax";
3 3
 
4 4
 export default {
5 5
     // 获取最新资讯
6
-    getLatestInfo() {
7
-        return axios.post('/xyjc/index-content/latest-info');
6
+    // getLatestInfo() {
7
+    //     return axios.post('/xyjc/index-content/latest-info');
8
+    // },
9
+    // 获取资源数据
10
+    resourceData(params) {
11
+        return axios.get('/resourceDirectory/homeStatisticalTotal', { params });
8 12
     },
9
-    // 获取栏目列表
10
-    getSectionList(params) {
11
-        return axios.get('/xyjc/index-category/list', { params });
13
+    // 获取我的收藏总量数据
14
+    collectTotal(params) {
15
+        return axios.get('/resourceDirectory/collectTotal', { params });
12 16
     },
13
-    // 获取文章列表
14
-    getArticleList(params, page, limit) {
15
-        return axios.post(`/xyjc/index-content/query/${page}/${limit}`, params)
17
+    // 获取主题、专题、指标资产数据
18
+    themeSpecialIndex(params) {
19
+        return axios.get('/resourceDirectory/assetNumStatistics', { params });
16 20
     },
21
+    // 获取api排行数据
22
+    apiRank(params) {
23
+        return axios.get('/resourceDirectory/serviceCallNum', { params });
24
+    },
25
+
17 26
     // 获取用户名
18 27
     getUserName() {
19 28
         return axios.get('/xyjc/cas/getUserName')
20 29
     },
21
-
22
-    // 保存用户名
23
-    saveUser(params) {
24
-        return axios.post('/xyjc/cas/addUser',params)
25
-    },
26 30
     // 获取用户头像
27 31
     getUserAvatar(id) {
28 32
         return axios.get(`/xyjc/cas/getUserAvatar/${id}`)
@@ -30,13 +34,5 @@ export default {
30 34
     // 用户登出
31 35
     logout() {
32 36
         return axios.get('/xyjc/cas/system/logout')
33
-    },
34
-    // 轮播图
35
-    getCarousel() {
36
-        return axios.post('/xyjc/index-content/carousel')
37
-    },
38
-    // 分层查询组织树结构
39
-    queryOrgByParentId(params) {
40
-        return axios.get('/xyjc/index-dept/queryByDepth', { params })
41 37
     }
42 38
 }

+ 64 - 21
src/pages/homepage/components/cardWrap.vue

@@ -30,7 +30,7 @@
30 30
                 <img style="width: 50px; height: 50px;" src="../../../assets/collect.png"/>
31 31
               </div>
32 32
               <div style="width: 74%; line-height: 50px;">
33
-                <p class="sub-title"><span/>收藏总量<span style="margin-left: 5px;" :class="`font-collect`">1553</span></p>
33
+                <p class="sub-title"><span/>收藏总量<span style="margin-left: 5px;" :class="`font-collect`">{{ collectTotal }}</span></p>
34 34
               </div>
35 35
             </div>
36 36
           </div>
@@ -56,10 +56,10 @@
56 56
             :bottom="90"
57 57
             :xlabelFormat="xLabelFormat"
58 58
             :top="60"
59
-            :yAxisName="['(张)', '(兆)']"
59
+            :yAxisName="['(张)']"
60 60
             :tooltip="tooltipFormat"
61 61
             :dataset="barData"
62
-            :encode="[{x: 'qyjc', y: 'hs', seriesName: '数据量'}, {x: 'qyjc', y: 'hs1', seriesName: '数据表'}]"
62
+            :encode="[{x: 'name', y: 'num', seriesName: '数据表'}]"
63 63
             :labelSize="15"
64 64
             id="dqfb"
65 65
           />
@@ -75,10 +75,10 @@
75 75
             :bottom="90"
76 76
             :xlabelFormat="xLabelFormat"
77 77
             :top="60"
78
-            :yAxisName="['(张)', '(兆)']"
78
+            :yAxisName="['(张)']"
79 79
             :tooltip="tooltipFormat"
80 80
             :dataset="specialAssetsData"
81
-            :encode="[{x: 'qyjc', y: 'hs', seriesName: '数据量'}, {x: 'qyjc', y: 'hs1', seriesName: '数据表'}]"
81
+            :encode="[{x: 'name', y: 'num', seriesName: '数据表'}]"
82 82
             :labelSize="15"
83 83
             id="ztzc"
84 84
           />
@@ -94,10 +94,10 @@
94 94
             :bottom="90"
95 95
             :xlabelFormat="xLabelFormat"
96 96
             :top="60"
97
-            :yAxisName="['(个)', '(兆)']"
97
+            :yAxisName="['(个)']"
98 98
             :tooltip="tooltipFormat"
99 99
             :dataset="indicatorStatData"
100
-            :encode="[{x: 'qyjc', y: 'hs', seriesName: '数据量'}, {x: 'qyjc', y: 'hs1', seriesName: '数据表'}]"
100
+            :encode="[{x: 'name', y: 'num', seriesName: '数据表'}]"
101 101
             :labelSize="15"
102 102
             id="bmzb"
103 103
           />
@@ -108,7 +108,7 @@
108 108
         <div class="chart rank-chart">
109 109
           <el-button-group>
110 110
             <el-button :type="rankType === 'API' ? 'primary' : ''" @click="rankType = 'API'" size="small">API</el-button>
111
-            <el-button :type="rankType === 'MQ' ? 'primary' : ''" @click="rankType = 'MQ'" size="small">MQ</el-button>
111
+            <!-- <el-button :type="rankType === 'MQ' ? 'primary' : ''" @click="rankType = 'MQ'" size="small">MQ</el-button> -->
112 112
           </el-button-group>
113 113
           <div class="rank-block">
114 114
             <div class="rank-item clearfix" v-for="(item, index) in rankData" :key="index">
@@ -119,7 +119,7 @@
119 119
                   <div class="name">{{item.name}}</div>
120 120
                   <div class="unit" v-if="index === 0">次</div>
121 121
                 </div>
122
-                <el-progress :percentage="item.percent"
122
+                <el-progress :percentage="item.percent || item.num"
123 123
                 :class="`progress progress${index}`"
124 124
                 :format="(per) => format(per, item.num)"
125 125
                 define-back-color="#5c6779"></el-progress>
@@ -134,6 +134,7 @@
134 134
 <script>
135 135
 
136 136
 import barchart from "@/components/barChart";
137
+import api from "@/api/homepage/homepage.js";
137 138
 
138 139
 export default {
139 140
     components: {
@@ -163,22 +164,19 @@ export default {
163 164
             history: 1553,
164 165
             pageType: 'service'
165 166
           }],
166
-          barData: [{qyjc: '2023-01', hs: 100, hs1: 200}, {qyjc: '2023-02', hs: 10, hs1: 20}, {qyjc: '2023-03', hs: 10, hs1: 20}, {qyjc: '2023-04', hs: 10, hs1: 20}, {qyjc: '2023-05', hs: 10, hs1: 20},],
167
-          specialAssetsData: [{qyjc: '专题1', hs: 100, hs1: 200}, {qyjc: '2023-02', hs: 10, hs1: 20}, {qyjc: '2023-03', hs: 10, hs1: 20}, {qyjc: '2023-04', hs: 10, hs1: 20}, {qyjc: '2023-05', hs: 10, hs1: 20},],
168
-          indicatorStatData: [{qyjc: '部门1', hs: 100, hs1: 200}, {qyjc: '2023-02', hs: 10, hs1: 20}, {qyjc: '2023-03', hs: 10, hs1: 20}, {qyjc: '2023-04', hs: 10, hs1: 20}, {qyjc: '2023-05', hs: 10, hs1: 20},],
167
+          barData: [],
168
+          specialAssetsData: [],
169
+          indicatorStatData: [],
169 170
           rankType: 'API',
170
-          rankData: [{ percent: 75, num: 160, name: 'xxxApi' },
171
-          { percent: 72, num: 120, name: 'xxxApi' },
172
-          { percent: 70, num: 100, name: 'xxxApi' },
173
-          { percent: 65, num: 80, name: 'xxxApi' },
174
-          { percent: 55, num: 70, name: 'xxxApi' },
175
-          { percent: 50, num: 60, name: 'xxxApi' },
176
-          { percent: 45, num: 50, name: 'xxxApi' },
177
-          { percent: 35, num: 40, name: 'xxxApi' },
178
-          { percent: 25, num: 30, name: 'xxxApi' },]
171
+          rankData: [],
172
+          collectTotal: 0
179 173
         }
180 174
     },
181 175
     mounted() {
176
+      this.getResourceData()
177
+      this.getCollectTotal()
178
+      this.getThemeSpecialIndex()
179
+      this.getApiRankData()
182 180
     },
183 181
     watch: {
184 182
 
@@ -209,6 +207,51 @@ export default {
209 207
       },
210 208
       format(percentage, num) {
211 209
         return num
210
+      },
211
+      getResourceData() {
212
+        api.resourceData().then(res => {
213
+          if (res.success) {
214
+            this.menus[0].new = res.data.themeAdd
215
+            this.menus[0].history = res.data.themeTotal
216
+            this.menus[1].new = res.data.specialSubjectAdd
217
+            this.menus[1].history = res.data.specialSubjectTotal
218
+            this.menus[2].new = res.data.indexAdd
219
+            this.menus[2].history = res.data.indexTotal
220
+            this.menus[3].new = res.data.serviceAdd
221
+            this.menus[3].history = res.data.serviceTotal
222
+          }
223
+        })
224
+      },
225
+      getCollectTotal() {
226
+        api.collectTotal().then(res => {
227
+          if (res.success) {
228
+            this.collectTotal = res.data
229
+          }
230
+        })
231
+      },
232
+      getThemeSpecialIndex() {
233
+        api.themeSpecialIndex({resourceType: 'theme'}).then(res => {
234
+          if (res.success) {
235
+            this.barData = res.data
236
+          }
237
+        })
238
+        api.themeSpecialIndex({resourceType: 'specialSubject'}).then(res => {
239
+          if (res.success) {
240
+            this.specialAssetsData = res.data
241
+          }
242
+        })
243
+        api.themeSpecialIndex({resourceType: 'index'}).then(res => {
244
+          if (res.success) {
245
+            this.indicatorStatData = res.data
246
+          }
247
+        })
248
+      },
249
+      getApiRankData() {
250
+        api.apiRank().then(res => {
251
+          if (res.success) {
252
+            this.rankData = res.data
253
+          }
254
+        })
212 255
       }
213 256
     }
214 257
 }

+ 40 - 21
src/pages/homepage/components/searchPage.vue

@@ -9,7 +9,7 @@
9 9
       </el-input>
10 10
     </div>
11 11
     <el-tabs class="bottom-card" v-model="activeName" @tab-click="handleClick">
12
-      <el-tab-pane :key="item.id" v-for="item in tabList" :label="item.name" :name="item.id">
12
+      <el-tab-pane :key="item.id" v-for="item in initTabList()" :label="item.name" :name="item.id">
13 13
         <div class="flex">
14 14
           <div class="tree-wrap">
15 15
             <el-button-group v-if="activeName === 'fourth'">
@@ -32,7 +32,7 @@
32 32
                   实体名称:{{item.logicTbName}}
33 33
                 </p>
34 34
                 <div class="right">
35
-                  <img src="../../../assets/image/u9765.svg" alt="">
35
+                  <img v-if="item.isCollect" src="../../../assets/image/u9765.svg" alt="">
36 36
                 </div>
37 37
               </div>
38 38
               <el-row v-if="activeName === 'first' || activeName === 'second'" style="color: rgb(91,91,91);line-height: 40px;">
@@ -133,25 +133,6 @@ export default {
133 133
     return {
134 134
       activeName: 'first',
135 135
       searchWords: this.$route.query.searchword || '',
136
-      tabList: [
137
-        {
138
-          name: '主题库',
139
-          id: 'first',
140
-          num: 0
141
-        },
142
-        {
143
-          name: '专题库',
144
-          id: 'second',
145
-          num: 0},
146
-        {
147
-          name: '指标',
148
-          id: 'third',
149
-          num: 0},
150
-        {
151
-          name: '服务',
152
-          id: 'fourth',
153
-          num: 0}
154
-      ],
155 136
       data: [{
156 137
         label: '一级 1',
157 138
         children: [{
@@ -327,6 +308,44 @@ export default {
327 308
     },
328 309
     handleUp() {
329 310
       console.log('up')
311
+    },
312
+    initTabList() {
313
+      let tabList = [
314
+        {
315
+          name: '主题库',
316
+          id: 'first',
317
+          num: 0
318
+        },
319
+        {
320
+          name: '专题库',
321
+          id: 'second',
322
+          num: 0},
323
+        {
324
+          name: '指标',
325
+          id: 'third',
326
+          num: 0},
327
+        {
328
+          name: '服务',
329
+          id: 'fourth',
330
+          num: 0}
331
+      ]
332
+      if (this.$route.query.pageType === 'theme') {
333
+        tabList = [{ name: '主题库', id: 'first', num: 0 }]
334
+        this.activeName = 'first'
335
+      }
336
+      if (this.$route.query.pageType === 'topic') {
337
+        tabList = [{ name: '专题库',id: 'second',num: 0 }]
338
+        this.activeName = 'second'
339
+      }
340
+      if (this.$route.query.pageType === 'index') {
341
+        tabList = [{ name: '指标',id: 'third',num: 0 }]
342
+        this.activeName = 'third'
343
+      }
344
+      if (this.$route.query.pageType === 'service') {
345
+        tabList = [{ name: '服务',id: 'fourth',num: 0 }]
346
+        this.activeName = 'fourth'
347
+      }
348
+      return tabList
330 349
     }
331 350
   }
332 351
 };