diff --git a/component/Map/Login/LoginView.js b/component/Map/Login/LoginView.js
index d346600512e92c82c2e86f820b4155f45f586034..48b426402a9de038cbd2b186f8d32be84c2216af 100644
--- a/component/Map/Login/LoginView.js
+++ b/component/Map/Login/LoginView.js
@@ -1,22 +1,23 @@
import React, {Component} from 'react';
+
import {
- StyleSheet,
- Text,
- View,
- Dimensions,
- TextInput,
- Button,
- Image,
- TouchableOpacity,
- ImageBackground,
- ToastAndroid,
+ StyleSheet,
+ Text,
+ View,
+ Dimensions,
+ TextInput,
+ Button,
+ Image,
+ TouchableOpacity,
+ ImageBackground,
+ ToastAndroid,
} from 'react-native';
import Icon from 'react-native-vector-icons/AntDesign';
import {
- ASPLogin,
- getUrlkey,
- loginSystem,
- SSOLogin,
+ ASPLogin,
+ getUrlkey,
+ loginSystem,
+ SSOLogin,
} from '../../../utils/educationUtil';
/**
@@ -29,259 +30,246 @@ import {
* 修改后 android:windowSoftInputMode="stateAlwaysHidden|adjustPan">
*/
const {width, height, scale} = Dimensions.get('window');
+
class LoginView extends Component {
- constructor(props) {
- super(props);
- this.state = {
- muser: '',
- passwd: '',
- VerifyCode: '',
- iconnum: true,
- id: '',
- verify_url:
- 'https://jwcjwxt1.fzu.edu.cn/plus/verifycode.asp?n=' + Math.random(),
- };
- this.login = this.login.bind(this);
- this.refreshCode = this.refreshCode.bind(this);
- }
- refreshCode() {
- this.setState({
- verify_url:
- 'https://jwcjwxt1.fzu.edu.cn/plus/verifycode.asp?n=' + Math.random(),
- });
- }
+ constructor(props) {
+ super(props);
+ this.state = {
+ muser: '',
+ passwd: '',
+ VerifyCode: '',
+ iconnum: true,
+ id: '',
+ verify_url:
+ 'https://jwcjwxt1.fzu.edu.cn/plus/verifycode.asp?n=' + Math.random(),
+ };
+ this.login = this.login.bind(this);
+ this.refreshCode = this.refreshCode.bind(this);
+ }
- changeMuser = text => {
- this.setState({muser: text});
- };
- changepasswd = text => {
- this.setState({passwd: text});
- };
- changeVerifyCode = text => {
- this.setState({VerifyCode: text});
- };
- changeiconnum = () => {
- this.setState({iconnum: !this.state.iconnum});
- };
+ refreshCode() {
+ this.setState({
+ verify_url:
+ 'https://jwcjwxt1.fzu.edu.cn/plus/verifycode.asp?n=' + Math.random(),
+ });
+ }
- async login() {
- let loginParams = {};
- let params = {};
- loginParams.muser = this.state.muser;
- loginParams.passwd = this.state.passwd;
- loginParams.VerifyCode = this.state.VerifyCode;
+ changeMuser = text => {
+ this.setState({muser: text});
+ };
+ changepasswd = text => {
+ this.setState({passwd: text});
+ };
+ changeVerifyCode = text => {
+ this.setState({VerifyCode: text});
+ };
+ changeiconnum = () => {
+ this.setState({iconnum: !this.state.iconnum});
+ };
- if (loginParams.muser === '') {
- ToastAndroid.show('学号不能为空!', 500); //提示
- return;
- }
- if (loginParams.passwd === '') {
- ToastAndroid.show('密码不能为空!', 500); //提示
- return;
- }
- if (loginParams.VerifyCode === '') {
- ToastAndroid.show('验证码不能为空!', 500); //提示
- return;
- }
+ async login() {
+ let loginParams = {};
+ let params = {};
+ loginParams.muser = this.state.muser;
+ loginParams.passwd = this.state.passwd;
+ loginParams.VerifyCode = this.state.VerifyCode;
- await loginSystem(loginParams)
- .then(response => {
- if (response.url.search('hosturl') !== -1) {
- params = getUrlkey(response.url);
- }
- return response.text();
- })
- .then(data => {
- if (data.search('验证码不能为空!') !== -1) {
- this.refreshCode();
- ToastAndroid.show('验证码不能为空!', 500); //提示
- return;
+ if (loginParams.muser === '') {
+ ToastAndroid.show('学号不能为空!', 500); //提示
+ return;
}
- if (data.search('验证码验证失败!') !== -1) {
- this.refreshCode();
- ToastAndroid.show('验证码验证失败!', 500); //提示
+ if (loginParams.passwd === '') {
+ ToastAndroid.show('密码不能为空!', 500); //提示
+ return;
}
- if (data.search('用户名或密码错误!') !== -1) {
- this.refreshCode();
- ToastAndroid.show('用户名或密码错误!', 500); //提示
+ if (loginParams.VerifyCode === '') {
+ ToastAndroid.show('验证码不能为空!', 500); //提示
+ return;
}
- });
- if (JSON.stringify(params) === '{}') {
- return;
- }
- this.setState({
- id: params.id,
- });
+ await loginSystem(loginParams)
+ .then(response => {
+ if (response.url.search('hosturl') !== -1) {
+ params = getUrlkey(response.url);
+ }
+ return response.text();
+ })
+ .then(data => {
+ if (data.search('验证码不能为空!') !== -1) {
+ this.refreshCode();
+ ToastAndroid.show('验证码不能为空!', 500); //提示
+ return;
+ }
+ if (data.search('验证码验证失败!') !== -1) {
+ this.refreshCode();
+ ToastAndroid.show('验证码验证失败!', 500); //提示
+ }
+ if (data.search('用户名或密码错误!') !== -1) {
+ this.refreshCode();
+ ToastAndroid.show('用户名或密码错误!', 500); //提示
+ }
+ });
- let SSOParams = {
- token: params.token,
- };
- let ASPParams = {};
- await SSOLogin(SSOParams).then(res => {
- ASPParams = {};
- ASPParams.hosturl = params.hosturl;
- ASPParams.ssourl = params.ssourl;
- ASPParams.num = params.num;
- ASPParams.id = params.id;
- });
+ if (JSON.stringify(params) === '{}') {
+ return;
+ }
+ this.setState({
+ id: params.id,
+ });
- if (JSON.stringify(ASPParams) === '{}') {
- return;
+ let SSOParams = {
+ token: params.token,
+ };
+ await SSOLogin(SSOParams).then(res => {
+ ToastAndroid.show('登录成功!', 500); //提示
+ this.props.navigation.navigate('SchoolMapHome', {id: params.id});
+ });
}
- await ASPLogin(ASPParams).then(resp => {
- if (resp.status === 200) {
- ToastAndroid.show('登录成功!', 500); //提示
- this.props.navigation.navigate('SchoolMapHome', {id: params.id});
- }
- return resp.text();
- });
- }
- render() {
- const {navigation} = this.props;
- return (
-
-
-
- 教务处登录
-
-
-
+ render() {
+ const {navigation} = this.props;
+ return (
+
+
+
+ 教务处登录
+
+
+
-
- {
- this.changeMuser(text);
- }}
- />
-
-
- {
- this.changepasswd(text);
- }}
- />
-
-
- {
- this.changeVerifyCode(text);
- }}
- />
- this.refreshCode()}>
-
-
+
+ {
+ this.changeMuser(text);
+ }}
+ />
+
+
+ {
+ this.changepasswd(text);
+ }}
+ />
+
+
+ {
+ this.changeVerifyCode(text);
+ }}
+ />
+ this.refreshCode()}>
+
+
+
+ {
+ if (!this.state.iconnum) {
+ this.login();
+ // navigation.navigate('SchoolMapHome');
+ } else {
+ ToastAndroid.show('阅读并同意用户协议和隐私政策!', 500); //提示
+ }
+ }}>
+ 登录
+
+
+
+ {this.state.iconnum ? (
+
+ ) : (
+
+ )}
+
+ 阅读并同意用户协议和隐私政策
+
+
+
- {
- if (!this.state.iconnum) {
- this.login();
- // navigation.navigate('SchoolMapHome');
- } else {
- ToastAndroid.show('阅读并同意用户协议和隐私政策!', 500); //提示
- }
- }}>
- 登录
-
-
-
- {this.state.iconnum ? (
-
- ) : (
-
- )}
-
- 阅读并同意用户协议和隐私政策
-
-
-
-
- );
- }
+ );
+ }
}
const styles = StyleSheet.create({
- container: {
- alignItems: 'center',
- flex: 1,
- flexDirection: 'column',
- backgroundColor: '#dddddd',
- },
- iconStyle: {
- width: 80,
- height: 80,
- marginTop: 50,
- marginBottom: 30,
- borderRadius: 40,
- borderWidth: 2,
- borderColor: 'white',
- },
- textInputStyle: {
- width: width - width / 2,
- backgroundColor: '#F6ECE1',
- marginBottom: 1,
- paddingLeft: 10,
- textAlign: 'left',
- borderBottomWidth: 1,
- borderBottomColor: '#797979',
- },
- textInputStyle2: {
- height: 38,
- width: width - width / 2 - width * 0.2,
- backgroundColor: '#F6ECE1',
- marginBottom: 1,
- paddingLeft: 10,
- textAlign: 'left',
- },
+ container: {
+ alignItems: 'center',
+ flex: 1,
+ flexDirection: 'column',
+ backgroundColor: '#dddddd',
+ },
+ iconStyle: {
+ width: 80,
+ height: 80,
+ marginTop: 50,
+ marginBottom: 30,
+ borderRadius: 40,
+ borderWidth: 2,
+ borderColor: 'white',
+ },
+ textInputStyle: {
+ width: width - width / 2,
+ backgroundColor: '#F6ECE1',
+ marginBottom: 1,
+ paddingLeft: 10,
+ textAlign: 'left',
+ borderBottomWidth: 1,
+ borderBottomColor: '#797979',
+ },
+ textInputStyle2: {
+ height: 38,
+ width: width - width / 2 - width * 0.2,
+ backgroundColor: '#F6ECE1',
+ marginBottom: 1,
+ paddingLeft: 10,
+ textAlign: 'left',
+ },
});
export default LoginView;
diff --git a/component/Map/SchoolMap/SchoolMapHome.js b/component/Map/SchoolMap/SchoolMapHome.js
index 602da308b9ab28e108fd638815f0c47dba5cd750..205ce973e62f44b648996d580ca0d2fe9e4a0da3 100644
--- a/component/Map/SchoolMap/SchoolMapHome.js
+++ b/component/Map/SchoolMap/SchoolMapHome.js
@@ -1,11 +1,11 @@
import React, {Component} from 'react';
import {
- StyleSheet,
- TouchableOpacity,
- Text,
- Image,
- View,
- Dimensions,
+ StyleSheet,
+ TouchableOpacity,
+ Text,
+ Image,
+ View,
+ Dimensions,
} from 'react-native';
import Drawer from 'react-native-drawer';
// Drawer组件
@@ -17,427 +17,437 @@ import moment from 'moment';
import SchoolMap from './SchoolMap';
import {queryRoom} from '../../../utils/educationUtil';
import http from '../../../utils/http';
+
/**
* 此为地图界面的容器
*/
const deviceWidthDp = Dimensions.get('window').width;
const deviceHeightDp = Dimensions.get('window').height;
+
class SchoolMapHome extends Component {
- constructor(props) {
- super(props);
- this.state = {
- drawerOpen: false,
- drawerDisabled: false,
- buildingnum: null,
- showDateBar: true,
- date: moment(new Date()).format('YYYY-MM-DD'),
- start: '1',
- end: '4',
- isIcon1: true,
- isIcon2: true,
- id: '',
- buildsList: {},
- };
- this.querySingleRoom = this.querySingleRoom.bind(this);
- this.query = this.query.bind(this);
- this.handleData = this.handleData.bind(this);
- this.refreshRoomList = this.refreshRoomList.bind(this);
- }
- async componentDidMount() {
- this.setState({
- id: this.props.route.params.id,
- });
- await this.query();
- await this.handleData();
+ constructor(props) {
+ super(props);
+ this.state = {
+ drawerOpen: false,
+ drawerDisabled: false,
+ buildingnum: null,
+ showDateBar: true,
+ date: moment(new Date()).format('YYYY-MM-DD'),
+ start: '1',
+ end: '4',
+ isIcon1: true,
+ isIcon2: true,
+ id: '',
+ buildsList: {},
+ };
+ this.querySingleRoom = this.querySingleRoom.bind(this);
+ this.query = this.query.bind(this);
+ this.handleData = this.handleData.bind(this);
+ this.refreshRoomList = this.refreshRoomList.bind(this);
+ }
- console.log(this.state.buildsList);
- }
+ async componentDidMount() {
+ await this.setState({
+ id: this.props.route.params.id,
+ });
+ await this.query();
+ await this.handleData();
- async refreshRoomList() {
- await this.query();
- await this.handleData();
- }
+ console.log(this.state.buildsList);
+ }
- //批量加工空教室列表
- async handleData() {
- //登录教务处,到时候删除
- let sno = '221900330';
- let password = '123';
- await http('post', '/login', {sno, password})
- .then(res => {
- console.log('登录成功');
- })
- .catch(err => {
- console.log('登录失败');
- console.log('err', err);
- });
- let {buildsList} = this.state;
- let list = {};
- for (let key in buildsList) {
- let roomList = buildsList[key];
+ async refreshRoomList() {
+ await this.query();
+ await this.handleData();
+ }
- await http('post', '/map/getRoomNumList', {roomList})
- .then(res => {
- // console.log(res);
- list[key] = res.data.roomList;
- })
- .catch(err => {
- alert('失败!');
- console.log('err', err);
+ //批量加工空教室列表
+ async handleData() {
+ //登录教务处,到时候删除
+ let sno = '221900330';
+ let password = '123';
+ await http('post', '/login', {sno, password})
+ .then(res => {
+ console.log('登录成功');
+ })
+ .catch(err => {
+ console.log('登录失败');
+ console.log('err', err);
+ });
+ let {buildsList} = this.state;
+ let list = {};
+ for (let key in buildsList) {
+ let roomList = buildsList[key];
+
+ await http('post', '/map/getRoomNumList', {roomList})
+ .then(res => {
+ // console.log(res);
+ list[key] = res.data.roomList;
+ })
+ .catch(err => {
+ alert('失败!');
+ console.log('err', err);
+ });
+ }
+ this.setState({
+ buildsList: list,
});
}
- this.setState({
- buildsList: list,
- });
- }
- //批量查找空教室
- async query() {
- let buildsName = ['x1', 'x2', 'x3', 'zl', 'd1', 'd2', 'd3'];
- let param = {
- time: this.state.date,
- build: '',
- start: this.state.start,
- end: this.state.end,
- };
- let list = {
- x1: '公共教学楼西1',
- x2: '公共教学楼西2',
- x3: '公共教学楼西3',
- zl: '公共教学楼中楼',
- d1: '公共教学楼东1',
- d2: '公共教学楼东2',
- d3: '公共教学楼东3',
- w1: '公共教学楼文1',
- w2: '公共教学楼文2',
- w3: '公共教学楼文3',
- w4: '公共教学楼文4',
- };
- for (let i = 0; i !== buildsName.length; i++) {
- param.build = buildsName[i];
- list[buildsName[i]] = await this.querySingleRoom(param);
- }
- param.build = 'wl';
- let wlList = await this.querySingleRoom(param);
- let w1List = [];
- let w2List = [];
- let w3List = [];
- let w4List = [];
- for (let i = 0; i !== wlList.length; i++) {
- if (wlList[i].match('文1') !== -1) {
- w1List.push(wlList[i]);
- }
- if (wlList[i].match('文2') !== -1) {
- w2List.push(wlList[i]);
- }
- if (wlList[i].match('文3') !== -1) {
- w3List.push(wlList[i]);
- }
- if (wlList[i].match('文4') !== -1) {
- w4List.push(wlList[i]);
- }
- }
- list.w1 = w1List;
- list.w2 = w2List;
- list.w3 = w3List;
- list.w4 = w4List;
- this.setState({
- buildsList: list,
- });
- }
- //查找空教室
- async querySingleRoom(queryParam) {
- let roomList;
- let params = queryParam;
- params.id = this.state.id;
- await queryRoom(params)
- .then(res => res.text())
- .then(data => {
- let htmlStr = data;
- // console.log(htmlStr);
- htmlStr = htmlStr.match(
- '