Skip to content

Commit

Permalink
Merge pull request #85 from kookmin-sw/FE_Feature/#59-BackendConnect
Browse files Browse the repository at this point in the history
FE feature/#59 backend connect
  • Loading branch information
ZombieBread123 authored May 18, 2024
2 parents acadb87 + 206c165 commit fe104b9
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 352 deletions.
3 changes: 2 additions & 1 deletion frontend/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
19 changes: 11 additions & 8 deletions frontend/lib/http.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:get/get.dart';
import 'dart:convert';

import 'package:frontend/secret.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import 'package:xml2json/xml2json.dart';
import 'package:frontend/secret.dart';
import 'dart:convert';

const String NaverBookSearchURL =
"https://openapi.naver.com/v1/search/book.json";
Expand Down Expand Up @@ -199,6 +199,7 @@ Future<dynamic> contentCreate(
dynamic asId,
String isbn,
String booktitle,
String description,
String author,
String publisher,
String publishDate,
Expand All @@ -211,7 +212,6 @@ Future<dynamic> contentCreate(
var address;
// print(clubId);
if (clubId == null) {
print(clubId);
address = Uri.parse("$BASE_URL/content/create?");
} else {
address = Uri.parse("$BASE_URL/content/create?clubId=$clubId&asId=$asId");
Expand All @@ -224,8 +224,9 @@ Future<dynamic> contentCreate(
},
body: json.encode({
"addBookRequest": {
"isbn": isbn,
"isbn": isbn,
"title": booktitle,
"description": description,
"author": author,
"publisher": publisher,
"publishDate": publishDate,
Expand All @@ -239,7 +240,7 @@ Future<dynamic> contentCreate(
}),
);
final data = res.body;
// final data = json.decode(utf8.decode(res.bodyBytes));
//final data = json.decode(utf8.decode(res.bodyBytes));
print(data);
return data;
}
Expand Down Expand Up @@ -279,15 +280,15 @@ Future<dynamic> quizCreate(
},
body: json.encode({
"addBookRequest": {
"isbn": isbn,
"isbn": isbn,
"title": booktitle,
"author": author,
"publisher": publisher,
"publishDate": publishDate,
"imageUrl": imageUrl,
},
"type": type,
"description" : description,
"description": description,
"answer": answer,
"example1": example1,
"example2": example2,
Expand Down Expand Up @@ -603,6 +604,7 @@ Future<String> addBookToLibrary(
String token,
String isbn,
String title,
String description,
String author,
String publisher,
String publishDate,
Expand All @@ -617,6 +619,7 @@ Future<String> addBookToLibrary(
body: json.encode({
"isbn": isbn,
"title": title,
"description": description,
"author": author,
"publisher": publisher,
"publishDate": publishDate,
Expand Down
42 changes: 18 additions & 24 deletions frontend/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:frontend/provider/bookinfo_provider.dart';
import 'package:frontend/provider/secure_storage_provider.dart';
import 'package:frontend/screens/book/book_content_screen.dart';
import 'package:frontend/screens/book/book_info_screen.dart';
import 'package:frontend/screens/home/bookreport/bookreport_template_screen.dart';
import 'package:frontend/screens/home/bookreport/bookreport_viewing_screen.dart';
import 'package:frontend/screens/home/bookreport/bookreport_writing_screen.dart';
import 'package:frontend/screens/home/mypage/login_screen.dart';
import 'package:frontend/screens/home/mypage/makelibrary_screen.dart';
import 'package:frontend/screens/home/mypage/mypage_screen.dart';
import 'package:frontend/screens/home/mypage/signup_screen.dart';
import 'package:get/get_connect/http/src/utils/utils.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';

import 'package:frontend/screens/home/home_screen.dart';
import 'package:frontend/screens/home/search/search_screen.dart';
import 'package:frontend/screens/home/shorts/shorts_screen.dart';
import 'package:frontend/screens/home/group/group_screen.dart';
import 'package:frontend/screens/home/group/in_group/group_info_screen.dart';
import 'package:frontend/screens/home/group/make_group/group_make_screen.dart';
import 'package:frontend/screens/home/group/in_group/groupbook_select_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/homework_list_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/homework_memberlist_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/make_post/homework_make_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/make_post/post_make_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/notice_list_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/post_list_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/post_screen.dart';
import 'package:frontend/screens/book/book_info_screen.dart';
import 'package:frontend/screens/home/group/in_group/groupbook_select_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/make_post/post_make_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/make_post/homework_make_screen.dart';
import 'package:frontend/screens/home/group/in_group/post/homework_memberlist_screen.dart';
import 'package:frontend/screens/home/group/in_group/voicecall/voice_class.dart';
import 'package:frontend/screens/book/book_content_screen.dart';
import 'package:frontend/screens/home/group/make_group/group_make_screen.dart';
import 'package:frontend/screens/home/home_screen.dart';
import 'package:frontend/screens/home/mypage/login_screen.dart';
import 'package:frontend/screens/home/mypage/makelibrary_screen.dart';
import 'package:frontend/screens/home/mypage/mypage_screen.dart';
import 'package:frontend/screens/home/mypage/signup_screen.dart';
import 'package:frontend/screens/home/search/search_screen.dart';
import 'package:frontend/screens/home/shorts/shorts_screen.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';

void main() async {
runApp(const App());
Expand Down Expand Up @@ -111,9 +107,7 @@ final GoRouter router = GoRouter(
path: '/bookreport_viewing',
builder: (context, state) {
dynamic contentData = state.extra as dynamic;
return BookReportViewingScreen(
contentData: contentData,
);
return BookReportViewingScreen(contentData: contentData);
},
),
GoRoute(
Expand Down Expand Up @@ -248,7 +242,7 @@ final GoRouter router = GoRouter(
String type = extraData['type'] as String;
String isbn = extraData['isbn'] as String;
return BookContentScreen(
posts: posts,
posts: posts,
type: type,
isbn: isbn,
);
Expand Down
53 changes: 29 additions & 24 deletions frontend/lib/screens/home/bookreport/bookreport_viewing_screen.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import 'package:flutter/material.dart';
import 'package:frontend/http.dart';
import 'package:frontend/provider/secure_storage_provider.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:frontend/provider/secure_storage_provider.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';

class BookReportViewingScreen extends StatefulWidget {
final dynamic contentData;

const BookReportViewingScreen({
super.key,
required this.contentData,
});
const BookReportViewingScreen({super.key, required this.contentData});

@override
State<BookReportViewingScreen> createState() => _BookReportViewingState();
Expand All @@ -20,43 +16,35 @@ class BookReportViewingScreen extends StatefulWidget {
class _BookReportViewingState extends State<BookReportViewingScreen> {
final TextEditingController _answerController = TextEditingController();
// List<dynamic> _contentData = [];
dynamic _startDate = DateTime.now();
dynamic _endDate = DateTime.now();
final dynamic _startDate = DateTime.now();
final dynamic _endDate = DateTime.now();
//bool _isPublic = false;
String _template = '';
String _writer = '';
String _title = '';
String _booktitle = '';
String _body = '';
String _author = "작가";
String _publisher = "출판사";
String _category = '';
String _answer = '';
bool _oxanswer = false;
// String _example1 = '';
// String _example2 = '';
// String _example3 = '';
// String _example4 = '';
List<dynamic> _exampleList = [null, null, null, null];
List<dynamic> _multipleanswer = [false, false, false, false];
// bool _answer1 = false;
// bool _answer2 = false;
// bool _answer3 = false;
// bool _answer4 = false;
final List<dynamic> _exampleList = [null, null, null, null];
final List<dynamic> _multipleanswer = [false, false, false, false];
var token;

void initializeClubContentData(dynamic content) {
print(content);
setState(() {
_template = contentTypeCheck(content['type']);
_writer = content['writer'];
// _startDate = content['startDate'];
// _endDate = content['endDate'];
_author = content['book']['author'];
_publisher = content['book']['publisher'];
print(_template);
if (_template == "독후감" || _template == "한줄평" || _template == "인용구") {
_body = content['body'];
_title = content['title'];
_booktitle = content['book']['title'];
} else {
_category = quizCategory(content['type']);
_answer = content['answer'];
Expand Down Expand Up @@ -145,6 +133,15 @@ class _BookReportViewingState extends State<BookReportViewingScreen> {
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
children: [
Text(_booktitle),
],
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
Expand All @@ -169,8 +166,12 @@ class _BookReportViewingState extends State<BookReportViewingScreen> {
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Expanded(
child: _buildTemplateUI(_template),
child: Row(
children: [
Expanded(
child: _buildTemplateUI(_template),
),
],
),
),
const SizedBox(height: 15),
Expand Down Expand Up @@ -248,8 +249,12 @@ class _BookReportViewingState extends State<BookReportViewingScreen> {
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Expanded(
child: _buildQuizUI(_category),
child: Row(
children: [
Expanded(
child: _buildQuizUI(_category),
),
],
),
),
const SizedBox(height: 10),
Expand Down
Loading

0 comments on commit fe104b9

Please sign in to comment.