Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
软件工程实践2022年春W班
穿梭在银河的火箭队
FZUStudyRoom
提交
76dfec46
F
FZUStudyRoom
项目概览
软件工程实践2022年春W班
/
穿梭在银河的火箭队
/
FZUStudyRoom
通知
12
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FZUStudyRoom
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
76dfec46
编写于
5月 12, 2022
作者:
YYYTDMS
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
330_合并联机自习模块
上级
f72fad14
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
25 addition
and
80 deletion
+25
-80
component/OnlineStudy/2-PlayerPKHome/index.js
component/OnlineStudy/2-PlayerPKHome/index.js
+1
-0
component/OnlineStudy/GlobalResourses/index.js
component/OnlineStudy/GlobalResourses/index.js
+1
-0
component/OnlineStudy/GlobalUserTest/index.js
component/OnlineStudy/GlobalUserTest/index.js
+0
-20
component/OnlineStudy/MyTest/index.js
component/OnlineStudy/MyTest/index.js
+0
-49
component/OnlineStudy/MyUtilities/index.js
component/OnlineStudy/MyUtilities/index.js
+14
-7
component/OnlineStudy/RangePKHome/index.js
component/OnlineStudy/RangePKHome/index.js
+2
-0
component/OnlineStudy/RangePKStudy/index.js
component/OnlineStudy/RangePKStudy/index.js
+3
-0
page/Login/index.js
page/Login/index.js
+2
-2
page/Login/register.js
page/Login/register.js
+2
-2
未找到文件。
component/OnlineStudy/2-PlayerPKHome/index.js
浏览文件 @
76dfec46
...
...
@@ -42,6 +42,7 @@ class TwoPlayerPKHome extends Component {
state
=
{
isStarted
:
false
,
isCanceling
:
false
};
resolveMessage
=
msg
=>
{
console
.
log
(
msg
);
const
data
=
JSON
.
parse
(
msg
.
data
);
console
.
log
(
data
);
if
(
data
.
hasOwnProperty
(
'
type
'
))
{
...
...
component/OnlineStudy/GlobalResourses/index.js
浏览文件 @
76dfec46
...
...
@@ -3,3 +3,4 @@ global.defaultACID = 'notLocated'; // default value of acID
global
.
acID
=
global
.
defaultACID
;
// a acID of range PK
global
.
rangeID
=
global
.
defaultRangeID
;
// rangeID for school buildings
global
.
websocket
=
new
WebSocket
(
'
ws://localhost:8080
'
);
// an instance of websocket
global
.
sno
=
''
;
component/OnlineStudy/GlobalUserTest/index.js
已删除
100644 → 0
浏览文件 @
f72fad14
global
.
sno
=
'
221900330
'
;
global
.
password
=
'
123
'
;
export
class
sno
{
static
get
()
{
return
global
.
sno
;
}
static
set
(
input
)
{
global
.
sno
=
input
;
}
}
export
class
password
{
static
get
()
{
return
global
.
password
;
}
static
set
(
input
)
{
global
.
password
=
input
;
}
}
component/OnlineStudy/MyTest/index.js
已删除
100644 → 0
浏览文件 @
f72fad14
import
{
sno
,
password
}
from
'
../GlobalUserTest
'
;
import
{
post
,
get
}
from
'
../MyUtilities
'
;
// import {get, post} from '../../../utils/http';
const
URL_LOGIN
=
'
http://www.tdms.xyz:8000/FZUStudy/login
'
;
const
URL_LOGOUT
=
'
http://www.tdms.xyz:8000/FZUStudy/logout
'
;
const
URL_2PLAYER_PK_MATCH
=
'
ws://www.tdms.xyz:8000/FZUStudy/websocket/pk/
'
;
// + '{sno}'
// export function login() {
// const data = {
// sno: sno.get(),
// password: password.get(),
// };
// const resolveData = r => {
// console.log(r);
// };
// // console.log('[Login] sno: ' + data.sno + ' password: ' + data.password);
// post(URL_LOGIN, data).then(resolveData).catch();
// }
// export function logout() {
// const resolveData = data => {
// console.log(data);
// };
// // console.log('[Logout]');
// get(URL_LOGOUT, {}).then(resolveData).catch();
// }
// export function connect() {
// const socketUrl = URL_2PLAYER_PK_MATCH + sno.get();
// let socket = new WebSocket(socketUrl);
// //打开事件
// socket.onopen = function () {
// console.log('websocket 已打开');
// };
// //获得消息事件
// socket.onmessage = function (msg) {
// const serverMsg = '收到服务端信息: ' + msg.data;
// console.log(serverMsg);
// };
// //关闭事件
// socket.onclose = function () {
// console.log('websocket 已关闭');
// };
// //发生了错误事件
// socket.onerror = function () {
// console.log('websocket 发生了错误');
// };
// }
component/OnlineStudy/MyUtilities/index.js
浏览文件 @
76dfec46
import
'
../GlobalResourses
'
;
// 用户 sno
import
'
../GlobalUserTest
'
;
import
CookieManager
from
'
@react-native-cookies/cookies
'
;
import
{
ToastAndroid
}
from
'
react-native
'
;
import
{
connect
}
from
"
react-redux
"
;
import
{
Component
}
from
"
react
"
;
/**
* class sno 的 get() 和 set() 需要修改以指向“全局变量”中的“学号”
*/
const
EARTH_RADIUS
=
6371393
;
// metre
const
DEFAULT_DISTANCE
=
1
00
;
// metre
const
DEFAULT_DISTANCE
=
2
00
;
// metre
const
URL_SHORT
=
'
http://www.tdms.xyz:8000/FZUStudy
'
;
const
URL_AREA_GET_ID
=
'
http://www.tdms.xyz:8000/FZUStudy/study/areaGetID
'
;
const
URL_AREA_MATCH
=
'
http://www.tdms.xyz:8000/FZUStudy/study/areamatch
'
;
...
...
@@ -315,13 +315,20 @@ export class websocket {
}
}
const
mapStateToProps
=
state
=>
{
const
{
user
}
=
state
;
return
{
user
};
};
// 用户 sno
export
class
sno
{
export
class
sno
{
static
get
()
{
return
global
.
sno
;
}
static
set
(
input
)
{
global
.
sno
=
input
;
static
set
(
sno
)
{
global
.
sno
=
sno
;
}
}
...
...
@@ -368,7 +375,7 @@ function getDistance(longitude1, latitude1, longitude2, latitude2) {
}
function
parseLocation
(
longitude
,
latitude
)
{
//
console.log('longitude: ' + longitude + ' latitude: ' + latitude);
console
.
log
(
'
longitude:
'
+
longitude
+
'
latitude:
'
+
latitude
);
let
range
=
{
ID
:
'
notInRange
'
,
distance
:
DEFAULT_DISTANCE
,
...
...
component/OnlineStudy/RangePKHome/index.js
浏览文件 @
76dfec46
...
...
@@ -63,6 +63,8 @@ class RangePKHome extends Component {
location
=>
{
const
longitude
=
location
.
coords
.
longitude
;
//经度
const
latitude
=
location
.
coords
.
latitude
;
//纬度
// console.log('longitude:',longitude)
// console.log('latitude:',latitude)
rangeID
.
setByLocation
(
longitude
,
latitude
);
this
.
setState
({
isStarted
:
false
,
...
...
component/OnlineStudy/RangePKStudy/index.js
浏览文件 @
76dfec46
...
...
@@ -252,6 +252,9 @@ class RangePKStudy extends Component {
let
top
=
'
ERROR
'
;
let
bottom
=
'
ERROR
'
;
console
.
log
(
'
[QUIT_SUCCESS]
'
,
params
);
if
(
params
.
hasOwnProperty
(
'
duration
'
)){
top
=
params
.
duration
}
if
(
params
.
hasOwnProperty
(
'
start_time
'
)
&&
params
.
hasOwnProperty
(
'
end_time
'
)
...
...
page/Login/index.js
浏览文件 @
76dfec46
...
...
@@ -16,7 +16,7 @@ import {SafeAreaProvider} from 'react-native-safe-area-context';
import
{
connect
}
from
'
react-redux
'
;
import
{
bindActionCreators
}
from
'
redux
'
;
import
{
updateUserDetail
}
from
'
../../store/action/user-actions
'
;
import
{
sno
as
globalSno
}
from
'
../../component/OnlineStudy/MyUtilities
'
class
Login
extends
Component
{
static
navigationOptions
=
{
title
:
'
登录
'
,
...
...
@@ -54,7 +54,7 @@ class Login extends Component {
});
// alert('登录成功!');
ToastAndroid
.
show
(
'
登录成功!
'
,
500
);
//提示
global
.
sno
=
sno
;
global
Sno
.
set
(
sno
)
this
.
props
.
navigation
.
navigate
(
'
Home
'
);
})
.
catch
(
err
=>
{
...
...
page/Login/register.js
浏览文件 @
76dfec46
...
...
@@ -12,7 +12,7 @@ import {Button, CheckBox, Icon, Input} from 'react-native-elements';
import
{
connect
}
from
'
react-redux
'
;
import
{
bindActionCreators
}
from
'
redux
'
;
import
{
updateUserDetail
}
from
'
../../store/action/user-actions
'
;
import
{
sno
as
globalSno
}
from
'
../../component/OnlineStudy/MyUtilities
'
const
{
width
,
height
}
=
Dimensions
.
get
(
'
window
'
);
class
register
extends
Component
{
...
...
@@ -49,7 +49,7 @@ class register extends Component {
ToastAndroid
.
show
(
'
注册成功!
'
,
500
);
//提示
http
(
'
post
'
,
'
/login
'
,
{
sno
,
password
}).
then
(
res
=>
{
console
.
log
(
'
res
'
,
res
);
global
.
sno
=
sno
;
global
Sno
.
set
(
sno
)
;
this
.
props
.
updateUserDetail
(
res
.
data
);
this
.
props
.
navigation
.
navigate
(
'
Home
'
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录