From 32e361efef0293dd5ec8d9f10052785a2a01c6c5 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Tue, 15 Sep 2020 13:53:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=8A=A0=E9=80=9A=E7=94=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=8E=A5=E5=8F=A3=EF=BC=8C=E9=A6=96=E9=A1=B5=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E8=B7=B3=E8=BD=AC=E5=88=B0=E8=A1=97=E9=81=93=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/basicReality.ts | 4 ++-- src/api/index.ts | 14 ++++++++++++ src/pages/index/index.scss | 2 ++ src/pages/index/index.ts | 22 +++++++++++++++---- .../components/selectStreet/selectStreet.ts | 14 +++++++----- .../enterSituation/enterSituation.ts | 8 +++---- 6 files changed, 49 insertions(+), 15 deletions(-) diff --git a/src/api/basicReality.ts b/src/api/basicReality.ts index bb50e47..514604f 100644 --- a/src/api/basicReality.ts +++ b/src/api/basicReality.ts @@ -191,12 +191,12 @@ export function getAllDynamicStatistics ({ someMonthsType, analysisType }: getAl * @param {string} someMonthsType 数据时间类型(1:最近1个月,2:最近3个月,3:最近半年,4:最近一年) * @param {string} analysisType 分析类型:1.平台,2.声音,3.议事,4.社群 */ -export function getDynamicPercentAnalysis ({ DeptId, someMonthsType, analysisType }: getDynamicPercentAnalysisApiOption) { +export function getDynamicPercentAnalysis ({ deptId, someMonthsType, analysisType }: getDynamicPercentAnalysisApiOption) { return request({ url: 'cloudAnalysis/dynamic/getDynamicPercentAnalysis', method: 'GET', options: { - DeptId, + deptId, someMonthsType, analysisType } diff --git a/src/api/index.ts b/src/api/index.ts index 518aa49..661cfe6 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -130,3 +130,17 @@ export function getIndexPanelV2() { url: 'cloudAnalysis/home/v2/getIndexPanel', }) } + +/** + * 获取小程序默认配置接口 + * 通用接口 + */ +export function getResidentConfig({ residentType }: {residentType : string}) { + return request({ + method: 'GET', + url:'api/work/residentConfig/swagger/getResidentConfig', + options:{ + residentType + } + }) +} \ No newline at end of file diff --git a/src/pages/index/index.scss b/src/pages/index/index.scss index 833acda..24b6b6b 100644 --- a/src/pages/index/index.scss +++ b/src/pages/index/index.scss @@ -314,10 +314,12 @@ swiper { display: flex; align-items: center; margin-top: 272rpx; + width: 100%; .count-text-item{ width: 12rpx; height: 12rpx; border-radius: 50%; + margin-left: 24%; } .project-n-bg-color{ background: #3B85E7; diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index 5bd363a..8e8773b 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -1,4 +1,4 @@ -import { bannerList, getAllSituation, getSurvey, getToken, getIndexPanelV2 } from '../../api/index' +import { bannerList, getAllSituation, getSurvey, getToken, getIndexPanelV2, getResidentConfig } from '../../api/index' import { checkUpdateAvatar, updateAvatar } from '../../api/clerkOnline' import { logout } from '../../api/setUp' // @ts-ignore @@ -483,9 +483,9 @@ Page({ }, // 跳转到用户分析模块 navigateToUserNum() { - wx.navigateTo({ - url: '/subpages/userNum/pages/userAnalysis/userAnalysis' - }) + // 获取街道id + this.getResidentConfig() + // url: '/subpages/userNum/pages/userAnalysis/userAnalysis' 瑜山只有一个街道所以不再跳转到这个页面 }, // 跳转到议题总数详情 navigateToyt() { @@ -604,5 +604,19 @@ Page({ } } }) + }, + // 小程序配置通用接口,这里主要获取默认街道id + async getResidentConfig (){ + const para = { + residentType: 'business_street_id' + } + try { + const res: any = await getResidentConfig(para) + wx.navigateTo({ + url: `/subpages/userNum/pages/streetDetail/streetDetail?deptId=${res.data[0].residentCode}&deptName=${res.data[0].residentValue}` + }) + } catch (error) { + console.log(error) + } } }) diff --git a/src/subpages/basicReality/components/selectStreet/selectStreet.ts b/src/subpages/basicReality/components/selectStreet/selectStreet.ts index 70721d4..2d66213 100644 --- a/src/subpages/basicReality/components/selectStreet/selectStreet.ts +++ b/src/subpages/basicReality/components/selectStreet/selectStreet.ts @@ -1,4 +1,5 @@ import { getStreetList } from '../../../../api/basic' +import { getResidentConfig } from '../../../../api/index' var utils = require('../../../../utils/util'); Component({ /** @@ -47,22 +48,25 @@ Component({ async getStreetList() { // @ts-ignore let streetList = []; + const para = { + residentType: 'business_street_id' + } try { - let res: any = await getStreetList() + let res: any = await getResidentConfig(para) res.data.forEach((item: any) => { this.data.streetList.push({ // @ts-ignore select: false, // @ts-ignore - title: item.deptName, + title: item.residentValue, // @ts-ignore - id: item.deptId, + id: item.residentCode, }) this.setData({ // 2020.9.11 去掉全部只保留瑜山街道 // @ts-ignore - 'choosedStreet.title': item.deptName, + 'choosedStreet.title': item.residentValue, // @ts-ignore - 'choosedStreet.id': item.deptId + 'choosedStreet.id': item.residentCode }) }) this.setData({ diff --git a/src/subpages/basicReality/pages/index/components/partyVan/components/enterSituation/enterSituation.ts b/src/subpages/basicReality/pages/index/components/partyVan/components/enterSituation/enterSituation.ts index 90c425b..37a391b 100644 --- a/src/subpages/basicReality/pages/index/components/partyVan/components/enterSituation/enterSituation.ts +++ b/src/subpages/basicReality/pages/index/components/partyVan/components/enterSituation/enterSituation.ts @@ -85,6 +85,9 @@ Component({ preloadVisible: true, streetContentList: [] }) + if(!this.data.condition.streetId) { // 9.14 必须传DeptId + return + } this.getAllDynamicStatistics() this.rankOfPartyJoin() this.getDynamicPercentAnalysis() @@ -213,13 +216,10 @@ Component({ // 党员参与占比分析 async getDynamicPercentAnalysis () { const para = { - DeptId: this.data.condition.streetId, + deptId: this.data.condition.streetId, someMonthsType: this.data.condition.timeId ? this.data.condition.timeId : '0', analysisType: '1' } - if(!this.data.condition.streetId) { // 9.14 必须传DeptId - return - } try { const res:any = await getDynamicPercentAnalysis(para) const categoryList:Array = []