Browse Source

(*)添加视频

dev
ww664853070 2 years ago
parent
commit
40a49100b2
  1. 37
      weapp/src/packages/patrol/index.jsx

37
weapp/src/packages/patrol/index.jsx

@ -571,7 +571,10 @@ const Index = () => {
maxDuration: 15, maxDuration: 15,
camera: 'back', camera: 'back',
success(res) { success(res) {
console.log(res,'上传的视频');
const tempFilePaths = res.tempFiles[0].tempFilePath const tempFilePaths = res.tempFiles[0].tempFilePath
setVideo(res.tempFiles[0].tempFilePath)
let token = getState('token') || Taro.getStorageSync('token') let token = getState('token') || Taro.getStorageSync('token')
Taro.uploadFile({ Taro.uploadFile({
url: `${baseUrl}${postImage()}?token=${token}`, url: `${baseUrl}${postImage()}?token=${token}`,
@ -580,7 +583,7 @@ const Index = () => {
success: (ress) => { success: (ress) => {
Taro.hideLoading(); Taro.hideLoading();
if (ress.statusCode == 200) { if (ress.statusCode == 200) {
setVideo(res.tempFiles[0].tempFilePath) // setVideo(res.tempFiles[0].tempFilePath)
} else { } else {
Taro.showToast({ title: '上传失败,请重试', icon: 'error' }) Taro.showToast({ title: '上传失败,请重试', icon: 'error' })
} }
@ -589,6 +592,7 @@ const Index = () => {
} }
}) })
} }
console.log(isView, '============');
return ( return (
<View className='patrol'> <View className='patrol'>
{/* { {/* {
@ -885,23 +889,28 @@ const Index = () => {
} }
</View> </View>
} }
{/* { {
videoShow ? '' : videoShow ? '' :
<view> <view>
<Video {
style={{ width: '90%', marginLeft: '-45%', left: '50%', marginBottom: 20 }} video != '' ? <Video
src={video} style={{ width: '90%', marginLeft: '-45%', left: '50%', marginBottom: 20 }}
poster='../../static/img/date.png' src={video}
initialTime={0} poster='../../static/img/date.png'
controls={true} initialTime={0}
autoplay={false} controls={true}
loop={false} autoplay={false}
muted={false} loop={false}
/> muted={false}
/> : ''
}
{
!isView ? <AtButton type='secondary' size='small' onClick={addVideo}>添加视频</AtButton> : ''
}
<AtButton type='secondary' size='small' onClick={addVideo}>添加视频</AtButton>
</view> </view>
} */} }
{ {
isView ? isView ?
isSuperAdmin && isSuperAdmin &&

Loading…
Cancel
Save