From cebfb09b6cc11432a85bcf3e53dc1aa25e8eb086 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Sat, 23 Jul 2022 19:48:56 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=B7=A1=E6=9F=A5=E5=85=BB=E6=8A=A4?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/package-lock.json | 5 + weapp/package.json | 1 + weapp/src/app.config.js | 1 + weapp/src/packages/patrolView/index.config.js | 0 weapp/src/packages/patrolView/index.jsx | 125 ++++++++++++++++ weapp/src/packages/patrolView/index.scss | 135 ++++++++++++++++++ weapp/src/pages/home/index.jsx | 8 +- weapp/src/pages/user/index.jsx | 4 +- weapp/src/pages/user/index.scss | 2 +- weapp/src/static/img/patrolView/card-img.png | Bin 0 -> 3710 bytes .../static/img/patrolView/chevron-down.png | Bin 0 -> 174 bytes .../static/img/patrolView/conserve-active.svg | 30 ++++ weapp/src/static/img/patrolView/conserve.svg | 32 +++++ .../static/img/patrolView/patrol-active.svg | 29 ++++ weapp/src/static/img/patrolView/patrol.svg | 27 ++++ weapp/src/static/img/patrolView/search.png | Bin 0 -> 1030 bytes 16 files changed, 396 insertions(+), 3 deletions(-) create mode 100644 weapp/src/packages/patrolView/index.config.js create mode 100644 weapp/src/packages/patrolView/index.jsx create mode 100644 weapp/src/packages/patrolView/index.scss create mode 100644 weapp/src/static/img/patrolView/card-img.png create mode 100644 weapp/src/static/img/patrolView/chevron-down.png create mode 100644 weapp/src/static/img/patrolView/conserve-active.svg create mode 100644 weapp/src/static/img/patrolView/conserve.svg create mode 100644 weapp/src/static/img/patrolView/patrol-active.svg create mode 100644 weapp/src/static/img/patrolView/patrol.svg create mode 100644 weapp/src/static/img/patrolView/search.png diff --git a/weapp/package-lock.json b/weapp/package-lock.json index 0d599ce4..8899ef8d 100644 --- a/weapp/package-lock.json +++ b/weapp/package-lock.json @@ -9532,6 +9532,11 @@ "resolved": "http://10.8.30.22:7000/mobile-detect/-/mobile-detect-1.4.5.tgz", "integrity": "sha1-2jk8PEE8oam83ZztZTw4KBwPtq0=" }, + "moment": { + "version": "2.29.1", + "resolved": "http://npm.anxinyun.cn/moment/-/moment-2.29.1.tgz", + "integrity": "sha1-sr52n6MZQL6e7qZGnAdeNQBvo9M=" + }, "move-concurrently": { "version": "1.0.1", "resolved": "http://10.8.30.22:7000/move-concurrently/-/move-concurrently-1.0.1.tgz", diff --git a/weapp/package.json b/weapp/package.json index 6306c08b..d63a9260 100644 --- a/weapp/package.json +++ b/weapp/package.json @@ -46,6 +46,7 @@ "@tarojs/taro": "3.1.4", "dayjs": "^1.9.8", "deepmerge": "^4.0.0", + "moment": "^2.29.1", "react": "^16.10.0", "react-dom": "^16.10.0", "swr": "^0.5.4", diff --git a/weapp/src/app.config.js b/weapp/src/app.config.js index 18a9b86e..34a44b5a 100644 --- a/weapp/src/app.config.js +++ b/weapp/src/app.config.js @@ -8,6 +8,7 @@ export default { 'root': 'packages/', 'pages': [ 'patrol/index', + 'patrolView/index' ] }], permission: { diff --git a/weapp/src/packages/patrolView/index.config.js b/weapp/src/packages/patrolView/index.config.js new file mode 100644 index 00000000..e69de29b diff --git a/weapp/src/packages/patrolView/index.jsx b/weapp/src/packages/patrolView/index.jsx new file mode 100644 index 00000000..9dccd266 --- /dev/null +++ b/weapp/src/packages/patrolView/index.jsx @@ -0,0 +1,125 @@ +import React, { useState } from 'react' +import Taro, { useDidShow } from '@tarojs/taro' +import { View, Picker, Input, Image } from '@tarojs/components' +import moment from 'moment' +import './index.scss' +import NoData from '@/components/no-data/noData' +import chevronDown from '../../static/img/patrolView/chevron-down.png' +import searchIcon from '../../static/img/patrolView/search.png' +import cardImg from '../../static/img/patrolView/card-img.png' +import patrolIcon from '../../static/img/patrolView/patrol.svg' +import patrolActiveIcon from '../../static/img/patrolView/patrol-active.svg' +import conserveIcon from '../../static/img/patrolView/conserve.svg' +import conserveActiveIcon from '../../static/img/patrolView/conserve-active.svg' + +function Index() { + const [datePicker, setDatePicker] = useState(moment().format('YYYY-MM-DD')) + const [listData, setListData] = useState([]) + const [inputSite, setInputSite] = useState('') + const [page, setPage] = useState(0) + const [total, setTotal] = useState(0) + const [num, setNum] = useState(Math.random()) + const [systemInfo, setSystemInfo] = useState('') + + const data = [ + { + place: { + name: '飞尚' + }, + user: { + name: '用户1' + }, + time: '2022-7-1' + } + ] + + useDidShow(() => { + let refresh = Taro.getStorageSync('refresh'); // 返回列表需要刷新 + if (refresh) { + setPage(0) + setNum(Math.random()) + Taro.removeStorageSync('refresh'); // 返回列表需要刷新 + } + Taro.getSystemInfo({ + success: (res) => { + // windows | mac为pc端 + // android | ios为手机端 + setSystemInfo(res.platform); + } + }); + }) + + const onDateChange = e => { + setDatePicker(e.detail.value); + } + + const handleConfirm = () => { + setPage(0) + setListData([]); + setTotal(0); + setNum(Math.random()) + } + + const handleInput = e => { + setInputSite(e.detail.value); + if (!e.detail.value) { + setPage(0) + setListData([]); + setTotal(0); + setNum(Math.random()) + } + } + + return ( + + + + + 巡查 + + + + + 养护 + + + + + 日期: + + {datePicker || '请选择'} + + + + + + + + + + + { + data && data.length > 0 ? data && data.map((e, index) => { + return ( + handleDetail(index)}> + + + + {e.place.name} + + 填报人: + {e.user.name} + + {moment(e.time).format('YYYY-MM-DD HH:mm:ss')} + + + + ) + }) : + } + + + ) +} + +export default Index diff --git a/weapp/src/packages/patrolView/index.scss b/weapp/src/packages/patrolView/index.scss new file mode 100644 index 00000000..fc705a70 --- /dev/null +++ b/weapp/src/packages/patrolView/index.scss @@ -0,0 +1,135 @@ +page { + background-color: #f6f6f6; + + .type-box { + background-color: #fff; + height: 80px; + display: flex; + justify-content: space-around; + align-items: center; + + .item { + flex-grow: 1; + display: flex; + justify-content: center; + align-items: center; + + .type-img { + width: 40px; + height: 40px; + margin: 0 10px; + } + } + .line { + + width: 1px; + height: 30px; + background-color: #f6f6f6; + } + } + + .filter-box { + position: fixed; + top: 80px; + display: flex; + width: 100%; + z-index: 100; + background: #fff; + color: #999999; + font-size: 28rpx; + border-top: 2rpx solid #f6f6f6; + + .filter-item { + overflow: hidden; + height: 98rpx; + line-height: 98rpx; + flex: 1; + + .filter-name { + float: left; + // margin-left: 20rpx; + } + + .filter-img { + width: 14px; + height: 8px; + float: left; + margin: 46rpx 20rpx 18rpx 10rpx; + } + } + + .head-search { + width: 400rpx; + display: flex; + background: #fff; + padding: 10rpx 26rpx 15rpx; + box-sizing: border-box; + border-radius: 50rpx; + box-shadow: 0 8rpx 10rpx 0rpx #00000008; + border: 2rpx solid #00000011; + height: 68rpx; + line-height: 68rpx; + margin: 14rpx 30rpx 14rpx 0; + + .search-img { + width: 36rpx; + height: 36rpx; + margin-top: 5rpx; + } + + .heard-search-input { + margin-left: 26rpx; + font-size: 28rpx; + width: 100%; + color: #333; + } + } + } + + .cardBox { + width: 690rpx; + margin: 50rpx auto; + + .card-item { + position: relative; + margin-bottom: 10rpx; + + .card-bg { + width: 100%; + height: 260rpx; + display: block; + + } + + .card-position { + position: absolute; + top: 0; + left: 0; + width: 88%; + padding: 16rpx 0 16rpx 36rpx; + overflow: hidden; + text-align: justify; + + .card-title { + font-size: 28rpx; + color: #333333; + float: left; + margin-bottom: 30rpx; + width: 470rpx; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + margin-top: 8rpx; + } + + .card-date { + float: left; + font-size: 28rpx; + color: #999999; + margin-top: 30rpx; + width: 100%; + } + } + } + } +} \ No newline at end of file diff --git a/weapp/src/pages/home/index.jsx b/weapp/src/pages/home/index.jsx index 2ff925f4..95fa024b 100644 --- a/weapp/src/pages/home/index.jsx +++ b/weapp/src/pages/home/index.jsx @@ -12,12 +12,18 @@ const Index = () => { url: '/packages/patrol/index' }) } + function toPatrolView() { + Taro.navigateTo({ + url: '/packages/patrolView/index' + }) + } return ( 巡 查 养 护 - 填报 + {/* 填报 */} + 查看 ); diff --git a/weapp/src/pages/user/index.jsx b/weapp/src/pages/user/index.jsx index 781cbb80..299a8eec 100644 --- a/weapp/src/pages/user/index.jsx +++ b/weapp/src/pages/user/index.jsx @@ -10,6 +10,8 @@ import moreImg from '../../static/img/my/more.svg'; import pswdImg from '../../static/img/my/pswd.svg'; import reportImg from '../../static/img/my/report.svg'; +import Common from '../../components/echartForWx/common'; // 如果这行删掉微信小程序编译就一直死循环,待解决 + const { webUrl } = cfg; const Index = ({ ...props }) => { @@ -27,7 +29,7 @@ const Index = ({ ...props }) => { }); } - console.log(userInfo) + return ( diff --git a/weapp/src/pages/user/index.scss b/weapp/src/pages/user/index.scss index 152e5a44..8273e5a1 100644 --- a/weapp/src/pages/user/index.scss +++ b/weapp/src/pages/user/index.scss @@ -1,6 +1,6 @@ .page { height: 100vh; - background: #F0F2F5; + background: #f6f6f6; display: flex; flex-direction: column; diff --git a/weapp/src/static/img/patrolView/card-img.png b/weapp/src/static/img/patrolView/card-img.png new file mode 100644 index 0000000000000000000000000000000000000000..9027dfbba925864366327fddeea6fd912fadc02a GIT binary patch literal 3710 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 WeerEe_i4Cx^XY0CXy$2H2mcErN7DlU literal 0 HcmV?d00001 diff --git a/weapp/src/static/img/patrolView/chevron-down.png b/weapp/src/static/img/patrolView/chevron-down.png new file mode 100644 index 0000000000000000000000000000000000000000..abbb78aebc9be160a373f76c77e3ca8223ebaf59 GIT binary patch literal 174 zcmeAS@N?(olHy`uVBq!ia0vp^d_c^>!VDy>?JxfaQjEnx?oJHr&dIz4azq1sLR^9L zym|AcPoF*$30UbGr2r+^N`m}?8AQbnpS~>qa?>TCh^eQGV+hCfWP`v2ASg;J;AXnC zN|R^NN+zD3#Kr`kBxX)Wg~^N>0$h)nST8xmENI}Kz|FwG&OX`j_mNvb0~kDA{an^L HB{Ts5L<2LJ literal 0 HcmV?d00001 diff --git a/weapp/src/static/img/patrolView/conserve-active.svg b/weapp/src/static/img/patrolView/conserve-active.svg new file mode 100644 index 00000000..9af62b14 --- /dev/null +++ b/weapp/src/static/img/patrolView/conserve-active.svg @@ -0,0 +1,30 @@ + + + 切片 + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/weapp/src/static/img/patrolView/conserve.svg b/weapp/src/static/img/patrolView/conserve.svg new file mode 100644 index 00000000..4025c704 --- /dev/null +++ b/weapp/src/static/img/patrolView/conserve.svg @@ -0,0 +1,32 @@ + + + 切片 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/weapp/src/static/img/patrolView/patrol-active.svg b/weapp/src/static/img/patrolView/patrol-active.svg new file mode 100644 index 00000000..5d9003d9 --- /dev/null +++ b/weapp/src/static/img/patrolView/patrol-active.svg @@ -0,0 +1,29 @@ + + + 切片 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/weapp/src/static/img/patrolView/patrol.svg b/weapp/src/static/img/patrolView/patrol.svg new file mode 100644 index 00000000..b77af261 --- /dev/null +++ b/weapp/src/static/img/patrolView/patrol.svg @@ -0,0 +1,27 @@ + + + 切片 + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/weapp/src/static/img/patrolView/search.png b/weapp/src/static/img/patrolView/search.png new file mode 100644 index 0000000000000000000000000000000000000000..15db47f26eeecf78d1c4fcadf0d30fac0a565260 GIT binary patch literal 1030 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k3?#4J%UA`Z7>k44ofy`glX(eb_XPNaxB>-% z;Q#;s4Gj&eR;>b(`}gmkIddkEJ!#UU`Sa%k+1=gUixw@KI(6#YxpRTs{{DWT)Vz7~ zrca+fd-iOgIFOt%W5%pmvw*U5=FFKkZ5ogSvVr12H9#pK8=?S00>yzM5cNPd5CGW_ z08t6i0u+I$2MQtsWI>=BpcF(sgoLPsh$E9gaX1&qfUuDT(b#Y_B; zS_cOyOw24StZeKYT-@9|y!-;9qS7+5imGZFI(mji z#%7j|&OW|=L7@>*F>wh=sc9LxdHE$JrDYXW)ipJ>^^Hx)#^1HHf=q8Er_P)?d->Y+TlenWfAsj-^B1pPzj^cF)8{W=zJ34s^Y@=W zfB*g4$#2XHOeQluT^vIsB&Qzij_xj$V0)mRn0@ZF%M!J-nU|b0Ig34>noJIG5=qir zrMdi@-Ff?Sq4#g?d;9#?j{HB{Z+v|Be6x?7_G2&i)xL8Rvv)S%xKQxSHr4q<_u0VBYc;s}gM1bTJu&@i#5Mnk zzNqkug5Ej3i@f+v_w&z|3g2?AOX_@vWRBE=q7_&F1a~J+Idg*V;KPkm8r0o<4?o>v z!Q|gwA*~mf#WXMPrOlkMsqN~zb6YO6>mIzUJh$m`lii`oBKikYs{?~SZ1MDeC^Y@p z15VK`yM+17mxy?|ofOG({j^DK%9h~yWs8roZZ4eS8^j;DwlY%8J@PdFM*h0r_h)Td zaV7Q92eS~1KYqXVaN9YH#LGILoTnY{yD9OnXZA-IW~L`mUVvLen5YY#LN@=PnRDH@{K5;o3u@iab3`~ x)$R?aMdWi`8|=FH1(r Date: Mon, 25 Jul 2022 09:51:11 +0800 Subject: [PATCH 2/8] comment --- .../containers/footer/operation/index.js | 7 +- .../containers/footer/operation/left.js | 166 ++++++++++++++++++ .../containers/footer/operation/right.js | 9 + 3 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 web/client/src/sections/quanju/containers/footer/operation/left.js create mode 100644 web/client/src/sections/quanju/containers/footer/operation/right.js diff --git a/web/client/src/sections/quanju/containers/footer/operation/index.js b/web/client/src/sections/quanju/containers/footer/operation/index.js index c8b81208..4ebd1ab2 100644 --- a/web/client/src/sections/quanju/containers/footer/operation/index.js +++ b/web/client/src/sections/quanju/containers/footer/operation/index.js @@ -1,8 +1,13 @@ import React from 'react' +import Left from './left' +import Right from './right' const Operation = () => { return ( - <>运营 +
+ + +
) } export default Operation \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/operation/left.js b/web/client/src/sections/quanju/containers/footer/operation/left.js new file mode 100644 index 00000000..2fbfdc75 --- /dev/null +++ b/web/client/src/sections/quanju/containers/footer/operation/left.js @@ -0,0 +1,166 @@ +import React, { useMemo, useState, useEffect } from 'react'; +import { Col, Row, Input, Tree } from 'antd' +import Module from '../../public/module' + +const { Search } = Input; +const x = 3; +const y = 2; +const z = 1; +const defaultData = []; + +const generateData = (_level, _preKey, _tns) => { + const preKey = _preKey || '0'; + const tns = _tns || defaultData; + const children = []; + + for (let i = 0; i < x; i++) { + const key = `${preKey}-${i}`; + tns.push({ + title: key, + key, + }); + + if (i < y) { + children.push(key); + } + } + + if (_level < 0) { + return tns; + } + + const level = _level - 1; + children.forEach((key, index) => { + tns[index].children = []; + return generateData(level, key, tns[index].children); + }); +}; + +generateData(z); +const dataList = []; + +const generateList = (data) => { + for (let i = 0; i < data.length; i++) { + const node = data[i]; + const { key } = node; + dataList.push({ + key, + title: key, + }); + + if (node.children) { + generateList(node.children); + } + } +}; + +generateList(defaultData); + +const getParentKey = (key, tree) => { + let parentKey; + + for (let i = 0; i < tree.length; i++) { + const node = tree[i]; + + if (node.children) { + if (node.children.some((item) => item.key === key)) { + parentKey = node.key; + } else if (getParentKey(key, node.children)) { + parentKey = getParentKey(key, node.children); + } + } + } + + return parentKey; +}; + +const Left = () => { + + useEffect(() => { + + }, []) + + const style = { height: "97%", marginTop: "3%" } + const [expandedKeys, setExpandedKeys] = useState([]); + const [searchValue, setSearchValue] = useState(''); + const [autoExpandParent, setAutoExpandParent] = useState(true); + + const onExpand = (newExpandedKeys) => { + setExpandedKeys(newExpandedKeys); + setAutoExpandParent(false); + }; + + const onChange = (e) => { + const { value } = e.target; + const newExpandedKeys = dataList + .map((item) => { + if (item.title.indexOf(value) > -1) { + return getParentKey(item.key, defaultData); + } + + return null; + }) + .filter((item, i, self) => item && self.indexOf(item) === i); + setExpandedKeys(newExpandedKeys); + setSearchValue(value); + setAutoExpandParent(true); + }; + + const treeData = useMemo(() => { + const loop = (data) => + data.map((item) => { + const strTitle = item.title; + const index = strTitle.indexOf(searchValue); + const beforeStr = strTitle.substring(0, index); + const afterStr = strTitle.slice(index + searchValue.length); + const title = + index > -1 ? ( + + {beforeStr} + {searchValue} + {afterStr} + + ) : ( + {strTitle} + ); + + if (item.children) { + return { + title, + key: item.key, + children: loop(item.children), + }; + } + + return { + title, + key: item.key, + }; + }); + + return loop(defaultData); + }, [searchValue]); + return ( +
+ +
+ + +
+
+
+ ); +}; + +export default Left; \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/operation/right.js b/web/client/src/sections/quanju/containers/footer/operation/right.js new file mode 100644 index 00000000..fe140e63 --- /dev/null +++ b/web/client/src/sections/quanju/containers/footer/operation/right.js @@ -0,0 +1,9 @@ +import React from 'react' + +const Right = () => { + return ( +
555555555 +
+ ) +} +export default Right \ No newline at end of file From 0d0d1e309534bb6ee0b8857ee2296bc4eae1d8e2 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Mon, 25 Jul 2022 10:13:22 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E9=A1=B5=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrolView/index.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/weapp/src/packages/patrolView/index.jsx b/weapp/src/packages/patrolView/index.jsx index 9dccd266..ed52ad54 100644 --- a/weapp/src/packages/patrolView/index.jsx +++ b/weapp/src/packages/patrolView/index.jsx @@ -13,6 +13,7 @@ import conserveIcon from '../../static/img/patrolView/conserve.svg' import conserveActiveIcon from '../../static/img/patrolView/conserve-active.svg' function Index() { + const [isPatrol, setIsPatrol] = useState(true) const [datePicker, setDatePicker] = useState(moment().format('YYYY-MM-DD')) const [listData, setListData] = useState([]) const [inputSite, setInputSite] = useState('') @@ -49,6 +50,10 @@ function Index() { }); }) + const onTypeChange = bool => { + setIsPatrol(bool) + } + const onDateChange = e => { setDatePicker(e.detail.value); } @@ -73,14 +78,14 @@ function Index() { return ( - - - 巡查 + onTypeChange(true)}> + + 巡查 - - - 养护 + onTypeChange(false)}> + + 养护 From 946ff7a620fd5b4f0c1ea4ab3e0c9b8a4d79d48a Mon Sep 17 00:00:00 2001 From: wanyiwei Date: Mon, 25 Jul 2022 10:18:23 +0800 Subject: [PATCH 4/8] =?UTF-8?q?*=E6=A0=91=E5=BD=A2=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E5=8F=8Ainput=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quanju/containers/footer/operation/left.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/client/src/sections/quanju/containers/footer/operation/left.js b/web/client/src/sections/quanju/containers/footer/operation/left.js index 2fbfdc75..86e9b9aa 100644 --- a/web/client/src/sections/quanju/containers/footer/operation/left.js +++ b/web/client/src/sections/quanju/containers/footer/operation/left.js @@ -143,15 +143,23 @@ const Left = () => { return (
-
+
Date: Mon, 25 Jul 2022 10:52:20 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=9D=A2=E5=8C=85=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/assets/color.less | 32 ++++--------- .../organization/components/depModal.js | 3 +- .../sections/organization/containers/user.js | 48 +++++++++++++++++-- .../footer/conserve/left/left-top.js | 2 +- web/client/src/sections/quanju/nav-item.js | 11 +++-- 5 files changed, 63 insertions(+), 33 deletions(-) diff --git a/web/client/assets/color.less b/web/client/assets/color.less index 83d90140..3b9b4ccd 100644 --- a/web/client/assets/color.less +++ b/web/client/assets/color.less @@ -1128,10 +1128,10 @@ tr > .ant-picker-cell-in-view.ant-picker-cell-range-hover-start:last-child::afte .ant-mentions-dropdown-menu-item-active {background-color: @item-hover-bg;} .ant-menu-item-danger.ant-menu-item {color: #ff4d4f;} .ant-menu-item-danger.ant-menu-item:hover, .ant-menu-item-danger.ant-menu-item-active {color: #ff4d4f;} -.ant-menu-item-danger.ant-menu-item:active {background: color(~`colorPalette("@{menu-popup-bg}", 2)`);} +.ant-menu-item-danger.ant-menu-item:active {background: #fff1f0;} .ant-menu-item-danger.ant-menu-item-selected {color: #ff4d4f;} .ant-menu-item-danger.ant-menu-item-selected > a, .ant-menu-item-danger.ant-menu-item-selected > a:hover {color: #ff4d4f;} -.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-danger.ant-menu-item-selected {background-color: color(~`colorPalette("@{menu-popup-bg}", 2)`);} +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-danger.ant-menu-item-selected {background-color: #fff1f0;} .ant-menu-inline .ant-menu-item-danger.ant-menu-item::after {border-right-color: #ff4d4f;} .ant-menu-dark .ant-menu-item-danger.ant-menu-item, .ant-menu-dark .ant-menu-item-danger.ant-menu-item:hover, .ant-menu-dark .ant-menu-item-danger.ant-menu-item > a {color: #ff4d4f;} .ant-menu-dark.ant-menu-dark:not(.ant-menu-horizontal) .ant-menu-item-danger.ant-menu-item-selected {color: #fff;background-color: #ff4d4f;} @@ -1702,17 +1702,11 @@ tr.ant-table-expanded-row:hover > td {background: @table-expanded-row-bg;} .ant-tag-checkable:active, .ant-tag-checkable-checked {color: #fff;} .ant-tag-checkable-checked {background-color: @primary-color;} .ant-tag-checkable:active {background-color: color(~`colorPalette("@{primary-color}", 7)`);} -<<<<<<< HEAD -.ant-tag-pink {color: #c41d7f;background: color(~`colorPalette("@{modal-footer-border-color-split}", 1)`);border-color: #ffadd2;} +.ant-tag-pink {color: #c41d7f;background: #fff0f6;border-color: #ffadd2;} .ant-tag-pink-inverse {color: #fff;background: #eb2f96;border-color: #eb2f96;} -.ant-tag-magenta {color: #c41d7f;background: color(~`colorPalette("@{modal-footer-border-color-split}", 1)`);border-color: #ffadd2;} -======= -.ant-tag-pink {color: #c41d7f;background: color(~`colorPalette("@{timeline-color}", 4)`);border-color: #ffadd2;} -.ant-tag-pink-inverse {color: #fff;background: #eb2f96;border-color: #eb2f96;} -.ant-tag-magenta {color: #c41d7f;background: color(~`colorPalette("@{timeline-color}", 4)`);border-color: #ffadd2;} ->>>>>>> 65cf2722eec21e1d07ce958f4298eec7ae620c85 +.ant-tag-magenta {color: #c41d7f;background: #fff0f6;border-color: #ffadd2;} .ant-tag-magenta-inverse {color: #fff;background: #eb2f96;border-color: #eb2f96;} -.ant-tag-red {color: #cf1322;background: color(~`colorPalette("@{menu-popup-bg}", 2)`);border-color: #ffa39e;} +.ant-tag-red {color: #cf1322;background: #fff1f0;border-color: #ffa39e;} .ant-tag-red-inverse {color: #fff;background: #f5222d;border-color: #f5222d;} .ant-tag-volcano {color: #d4380d;background: #fff2e8;border-color: #ffbb96;} .ant-tag-volcano-inverse {color: #fff;background: #fa541c;border-color: #fa541c;} @@ -1720,7 +1714,7 @@ tr.ant-table-expanded-row:hover > td {background: @table-expanded-row-bg;} .ant-tag-orange-inverse {color: #fff;background: #fa8c16;border-color: #fa8c16;} .ant-tag-yellow {color: #d4b106;background: #feffe6;border-color: #fffb8f;} .ant-tag-yellow-inverse {color: #fff;background: #fadb14;border-color: #fadb14;} -.ant-tag-gold {color: #d48806;background: color(~`colorPalette("@{skeleton-color}", 1)`);border-color: #ffe58f;} +.ant-tag-gold {color: #d48806;background: #fffbe6;border-color: #ffe58f;} .ant-tag-gold-inverse {color: #fff;background: #faad14;border-color: #faad14;} .ant-tag-cyan {color: #08979c;background: #e6fffb;border-color: #87e8de;} .ant-tag-cyan-inverse {color: #fff;background: #13c2c2;border-color: #13c2c2;} @@ -1728,17 +1722,11 @@ tr.ant-table-expanded-row:hover > td {background: @table-expanded-row-bg;} .ant-tag-lime-inverse {color: #fff;background: #a0d911;border-color: #a0d911;} .ant-tag-green {color: #389e0d;background: #f6ffed;border-color: #b7eb8f;} .ant-tag-green-inverse {color: #fff;background: #52c41a;border-color: #52c41a;} -.ant-tag-blue {color: #096dd9;background: color(~`colorPalette("@{progress-steps-item-bg}", 1)`);border-color: #91d5ff;} +.ant-tag-blue {color: #096dd9;background: color(~`colorPalette("@{pagination-item-input-bg}", 1)`);border-color: #91d5ff;} .ant-tag-blue-inverse {color: #fff;background: #1890ff;border-color: #1890ff;} -<<<<<<< HEAD -.ant-tag-geekblue {color: #1d39c4;background: color(~`colorPalette("@{success-color-deprecated-border}", 1)`);border-color: #adc6ff;} -.ant-tag-geekblue-inverse {color: #fff;background: #2f54eb;border-color: #2f54eb;} -.ant-tag-purple {color: #531dab;background: color(~`colorPalette("@{progress-steps-item-bg}", 3)`);border-color: #d3adf7;} -======= -.ant-tag-geekblue {color: #1d39c4;background: color(~`colorPalette("@{popover-background}", 3)`);border-color: #adc6ff;} +.ant-tag-geekblue {color: #1d39c4;background: color(~`colorPalette("@{avatar-bg}", 4)`);border-color: #adc6ff;} .ant-tag-geekblue-inverse {color: #fff;background: #2f54eb;border-color: #2f54eb;} -.ant-tag-purple {color: #531dab;background: #f9f0ff;border-color: #d3adf7;} ->>>>>>> 65cf2722eec21e1d07ce958f4298eec7ae620c85 +.ant-tag-purple {color: #531dab;background: color(~`colorPalette("@{calendar-bg}", 1)`);border-color: #d3adf7;} .ant-tag-purple-inverse {color: #fff;background: #722ed1;border-color: #722ed1;} .ant-tag-success {color: #52c41a;background: @success-color-deprecated-bg;border-color: @success-color-deprecated-border;} .ant-tag-processing {color: @primary-color;background: @info-color-deprecated-bg;border-color: @info-color-deprecated-border;} @@ -1975,7 +1963,7 @@ a.ant-typography.ant-typography-disabled:hover, .ant-typography a.ant-typography .ant-upload-list-picture .ant-upload-list-item-error, .ant-upload-list-picture-card .ant-upload-list-item-error {border-color: #ff4d4f;} .ant-upload-list-picture .ant-upload-list-item:hover .ant-upload-list-item-info, .ant-upload-list-picture-card .ant-upload-list-item:hover .ant-upload-list-item-info {background: transparent;} .ant-upload-list-picture .ant-upload-list-item-uploading, .ant-upload-list-picture-card .ant-upload-list-item-uploading {border-style: dashed;} -.ant-upload-list-picture .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='color(~`colorPalette("@{progress-steps-item-bg}", 1)`)'], .ant-upload-list-picture-card .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='color(~`colorPalette("@{progress-steps-item-bg}", 1)`)'] {fill: @error-color-deprecated-bg;} +.ant-upload-list-picture .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='color(~`colorPalette("@{pagination-item-input-bg}", 1)`)'], .ant-upload-list-picture-card .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='color(~`colorPalette("@{pagination-item-input-bg}", 1)`)'] {fill: @error-color-deprecated-bg;} .ant-upload-list-picture .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='#1890ff'], .ant-upload-list-picture-card .ant-upload-list-item-error .ant-upload-list-item-thumbnail .anticon svg path[fill='#1890ff'] {fill: #ff4d4f;} .ant-upload-list-picture-card .ant-upload-list-item-info::before {background-color: rgba(0, 0, 0, 0.5);} .ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-eye, .ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-download, .ant-upload-list-picture-card .ant-upload-list-item-actions .anticon-delete {color: rgba(255, 255, 255, 0.85);} diff --git a/web/client/src/sections/organization/components/depModal.js b/web/client/src/sections/organization/components/depModal.js index 56f341b4..bd624b48 100644 --- a/web/client/src/sections/organization/components/depModal.js +++ b/web/client/src/sections/organization/components/depModal.js @@ -68,7 +68,7 @@ const DepModal = (props) => { function mapStateToProps(state) { const { depMessage } = state; - console.log('depMessage:',depMessage); + const pakData = (dep) => { return dep.map((d) => { return { @@ -80,7 +80,6 @@ function mapStateToProps(state) { }) } let depData = pakData(depMessage.data || []) - console.log('depData:',depData); return { loading: depMessage.isRequesting, depData, diff --git a/web/client/src/sections/organization/containers/user.js b/web/client/src/sections/organization/containers/user.js index bf811a2f..f5ac9ac9 100644 --- a/web/client/src/sections/organization/containers/user.js +++ b/web/client/src/sections/organization/containers/user.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import { DeleteOutlined, EllipsisOutlined, FormOutlined } from '@ant-design/icons'; -import { Spin, Space, Button, Popconfirm, Row, Col, Tree, Table, Card, Switch, Tooltip } from 'antd'; +import { Spin, Space, Button, Popconfirm, Row, Col, Tree, Table, Card, Switch, Tooltip, Breadcrumb } from 'antd'; import ProTable from '@ant-design/pro-table'; import { getDepMessage, getDepUser, createUser, updateUser, delUser, resetPwd, createDep, delDep, updateDep } from '../actions/user'; import UserModal from '../components/userModal'; @@ -22,6 +22,7 @@ const UserManage = (props) => { const [depModalType, setDepModalType] = useState(); const [depModalRecord, setDepModalRecord] = useState(); const [selectedTree, setSelectedTree] = useState(); + const [depCrumbs, setDepCrumbs] = useState([]); useEffect(() => { @@ -34,6 +35,12 @@ const UserManage = (props) => { dispatch(getDepUser(depMessage[0].id)) } }, [depMessage]) + + useEffect(() => { + const list = handleCrumbs(depSelectedKeys) + setDepCrumbs(list) + + }, [depSelectedKeys]) const columns = [ { @@ -181,7 +188,7 @@ const UserManage = (props) => { // 删除部门 const delDepartment = (id) => { dispatch(delDep(id)).then(res => { - if(res.success){ + if (res.success) { dispatch(getDepMessage()) } }); @@ -208,6 +215,32 @@ const UserManage = (props) => {
} + + const handleCrumbs = (id) => { + let crumbsList = [] + + depMessage?.forEach(d => { + if (id == d.id) { + crumbsList.push(d.name) + } + d.subordinate?.forEach(s => { + if (id == s.id) { + crumbsList.push(d.name) + crumbsList.push(s.name) + } + s.subordinate?.forEach(a => { + if (id == a.id) { + crumbsList.push(d.name) + crumbsList.push(s.name) + crumbsList.push(a.name) + } + }) + }) + }) + return crumbsList + } + + return (
@@ -220,6 +253,7 @@ const UserManage = (props) => { style={{ marginLeft: 10 }} onClick={() => openDepModal('create')} >新建部门 + { depMessage.length ? { defaultExpandedKeys={[depMessage[0].id]} selectedKeys={depSelectedKeys} onSelect={(selectedKeys, e) => { + // console.log('selectedKeys:',selectedKeys); + if (e.selected) { + handleCrumbs(selectedKeys) setSelectedTree(selectedKeys) setDepSelectedKeys(selectedKeys) dispatch(getDepUser(selectedKeys[0])) @@ -260,7 +297,11 @@ const UserManage = (props) => { - + + { + depCrumbs?.map((c, index) => { return ({c}) }) + } + { function mapStateToProps(state) { const { depMessage, depUser, global } = state; + console.log('depMessage:', depMessage); // console.log(state); return { clientHeight: global.clientHeight, diff --git a/web/client/src/sections/quanju/containers/footer/conserve/left/left-top.js b/web/client/src/sections/quanju/containers/footer/conserve/left/left-top.js index 3ab9489d..eaadc4f8 100644 --- a/web/client/src/sections/quanju/containers/footer/conserve/left/left-top.js +++ b/web/client/src/sections/quanju/containers/footer/conserve/left/left-top.js @@ -194,7 +194,7 @@ const LeftTop = () => { const style = { height: "31%", marginTop: "3%" } return ( <> - +
diff --git a/web/client/src/sections/quanju/nav-item.js b/web/client/src/sections/quanju/nav-item.js index 74bdd2a2..63fc92d6 100644 --- a/web/client/src/sections/quanju/nav-item.js +++ b/web/client/src/sections/quanju/nav-item.js @@ -7,10 +7,11 @@ const SubMenu = Menu.SubMenu; export function getNavItem(user, dispatch) { return ( - } title={'举个栗子'}> - - 举个棒子2 - - + // } title={'举个栗子'}> + // + // 举个棒子2 + // + // + <> ); } \ No newline at end of file From ce1b8102d01977fb1f1aff5b4dd3639562c8d3bf Mon Sep 17 00:00:00 2001 From: wanyiwei Date: Mon, 25 Jul 2022 11:15:22 +0800 Subject: [PATCH 6/8] =?UTF-8?q?*input=E6=90=9C=E7=B4=A2=E6=A1=86=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E5=9B=BE=E7=89=87=E5=8F=8A=E9=83=A8=E5=88=86=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/assets/images/quanju/search.png | Bin 0 -> 1670 bytes .../containers/footer/operation/left.js | 30 +++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 web/client/assets/images/quanju/search.png diff --git a/web/client/assets/images/quanju/search.png b/web/client/assets/images/quanju/search.png new file mode 100644 index 0000000000000000000000000000000000000000..b2e932c3486f0739ef828de32ed32b7268a908b4 GIT binary patch literal 1670 zcmV;126_33P)Px*KuJVFR9HvNm~D()WfjMN=gxGgJ2P8byVY*|P=o}7N=@imY!of=1)J0o4UGX` zf+XTwO`VzDE+{xvgWKJ`gEoRfDAAglC?Hm(Pzy;-M6^|e4;r*!A!r*>>F&V9HCEziH75heq;c8Uh#ik36vrl=)8#%KLUcsC^Ca0CYc&>T{nX%n-?OV;9+nrBk zb+_R9Y6@&x&n5S6wMrws5HyvSE1zuSc&s?xOA5rStl#?{jk$oJT#^-rEqgE3fr4KEH_^PW5J3wV2VY z!n}GwYo?~C9@OcME><=A5Lha!TLm{pp!+=6KH6@STJ=li^t8k!;o1(@dL#D3dKv-f zLxN3lj9Ue1W}nJxP_QG)(_LQC2I_<6^aqKz1_lX-4W$u#qS*oqHJ{Gw2H)qq(Qf|0 zbM51eK>s1JDlq8i;QY}+dw!unn(1Wn+FbDo?@%)y^IQuGnR$nG<}_LTQgn2&yq(IX z8Bo3X@Jl6r8O|HOFT1v`5$KDE*N0mV7nO<@6uW0-r2F(?zruY{L=SqdU0EMAtKR}| z3k)2GjT0kw_^eO@>72ItVs~_y_IgG8M5Bm4fVe6Ih0jhD?K@`+v@@?e@cB%*wsGr( zYeBs+e~zZI$_s|0fAxr0v=5v$(41z|&W!hYt{tii+BKjHXQnt78BBI2>HgP{l@=Se zGp9=tzl+u>_pD*XvtO{ux}d>CDyKir)}apl-iU<}Ud)loX|Ke`qBZuHix#F|W6->| z%jdS}^qopB;exS23m$QcGEzIVRx><_f@1**tNhacI~ca0=JajE=OVvKGRZr} zhb*k#nnpA*2Av(zum1?@DC&*?GUzodiyu|fN5 ztFT=;_0GUI5gX?CRxH6Myuc(OZ+VQ^1|(aE~`^Pc;(1`o~H< za+D2zg>8bX=h#lyG&h1iRB#sVZU$So_q3*v-XAop<5|t}s}usN-zLa>2_%*V*93M1sTbU&qmAO@(Cx zT0T9^!P>LnIP9DlvBF%~mO-0Eveo$&Us2a96FgjdE0{6pxfZ^RYf__C>4mqC?(d%q z-Zcwm+~&C!c5lM8SomezQ;fQa`*pfgU8TFj8{zY2rgH`~APcX=aqh478KOw;>FeTC z=M-oF7FBXTsy>fGSYzm%0}a5UQgENd)+j+woRgpdT<{q_aD*X=j~ER77w|S|ol*^3 Q+yDRo07*qoM6N<$f_&Xe7ytkO literal 0 HcmV?d00001 diff --git a/web/client/src/sections/quanju/containers/footer/operation/left.js b/web/client/src/sections/quanju/containers/footer/operation/left.js index 86e9b9aa..eb5681e7 100644 --- a/web/client/src/sections/quanju/containers/footer/operation/left.js +++ b/web/client/src/sections/quanju/containers/footer/operation/left.js @@ -1,4 +1,5 @@ import React, { useMemo, useState, useEffect } from 'react'; +import { SearchOutlined } from '@ant-design/icons'; import { Col, Row, Input, Tree } from 'antd' import Module from '../../public/module' @@ -144,21 +145,26 @@ const Left = () => {
- +
+ + +
Date: Mon, 25 Jul 2022 11:28:08 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/actions/auth.js | 2 +- weapp/src/config.js | 2 +- weapp/src/packages/patrolView/index.jsx | 34 +++++++++++++++++++++--- weapp/src/packages/patrolView/index.scss | 8 ++++-- weapp/src/pages/auth/login/login.jsx | 4 +-- weapp/src/pages/user/index.jsx | 2 +- weapp/src/services/api.js | 7 +++-- 7 files changed, 46 insertions(+), 13 deletions(-) diff --git a/weapp/src/actions/auth.js b/weapp/src/actions/auth.js index 5b33a8f2..30fdf382 100644 --- a/weapp/src/actions/auth.js +++ b/weapp/src/actions/auth.js @@ -37,7 +37,7 @@ export const login = (url, data) => { export const logout = (url, data) => { - return request.post(url, data).then(res => { + return request.put(url, data).then(res => { if (res.statusCode == 200 || res.statusCode == 204) { Taro.clearStorage(); return res.data; diff --git a/weapp/src/config.js b/weapp/src/config.js index a50b38d3..71b3443d 100644 --- a/weapp/src/config.js +++ b/weapp/src/config.js @@ -8,7 +8,7 @@ const baseConfig = { }; const development = { - baseUrl: 'https://smartwater.anxinyun.cn/api', + baseUrl: 'https://3024-117-90-36-177.jp.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/patrolView/index.jsx b/weapp/src/packages/patrolView/index.jsx index ed52ad54..db072309 100644 --- a/weapp/src/packages/patrolView/index.jsx +++ b/weapp/src/packages/patrolView/index.jsx @@ -1,9 +1,11 @@ -import React, { useState } from 'react' +import React, { useState, useEffect } from 'react' import Taro, { useDidShow } from '@tarojs/taro' import { View, Picker, Input, Image } from '@tarojs/components' import moment from 'moment' import './index.scss' import NoData from '@/components/no-data/noData' +import request from '@/services/request' +import { getReportList } from '@/services/api'; import chevronDown from '../../static/img/patrolView/chevron-down.png' import searchIcon from '../../static/img/patrolView/search.png' import cardImg from '../../static/img/patrolView/card-img.png' @@ -22,6 +24,8 @@ function Index() { const [num, setNum] = useState(Math.random()) const [systemInfo, setSystemInfo] = useState('') + const userInfo = Taro.getStorageSync('userInfo') || {}; + const data = [ { place: { @@ -34,6 +38,28 @@ function Index() { } ] + function dealError(error) { + Taro.showToast({ + title: error, + icon: 'none', + duration: 1500 + }); + throw new Error(error); + } + useEffect(() => { + request.get(getReportList(), {}, { hideErrorToast: true, hideLoading: true }).then(res => { + if (res.statusCode == 200) { + console.log(res); + setListData(res.data) + return res.data; + } else { + dealError(res.data.message || '请求出错'); + } + }, err => { + dealError(err.message || '请求出错'); + }); + }, []) + useDidShow(() => { let refresh = Taro.getStorageSync('refresh'); // 返回列表需要刷新 if (refresh) { @@ -102,15 +128,15 @@ function Index() { - + { - data && data.length > 0 ? data && data.map((e, index) => { + listData && listData.length > 0 ? listData && listData.map((e, index) => { return ( handleDetail(index)}> - {e.place.name} + {e.road} 填报人: {e.user.name} diff --git a/weapp/src/packages/patrolView/index.scss b/weapp/src/packages/patrolView/index.scss index fc705a70..7de6c587 100644 --- a/weapp/src/packages/patrolView/index.scss +++ b/weapp/src/packages/patrolView/index.scss @@ -2,6 +2,10 @@ page { background-color: #f6f6f6; .type-box { + position: fixed; + top: 0px; + width: 100%; + z-index: 100; background-color: #fff; height: 80px; display: flex; @@ -20,8 +24,8 @@ page { margin: 0 10px; } } + .line { - width: 1px; height: 30px; background-color: #f6f6f6; @@ -88,7 +92,7 @@ page { .cardBox { width: 690rpx; - margin: 50rpx auto; + margin: 40rpx auto; .card-item { position: relative; diff --git a/weapp/src/pages/auth/login/login.jsx b/weapp/src/pages/auth/login/login.jsx index 70779dc8..5f45438f 100644 --- a/weapp/src/pages/auth/login/login.jsx +++ b/weapp/src/pages/auth/login/login.jsx @@ -18,7 +18,7 @@ const LoginPage = (props) => { const [password, setPassword] = useState(''); const doLogin = () => { - login(getLoginUrl(), { username, password, pcode }).then(res => { + login(getLoginUrl(), { phone: username, password }).then(res => { Taro.reLaunch({ url: '/pages/home/index' }); @@ -50,7 +50,7 @@ const LoginPage = (props) => { 登录 - + diff --git a/weapp/src/pages/user/index.jsx b/weapp/src/pages/user/index.jsx index 299a8eec..b1a7009d 100644 --- a/weapp/src/pages/user/index.jsx +++ b/weapp/src/pages/user/index.jsx @@ -36,7 +36,7 @@ const Index = ({ ...props }) => { - {userInfo.displayName} + {userInfo.name} {userInfo.phone} diff --git a/weapp/src/services/api.js b/weapp/src/services/api.js index 08fe03f8..bc0f6aeb 100644 --- a/weapp/src/services/api.js +++ b/weapp/src/services/api.js @@ -1,13 +1,16 @@ export const getLoginUrl = () => { - return `/login`; + return `/wxLogin`; }; - export const getLogoutUrl = () => { return `/logout`; }; +export const getReportList = () => { + return `/report/list`; +}; + //行业查询 export const getIndustryUrl = () => { return `/elec/business/industry` From 2ed26ba452af2ce55631c353d1fec701b03a59d5 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Mon, 25 Jul 2022 13:28:57 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 2 +- weapp/src/packages/patrol/index.scss | 10 +++++----- weapp/src/packages/patrolView/index.jsx | 14 +------------- weapp/src/pages/home/index.jsx | 8 +++++--- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index fa27ad47..36390b54 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -81,7 +81,7 @@ const Index = () => { }, [images]) return ( - + 上报类型 diff --git a/weapp/src/packages/patrol/index.scss b/weapp/src/packages/patrol/index.scss index b7338b0f..83057e4b 100644 --- a/weapp/src/packages/patrol/index.scss +++ b/weapp/src/packages/patrol/index.scss @@ -1,13 +1,12 @@ -.patrol { - height: 100vh; +page { + height: 100%; width: 100vw; background-color: #f6f6f6; - padding-top: 20px; .report-type { height: 96px; background-color: #fff; - margin-bottom: 20px; + margin: 20px auto; display: flex; justify-content: space-between; align-items: center; @@ -53,6 +52,7 @@ .horizontal-line { height: 30px; width: 100%; + border-radius: 5px; display: flex; justify-content: left; align-items: center; @@ -111,6 +111,6 @@ .sub-btn { width: 70%; - margin-top: 100px; + margin: 80px auto; } } \ No newline at end of file diff --git a/weapp/src/packages/patrolView/index.jsx b/weapp/src/packages/patrolView/index.jsx index db072309..04792eea 100644 --- a/weapp/src/packages/patrolView/index.jsx +++ b/weapp/src/packages/patrolView/index.jsx @@ -26,18 +26,6 @@ function Index() { const userInfo = Taro.getStorageSync('userInfo') || {}; - const data = [ - { - place: { - name: '飞尚' - }, - user: { - name: '用户1' - }, - time: '2022-7-1' - } - ] - function dealError(error) { Taro.showToast({ title: error, @@ -47,7 +35,7 @@ function Index() { throw new Error(error); } useEffect(() => { - request.get(getReportList(), {}, { hideErrorToast: true, hideLoading: true }).then(res => { + request.get(getReportList(),{}, { hideErrorToast: true, hideLoading: true }).then(res => { if (res.statusCode == 200) { console.log(res); setListData(res.data) diff --git a/weapp/src/pages/home/index.jsx b/weapp/src/pages/home/index.jsx index 95fa024b..ca1d68ca 100644 --- a/weapp/src/pages/home/index.jsx +++ b/weapp/src/pages/home/index.jsx @@ -4,8 +4,9 @@ import { View } from '@tarojs/components'; import { useIndustry } from '@/actions/business'; import './index.scss'; - const Index = () => { + const userInfo = Taro.getStorageSync('userInfo') || {}; + const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false function toPatrol() { Taro.navigateTo({ @@ -22,8 +23,9 @@ const Index = () => { 巡 查 养 护 - {/* 填报 */} - 查看 + + {isSuperAdmin ? '查看' : '填报'} + );