|
@ -57,6 +57,7 @@ const Index = () => { |
|
|
const [handlePic, setHandlePic] = useState([]) |
|
|
const [handlePic, setHandlePic] = useState([]) |
|
|
const [handlePicPn, setHandlePicPn] = useState([]) |
|
|
const [handlePicPn, setHandlePicPn] = useState([]) |
|
|
const [handleId, setHandleId] = useState([]) |
|
|
const [handleId, setHandleId] = useState([]) |
|
|
|
|
|
const [video, setVideo] = useState('') |
|
|
|
|
|
|
|
|
const prjType = |
|
|
const prjType = |
|
|
isAnomaly ? |
|
|
isAnomaly ? |
|
@ -241,7 +242,7 @@ const Index = () => { |
|
|
]) |
|
|
]) |
|
|
}, [reportType]) |
|
|
}, [reportType]) |
|
|
|
|
|
|
|
|
function report () { |
|
|
function report() { |
|
|
if (!canReport) { return } |
|
|
if (!canReport) { return } |
|
|
if ( |
|
|
if ( |
|
|
(isPatrol && (!projectType || !road)) |
|
|
(isPatrol && (!projectType || !road)) |
|
@ -317,7 +318,7 @@ const Index = () => { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function deleteReport () { |
|
|
function deleteReport() { |
|
|
Taro.showModal({ |
|
|
Taro.showModal({ |
|
|
title: '提示', |
|
|
title: '提示', |
|
|
content: '确定删除吗?', |
|
|
content: '确定删除吗?', |
|
@ -344,7 +345,7 @@ const Index = () => { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function handleInput ({ detail: { value } }, type) { |
|
|
function handleInput({ detail: { value } }, type) { |
|
|
switch (type) { |
|
|
switch (type) { |
|
|
case 'roadSectionStart': |
|
|
case 'roadSectionStart': |
|
|
setRoadSectionStart(value) |
|
|
setRoadSectionStart(value) |
|
@ -379,15 +380,15 @@ const Index = () => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function handleTypeChange (e) { |
|
|
function handleTypeChange(e) { |
|
|
setReportType(e.detail.value) |
|
|
setReportType(e.detail.value) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function handleImgChange (files, operationType, index, type) { |
|
|
function handleImgChange(files, operationType, index, type) { |
|
|
if (operationType === 'remove') { |
|
|
if (operationType === 'remove') { |
|
|
setImg(false) |
|
|
setImg(false) |
|
|
} |
|
|
} |
|
|
function setImg (isAdd, url) { |
|
|
function setImg(isAdd, url) { |
|
|
switch (type) { |
|
|
switch (type) { |
|
|
case 'scenePic': |
|
|
case 'scenePic': |
|
|
let nextImg = sceneImg |
|
|
let nextImg = sceneImg |
|
@ -462,6 +463,7 @@ const Index = () => { |
|
|
default: |
|
|
default: |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
console.log(files, '=============='); |
|
|
for (i; i < files.length; i++) { |
|
|
for (i; i < files.length; i++) { |
|
|
const tempFilePaths = files[i].url |
|
|
const tempFilePaths = files[i].url |
|
|
let token = getState('token') || Taro.getStorageSync('token') |
|
|
let token = getState('token') || Taro.getStorageSync('token') |
|
@ -484,19 +486,19 @@ const Index = () => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function handleImgClick (index, file) { |
|
|
function handleImgClick(index, file) { |
|
|
Taro.previewImage({ |
|
|
Taro.previewImage({ |
|
|
urls: [file.url] // 需要预览的图片http链接列表 |
|
|
urls: [file.url] // 需要预览的图片http链接列表 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
function handleImgClicks (index, file) { |
|
|
function handleImgClicks(index, file) { |
|
|
Taro.previewImage({ |
|
|
Taro.previewImage({ |
|
|
urls: [file] // 需要预览的图片http链接列表 |
|
|
urls: [file] // 需要预览的图片http链接列表 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (!isView) { |
|
|
if (!isView) { |
|
|
let newRoadList = roadList.filter(e => e?.routeName?.match(road)) |
|
|
let newRoadList = roadList.filter(e => e.routeName.match(road)) |
|
|
let codeRoadSel = [] |
|
|
let codeRoadSel = [] |
|
|
if (newRoadList.length && road != '') { |
|
|
if (newRoadList.length && road != '') { |
|
|
newRoadList.forEach((e, index) => { |
|
|
newRoadList.forEach((e, index) => { |
|
@ -511,7 +513,7 @@ const Index = () => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, [road]) |
|
|
}, [road]) |
|
|
function handleOk () { |
|
|
function handleOk() { |
|
|
if (!canReport) { return } |
|
|
if (!canReport) { return } |
|
|
let str = handleCenter.trim() |
|
|
let str = handleCenter.trim() |
|
|
if (!str) { |
|
|
if (!str) { |
|
@ -562,6 +564,36 @@ const Index = () => { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
function addVideo() { |
|
|
|
|
|
wx.chooseMedia({ |
|
|
|
|
|
count: 1, |
|
|
|
|
|
mediaType: ['video'], |
|
|
|
|
|
sourceType: ['album', 'camera'], |
|
|
|
|
|
maxDuration: 15, |
|
|
|
|
|
camera: 'back', |
|
|
|
|
|
success(res) { |
|
|
|
|
|
console.log(res, 'res'); |
|
|
|
|
|
const tempFilePaths = res.tempFiles[0].tempFilePath |
|
|
|
|
|
let token = getState('token') || Taro.getStorageSync('token') |
|
|
|
|
|
Taro.uploadFile({ |
|
|
|
|
|
url: `${baseUrl}${postImage()}?token=${token}`, |
|
|
|
|
|
filePath: tempFilePaths, |
|
|
|
|
|
name: 'file', |
|
|
|
|
|
success: (ress) => { |
|
|
|
|
|
console.log(ress, '上传成功'); |
|
|
|
|
|
Taro.hideLoading(); |
|
|
|
|
|
if (ress.statusCode == 200) { |
|
|
|
|
|
setVideo(res.tempFiles[0].tempFilePath) |
|
|
|
|
|
} else { |
|
|
|
|
|
Taro.showToast({ title: '上传失败,请重试', icon: 'error' }) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
console.log(video, 'video'); |
|
|
|
|
|
console.log(scenePic, 'tupia'); |
|
|
return ( |
|
|
return ( |
|
|
<View className='patrol'> |
|
|
<View className='patrol'> |
|
|
{/* { |
|
|
{/* { |
|
@ -600,7 +632,6 @@ const Index = () => { |
|
|
onInput={setProjectType} |
|
|
onInput={setProjectType} |
|
|
selector={prjTypeSelector} |
|
|
selector={prjTypeSelector} |
|
|
isView={isView} |
|
|
isView={isView} |
|
|
onlySelect={true} |
|
|
|
|
|
/> : '' |
|
|
/> : '' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -610,9 +641,7 @@ const Index = () => { |
|
|
title='反馈类型:' |
|
|
title='反馈类型:' |
|
|
placeholder='请选择反馈类型' |
|
|
placeholder='请选择反馈类型' |
|
|
value={projectType} |
|
|
value={projectType} |
|
|
onInput={(v) => { |
|
|
onInput={setProjectType} |
|
|
setProjectType(v) |
|
|
|
|
|
}} |
|
|
|
|
|
selector={prjTypeSelector} |
|
|
selector={prjTypeSelector} |
|
|
isView={isView} |
|
|
isView={isView} |
|
|
onlySelect={true} |
|
|
onlySelect={true} |
|
@ -861,6 +890,20 @@ const Index = () => { |
|
|
} |
|
|
} |
|
|
</View> |
|
|
</View> |
|
|
} |
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
video.length ? <Video |
|
|
|
|
|
style={{ width: '90%', marginLeft: '-45%', left: '50%', marginBottom: 20 }} |
|
|
|
|
|
src={video} |
|
|
|
|
|
poster='../../static/img/date.png' |
|
|
|
|
|
initialTime={0} |
|
|
|
|
|
controls={true} |
|
|
|
|
|
autoplay={false} |
|
|
|
|
|
loop={false} |
|
|
|
|
|
muted={false} |
|
|
|
|
|
/> : '' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
<AtButton type='secondary' size='small' onClick={addVideo}>添加视频</AtButton> |
|
|
{ |
|
|
{ |
|
|
isView ? |
|
|
isView ? |
|
|
isSuperAdmin && |
|
|
isSuperAdmin && |
|
|