diff --git a/api/common/home.js b/api/common/home.js index 449a93b..d980912 100644 --- a/api/common/home.js +++ b/api/common/home.js @@ -10,5 +10,15 @@ export const HomeApi = { method: 'GET', params }) + }, + /** + * 获取列表数据 + */ + getListData: params => { + return request({ + url: '/system/home/appCount2', + method: 'GET', + params + }) } } \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index cf1430b..05e6780 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -132,16 +132,18 @@ class="tab" v-for="(item, index) in tabs" :key="index" - :style="{ '--index': queryParams.enterprise }" - @tap="queryParams.enterprise = item.type" + :style="{ + '--index': tabs.findIndex( + i => i.type == queryParams.type + ) + }" + @tap="changeTab(item.type)" > {{ item.name }} @@ -151,22 +153,22 @@ - 企业名称 + {{ item.name }} - + {{ queryParams.type == 1 ? '天' : '次' }} @@ -203,6 +205,7 @@ export default { type: 2 } ], + list: [], color: ['#1B84FF', '#7239EA', '#F6B100', '#F8285A', '#17C653'] } }, @@ -283,6 +286,14 @@ export default { return res }) this.detail.legendData = data + this.setPieData(data) + this.getList() + }, + async getList() { + const res = await HomeApi.getListData(this.queryParams) + this.list = res.data + }, + setPieData(data) { const isMax = data.reduce( (pre, cur) => pre + Number(cur.pieValue), 0 @@ -347,6 +358,10 @@ export default { querySelect(v, key) { this.queryParams[key] = v.detail this.init() + }, + changeTab(type) { + this.queryParams.type = type + this.getList() } } } diff --git a/pages/owner.vue b/pages/owner.vue index b780dce..b7ed61c 100644 --- a/pages/owner.vue +++ b/pages/owner.vue @@ -111,7 +111,10 @@ - +