From 5b406fed885e542cd3d4b7c10774089dd2b36dcc Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 29 Jul 2022 13:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=B7=A5=E7=A8=8B=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=94=B9=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/config.js | 4 ++-- weapp/src/packages/patrol/index.jsx | 20 ++++++++++++++++++-- weapp/src/packages/patrolView/index.jsx | 2 ++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/weapp/src/config.js b/weapp/src/config.js index 9648c0ca..d2cb8303 100644 --- a/weapp/src/config.js +++ b/weapp/src/config.js @@ -8,8 +8,8 @@ const baseConfig = { }; const development = { - baseUrl: 'http://221.230.55.29:31919', - // baseUrl: 'https://c5a6-117-90-37-10.ap.ngrok.io', + // baseUrl: 'http://221.230.55.29:31919', + baseUrl: 'https://c5a6-117-90-37-10.ap.ngrok.io', // webUrl: 'https://smartwater.anxinyun.cn', // pcode: 'fce4afe2-5b6a-408a-ab18-a2afa7fa027c', imgUrl: 'http://test.resources.anxinyun.cn/', diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index d756cb2f..c99df9a8 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -34,6 +34,12 @@ const Index = () => { const [sourceRoadStartSel, setSourceRoadStartSel] = useState([]) const [sourceRoadEndSel, setSourceRoadEndSel] = useState([]) + const prjType = [ + { text: '道路', value: 'road'}, + { text: '桥梁', value: 'birdge'}, + { text: '涵洞', value: 'culvert'}, + { text: '其他', value: 'other'}, + ] const prjTypeSelector = ['道路', '桥梁', '涵洞', '其他'] const [roadStartSel, setRoadStartSel] = useState([]) const [roadEndSel, setRoadEndSel] = useState([]) @@ -60,8 +66,15 @@ const Index = () => { Taro.hideLoading() if (res.statusCode == 200 || res.statusCode == 204) { const { data } = res + let showPrjType = '' + for (const item of prjType) { + if (item.value === data.projectType) { + showPrjType = item.text + break + } + } setReportType(data.reportType) - setProjectType(data.projectType) + setProjectType(showPrjType || data.projectType) setRoad(data.road) setRoadSectionStart(data.roadSectionStart) setRoadSectionEnd(data.roadSectionEnd) @@ -118,6 +131,7 @@ const Index = () => { }) } }, []) + useEffect(() => { setRoadStartSel(sourceRoadStartSel) setRoadEndSel(sourceRoadEndSel) @@ -148,9 +162,11 @@ const Index = () => { Taro.showToast({ title: '工程类型错误', icon: 'none' }) return } + const reportProjectType = prjType[prjTypeSelector.indexOf(projectType)].value + let data = { reportType, - projectType, + projectType: reportProjectType, road, roadSectionStart, roadSectionEnd, diff --git a/weapp/src/packages/patrolView/index.jsx b/weapp/src/packages/patrolView/index.jsx index a8beeffb..fe60a993 100644 --- a/weapp/src/packages/patrolView/index.jsx +++ b/weapp/src/packages/patrolView/index.jsx @@ -84,6 +84,8 @@ function Index() { }) useDidShow(() => { + setPage(0) + setNum(Math.random()) let refresh = Taro.getStorageSync('refresh'); // 返回列表需要刷新 if (refresh) { Taro.removeStorageSync('refresh'); // 返回列表需要刷新