Browse Source

动态修改上报页的标题

dev
巴林闲侠 2 years ago
parent
commit
2b7ab08d8c
  1. 49
      weapp/src/packages/patrol/index.jsx
  2. 8
      weapp/src/packages/patrolView/index.jsx

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

@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import Taro, { useRouter } from '@tarojs/taro'; import Taro, { useRouter } from '@tarojs/taro';
import { View, RadioGroup, Radio, Image, Input, Picker } from '@tarojs/components'; import { View, RadioGroup, Radio, Image, Input, Picker, Video } from '@tarojs/components';
import { AtButton, AtTextarea, AtImagePicker } from 'taro-ui'; import { AtButton, AtTextarea, AtImagePicker } from 'taro-ui';
import InputPicker from '../components/inputPicker'; import InputPicker from '../components/inputPicker';
import VideoUpload from '../../components/uploads' import VideoUpload from '../../components/uploads'
@ -75,6 +75,12 @@ const Index = () => {
]) ])
useEffect(() => { useEffect(() => {
if (isRoad) {
Taro.setNavigationBarTitle({ title: '在建道路' })
} if (isAnomaly) {
Taro.setNavigationBarTitle({ title: '异常反馈' })
}
if (isView) { // if (isView) { //
Taro.showLoading({ title: '加载中' }) Taro.showLoading({ title: '加载中' })
request.get(getReportDetail(router.params.id)).then(res => { request.get(getReportDetail(router.params.id)).then(res => {
@ -558,17 +564,46 @@ const Index = () => {
onImageClick={handleImgClick} onImageClick={handleImgClick}
/> />
} }
{/* <VideoUpload isUpload={true} />
<AtButton onClick={() => { {/* <Video
Taro.chooseVideo({ id='video'
sourceType: ['album', 'camera'], src='https://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
maxDuration: 60, poster='../../static/img/date.png'
initialTime={0}
controls={true}
autoplay={false}
loop={false}
muted={false}
/> */}
{/* <AtButton onClick={() => {
Taro.chooseMedia({
sourceType: ['album', 'camera'], mediaType: ['image', 'video'],
camera: 'back', camera: 'back',
success: function (res) { success: function (res) {
console.log(res.tempFilePath) console.log(res.tempFilePath)
Taro.showLoading({ title: '上传中' })
const tempFilePaths = res.tempFilePath
let token = getState('token') || Taro.getStorageSync('token')
Taro.uploadFile({
url: `${baseUrl}${postImage()}?token=${token}`,
filePath: tempFilePaths,
name: 'file',
success: (res) => {
console.log(res);
Taro.hideLoading();
if (res.statusCode == 200) {
// setImg(true, JSON.parse(res.data).key)
} else {
Taro.showToast({ title: '上传失败,请重试', icon: 'error' })
}
}
});
} }
}) })
}}>v</AtButton> */} }}>
添加视频
</AtButton> */}
</View> : </View> :
<View className='conserve-img'> <View className='conserve-img'>
养护图片: 养护图片:

8
weapp/src/packages/patrolView/index.jsx

@ -33,6 +33,14 @@ function Index () {
const limit = 10 const limit = 10
useEffect(() => {
if (isRoad) {
Taro.setNavigationBarTitle({ title: '在建道路' })
} if (isAnomaly) {
Taro.setNavigationBarTitle({ title: '异常反馈' })
}
}, [])
useEffect(() => { useEffect(() => {
setPage(0) setPage(0)
setNum(Math.random()) setNum(Math.random())

Loading…
Cancel
Save