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" />
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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>
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { import {
Image, View, Text, StatusBar, TextInput, ActionSheetIOS, Keyboard, FlatList, Modal, Platform, Animated, Image, View, Text, StatusBar, TextInput, ActionSheetIOS, Keyboard, FlatList, Modal, Platform, Animated,
DeviceEventEmitter, ScrollView, ImageBackground, TouchableHighlight, NativeEventEmitter, NativeModules DeviceEventEmitter, ScrollView, ImageBackground, TouchableHighlight, NativeEventEmitter, NativeModules,
PermissionsAndroid
} from 'react-native'; } from 'react-native';
import DeviceInfo from 'react-native-device-info';
import { WebView } from 'react-native-webview'; import { WebView } from 'react-native-webview';
import CameraRoll from "@react-native-community/cameraroll"; import CameraRoll from "@react-native-community/cameraroll";
...@@ -40,10 +44,7 @@ import Rush from '../components/Rush'; ...@@ -40,10 +44,7 @@ import Rush from '../components/Rush';
import ImagePicker from 'react-native-image-crop-picker'; import ImagePicker from 'react-native-image-crop-picker';
import IdleTimerManager from 'react-native-idle-timer'; import IdleTimerManager from 'react-native-idle-timer';
import Switch from 'react-native-switch-pro'; import Switch from 'react-native-switch-pro';
const movingWidth = Constants.height;
const movingHeight = Constants.width - Constants.statusBarHeight - Constants.unitWidth * 104;
const movingInitX = Constants.height * 0.5 - Constants.unitWidth * 75;
const movingInitY = (Constants.width - Constants.statusBarHeight - Constants.unitWidth * 124) * 0.5 - Constants.unitWidth * 43;
import { KeyboardAccessoryView } from 'react-native-keyboard-accessory'; import { KeyboardAccessoryView } from 'react-native-keyboard-accessory';
import CourseCSS from "../../css/Course.css"; import CourseCSS from "../../css/Course.css";
...@@ -77,8 +78,22 @@ import AddNote from "../components/AddNote"; ...@@ -77,8 +78,22 @@ import AddNote from "../components/AddNote";
import EditNote from "../components/EditNote"; import EditNote from "../components/EditNote";
// import { RNLockScreen } from 'react-native-lock-screen'; // import { RNLockScreen } from 'react-native-lock-screen';
let webViewUrl = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + `Static.bundle/dd.html`; let webViewUrl = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + `Static.bundle/dd.html`;
webViewUrl = `file:///android_asset/Static.bundle/index.html` webViewUrl = `file:///android_asset/Static.bundle/index.html`
let model = DeviceInfo.getModel();
const isFhPad = model.indexOf('BZC-W00') > -1 ;
// alert(isFhPad + model)
const movingWidth = Constants.height;
let movingHeight = Constants.width - Constants.statusBarHeight - Constants.unitWidth * 60;
const movingInitX = Constants.height * 0.5 - Constants.unitWidth * 75;
const movingInitY = (Constants.width - Constants.statusBarHeight - Constants.unitWidth * 124) * 0.5 - Constants.unitWidth * 43;
if(!isFhPad){
movingHeight = Constants.width - Constants.statusBarHeight - Constants.unitWidth * 146;
}
export default class Index extends Component<Props, State, HomeState, AppContextType> { export default class Index extends Component<Props, State, HomeState, AppContextType> {
_engine?: RtcEngine; _engine?: RtcEngine;
...@@ -98,6 +113,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -98,6 +113,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
channelId: '', channelId: '',
joinSucceed: false, joinSucceed: false,
peerIds: [], peerIds: [],
videoIds:[],
movingIds: [], movingIds: [],
movingPositions: [], movingPositions: [],
movingSizes: [], movingSizes: [],
...@@ -189,7 +205,8 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -189,7 +205,8 @@ export default class Index extends Component<Props, State, HomeState, AppContext
showLook: false, showLook: false,
group: '', group: '',
webViewBoard: false, webViewBoard: false,
permissionsAndroid:false,
}; };
this.msgList = null; this.msgList = null;
this.timer = null; this.timer = null;
...@@ -217,9 +234,36 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -217,9 +234,36 @@ export default class Index extends Component<Props, State, HomeState, AppContext
componentDidUpdate() { componentDidUpdate() {
} }
requestCameraAndAudioPermission = async () => {
try {
const granted = await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.CAMERA,
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
])
if (
granted['android.permission.RECORD_AUDIO'] === PermissionsAndroid.RESULTS.GRANTED
&& granted['android.permission.CAMERA'] === PermissionsAndroid.RESULTS.GRANTED
) {
console.log('You can use the cameras & mic');
this.setState({
permissionsAndroid: true
});
this.startCall();
} else {
console.log('Permission denied')
this.props.navigation.goBack();
}
} catch (err) {
console.warn(err)
}
}
componentDidMount() { componentDidMount() {
StatusBar.setBarStyle('light-content'); StatusBar.setBarStyle('light-content');
// console.log(DeviceInfo)
// const model = DeviceInfo.getModel()
// alert(model)
// const whBoard = new NativeEventEmitter(NativeModules.TICBridgeManager); // const whBoard = new NativeEventEmitter(NativeModules.TICBridgeManager);
WhiteBoardEngine.addListener('joinRoomSuccess', (data) => { WhiteBoardEngine.addListener('joinRoomSuccess', (data) => {
console.log('joinRoomSuccess', data); console.log('joinRoomSuccess', data);
...@@ -245,6 +289,9 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -245,6 +289,9 @@ export default class Index extends Component<Props, State, HomeState, AppContext
teacherUid = this.props.route.params.teachers[0].liveRoomUid; teacherUid = this.props.route.params.teachers[0].liveRoomUid;
teacherName = this.props.route.params.teachers[0].tchName; teacherName = this.props.route.params.teachers[0].tchName;
} }
// alert(teacherUid)
// alert(teacherName)
this.props.route.params.teacherUid = teacherUid; this.props.route.params.teacherUid = teacherUid;
this.props.route.params.teacherName = teacherName; this.props.route.params.teacherName = teacherName;
this.setState(this.props.route.params); this.setState(this.props.route.params);
...@@ -330,7 +377,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -330,7 +377,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
console.log(res, '保存成功') console.log(res, '保存成功')
Constants.uploadFile(Api.uploadFile({ Constants.uploadFile(Api.uploadFile({
file: downloadDest, file: downloadDest,
folder:'lesson', folder: 'lesson',
})).then((response) => { })).then((response) => {
return response.json() return response.json()
}).then(data => { }).then(data => {
...@@ -343,13 +390,13 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -343,13 +390,13 @@ export default class Index extends Component<Props, State, HomeState, AppContext
uid: this.state.liveRoomUid, uid: this.state.liveRoomUid,
stuId: this.props.route.params.stuScheduleId, stuId: this.props.route.params.stuScheduleId,
time: timestamp, time: timestamp,
boardUrl:data.data.domain + data.data.fileList[0].key boardUrl: data.data.domain + data.data.fileList[0].key
}) })
}) })
setTimeout(() => { setTimeout(() => {
this.setState({ this.setState({
webViewBoard:false webViewBoard: false
}) })
}); });
}).catch(error => { }).catch(error => {
console.log('save image error', error) console.log('save image error', error)
...@@ -373,7 +420,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -373,7 +420,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
uploadScreenShot = (uri) => { uploadScreenShot = (uri) => {
Constants.uploadFile(Api.uploadFile({ Constants.uploadFile(Api.uploadFile({
file: uri, file: uri,
folder:'lesson', folder: 'lesson',
})).then((response) => { })).then((response) => {
return response.json() return response.json()
}) })
...@@ -460,7 +507,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -460,7 +507,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
clearTimeout(this.timer); clearTimeout(this.timer);
} }
this.context.client.removeAllListeners() this.context.client.removeAllListeners()
// await this.context.client.leave(this.state.channelId); await this.context.client.leave(this.state.channelId);
this.sendLessonActivityInOut('out') this.sendLessonActivityInOut('out')
await this.logout(); await this.logout();
...@@ -473,7 +520,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -473,7 +520,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
// console.log('leave room ok', e); // console.log('leave room ok', e);
// WhiteBoardEngine.unInitEngine().then(() => {}); // WhiteBoardEngine.unInitEngine().then(() => {});
}); });
// await this.endCall(); await this.endCall();
} }
getAgoraConfig = () => { getAgoraConfig = () => {
...@@ -514,22 +561,66 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -514,22 +561,66 @@ export default class Index extends Component<Props, State, HomeState, AppContext
this.getNetlessToken(); this.getNetlessToken();
// this.getRTMToken(); // this.getRTMToken();
}); });
// this.startCall();
return; // return;
if (!isFhPad) {
this.requestCameraAndAudioPermission();
return
}
this.getRTMToken();
// if (isFhPad) return;
// this.checkConnection();
//
// console.log('this._engine', this._engine);
// this.joinRTCChannel();
};
checkConnection = () => {
console.log('checkConnection');
if (this.state.joinSucceed) {
this._engine.startLastmileProbeTest({
probeUplink: true,
probeDownlink: true,
expectedUplinkBitrate: 1000001,
expectedDownlinkBitrate: 1000001,
}).then((e, e2) => {
console.log(e, e2, 'ok22222');
}).catch((e) => {
console.log(e, 'rejected')
})
}
setTimeout(this.checkConnection, 3000);
}
/**
* @name startCall
* @description Function to start the call
*/
startCall = async () => {
const { appId } = this.state; const { appId } = this.state;
console.log('appid = ', appId); console.log('appid = ', appId);
this._engine = await RtcEngine.create(appId); this._engine = await RtcEngine.create(appId);
await this._engine.enableVideo();
// this._engine.addListener('Warning', (warn) => { this._engine.addListener('Warning', (warn) => {
// console.log('Warning', warn); console.log('Warning', warn);
// }); });
// this._engine.addListener('Error', (err) => { this._engine.addListener('Error', (err) => {
// console.log('Error2222', err); console.log('Error2222', err);
// }); });
this._engine.addListener('LocalAudioStateChanged', (err) => {
console.log('LocalAudioStateChanged', err);
});
await this._engine.enableVideo();
await this._engine.startPreview();
this._engine.addListener('UserJoined', (uid, elapsed) => { this._engine.addListener('UserJoined', (uid, elapsed) => {
console.log('UserJoined--000000', uid, elapsed); console.log('UserJoined--000000', uid, elapsed);
...@@ -542,6 +633,16 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -542,6 +633,16 @@ export default class Index extends Component<Props, State, HomeState, AppContext
peerIds: [...peerIds, uid], peerIds: [...peerIds, uid],
}); });
} }
const { videoIds } = this.state;
// If new user
if (videoIds.indexOf(uid) === -1) {
this.setState({
// Add peer ID to state array
videoIds: [...videoIds, uid],
});
}
}); });
this._engine.addListener('UserOffline', (uid, reason) => { this._engine.addListener('UserOffline', (uid, reason) => {
...@@ -551,11 +652,16 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -551,11 +652,16 @@ export default class Index extends Component<Props, State, HomeState, AppContext
// Remove peer ID from state array // Remove peer ID from state array
peerIds: peerIds.filter((id) => id !== uid), peerIds: peerIds.filter((id) => id !== uid),
}); });
const { videoIds } = this.state;
this.setState({
// Remove peer ID from state array
videoIds: videoIds.filter((id) => id !== uid),
});
}); });
// If Local user joins RTC channel // If Local user joins RTC channel
this._engine.addListener('JoinChannelSuccess', (channel, uid, elapsed) => { this._engine.addListener('JoinChannelSuccess', (channel, uid, elapsed) => {
// console.log('JoinChannelSuccess', channel, uid, elapsed); console.log('JoinChannelSuccess', channel, uid, elapsed);
// 加入直播成功 把 自己的视频视图加入到videoList // 加入直播成功 把 自己的视频视图加入到videoList
const { peerIds } = this.state; const { peerIds } = this.state;
if (peerIds.indexOf(uid) === -1) { if (peerIds.indexOf(uid) === -1) {
...@@ -565,6 +671,15 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -565,6 +671,15 @@ export default class Index extends Component<Props, State, HomeState, AppContext
// movingIds: [uid], //测试 // movingIds: [uid], //测试
}); });
} }
const { videoIds } = this.state;
if (videoIds.indexOf(uid) === -1) {
this.setState({
joinSucceed: true,
videoIds: [...videoIds, uid],
// movingIds: [uid], //测试
});
}
}); });
this._engine.addListener('NetworkQuality', (uid, data) => { this._engine.addListener('NetworkQuality', (uid, data) => {
...@@ -602,38 +717,6 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -602,38 +717,6 @@ export default class Index extends Component<Props, State, HomeState, AppContext
this.setState(stats); this.setState(stats);
}); });
// this.checkConnection();
//
// console.log('this._engine', this._engine);
// this.joinRTCChannel();
};
checkConnection = () => {
console.log('checkConnection');
if (this.state.joinSucceed) {
this._engine.startLastmileProbeTest({
probeUplink: true,
probeDownlink: true,
expectedUplinkBitrate: 1000001,
expectedDownlinkBitrate: 1000001,
}).then((e, e2) => {
console.log(e, e2, 'ok22222');
}).catch((e) => {
console.log(e, 'rejected')
})
}
setTimeout(this.checkConnection, 3000);
}
/**
* @name startCall
* @description Function to start the call
*/
startCall = () => {
Constants.get(Api.getRTCToken({ Constants.get(Api.getRTCToken({
channelId: this.state.channelId, channelId: this.state.channelId,
userId: this.state.liveRoomUid userId: this.state.liveRoomUid
...@@ -668,7 +751,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -668,7 +751,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
null, null,
parseInt(this.state.liveRoomUid) parseInt(this.state.liveRoomUid)
).then((data) => { ).then((data) => {
// console.log('start call hahah', data); console.log('start call hahah', data);
this.getRTMToken(); this.getRTMToken();
}).catch((err) => { }).catch((err) => {
console.log('start call errro 22 ', err) console.log('start call errro 22 ', err)
...@@ -680,8 +763,9 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -680,8 +763,9 @@ export default class Index extends Component<Props, State, HomeState, AppContext
* @description Function to end the call * @description Function to end the call
*/ */
endCall = async () => { endCall = async () => {
await this._engine?.removeAllListeners();
await this._engine?.leaveChannel(); await this._engine?.leaveChannel();
this.setState({ peerIds: [], joinSucceed: false }); this.setState({ peerIds: [],videoIds:[], joinSucceed: false });
}; };
sendLessonActivityInOut = async (type) => { sendLessonActivityInOut = async (type) => {
await Constants.postJSONWithToken(Api.sendLessonActivityInOut({ await Constants.postJSONWithToken(Api.sendLessonActivityInOut({
...@@ -731,7 +815,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -731,7 +815,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
rtmToken: data.data, rtmToken: data.data,
gettingRTMToken: false gettingRTMToken: false
}); });
setTimeout(this.rtmLogin, 100); setTimeout(this.rtmLogin);
} }
}) })
.catch(error => { .catch(error => {
...@@ -878,6 +962,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -878,6 +962,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
} }
if ('closeLocalVideo' in value) { if ('closeLocalVideo' in value) {
if(isFhPad) return;
let closeVideos = this.state.closeVideos; let closeVideos = this.state.closeVideos;
if (value.closeLocalVideo) { if (value.closeLocalVideo) {
//关闭 视频 //关闭 视频
...@@ -924,7 +1009,8 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -924,7 +1009,8 @@ export default class Index extends Component<Props, State, HomeState, AppContext
} }
} else if (item.key === "AAAGroupState") { } else if (item.key === "AAAGroupState") {
let value = JSON.parse(item.value) let value = JSON.parse(item.value)
if (value.gpList && value.gpList.length && !this.state.group) { console.log(value,'AAAGroupStateAAAGroupState')
if (value.gpList && value.gpList.length) {
let gp = ''; let gp = '';
value.gpList.forEach((item, index) => { value.gpList.forEach((item, index) => {
item.gpStu.forEach(stu => { item.gpStu.forEach(stu => {
...@@ -934,7 +1020,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -934,7 +1020,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
} }
}) })
}); });
if (gp) { if (gp && gp.gpName != this.state.group.gpName) {
this.setState({ this.setState({
group: gp, group: gp,
// canEditWB: true, // canEditWB: true,
...@@ -943,12 +1029,17 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -943,12 +1029,17 @@ export default class Index extends Component<Props, State, HomeState, AppContext
tipsIcon: require('../../images/common/success.png') tipsIcon: require('../../images/common/success.png')
}); });
} }
}else{
this.setState({
group:'',
})
} }
} else if (item.key === "muteUser") { } else if (item.key === "muteUser") {
if(isFhPad) return;
let value = JSON.parse(item.value); let value = JSON.parse(item.value);
if (value.includes(parseInt(this.state.liveRoomUid))) { if (value.includes(parseInt(this.state.liveRoomUid))) {
if (!this.state.microphoneDisabled) { if (!this.state.microphoneDisabled) {
this._engine.enableLocalAudio(false).then((result) => { this._engine?.muteLocalAudioStream (true).then((result) => {
console.log('disableLocalAudio 001 ok', result); console.log('disableLocalAudio 001 ok', result);
this.setState({ this.setState({
microphoneDisabled: true, microphoneDisabled: true,
...@@ -965,7 +1056,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -965,7 +1056,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
} }
} else { } else {
if (this.state.microphoneDisabled) { if (this.state.microphoneDisabled) {
this._engine.enableLocalAudio(true).then((result) => { this._engine?.muteLocalAudioStream (false).then((result) => {
// console.log('enableLocalAudio 001 ok', result); // console.log('enableLocalAudio 001 ok', result);
this.setState({ this.setState({
microphoneDisabled: false, microphoneDisabled: false,
...@@ -1051,9 +1142,9 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1051,9 +1142,9 @@ export default class Index extends Component<Props, State, HomeState, AppContext
// selectedIndex = (value.rand) % students.length; // selectedIndex = (value.rand) % students.length;
// console.log(selectedIndex, 'selectedIndex') // console.log(selectedIndex, 'selectedIndex')
// } // }
// console.log('randomStuState', students, selectedIndex, value); console.log('randomStuStateSS', students, value);
this.setState({ this.setState({
showRandom: value.showModules, showRandom: (value.showModules && !!value.selNumList.length) ,
selNum: value.selNum, selNum: value.selNum,
selScope: value.selScope, selScope: value.selScope,
// isAnstype: value.isAnstype, // isAnstype: value.isAnstype,
...@@ -1068,14 +1159,17 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1068,14 +1159,17 @@ export default class Index extends Component<Props, State, HomeState, AppContext
this.setState({ this.setState({
webViewBoard: 'randomBoard' webViewBoard: 'randomBoard'
}); });
}, 300); }, 200);
// console.log( // console.log(
// `http://192.168.0.102:8082?token=${Constants.token}&type=${this.state.webViewBoard}&host=${Api.uploadFile().host}` // `http://192.168.0.102:8082?token=${Constants.token}&type=${this.state.webViewBoard}&host=${Api.uploadFile().host}`
// ) // )
} else { } else {
this.setState({ if(this.state.webViewBoard == 'randomBoard'){
webViewBoard: false this.setState({
}); webViewBoard: false
});
}
} }
} else if (item.key === "rushToAnswerState") { } else if (item.key === "rushToAnswerState") {
// 抢答器 // 抢答器
...@@ -1118,17 +1212,19 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1118,17 +1212,19 @@ export default class Index extends Component<Props, State, HomeState, AppContext
this.setState({ this.setState({
webViewBoard: 'rushBoard' webViewBoard: 'rushBoard'
}); });
}, 300); }, 200);
} else { } else {
this.setState({ if(this.state.webViewBoard == 'rushBoard'){
webViewBoard: false this.setState({
}); webViewBoard: false
});
}
} }
} else if (item.key === "AnswerState") { } else if (item.key === "AnswerState") {
let value = JSON.parse(item.value); let value = JSON.parse(item.value);
console.log('AnswerState', value); console.log('AnswerState', value);
// alert(this.state.group.index) // alert(this.state.group.index)
if (this.state.group && value.selScope.length && value.selScope.indexOf (this.state.group.index) == -1 ) { if (this.state.group && value.selScope.length && value.selScope.indexOf(this.state.group.index) == -1) {
value.showModules = false value.showModules = false
} }
let _times = value.timeString.split(':'); let _times = value.timeString.split(':');
...@@ -1562,7 +1658,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1562,7 +1658,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
this.setState({ this.setState({
showNetless: true showNetless: true
}); });
this.getRTMToken(); // this.getRTMToken();
setTimeout(() => { setTimeout(() => {
//加入白板成功 //加入白板成功
// WhiteBoardEngine.setViewMode('follower'); // WhiteBoardEngine.setViewMode('follower');
...@@ -1578,11 +1674,12 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1578,11 +1674,12 @@ export default class Index extends Component<Props, State, HomeState, AppContext
_renderVideos = () => { _renderVideos = () => {
// console.log('uids2222', this.state.peerIds, this.state.channelId); // console.log('uids2222', this.state.peerIds, this.state.channelId);
if(!this.state.permissionsAndroid) return [];
let result = []; let result = [];
/*1 先获取 老师*/ /*1 先获取 老师*/
for (let i = 0; i < this.state.peerIds.length; i++) { for (let i = 0; i < this.state.videoIds.length; i++) {
if (parseInt(this.state.peerIds[i]) === parseInt(this.state.teacherUid) && !this.state.movingIds.includes(parseInt(this.state.teacherUid))) { if (parseInt(this.state.videoIds[i]) === parseInt(this.state.teacherUid) && !this.state.movingIds.includes(parseInt(this.state.teacherUid))) {
result.push(<ImageBackground imageStyle={LiveCSS.videoBg} source={require('../../images/common/camera.png')} style={LiveCSS.myVideoWrapper}> result.push(<ImageBackground key={this.state.teacherUid} imageStyle={LiveCSS.videoBg} source={require('../../images/common/camera.png')} style={LiveCSS.myVideoWrapper}>
<RtcRemoteView.SurfaceView <RtcRemoteView.SurfaceView
style={LiveCSS.max} style={LiveCSS.max}
uid={parseInt(this.state.teacherUid)} uid={parseInt(this.state.teacherUid)}
...@@ -1595,7 +1692,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1595,7 +1692,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
<View style={LiveCSS.videoInfoRight}> <View style={LiveCSS.videoInfoRight}>
</View> </View>
</View> </View>
{this.state.closeVideos.includes(String(this.state.peerIds[i])) && <View style={{ {this.state.closeVideos.includes(String(this.state.videoIds[i])) && <View style={{
position: 'absolute', position: 'absolute',
width: Constants.unitWidth * 150, width: Constants.unitWidth * 150,
height: Constants.unitWidth * 86, height: Constants.unitWidth * 86,
...@@ -1613,7 +1710,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1613,7 +1710,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
} }
} }
/*2 在获取学生*/ /*2 在获取学生*/
this.state.peerIds.map((item, index) => { this.state.videoIds.map((item, index) => {
// console.log(item, index, this.state.liveRoomUid, parseInt(this.state.liveRoomUid) === parseInt(item)); // console.log(item, index, this.state.liveRoomUid, parseInt(this.state.liveRoomUid) === parseInt(item));
// console.log('attributesUpdated moveingids', item, this.state.movingIds, this.state.movingIds.includes(item)); // console.log('attributesUpdated moveingids', item, this.state.movingIds, this.state.movingIds.includes(item));
if (parseInt(item) !== parseInt(this.state.teacherUid) && !this.state.movingIds.includes(item)) { if (parseInt(item) !== parseInt(this.state.teacherUid) && !this.state.movingIds.includes(item)) {
...@@ -1626,7 +1723,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1626,7 +1723,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
} }
} }
if (parseInt(this.state.liveRoomUid) === parseInt(item)) { if (parseInt(this.state.liveRoomUid) === parseInt(item)) {
result.push(<ImageBackground key={index} imageStyle={LiveCSS.videoBg} source={require('../../images/common/camera.png')} style={LiveCSS.myVideoWrapper}> result.push(<ImageBackground key={parseInt(item)} imageStyle={LiveCSS.videoBg} source={require('../../images/common/camera.png')} style={LiveCSS.myVideoWrapper}>
{this.state.videoEnabled && <RtcLocalView.SurfaceView {this.state.videoEnabled && <RtcLocalView.SurfaceView
style={LiveCSS.max} style={LiveCSS.max}
uid={item} uid={item}
...@@ -1656,7 +1753,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -1656,7 +1753,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
</View>} </View>}
</ImageBackground>) </ImageBackground>)
} else { } else {
result.push(<ImageBackground key={index} imageStyle={LiveCSS.videoBg} source={require('../../images/common/camera.png')} style={LiveCSS.myVideoWrapper}> result.push(<ImageBackground key={parseInt(item)} imageStyle={LiveCSS.videoBg} source={require('../../images/common/camera.png')} style={LiveCSS.myVideoWrapper}>
<RtcRemoteView.SurfaceView <RtcRemoteView.SurfaceView
style={LiveCSS.max} style={LiveCSS.max}
uid={item} uid={item}
...@@ -2096,7 +2193,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2096,7 +2193,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
} }
toggleSwitchVideo = () => { toggleSwitchVideo = () => {
this._engine.enableLocalVideo(!this.state.videoEnabled); this._engine?.enableLocalVideo(!this.state.videoEnabled);
this.setState({ this.setState({
videoEnabled: !this.state.videoEnabled videoEnabled: !this.state.videoEnabled
}) })
...@@ -2203,7 +2300,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2203,7 +2300,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
}]}> }]}>
<StatusBar <StatusBar
hidden={false} hidden={false}
backgroundColor="#0E5C4A" backgroundColor="#30323D"
barStyle="light-content" barStyle="light-content"
/> />
<View style={{ <View style={{
...@@ -2225,9 +2322,9 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2225,9 +2322,9 @@ export default class Index extends Component<Props, State, HomeState, AppContext
width: Constants.height, width: Constants.height,
height: Constants.width - Constants.statusBarHeight, height: Constants.width - Constants.statusBarHeight,
}}> }}>
<View style={LiveCSS.headerRow}> {/* <View style={LiveCSS.headerRow}>
<View style={LiveCSS.headerRowLeft}> <View style={LiveCSS.headerRowLeft}>
{/* {this.getSignal()} */} {this.getSignal()}
</View> </View>
<View style={{ <View style={{
flex: 1, flex: 1,
...@@ -2235,21 +2332,26 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2235,21 +2332,26 @@ export default class Index extends Component<Props, State, HomeState, AppContext
justifyContent: 'center', justifyContent: 'center',
}}> }}>
<Text allowFontScaling={false} style={LiveCSS.courseTitle}>{this.state.courseName}</Text> <Text allowFontScaling={false} style={LiveCSS.courseTitle}>{this.state.courseName}</Text>
{/* <View style={LiveCSS.courseTitleRight}> <View style={LiveCSS.courseTitleRight}>
<View style={LiveCSS.courseTitleRight1}></View> <View style={LiveCSS.courseTitleRight1}></View>
<Text allowFontScaling={false} style={LiveCSS.courseTitleRight2}>上课中:{this.getFormattedDuration()}</Text> <Text allowFontScaling={false} style={LiveCSS.courseTitleRight2}>上课中:{this.getFormattedDuration()}</Text>
</View> */} </View>
</View> </View>
</View> </View> */}
<View style={[LiveCSS.videoRow, PublicCSS.centerAll]}> {
{/* {this._renderVideos()} */} !isFhPad &&
</View> <View style={[LiveCSS.videoRow, PublicCSS.centerAll]}>
{this._renderVideos()}
</View>
}
<View style={{ <View style={{
flexDirection: 'row', flexDirection: 'row',
width: movingWidth, width: movingWidth,
height: movingHeight, height: movingHeight,
position: 'relative', position: 'relative',
backgroundColor: '#0E5C4A' backgroundColor: '#0E5C4A',
warp: 'renderMovingVideo',
}}> }}>
{/*{this.renderMovingVideo()}*/} {/*{this.renderMovingVideo()}*/}
{ {
...@@ -2358,8 +2460,8 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2358,8 +2460,8 @@ export default class Index extends Component<Props, State, HomeState, AppContext
{ {
this.state.showNetless && <RCTTICBridgeView styleBox={[LiveCSS.wbWrapper, { this.state.showNetless && <RCTTICBridgeView styleBox={[LiveCSS.wbWrapper, {
display: this.state.showNetless2 ? 'flex' : 'none', display: this.state.showNetless2 ? 'flex' : 'none',
zIndex: this.state.canEditWB && this.state.wbTool !== '' ? 100 : -1 zIndex: this.state.canEditWB && this.state.wbTool !== '' ? 100 : -1,
}]} /> },!isFhPad?{height:Constants.width - Constants.statusBarHeight - Constants.unitWidth * 86}:'']} />
} }
...@@ -2996,7 +3098,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2996,7 +3098,7 @@ export default class Index extends Component<Props, State, HomeState, AppContext
{ {
this.state.showAlarm && <Alarm max={this.state.max} start={this.state.start} /> this.state.showAlarm && <Alarm max={this.state.max} start={this.state.start} />
} }
{this.state.showRandom && <Random uid={this.state.liveRoomUid} selNumList={this.state.selNumList} random={this.state.random} students={this.state.students} selectedIndex={this.state.selectedIndex} randNum={this.state.randNum} />} {this.state.showRandom && <Random uid={this.state.liveRoomUid} selNumList={this.state.selNumList} random={this.state.random} students={this.state.students} selectedIndex={this.state.selectedIndex} randNum={this.state.randNum} />}
{this.state.showRush && <Rush rushing={this.state.rushing} rushMax={this.state.rushMax} answerStu={this.state.answerStu} />} {this.state.showRush && <Rush rushing={this.state.rushing} rushMax={this.state.rushMax} answerStu={this.state.answerStu} />}
{this.state.showQA && <QA max={this.state.qaMax} currentMax={this.state.qaCurrentSec} answerState={this.state.answerState} {this.state.showQA && <QA max={this.state.qaMax} currentMax={this.state.qaCurrentSec} answerState={this.state.answerState}
selectButton={this.state.selectButton} answerList={this.state.answerList} selectButton={this.state.selectButton} answerList={this.state.answerList}
...@@ -3086,18 +3188,18 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -3086,18 +3188,18 @@ export default class Index extends Component<Props, State, HomeState, AppContext
const { nativeEvent } = syntheticEvent; const { nativeEvent } = syntheticEvent;
console.log('onLoadEnd error: ', nativeEvent); console.log('onLoadEnd error: ', nativeEvent);
// this.isLoading = nativeEvent.loading; // this.isLoading = nativeEvent.loading;
}} }}
onHttpError={(syntheticEvent) => { onHttpError={(syntheticEvent) => {
const { nativeEvent } = syntheticEvent; const { nativeEvent } = syntheticEvent;
console.warn( console.warn(
'WebView received error status code: ', 'WebView received error status code: ',
nativeEvent.statusCode, nativeEvent.statusCode,
); );
}} }}
onError={(syntheticEvent) => { onError={(syntheticEvent) => {
const { nativeEvent } = syntheticEvent; const { nativeEvent } = syntheticEvent;
console.warn('WebView error: ', nativeEvent); console.warn('WebView error: ', nativeEvent);
}} }}
// onLoad={this.onLoad} // onLoad={this.onLoad}
// renderError={(e) => { // renderError={(e) => {
// if (e === 'WebKitErrorDomain') { // if (e === 'WebKitErrorDomain') {
......
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