123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. import React from 'react';
  2. import Map from '@/components/map';
  3. import Page from '@/layouts/index';
  4. import { Button, Field, Cell, CellGroup, Row, Col, Image } from '@antmjs/vantui';
  5. import mapIcon from '@/assets/icons/marker.png';
  6. import LocType from '@/components/LocType';
  7. import { View, Input } from '@tarojs/components';
  8. import Uploader from '@/components/Uploader/index';
  9. import ScrollPage from '@/components/ScrollPage/index';
  10. import icon from '@/assets/icons/box.png';
  11. import Choice from "./components/Choice";
  12. export default (props) => {
  13. const {
  14. issue,
  15. readOnly,
  16. showOrg,
  17. showExpireDate,
  18. renderFields,
  19. renderAction,
  20. } = props;
  21. const [inx, setInx] = React.useState(-1);
  22. const num = 1;
  23. const count = 15;
  24. const [formData, setFormData] = React.useState({
  25. typeId: undefined,
  26. typeName: undefined,
  27. locId: undefined,
  28. locName: undefined,
  29. location: undefined,
  30. addr: undefined,
  31. content: undefined,
  32. attachList: [],
  33. });
  34. const [showLocType, setShowLocType] = React.useState(false);
  35. const [evaluationPage, setEvaluationPage] = React.useState(true);
  36. const [evaluationPage2, setEvaluationPage2] = React.useState(false);
  37. const [evaluationPage3, setEvaluationPage3] = React.useState(false);
  38. const [scrollPage, setScrollPage] = React.useState(false);
  39. const onLocTypeChange = (_, it) => {
  40. setFormData({
  41. ...formData,
  42. locId: it.typeId,
  43. locName: it.name,
  44. });
  45. setShowLocType(false);
  46. }
  47. const setFieldChange = (field, value) => {
  48. setFormData({
  49. ...formData,
  50. [field]: value,
  51. })
  52. }
  53. const onChangePage = () => {
  54. setEvaluationPage(false);
  55. setEvaluationPage2(true);
  56. }
  57. const onChangePage2 = () => {
  58. setEvaluationPage2(false);
  59. setEvaluationPage3(true);
  60. }
  61. const onChangePage3 = () => {
  62. setEvaluationPage3(false);
  63. setScrollPage(true);
  64. }
  65. return (
  66. <>
  67. <Page>
  68. {
  69. evaluationPage && (<>
  70. <LocType
  71. show={showLocType}
  72. value={formData.addr}
  73. onCancel={() => setShowLocType(false)}
  74. onChange={onLocTypeChange}
  75. />
  76. <Map location={formData.location} />
  77. <CellGroup>
  78. <Cell
  79. title="点位"
  80. isLink
  81. value={formData.locName}
  82. onClick={() => !readOnly && setShowLocType(true)}
  83. />
  84. <Field
  85. placeholder="请输入地址"
  86. value={formData.addr}
  87. leftIcon={mapIcon}
  88. // readonly={readOnly}
  89. // onChange={e => setFieldChange('addr', e.detail)}
  90. />
  91. </CellGroup>
  92. <CellGroup style={{ padding: 'var(--main-space)', position: 'relative', top: '330px' }}>
  93. <Button
  94. type="primary"
  95. block
  96. onClick={onChangePage}
  97. >
  98. 下一步
  99. </Button>
  100. </CellGroup>
  101. </>)
  102. }
  103. {
  104. evaluationPage2 && (
  105. <View style={{ flex: '1' }}>
  106. <Choice />
  107. <CellGroup>
  108. <Cell title="评测标准" border={false} size="large" />
  109. <Row>
  110. <Col offset="2" span="20">
  111. <Cell
  112. title="
  113. 在显著位置看到市民公约或居民公约展示"
  114. border={false}
  115. style={{ paddingTop: '0px' }}
  116. />
  117. </Col>
  118. </Row>
  119. </CellGroup>
  120. <CellGroup style={{ marginTop: '20px' }}>
  121. <Cell title="拍照" border={false} size="large" />
  122. <Cell
  123. renderTitle={
  124. <Uploader
  125. value={formData.attachList}
  126. disabled={readOnly}
  127. onChange={e => setFieldChange('attachList', e)}
  128. />
  129. }
  130. />
  131. </CellGroup>
  132. <View style={{ position: 'relative', marginBottom: '20px', flex: 'none' }}>
  133. <View style={{ position: 'absolute', width: '100%', top: '100px' }}>
  134. <CellGroup style={{ marginTop: '20px', padding: 'var(--main-space)' }}>
  135. <Button
  136. type="primary"
  137. block
  138. onClick={onChangePage2}
  139. >
  140. 下一题
  141. </Button>
  142. </CellGroup>
  143. <CellGroup>
  144. <Cell
  145. style={{ textAlign: 'right' }}
  146. >
  147. <Image src={icon} width="25px" height="25px"
  148. style={{ verticalAlign: 'middle', marginRight: '10px' }}
  149. />
  150. {num + '/' + count}
  151. </Cell>
  152. </CellGroup>
  153. </View>
  154. </View>
  155. </View>)
  156. }
  157. {
  158. evaluationPage3 && (
  159. <ScrollPage>
  160. <CellGroup>
  161. <Cell title="测评内容" border={false} size="large" style={{ paddingBottom: '0px' }} />
  162. <View style={{ padding: 'var(--main-space)', paddingTop: '0px' }}>
  163. <View style={{ padding: 'var(--main-space)', fontSize: '14px', color: 'var(--main-bg-color)' }}>
  164. 垃圾乱扔,乱张贴(具体标准),测评结果:<Input type="text" style={{ width: '45px', display: 'inline-block', verticalAlign: 'middle' }} />处。(此处填写数字)
  165. </View>
  166. </View>
  167. </CellGroup>
  168. <CellGroup>
  169. <Cell title="评测标准" border={false} size="large" />
  170. <Row>
  171. <Col offset="2" span="20">
  172. <Cell
  173. title="
  174. (1)每看到1处垃圾乱扔(1平方米以内的垃圾算作1处)计为1处;
  175. (2)每看到1处乱张贴乱涂写乱刻画《1平米内出现的算作1 处在统一设置的信息栏中张贴的小广告不算作失分点)计为1处;
  176. (3)每看到建筑物外立面的1处大面积破损污损《高3米以上、宽2米以上)计为1处。"
  177. border={false}
  178. style={{ paddingTop: '0px' }}
  179. />
  180. </Col>
  181. </Row>
  182. </CellGroup>
  183. <CellGroup style={{ marginTop: '20px' }}>
  184. <Cell title="拍照" border={false} size="large" />
  185. <Cell
  186. renderTitle={
  187. <Uploader
  188. value={formData.attachList}
  189. disabled={readOnly}
  190. onChange={e => setFieldChange('attachList', e)}
  191. />
  192. }
  193. />
  194. </CellGroup>
  195. <CellGroup style={{ marginTop: '20px', padding: 'var(--main-space)' }}>
  196. <Row>
  197. <Col offset="1" span="10">
  198. <Button
  199. type="primary"
  200. block
  201. >
  202. 上一题
  203. </Button>
  204. </Col>
  205. <Col offset="2" span="10">
  206. <Button
  207. type="primary"
  208. block
  209. onClick={onChangePage3}
  210. >
  211. 下一题
  212. </Button>
  213. </Col>
  214. </Row>
  215. </CellGroup>
  216. </ScrollPage>)
  217. }
  218. </Page >
  219. <View>
  220. {
  221. scrollPage && (
  222. <ScrollPage />
  223. )
  224. }
  225. </View>
  226. </>
  227. )
  228. }