Commit d70f6668 authored by zhangkaixuan11's avatar zhangkaixuan11

上传下

parent 6c2cefb8
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<application <application
tools:replace="android:allowBackup" tools:replace="android:allowBackup"
android:name=".MainApplication" android:name=".MainApplication"
...@@ -34,7 +36,7 @@ ...@@ -34,7 +36,7 @@
<data android:scheme="fhstudents" android:host="fhstudents"/> <data android:scheme="fhstudents" android:host="fhstudents"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> <activity android:name="com.fa cebook.react.devsupport.DevSettingsActivity" />
<activity android:name="com.ahmedadeltito.photoeditor.PhotoEditorActivity" /> <activity android:name="com.ahmedadeltito.photoeditor.PhotoEditorActivity" />
<activity android:name="com.yalantis.ucrop.UCropActivity" /> <activity android:name="com.yalantis.ucrop.UCropActivity" />
......
...@@ -276,15 +276,17 @@ let LiveCSS = StyleSheet.create({ ...@@ -276,15 +276,17 @@ let LiveCSS = StyleSheet.create({
width: Constants.unitWidth * 160 width: Constants.unitWidth * 160
}, },
videoRow: { videoRow: {
height: Constants.unitWidth * 0, height: Constants.unitWidth * 86,
backgroundColor: '#21232A', backgroundColor: '#008A6A',
flexDirection: 'row' flexDirection: 'row'
}, },
wbWrapper: { wbWrapper: {
backgroundColor: '#0E5C4A', backgroundColor: '#0E5C4A',
// background:'black', // background:'black',
width: Constants.height, width: Constants.height,
height: Constants.width - Constants.statusBarHeight - Constants.unitWidth * 40, height: Constants.width - Constants.statusBarHeight - Constants.unitWidth * 0,
// height: Constants.width - Constants.statusBarHeight - Constants.unitWidth * s86,
// width: Constants.unitWidth * 400, // width: Constants.unitWidth * 400,
// height: Constants.unitWidth * 300, // height: Constants.unitWidth * 300,
position: 'absolute', position: 'absolute',
...@@ -415,7 +417,7 @@ let LiveCSS = StyleSheet.create({ ...@@ -415,7 +417,7 @@ let LiveCSS = StyleSheet.create({
top: Constants.unitWidth * 8, top: Constants.unitWidth * 8,
}, },
toolbar: { toolbar: {
backgroundColor: '#0E5C4A', // backgroundColor: '#0E5C4A',
flex: 1, flex: 1,
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
......
...@@ -54,6 +54,8 @@ var LoginCSS = StyleSheet.create( ...@@ -54,6 +54,8 @@ var LoginCSS = StyleSheet.create(
fontFamily: 'PingFangSC-Regular', fontFamily: 'PingFangSC-Regular',
fontSize: Constants.baseFontSize * 0.933, fontSize: Constants.baseFontSize * 0.933,
height: Constants.unitWidth * 36, height: Constants.unitWidth * 36,
// backgroundColor:'red',
padding:0,
flex: 1, flex: 1,
color: '#333333' color: '#333333'
}, },
......
...@@ -8095,6 +8095,11 @@ ...@@ -8095,6 +8095,11 @@
"nullthrows": "^1.1.1" "nullthrows": "^1.1.1"
} }
}, },
"react-native-device-info": {
"version": "9.0.2",
"resolved": "https://registry.npmmirror.com/react-native-device-info/-/react-native-device-info-9.0.2.tgz",
"integrity": "sha512-+IfYZ/OuKjnFf7SFfgIzEqynSeFngrIHc5KgHUIfXusLDXIFJ+LhRBCD7skqnraHrfmESUOMjLbNcvy4SVdwSA=="
},
"react-native-document-picker": { "react-native-document-picker": {
"version": "8.1.0", "version": "8.1.0",
"resolved": "https://registry.npmmirror.com/react-native-document-picker/-/react-native-document-picker-8.1.0.tgz", "resolved": "https://registry.npmmirror.com/react-native-document-picker/-/react-native-document-picker-8.1.0.tgz",
......
...@@ -175,17 +175,17 @@ export default class Login extends Component { ...@@ -175,17 +175,17 @@ export default class Login extends Component {
loginWithPassword = () => { loginWithPassword = () => {
if (this.state.canSubmit) { if (this.state.canSubmit) {
// alert(1) // alert(1)
// if (this.state.rememberPwd) { if (this.state.rememberPwd) {
// Constants.storeData('loginInfo', JSON.stringify({ Constants.storeData('loginInfo', JSON.stringify({
// mobile: this.state.mobile, mobile: this.state.mobile,
// password: this.state.password password: this.state.password
// })); }));
// } else { } else {
// Constants.storeData('loginInfo', JSON.stringify({ Constants.storeData('loginInfo', JSON.stringify({
// mobile: '', mobile: '',
// password: '' password: ''
// })); }));
// } }
Constants.postJSON(Api.loginWithPassword({ Constants.postJSON(Api.loginWithPassword({
userName: this.state.mobile, userName: this.state.mobile,
password: md5(this.state.password), password: md5(this.state.password),
...@@ -329,7 +329,7 @@ export default class Login extends Component { ...@@ -329,7 +329,7 @@ export default class Login extends Component {
</View> </View>
{/* <Image source={require('../../images/common/jiantouba.png')} style={LoginCSS.jiantou}/> */} {/* <Image source={require('../../images/common/jiantouba.png')} style={LoginCSS.jiantou}/> */}
<TextInput maxLength={11} allowFontScaling={false} keyboardType="phone-pad" <TextInput maxLength={11} allowFontScaling={false} keyboardType="phone-pad"
placeholderTextColor="#919191" placeholder="请输入手机号" placeholderTextColor="#919191" placeholder="请输入号"
style={LoginCSS.mobile} onChangeText={(text) => { style={LoginCSS.mobile} onChangeText={(text) => {
this.setState({ this.setState({
mobile: text mobile: text
......
...@@ -25,11 +25,11 @@ export default class Rush extends Component { ...@@ -25,11 +25,11 @@ export default class Rush extends Component {
shouldComponentUpdate(nextProps, nextState){ shouldComponentUpdate(nextProps, nextState){
// console.log('hello', nextProps, nextState); // console.log('hello', nextProps, nextState);
if (this.state.max !== nextProps.rushMax || this.state.rushing !== nextProps.rushing) { if ( this.state.rushing !== nextProps.rushing) {
this.setState({ this.setState({
max: nextProps.rushMax, max: nextProps.rushMax,
currentSec: nextProps.rushMax, currentSec: nextProps.rushMax,
rushing: nextProps.rushing, rushing: nextProps.rushing,
answerStu: nextProps.answerStu answerStu: nextProps.answerStu
}); });
if (this.timer) { if (this.timer) {
......
import React, { Component } from 'react'; import React, { Component ,useState, useEffect} from 'react';
import { View, Modal, FlatList, Text, Image, ScrollView, TextInput, TouchableHighlight, Linking, Alert } from 'react-native'; import { View, Modal, FlatList, Text, Image, ScrollView, TextInput, TouchableHighlight, Linking, Alert } from 'react-native';
import Button from 'react-native-button'; import Button from 'react-native-button';
import Constants from '../../../Constants'; import Constants from '../../../Constants';
...@@ -17,6 +17,55 @@ import ImageShow from '../imageShow' ...@@ -17,6 +17,55 @@ import ImageShow from '../imageShow'
let timeer; let timeer;
import moment from 'moment'; import moment from 'moment';
let getStrTime = (totalTime, needHour) => {
// let totalTime = this.state.whoosh.getDuration();
totalTime = Math.ceil(totalTime);
let totalMin = parseInt(totalTime / 60); //总分钟数
let totalSec = totalTime - totalMin * 60; //秒钟数并判断前缀是否 + '0'
totalSec = totalSec > 9 ? totalSec : '0' + totalSec;
if (needHour) {
let hour = parseInt(totalTime / 3600);
totalMin = parseInt((totalTime - hour * 3600) / 60);
hour = hour > 9 ? hour : '0' + hour;
totalMin = totalMin > 9 ? totalMin : '0' + totalMin;
return hour + ':' + totalMin + ':' + totalSec;
}
return totalMin + ':' + totalSec
// this.setState({
// maximumValue: totalTime,
// })
}
function SurplusTime(state) {
const [count, setCount] = useState('00:00:00');
let d1 = new Date(moment(state.workDetailObj.closeTime).format()).getTime();
let d2 ;
useEffect(() => {
let id = setInterval(() => {
// console.log(state.workDetailObj,d1,Date.now(),d1 - Date.now())
// setCount((prevCount) => prevCount + 1); // <= here
d2 = Date.now()
if(d1 > d2 ){
setCount(getStrTime((d1 - d2) / 1000, true))
}else{
setCount('00:00:00')
}
}, 1000);
return () => clearInterval(id);
}, []);
return (
<View>
{state.workDetailObj.sepStatus != 70 &&
<Text style={{ textAlign: 'center', lineHeight: Constants.unitWidth * 40, }}>剩余时间:{count}</Text>
}
</View>
);
}
export default class Index extends Component { export default class Index extends Component {
constructor(props) { constructor(props) {
...@@ -70,16 +119,16 @@ export default class Index extends Component { ...@@ -70,16 +119,16 @@ export default class Index extends Component {
console.log(this.state.workDetailObj.closeTime, d1, d2, 'newDate') console.log(this.state.workDetailObj.closeTime, d1, d2, 'newDate')
console.log(moment(this.state.workDetailObj.closeTime).format(), 'moment') console.log(moment(this.state.workDetailObj.closeTime).format(), 'moment')
if (d1 > d2 && this.state.workDetailObj.sepStatus != 70) { if (d1 > d2 && this.state.workDetailObj.sepStatus != 70) {
timeer = setInterval(e => { // timeer = setInterval(e => {
this.setState({ // this.setState({
surplusTimeStr: this.getStrTime((d1 - Date.now()) / 1000) // surplusTimeStr: this.getStrTime((d1 - Date.now()) / 1000, true)
}) // })
// this.getStrTime(d1 - d2) // // this.getStrTime(d1 - d2)
}, 1000) // }, 1000)
} else { } else {
clearInterval(timeer) clearInterval(timeer)
this.setState({ this.setState({
surplusTimeStr: this.getStrTime(0), // surplusTimeStr: this.getStrTime(0),
canSubMit: false, canSubMit: false,
}) })
} }
...@@ -124,7 +173,7 @@ export default class Index extends Component { ...@@ -124,7 +173,7 @@ export default class Index extends Component {
let detailLinkList = mediaList.filter(e => { let detailLinkList = mediaList.filter(e => {
return e.mediaType == 5 return e.mediaType == 5
}) })
this.setState({ this.setState({
detailAudioList, detailAudioList,
detailImgList, detailImgList,
...@@ -308,18 +357,7 @@ export default class Index extends Component { ...@@ -308,18 +357,7 @@ export default class Index extends Component {
}) })
return res return res
} }
getStrTime = (totalTime) => {
// let totalTime = this.state.whoosh.getDuration();
totalTime = Math.ceil(totalTime);
let totalMin = parseInt(totalTime / 60); //总分钟数
let totalSec = totalTime - totalMin * 60; //秒钟数并判断前缀是否 + '0'
totalSec = totalSec > 9 ? totalSec : '0' + totalSec;
return totalMin + ':' + totalSec
// this.setState({
// maximumValue: totalTime,
// })
}
// 请求录音授权 // 请求录音授权
getAudioAuthorize() { getAudioAuthorize() {
AudioRecorder.requestAuthorization() AudioRecorder.requestAuthorization()
...@@ -411,20 +449,30 @@ export default class Index extends Component { ...@@ -411,20 +449,30 @@ export default class Index extends Component {
} }
uploadAudio = () => { uploadAudio = () => {
let downloadDest = 'file://' + this.state.audioPath let downloadDest = 'file://' + this.state.audioPath
// let pathList = this.state.audioPath
Constants.uploadFile(Api.uploadFile({ Constants.uploadFile(Api.uploadFile({
file: downloadDest, file: downloadDest,
folder: 'student', folder: 'student',
name: 'acc' name: `quick_audio_${new Date().getTime()}.aac`,
})).then((response) => { })).then((response) => {
return response.json() return response.json()
}).then(data => { }).then(data => {
console.log('save uploadAudio', JSON.stringify(data)); console.log('save uploadAudio', JSON.stringify(data));
let AudioList = this.state.pushAudioList
// setTimeout(() => { data.data.fileList.forEach(item => {
// this.setState({ AudioList.push({
// webViewBoard:false mediaUrl: data.data.domain + item.key,
// }) fileSize: item.fileSize,
// }); title: item.fileName,
// 媒体类型 1:图片 2:语音 3:视频 4:文件
mediaType: 2
})
})
this.setState({
pushAudioList: AudioList,
showActionSheet: false
})
}).catch(error => { }).catch(error => {
console.log('save image error', error) console.log('save image error', error)
}); });
...@@ -528,7 +576,10 @@ export default class Index extends Component { ...@@ -528,7 +576,10 @@ export default class Index extends Component {
} }
}; };
submitHomeWork = () => { submitHomeWork = () => {
if (!this.state.note) return; if (!this.state.note) {
Alert.alert('请输入回答')
return
};
console.log( console.log(
{ {
sepId: this.state.sepId, sepId: this.state.sepId,
...@@ -570,7 +621,7 @@ export default class Index extends Component { ...@@ -570,7 +621,7 @@ export default class Index extends Component {
{!!this.state.workDetailObj && {!!this.state.workDetailObj &&
<View> <View>
<View style={homeWork.downTime}> <View style={homeWork.downTime}>
<Text style={{ textAlign: 'center', lineHeight: Constants.unitWidth * 40, }}>剩余时间:{this.state.surplusTimeStr}</Text> <SurplusTime workDetailObj= {this.state.workDetailObj}></SurplusTime>
</View> </View>
<View style={homeWork.taskMainWarp}> <View style={homeWork.taskMainWarp}>
<View style={homeWork.taskMain}> <View style={homeWork.taskMain}>
...@@ -708,7 +759,7 @@ export default class Index extends Component { ...@@ -708,7 +759,7 @@ export default class Index extends Component {
</ScrollView> </ScrollView>
</View>{ </View>{
this.state.canSubMit && this.state.canSubMit &&
<View style={{ paddingTop: 10, display: 'flex', flexDirection: 'row', }}> <View style={{ display: 'flex', flexDirection: 'row', height: Constants.unitWidth * 50, alignItems:'center',justifyContent:'center', }}>
<View style={{ width: '50%', height: Constants.unitWidth * 40, display: 'flex', flexDirection: 'row', alignItems: 'center' }}> <View style={{ width: '50%', height: Constants.unitWidth * 40, display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
<View style={{ height: Constants.unitWidth * 30, width: Constants.unitWidth * 30, marginLeft: 30 }}> <View style={{ height: Constants.unitWidth * 30, width: Constants.unitWidth * 30, marginLeft: 30 }}>
<Button onPress={() => { <Button onPress={() => {
...@@ -750,8 +801,11 @@ export default class Index extends Component { ...@@ -750,8 +801,11 @@ export default class Index extends Component {
</View> </View>
</View> </View>
<RNModal transparent={true} <RNModal transparent={true}
statusBarTranslucent={true}
animationType="slide" animationType="slide"
visible={this.state.showActionSheet} visible={this.state.showActionSheet}
onRequestClose={() => this.setState({ showActionSheet: false })}
onBackdropPress={() => { alert(1) }}
style={{ style={{
margin: 0, alignItems: 'center', margin: 0, alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
...@@ -759,7 +813,7 @@ export default class Index extends Component { ...@@ -759,7 +813,7 @@ export default class Index extends Component {
> >
<TouchableHighlight <TouchableHighlight
style={{ style={{
backgroundColor: 'rgba(0, 0, 0, 0.5)', backgroundColor: 'rgba(0, 0, 0, 0.4)',
width: Constants.height, width: Constants.height,
height: Constants.width, height: Constants.width,
display: 'flex', display: 'flex',
...@@ -771,20 +825,21 @@ export default class Index extends Component { ...@@ -771,20 +825,21 @@ export default class Index extends Component {
showActionSheet: false showActionSheet: false
}) })
}} }}
underlayColor="rgba(255, 255, 255, 0)" underlayColor="rgba(0, 0, 0, 0.4)"
> >
<View style={{ <View style={{
width: Constants.unitWidth * 424, width: Constants.unitWidth * 424,
height: Constants.unitWidth * 312, height: Constants.unitWidth * 312,
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
position:'relative',
zIndex:10,
}} > }} >
{!this.state.recording && !this.state.stop && {!this.state.recording && !this.state.stop &&
<View style={{ <View style={{
height: Constants.unitWidth * 312, justifyContent: 'space-around', height: Constants.unitWidth * 312, justifyContent: 'space-around',
alignItems: 'center' alignItems: 'center'
}}> }}>
<Text>{this.getStrTime(this.state.currentTime)} / {this.getStrTime(this.state.maxcurrentTime)}</Text> <Text>{getStrTime(this.state.currentTime)} / {getStrTime(this.state.maxcurrentTime)}</Text>
<Button onPress={() => { <Button onPress={() => {
this.getAudioAuthorize() this.getAudioAuthorize()
...@@ -800,7 +855,7 @@ export default class Index extends Component { ...@@ -800,7 +855,7 @@ export default class Index extends Component {
height: Constants.unitWidth * 312, justifyContent: 'space-around', height: Constants.unitWidth * 312, justifyContent: 'space-around',
alignItems: 'center' alignItems: 'center'
}}> }}>
<Text>{this.getStrTime(this.state.currentTime)} / {this.getStrTime(this.state.maxcurrentTime)}</Text> <Text>{getStrTime(this.state.currentTime)} / {getStrTime(this.state.maxcurrentTime)}</Text>
<Button onPress={() => { <Button onPress={() => {
this.handleStopAudio() this.handleStopAudio()
}}> }}>
......
...@@ -7,6 +7,7 @@ import homeWork from '../../../css/homework.css'; ...@@ -7,6 +7,7 @@ import homeWork from '../../../css/homework.css';
import Api from '../../../Api'; import Api from '../../../Api';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import moment from 'moment';
export default class Index extends Component { export default class Index extends Component {
...@@ -59,6 +60,9 @@ export default class Index extends Component { ...@@ -59,6 +60,9 @@ export default class Index extends Component {
// }) // })
} }
componentWillUnmount() {
Picker.hide()
}
pinkeState = () => { pinkeState = () => {
Picker.isPickerShow(status => { Picker.isPickerShow(status => {
if (status) { if (status) {
...@@ -185,11 +189,6 @@ export default class Index extends Component { ...@@ -185,11 +189,6 @@ export default class Index extends Component {
}); });
} }
componentWillUnmount() {
// this.setState({
// uri:false,
// })
}
getListHomework = () => { getListHomework = () => {
Constants.postJSONWithToken(Api.studentListHomework(this.state.par)) Constants.postJSONWithToken(Api.studentListHomework(this.state.par))
.then((response) => { .then((response) => {
...@@ -209,7 +208,6 @@ export default class Index extends Component { ...@@ -209,7 +208,6 @@ export default class Index extends Component {
}) })
} }
} }
console.log(this.listHomework)
// if (data.memo === '成功') { // if (data.memo === '成功') {
// this.setState(data.data); // this.setState(data.data);
// setTimeout(this.init, 100); // setTimeout(this.init, 100);
...@@ -230,6 +228,14 @@ export default class Index extends Component { ...@@ -230,6 +228,14 @@ export default class Index extends Component {
return '题库堂测' return '题库堂测'
} }
} }
compareTime(time){
let d1 = new Date(moment(time).format()).getTime()
let d2 = Date.now()
if(d1 > d2){
return true
}
return false
}
sepStatus(type) { sepStatus(type) {
let day; let day;
switch (type) { switch (type) {
...@@ -280,7 +286,7 @@ export default class Index extends Component { ...@@ -280,7 +286,7 @@ export default class Index extends Component {
<Text style={{ lineHeight: Constants.unitWidth * 32 }}>提交截止时间:{item.closeTime}</Text> <Text style={{ lineHeight: Constants.unitWidth * 32 }}>提交截止时间:{item.closeTime}</Text>
</View> </View>
</View> </View>
{(item.sepStatus == 20 || item.sepStatus == 10 || item.sepStatus == 30 || item.sepStatus == 60 || item.sepStatus == 25 || item.sepStatus == 50 || item.sepStatus == 70) && {this.compareTime(item.closeTime) && (item.sepStatus == 20 || item.sepStatus == 10 || item.sepStatus == 30 || item.sepStatus == 60 || item.sepStatus == 25 || item.sepStatus == 50 || item.sepStatus == 70) &&
<View style={homeWork.taskListBtn}> <View style={homeWork.taskListBtn}>
<Button onPress={() => { <Button onPress={() => {
this.props.navigation.navigate('doHomeworkWithImg', { this.props.navigation.navigate('doHomeworkWithImg', {
...@@ -327,7 +333,7 @@ export default class Index extends Component { ...@@ -327,7 +333,7 @@ export default class Index extends Component {
}) })
} }
}} value={this.state.note} }} value={this.state.note}
multiline={true} placeholder="请输入作业关键字" placeholderTextColor="#727272" /> placeholder="请输入作业关键字" placeholderTextColor="#727272" />
<Button onPress={() => { this.getListHomework() }} > <Button onPress={() => { this.getListHomework() }} >
<Icon name="text-search" size={30} color="#333333" /> <Icon name="text-search" size={30} color="#333333" />
</Button> </Button>
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment