diff --git a/components/drawer/home/card/BusTime.js b/components/drawer/home/card/BusTime.js
index d00ef99..c83e8ac 100644
--- a/components/drawer/home/card/BusTime.js
+++ b/components/drawer/home/card/BusTime.js
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react'
-import { View, Text, StyleSheet } from 'react-native'
+import { View, Text, StyleSheet, Platform } from 'react-native'
import Picker from 'react-native-picker-select';
import BusTb from '../../../../jsons/busschedule.json';
import BusA from '../../../../tool/busA';
@@ -58,21 +58,29 @@ const BusTime = () => {
const pickerSelectStyles = StyleSheet.create({
inputIOS: {
- fontSize: 16,
- paddingVertical: 12,
+ fontSize: 14,
+ paddingVertical: 4,
paddingHorizontal: 10,
color: '#ffffff',
paddingRight: 24, // to ensure the text is never behind the icon
},
inputAndroid: {
- fontSize: 16,
- paddingHorizontal: 10,
- paddingVertical: 8,
+ fontSize: 14,
+ paddingHorizontal: 12,
color: '#ffffff',
paddingRight: 24, // to ensure the text is never behind the icon
},
+ inputAndroidContainer: {
+ height: null,
+ },
+ // headlessAndroidPicker: {
+ // height: null,
+ // },
+ headlessAndroidContainer: {
+ height: '100%'
+ },
iconContainer: {
- top: 10,
+ top: Platform.select({ios: 0, android: 10})
},
});
diff --git a/components/drawer/jnuservice/dreamy/DreamyHome.js b/components/drawer/jnuservice/dreamy/DreamyHome.js
index f8d857e..bd6fa20 100644
--- a/components/drawer/jnuservice/dreamy/DreamyHome.js
+++ b/components/drawer/jnuservice/dreamy/DreamyHome.js
@@ -74,7 +74,7 @@ const DreamyHome = ({navigation, isFocused}) => {
afterLogin(() => navigation.navigate("Credit"))}>
전체 성적을 조회하실 수 있습니다.
- {/* {isLogin && */}
+ {isLogin &&
{
renderItem={MenuItem}
contentContainerStyle={styles.totalMenuContainer}
/>
- {/* } */}
+ }
)
}
diff --git a/components/drawer/jnuservice/dreamy/LecturePlan.js b/components/drawer/jnuservice/dreamy/LecturePlan.js
index a6d3780..975d023 100644
--- a/components/drawer/jnuservice/dreamy/LecturePlan.js
+++ b/components/drawer/jnuservice/dreamy/LecturePlan.js
@@ -6,6 +6,7 @@ import colorPalette from '../../../styles/colorPalette';
import Picker from 'react-native-picker-select';
import semesterData from '../../../../jsons/semesterMap';
import Icon from 'react-native-vector-icons/Ionicons';
+import elevationShadowStyle from '../../../../tool/elevationShadow';
const LecturePlan = ({navigation}) => {
const date = new Date();
@@ -13,7 +14,7 @@ const LecturePlan = ({navigation}) => {
const [semester, setSemester] = useState([21, 10, 10, 10, 10, 10, 11, 20, 20, 20, 20, 20][date.getMonth()]);
const [classCode, setClassCode] = useState('');
const [professorName, setProfessorName] = useState('');
- const [lectureName, setLectureName] = useState('보안시스템개론');
+ const [lectureName, setLectureName] = useState('');
const [data, setData] = useState([]);
const [isLoading, setLoading] = useState(false);
@@ -27,10 +28,6 @@ const LecturePlan = ({navigation}) => {
await setLoading(false);
}
- useEffect(() => {
- getData()
- } ,[]);
-
const LectureItem = ({item: {classCode, credit, professorName, takeName, lectureCode, lectureName, time}}) => (
navigation.navigate("LecturePlanDetail", { year, semester, classCode, lectureCode })}>
@@ -74,27 +71,28 @@ const LecturePlan = ({navigation}) => {
Icon={() => ()}
/>
- {
- isLoading ? (
-
-
-
- ) : (
-
- setClassCode(classCode)} labelStyle={styles.label} containerStyle={styles.searchContainer} inputStyle={styles.searchInput}/>
- setProfessorName(professorName)} labelStyle={styles.label} containerStyle={styles.searchContainer} inputStyle={styles.searchInput}/>
- setLectureName(lectureName)} labelStyle={styles.label} containerStyle={styles.searchContainer} inputStyle={styles.searchInput}/>
-
)
@@ -131,6 +129,7 @@ const styles = StyleSheet.create({
borderWidth: 0.5,
backgroundColor: colorPalette.cardBackgroundColor,
padding: 16,
+ ...elevationShadowStyle(5),
},
lectureHeader: {
paddingBottom: 8,
@@ -169,8 +168,8 @@ const styles = StyleSheet.create({
backgroundColor: colorPalette.cardBackgroundColor,
borderColor: colorPalette.cardBorderColor,
borderWidth: 0.5,
- overflow: 'hidden',
marginVertical: 4,
+ ...elevationShadowStyle(5),
}
});
diff --git a/components/drawer/jnuservice/dreamy/LecturePlanDetail.js b/components/drawer/jnuservice/dreamy/LecturePlanDetail.js
index ea6627d..f37e226 100644
--- a/components/drawer/jnuservice/dreamy/LecturePlanDetail.js
+++ b/components/drawer/jnuservice/dreamy/LecturePlanDetail.js
@@ -1,12 +1,244 @@
import React, {useState, useEffect} from 'react'
-import { View, Text } from 'react-native';
+import { View, Text, ActivityIndicator, ScrollView, StyleSheet, FlatList, TouchableOpacity, Alert } from 'react-native';
+import { getLecturePlanDetail, downloadLecturePlanFile } from '../../../../service/jedaeroService';
+import colorPalette from '../../../styles/colorPalette';
+import elevationShadowStyle from '../../../../tool/elevationShadow';
+import { normalize } from 'react-native-elements';
+import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
+import { requestDownloadPermission } from '../../../../tool/requestPermission';
+import RNFetchBlob from 'rn-fetch-blob';
+import getMimeType from '../../../../tool/openFile';
-const LecturePlanDetail = () => {
- return (
-
- 상세 ㅎㅇ
+const Card = ({children}) => (
+
+ {children}
+
+)
+const renderHeader = ({item: {title, description}}) => (
+
+ {title}
+ {description}
+
+)
+
+const Book = ({item: {author, name, publish, year}}) => (
+
+ {author}
+ {name}
+ {publish}
+ {year}
+
+)
+
+const Week = ({item: week}) => (
+
+
+ {week.week}주차
+
+ {week.title}
+ {!!week.plan && {week.plan}}
+
+
+)
+const Task = ({item: task}) => (
+
+ {task.name}
+ {task.description}
+
+)
+
+const LecturePlanDetail = ({navigation}) => {
+ const [ plan, setPlan ] = useState(null);
+ const {year, semester, classCode, lectureCode} = navigation.state.params;
+ const getPlan = async () => setPlan(await getLecturePlanDetail({year, semester, lecture: {classCode, lectureCode}}));
+ useEffect(() => {getPlan()}, []);
+ const downloadFile = async ({fileName, encoded}) => {
+ if(Platform.OS === 'android' && !(await requestDownloadPermission())) {
+ Alert.alert("권한이 없어 다운로드가 불가능합니다.");
+ return;
+ }
+ try {
+ const res = await downloadLecturePlanFile({fileName, encoded, classCode, year, semester, lectureName: plan.lectureName})
+ console.log(res);
+ try {
+ !!res && Platform.select({
+ ios: () => RNFetchBlob.ios.openDocument(res.path()),
+ android: () => RNFetchBlob.android.actionViewIntent(res.path(), getMimeType(fileName))
+ })();
+ } catch(err) {
+ Alert.alert("다운로드했습니다.")
+ }
+ } catch (err) {
+ Alert.alert("다운로드에 실패하였습니다. 다시 시도해 주세요.");
+ }
+ }
+
+ const File = ({item: {fileName, encoded}}) => (
+ downloadFile({fileName, encoded})}>
+ {fileName}
+
+
)
+
+ return !plan ? (
+
+
+
+ ) : (Object.keys(plan).length === 0 ? (
+ 오류가 있거나 강의계획이 없습니다.
+ ) : (
+
+
+ item.title}
+ renderItem={renderHeader}
+ />
+
+ {!!plan.lecturePlan && (
+
+ 교수 개요 및 학습 목표
+ {plan.lecturePlan}
+
+ )}
+ {!!plan.note && (
+
+ 참고사항
+ {plan.lecturePlan}
+
+ )}
+ {!!plan.book.name && (
+
+ 교재
+
+
+ )}
+ {plan.references.length > 0 && (
+
+ 참고도서
+ index.toString()}
+ nestedScrollEnabled={true}
+ />
+
+ )}
+ {plan.weekList.length > 0 && (
+
+ 주차별 교수계획서
+ item.week}
+ nestedScrollEnabled={true}
+ />
+
+ )}
+
+ 평가방법
+
+
+ 출석
+ 중간고사
+ 기말고사
+ 과제물
+ 수시고사
+ 기타
+
+
+ {plan.attendanceRate}
+ {plan.middleRate}
+ {plan.finalRate}
+ {plan.assignmentRate}
+ {plan.frequentRate}
+ {plan.etcetraRate}
+
+
+
+ {plan.tasks.length > 0 && (
+
+ 과제
+ item.name}
+ />
+
+ )}
+ {plan.fileList.length > 0 && (
+
+ 첨부파일
+ item.encoded}
+ />
+
+ )}
+
+ ))
}
+const styles = StyleSheet.create({
+ cardContainer: {
+ marginVertical: 12,
+ marginHorizontal: 16,
+ paddingVertical: 16,
+ paddingHorizontal: 12,
+ borderRadius: 16,
+ borderWidth: 0.5,
+ borderColor: colorPalette.cardBorderColor,
+ backgroundColor: colorPalette.cardBackgroundColor,
+ ...elevationShadowStyle(5),
+ },
+ headerItem: {
+ flexDirection: 'row',
+ justifyContent: 'flex-start',
+ alignItems: 'center',
+ marginVertical: 4,
+ },
+ headerTitle: {
+ fontSize: normalize(12),
+ color: colorPalette.mainColor,
+ fontWeight: 'bold',
+ flexBasis: 100,
+ },
+ headerDescription: {
+ fontSize: normalize(12),
+ },
+ planText: {
+ fontSize: normalize(11),
+ lineHeight: normalize(14),
+ },
+ cardTitle: {
+ color: colorPalette.mainColor,
+ fontSize: normalize(14),
+ fontWeight: 'bold',
+ marginBottom: 16,
+ },
+ fileItem: {
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ marginVertical: 8,
+ },
+ fileName: {
+ fontSize: normalize(10),
+ color: colorPalette.mainColor,
+ flex: 1,
+ },
+ rate: {
+ flex: 1,
+ textAlign: 'center',
+ fontSize: normalize(10)
+ }
+})
+
export default LecturePlanDetail;
\ No newline at end of file
diff --git a/components/drawer/jnuservice/dreamy/LecturePost.js b/components/drawer/jnuservice/dreamy/LecturePost.js
index 6a80eb0..264ade7 100644
--- a/components/drawer/jnuservice/dreamy/LecturePost.js
+++ b/components/drawer/jnuservice/dreamy/LecturePost.js
@@ -32,7 +32,6 @@ const PostFooter = ({count, email}) => (
const PostFile = ({post: {author, count, date, email, title, file}, lectureDetail: {classCode, year, semester, root, num, reply, lectureCode, lectureName, professorCode, professorName }}) => {
const downloadFile = async ({fileName, encoded}) => {
- console.log({author, count, date, email, title, classCode, year, semester, root, num, reply, lectureCode, lectureName, professorCode, professorName });
if(Platform.OS === 'android' && !(await requestDownloadPermission())) {
Alert.alert("권한이 없어 다운로드가 불가능합니다.");
return;
@@ -76,20 +75,12 @@ const LecturePost = ({navigation: {state: {params: {year, semester, root, num, r
const getPost = async () => {
setPost(await getLecturePostData(year, semester, classCode, num, root));
}
-
- useEffect(() => {
- getPost();
- }, []);
-
- useEffect(() => {
- console.log(post);
- }, [post]);
-
+ useEffect(() => {getPost()}, []);
return !post ? (
- ) : (post === {} ? (
+ ) : (Object.keys(post).length === 0 ? (
오류가 있어유
) : (
diff --git a/components/drawer/jnuservice/dreamy/TimeTable.js b/components/drawer/jnuservice/dreamy/TimeTable.js
index 8fb17ed..76f1f34 100644
--- a/components/drawer/jnuservice/dreamy/TimeTable.js
+++ b/components/drawer/jnuservice/dreamy/TimeTable.js
@@ -36,8 +36,6 @@ const TimeTable = ({navigation}) => {
setTimeTable(await getTimeTable(day.year,day.month,day.day));
})();
}, [day])
-
- useEffect(() => { console.log(timeTable)}, [timeTable])
const scheduleHeader = () => (
diff --git a/components/drawer/jnuservice/dreamy/components/DreamyCard.js b/components/drawer/jnuservice/dreamy/components/DreamyCard.js
index aa5facb..ba26888 100644
--- a/components/drawer/jnuservice/dreamy/components/DreamyCard.js
+++ b/components/drawer/jnuservice/dreamy/components/DreamyCard.js
@@ -2,6 +2,7 @@ import React from 'react'
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import colorPalette from '../../../../styles/colorPalette';
import { normalize } from 'react-native-elements';
+import elevationShadowStyle from '../../../../../tool/elevationShadow';
const DreamyCard = ({title, children, onPress}) => {
return (
@@ -19,16 +20,18 @@ const DreamyCard = ({title, children, onPress}) => {
const styles = StyleSheet.create({
container: {
- overflow: 'hidden',
marginHorizontal: 16,
marginVertical: 12,
borderColor: colorPalette.cardBorderColor,
backgroundColor: colorPalette.cardBackgroundColor,
- borderRadius: 4
+ borderRadius: 16,
+ ...elevationShadowStyle(5)
},
header: {
paddingVertical: 8,
paddingHorizontal: 16,
+ borderTopLeftRadius: 16,
+ borderTopRightRadius: 16,
backgroundColor: colorPalette.mainColor,
justifyContent: 'center',
alignItems: 'center'
diff --git a/components/drawer/library/BookDetail.js b/components/drawer/library/BookDetail.js
index 8a95cc4..0601528 100644
--- a/components/drawer/library/BookDetail.js
+++ b/components/drawer/library/BookDetail.js
@@ -72,9 +72,7 @@ const BookRow = ({left, right, style}) => (
const bookdetailStyles = StyleSheet.create({
container: {
paddingTop:16,
- paddingHorizontal:8,
- paddingBottom: 56,
-
+ paddingHorizontal:8,
},
title: {
fontSize:normalize(24),
diff --git a/components/drawer/library/LibrarySearchDetail.js b/components/drawer/library/LibrarySearchDetail.js
index 2fb4b32..2b30d72 100644
--- a/components/drawer/library/LibrarySearchDetail.js
+++ b/components/drawer/library/LibrarySearchDetail.js
@@ -3,6 +3,7 @@ import { Text, View, StyleSheet, FlatList } from 'react-native'
import { normalize, ListItem } from 'react-native-elements';
import {LibraryBookListAPI} from '../../../tool/jedaero';
import colorPalette from '../../styles/colorPalette';
+import elevationShadowStyle from '../../../tool/elevationShadow';
const LibrarySearchDetail = ({navigation}) => {
const [list, setList] = useState([]);
@@ -32,6 +33,7 @@ const LibrarySearchDetail = ({navigation}) => {
{item.author}
@@ -40,7 +42,7 @@ const LibrarySearchDetail = ({navigation}) => {
}
titleStyle={{fontSize:normalize(16), fontWeight:'bold'}}
- containerStyle={{borderWidth: 0.5, borderColor:colorPalette.cardBorderColor, marginHorizontal: 10, marginBottom: 8, borderRadius: 4}}
+ containerStyle={{borderWidth: 0.5, borderColor:colorPalette.cardBorderColor, marginHorizontal: 10, marginBottom: 8, borderRadius: 16, ...elevationShadowStyle(5)}}
onPress={() => navigation.navigate('BookDetail', item)}
chevron
/>
diff --git a/components/drawer/library/LibrarySeat.js b/components/drawer/library/LibrarySeat.js
index 0ccaccf..75a93c6 100644
--- a/components/drawer/library/LibrarySeat.js
+++ b/components/drawer/library/LibrarySeat.js
@@ -4,6 +4,7 @@ import { normalize } from 'react-native-elements';
import { LibrarySeatAPI } from '../../../tool/jedaero';
import Icon from 'react-native-vector-icons/SimpleLineIcons'
import colorPalette from '../../styles/colorPalette';
+import elevationShadowStyle from '../../../tool/elevationShadow';
const LibrarySeat = () => {
const [data, setData] = useState(null);
@@ -27,11 +28,14 @@ const LibrarySeat = () => {
flexDirection:'row',
justifyContent:'flex-end',
borderRadius:8,
+ marginHorizontal: 16,
paddingHorizontal:8,
paddingVertical:4,
+ marginBottom: 8,
borderWidth:0.5,
borderColor:colorPalette.cardBorderColor,
- backgroundColor:colorPalette.cardBackgroundColor
+ backgroundColor:colorPalette.cardBackgroundColor,
+ ...elevationShadowStyle(5)
}}
onPress={getLibrarySeatData}
>
@@ -71,34 +75,45 @@ class TableRow extends Component {
const styles = StyleSheet.create({
listContainer: {
- borderRadius:8,
- overflow:'hidden',
- borderWidth: 0.5,
- borderColor:'#d7d7d7',
- borderBottomWidth:0,
- marginVertical:8,
+ // borderRadius:8,
+ // borderWidth: 0.5,
+ // borderColor:'#d7d7d7',
+ // borderBottomWidth:0,
+ // marginVertical:8,
+ // marginHorizontal: 16,
+ // ...elevationShadowStyle(5)
},
titleText: {
color:'#334955',
fontSize:normalize(20),
marginBottom: 16,
- fontWeight:'bold'
+ fontWeight:'bold',
+ marginHorizontal: 16,
},
rowUnit: {
flexDirection:'row',
- borderBottomWidth:0.5,
- borderColor:'#d7d7d7',
+ borderRadius: 8,
+ // borderWidth: 0.5,
+ // borderColor: colorPalette.cardBorderColor,
+ // borderBottomWidth:0.5,
backgroundColor: colorPalette.cardBackgroundColor,
+ marginHorizontal: 16,
+ marginVertical: 4,
+ ...elevationShadowStyle(5)
},
rowUnitLeft: {
flex:2.5,
paddingHorizontal:8,
paddingVertical: 6,
- justifyContent:'center'
+ borderTopLeftRadius: 8,
+ borderBottomLeftRadius: 8,
+ justifyContent:'center',
},
rowUnitRight: {
paddingHorizontal:8,
paddingVertical:4,
+ borderTopRightRadius: 8,
+ borderBottomRightRadius: 8,
justifyContent:'center',
flex: 1,
backgroundColor:colorPalette.mainColor,
diff --git a/components/navigations/MainBottomTabNavigation.js b/components/navigations/MainBottomTabNavigation.js
index 2f5f77a..fbaaf3f 100644
--- a/components/navigations/MainBottomTabNavigation.js
+++ b/components/navigations/MainBottomTabNavigation.js
@@ -44,7 +44,7 @@ const TabNav = createMaterialBottomTabNavigator({
},
}, {
...jedaeroBottomTabNavigationConfig,
- initialRouteName: "Dreamy"
+ initialRouteName: "Home"
})
TabNav.navigationOptions = () => ({
diff --git a/components/styles/busStyle.js b/components/styles/busStyle.js
index 8a63c4e..cc4fb6b 100644
--- a/components/styles/busStyle.js
+++ b/components/styles/busStyle.js
@@ -1,6 +1,7 @@
import { StyleSheet } from 'react-native';
import { normalize } from 'react-native-elements';
import colorPalette from './colorPalette';
+import elevationShadowStyle from '../../tool/elevationShadow';
const mainScreen = StyleSheet.create({
busView: {
@@ -11,14 +12,17 @@ const mainScreen = StyleSheet.create({
},
blockView: {
height:"auto",
- borderRadius: 4,
+ borderRadius: 16,
borderColor: colorPalette.cardBorderColor,
marginHorizontal: 16,
marginVertical: 12,
backgroundColor: colorPalette.cardBackgroundColor,
- overflow: 'hidden',
+ // overflow: 'hidden',
+ ...elevationShadowStyle(5),
},
blockViewTitle: {
+ borderTopLeftRadius: 16,
+ borderTopRightRadius: 16,
paddingTop: 10,
paddingBottom: 10,
paddingLeft: 15,
@@ -44,8 +48,8 @@ const mainScreen = StyleSheet.create({
borderLeftWidth: 0.5,
borderRightWidth: 0.5,
borderBottomWidth: 1,
- borderBottomLeftRadius: 4,
- borderBottomRightRadius: 4,
+ borderBottomLeftRadius: 16,
+ borderBottomRightRadius: 16,
borderColor: '#e7e7e7',
overflow: 'hidden',
},
@@ -106,13 +110,11 @@ const mainScreen = StyleSheet.create({
borderLeftWidth: 0.5,
borderRightWidth: 0.5,
borderBottomWidth: 0.5,
- borderBottomLeftRadius: 4,
- borderBottomRightRadius: 4,
+ borderBottomLeftRadius: 16,
+ borderBottomRightRadius: 16,
borderColor: '#e7e7e7',
- paddingLeft: 10,
- paddingRight: 10,
- paddingTop: 15,
- paddingBottom: 15,
+ paddingHorizontal: 12,
+ paddingVertical: 16,
overflow: 'hidden',
}
})
diff --git a/components/styles/haksaStyle.js b/components/styles/haksaStyle.js
index 4cb93ec..faa3f44 100644
--- a/components/styles/haksaStyle.js
+++ b/components/styles/haksaStyle.js
@@ -1,6 +1,7 @@
import { StyleSheet } from 'react-native';
import { normalize } from 'react-native-elements';
import colorPalette from './colorPalette';
+import elevationShadowStyle from '../../tool/elevationShadow';
export default StyleSheet.create({
container: {
@@ -25,13 +26,14 @@ export default StyleSheet.create({
backgroundColor: colorPalette.cardBackgroundColor,
borderWidth: 0.5,
borderColor: colorPalette.cardBorderColor,
- borderRadius: 4,
+ borderRadius: 16,
justifyContent:'flex-start',
alignItems:'center',
flexDirection:'column',
flexGrow: 0,
flexShrink: 1,
- flexBasis: '31.3%'
+ flexBasis: '31.3%',
+ ...elevationShadowStyle(5)
},
calendarMonth: {
fontSize: normalize(24),
diff --git a/components/styles/jedaeroCSS.js b/components/styles/jedaeroCSS.js
index bc8c407..a556f5f 100644
--- a/components/styles/jedaeroCSS.js
+++ b/components/styles/jedaeroCSS.js
@@ -105,7 +105,6 @@ let foodTabNavStyles = StyleSheet.create({
let libsearchStyles = StyleSheet.create({
container: {
- paddingHorizontal: 16,
paddingBottom:32,
},
textContainer: {
diff --git a/service/jedaeroService.js b/service/jedaeroService.js
index 38fff11..e197f03 100644
--- a/service/jedaeroService.js
+++ b/service/jedaeroService.js
@@ -7,16 +7,13 @@ const getTimeTable = async (year,month,day) => {
let res;
try {
res = await Dreamy.getTimeTable(account, year, month, day);
- console.log(res);
} catch(err) {
- console.log(err);
// json형태에서 오류가 발생했으면 undefined이거나 . 그러므로 재 로그인 시도.
await Dreamy._openSession(account, password);
res = await Dreamy.getTimeTable(account, year, month, day);
} finally {
// undefined라면? 그 밖의 문제를 의미하므로 빈 오브젝트 반환.
if(!res) return {};
-
const week = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
const data = {
day: {
@@ -321,9 +318,104 @@ const getLecturePlanList = async data => {
}
}
+const getLecturePlanDetail = async ({year, semester, lecture: {classCode, lectureCode}}) => {
+ let res;
+ try {
+ res = {
+ ...await Dreamy.getLecturePlanSummary({year, semester, lecture: {classCode, lectureCode}})['CODE_DETAIL'],
+ ...await Dreamy.getLecturePlanList({year, semester, classCode}),
+ ...await Dreamy.getLecturePlanDetailWeekList({year, semester, classCode})['MST_LIST']
+ }
+ } catch(err) {
+ const { username: account, password: baseInfo } = await Keychain.getGenericPassword();
+ const { password } = JSON.parse(baseInfo);
+ await Dreamy._openSession(account, password);
+ res = {
+ ...await Dreamy.getLecturePlanSummary({year, semester, lecture: {classCode, lectureCode}})['CODE_DETAIL'],
+ ...await Dreamy.getLecturePlanDetail({year, semester, classCode}),
+ ...await Dreamy.getLecturePlanDetailWeekList({year, semester, classCode})
+ }
+ } finally {
+ if(!res) return {};
+ return Array.isArray(res['SINGLE_DATA']) && res['SINGLE_DATA'].length > 0 ? {
+ classCode: res['SINGLE_DATA'][0]['ban_no'],
+ credit: res['SINGLE_DATA'][0]['credit'],
+ professorName: res['SINGLE_DATA'][0]['disp_emp_nm'],
+ professorCode: res['SINGLE_DATA'][0]['emp_no'],
+ lectureName: res['SINGLE_DATA'][0]['subject_nm'],
+ lectureCode: res['SINGLE_DATA'][0]['subject_cd'],
+ evaluation: res['SINGLE_DATA'][0]['sj_val_gb'],
+ attendanceRate: res['SINGLE_DATA'][0]['eval_rate1'],
+ middleRate: res['SINGLE_DATA'][0]['eval_rate2'],
+ finalRate: res['SINGLE_DATA'][0]['eval_rate3'],
+ assignmentRate: res['SINGLE_DATA'][0]['eval_rate4'],
+ frequentRate: res['SINGLE_DATA'][0]['eval_rate5'],
+ etcetraRate: res['SINGLE_DATA'][0]['eval_rate6'],
+ email: res['SINGLE_DATA'][0]['inst_email'],
+ tel: res['SINGLE_DATA'][0]['inst_tel'],
+ lecturePlan: res['SINGLE_DATA'][0]['learn_mark'],
+ note: res['SINGLE_DATA'][0]['note'],
+ book: {
+ author: res['SINGLE_DATA'][0]['mater_author'],
+ publish: res['SINGLE_DATA'][0]['mater_com'],
+ name: res['SINGLE_DATA'][0]['mater_nm'],
+ year: res['SINGLE_DATA'][0]['mater_year'],
+ },
+ references: [
+ {
+ author: res['SINGLE_DATA'][0]['ref1_author'],
+ publish: res['SINGLE_DATA'][0]['ref1_com'],
+ name: res['SINGLE_DATA'][0]['ref1_nm'],
+ year: res['SINGLE_DATA'][0]['year'],
+ },
+ {
+ author: res['SINGLE_DATA'][0]['ref1_author'],
+ publish: res['SINGLE_DATA'][0]['ref1_com'],
+ name: res['SINGLE_DATA'][0]['ref1_nm'],
+ year: res['SINGLE_DATA'][0]['year'],
+ }
+ ].filter(reference => !!reference.name),
+ tasks: [
+ {
+ name: res['SINGLE_DATA'][0]['task_nm'],
+ description: res['SINGLE_DATA'][0]['task_desc'],
+ },
+ {
+ name: res['SINGLE_DATA'][0]['task_nm2'],
+ description: res['SINGLE_DATA'][0]['task_desc2'],
+ }
+ ].filter(task => !!task.name),
+ weekList: res['MST_LIST'].map(row => ({
+ week: row['week_cnt'],
+ title: row['week_title'],
+ book: row['task_exte'],
+ plan: row['learn_plan'],
+ })),
+ fileList: res['FILE_LIST'].map(row => ({
+ fileName: row['file_nm'],
+ encoded: row['down_file_nm'],
+ fileSize: row['file_size']
+ }))
+ } : {};
+ }
+}
+
+const downloadLecturePlanFile = async ({fileName, encoded, classCode, year, semester, lectureName}) => {
+ const {username: account, password: baseInfo} = await Keychain.getGenericPassword();
+ const { password, name } = JSON.parse(baseInfo);
+ let res;
+ try {
+ res = await Dreamy.downloadLecturePlan({account, name, encoded, fileName, classCode, year, semester, lectureName});
+ } catch (err) {
+ await Dreamy._openSession(account, password);
+ res = await Dreamy.downloadLecturePlan({account, name, encoded, fileName, classCode, year, semester, lectureName});
+ } finally {
+ return res;
+ }
+}
+
const checkLogin = async () => {
const credentials = await Keychain.getGenericPassword();
return !!credentials;
}
-
-export { getTimeTable, getCreditData, getCreditDetailData, getBaseInfo, getLectureBoardData, getLectureItemBoardData, getLecturePostData, downloadLecturePostFile, logoutDreamy, isPassDormitory, checkLogin, getLecturePlanList }
\ No newline at end of file
+export { getTimeTable, getCreditData, getCreditDetailData, getBaseInfo, getLectureBoardData, getLectureItemBoardData, getLecturePostData, downloadLecturePostFile, logoutDreamy, isPassDormitory, checkLogin, getLecturePlanList, getLecturePlanDetail, downloadLecturePlanFile }
diff --git a/tool/elevationShadow.js b/tool/elevationShadow.js
new file mode 100644
index 0000000..0ab81d5
--- /dev/null
+++ b/tool/elevationShadow.js
@@ -0,0 +1,14 @@
+export default function elevationShadowStyle(elevation) {
+ return {
+ elevation,
+ shadowColor: 'black',
+ shadowOffset: { width: 0, height: 0.2 * elevation },
+ shadowOpacity: 0.3,
+ shadowRadius: 0.5 * elevation
+ };
+}
+
+/**
+ * https://stenbeck.io/styling-shadows-in-react-native-ios-and-android/
+ */
+
diff --git a/tool/jedaero/lib/dreamy.js b/tool/jedaero/lib/dreamy.js
index d7facf7..8e76619 100644
--- a/tool/jedaero/lib/dreamy.js
+++ b/tool/jedaero/lib/dreamy.js
@@ -114,14 +114,6 @@ const Dreamy = {
path: `${Platform.select({ios: RNFetchBlob.fs.dirs.DocumentDir, android: RNFetchBlob.fs.dirs.DownloadDir})}/${fileName}`,
trusty: true,
fileCache: true,
- // addAndroidDownloads: {
- // useDownloadManager: true,
- // title: fileName,
- // description: "제대로 가자",
- // mime:'application/octet-stream',
- // mediaScannable: true,
- // notification: true,
- // }
}).fetch('POST', uri, {
"Content-Type": "application/x-www-form-urlencoded"
}, body);
@@ -141,11 +133,7 @@ const Dreamy = {
const body = `mode=doGetListDetail&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&subject_cd=${lectureCode}&_=`
return (await fetchData(uri, body)).json();
},
-
- /**
- * @param {mode: string , year, semester, classCode} search
- */
- getLecturePlanDetail: async function({mode, year, semester, classCode}) {
+ getLecturePlanDetail: async function({year, semester, classCode}) {
const uri = 'https://dreamy.jejunu.ac.kr/susj/su/sta_su_7012e.jejunu';
const body = `mode=doSearch&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&_=`
return (await fetchData(uri, body)).json();
@@ -154,6 +142,17 @@ const Dreamy = {
const uri = 'https://dreamy.jejunu.ac.kr/susj/su/sta_su_7012e.jejunu';
const body = `mode=doListMst&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&_=`
return (await fetchData(uri, body)).json();
+ },
+ downloadLecturePlan: async function ({account, name, encoded, fileName, classCode, year, semester, lectureName}) {
+ const uri = 'https://dreamy.jejunu.ac.kr/susj/su/sta_su_7020q.jejunu';
+ const body = `mode=doDownLoadFile&init_user_id=${account}&init_user_nm=${encodeURIComponent(name)}&tempfilename=${encoded}_down&filename=${encodeURIComponent(fileName)}&seq=&select_ban_no=${classCode}&find_curri_year=${year}&find_term_gb=${semester}&find_ban_no=&find_emp_nm=&find_subject_nm=${lectureName}&cb_pagingMst=1`
+ return RNFetchBlob.config({
+ path: `${Platform.select({ios: RNFetchBlob.fs.dirs.DocumentDir, android: RNFetchBlob.fs.dirs.DownloadDir})}/${fileName}`,
+ trusty: true,
+ fileCache: true,
+ }).fetch('POST', uri, {
+ "Content-Type": "application/x-www-form-urlencoded"
+ }, body);
}
};