diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx
index 440e3c26..fcec62b9 100644
--- a/weapp/src/packages/patrol/index.jsx
+++ b/weapp/src/packages/patrol/index.jsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import Taro, { useRouter } from '@tarojs/taro';
import { View, RadioGroup, Radio, Image, Input, Picker, Video } from '@tarojs/components';
-import { AtButton, AtTextarea, AtImagePicker } from 'taro-ui';
+import { AtButton, AtTextarea, AtImagePicker, AtMessage, AtIcon } from 'taro-ui';
import InputPicker from '../components/inputPicker';
import InputPickers from '../components/inputPickers';
import VideoUpload from '../../components/uploads'
@@ -58,6 +58,7 @@ const Index = () => {
const [handlePicPn, setHandlePicPn] = useState([])
const [handleId, setHandleId] = useState([])
const [video, setVideo] = useState('')
+ const [videoqn, setVideoqn] = useState([])
const prjType =
isAnomaly ?
@@ -145,6 +146,7 @@ const Index = () => {
setConserveUnderwayPic(data.conserveUnderwayPic ? data.conserveUnderwayPic.map(item => ({ url: imgUrl + item })) : [])
setConserveAfterPic(data.conserveAfterPic ? data.conserveAfterPic.map(item => ({ url: imgUrl + item })) : [])
setHandleId(data.id)
+ setVideo(imgUrl + data.videoUrl[0])
if (data.handleContent) {
setHandleCenter(data.handleContent)
}
@@ -284,6 +286,7 @@ const Index = () => {
codeRoad,
projectName,
handleState: isAnomaly ? '待处理' : undefined,
+ videoUrl: videoqn
}
if (reportType === 'patrol' || isAnomaly || isRoad) {
data['scenePic'] = sceneImg
@@ -572,28 +575,41 @@ const Index = () => {
maxDuration: 15,
camera: 'back',
success(res) {
- console.log(res,'上传的视频');
const tempFilePaths = res.tempFiles[0].tempFilePath
-
- setVideo(res.tempFiles[0].tempFilePath)
let token = getState('token') || Taro.getStorageSync('token')
- Taro.uploadFile({
- url: `${baseUrl}${postImage()}?token=${token}`,
- filePath: tempFilePaths,
- name: 'file',
- success: (ress) => {
- Taro.hideLoading();
- if (ress.statusCode == 200) {
- // setVideo(res.tempFiles[0].tempFilePath)
- } else {
- Taro.showToast({ title: '上传失败,请重试', icon: 'error' })
+ if (res.tempFiles[0].duration < 15) {
+ Taro.showLoading({
+ title: '视频上传中'
+ })
+ Taro.uploadFile({
+ url: `${baseUrl}${postImage()}?token=${token}`,
+ filePath: tempFilePaths,
+ name: 'file',
+ success: (ress) => {
+ Taro.hideLoading();
+ if (ress.statusCode == 200) {
+ setVideo(res.tempFiles[0].tempFilePath)
+ let videoqns = videoqn
+ videoqns.push(JSON.parse(ress.data).key)
+ setVideoqn(videoqns)
+ } else {
+ Taro.showToast({ title: '上传失败,请重试', icon: 'error' })
+ }
+ },
+ fail: (res) => {
+ Taro.hideLoading();
}
- }
- });
+ });
+ } else {
+ Taro.atMessage({
+ 'message': '请传15秒内的视频!',
+ 'type': 'error',
+ })
+ }
+
}
})
}
- console.log(isView, '============');
return (
{/* {
@@ -894,20 +910,24 @@ const Index = () => {
videoShow ? '' :
{
- video != '' ? : ''
+ video != '' ?
+ { setVideo('') }} style={{ position: 'absolute', zIndex: '999', right: '70rpx', top: '30rpx' }}>
+
+
+ : ''
}
{
- !isView ? 添加视频 : ''
+ !isView && video == '' ? 添加视频 : ''
}
@@ -952,6 +972,7 @@ const Index = () => {
: ''
}
+
)
}