Skip to content

Commit

Permalink
[Update]
Browse files Browse the repository at this point in the history
Former-commit-id: ea70ebead79b5d558579ef8fd817ce5e4bae3886
  • Loading branch information
krc authored and krc committed Nov 29, 2021
2 parents b3ee588 + 65a4dd9 commit 0b88292
Show file tree
Hide file tree
Showing 15 changed files with 608 additions and 3,082 deletions.
Binary file added UIUX 기능정의서(1129 수정).pdf
Binary file not shown.
3,439 changes: 529 additions & 2,910 deletions analysis/visualize.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/static/css/foodSearch.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
}
/* 검색란 */
.search_box{
width: 450px;
height: 200px;
display: flex;
justify-content: center;
flex-direction: column;

}
.search_button{
width: fit-content;
Expand Down Expand Up @@ -65,7 +65,7 @@
list-style: none;
padding: 8px 12px;
display: none;
width: auto;
width: inherit;
cursor: default;
border-radius: 3px;
}
Expand Down
15 changes: 14 additions & 1 deletion app/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ a:active{color: white;}
border: 10px solid #AD732E;
border-radius: 10px;
box-shadow: 0px 1px 3px gray;
z-index: 100;
}
.personal_bubble{
width: fit-content;
Expand All @@ -473,7 +474,8 @@ a:active{color: white;}
/*--------diet--------*/
.diet_background{
width: 100%;
background: linear-gradient(to bottom, rgb(240,207,240) 10%, rgb(216,168,216) 50%, rgb(191,147,204));
padding-bottom: 130px;
background: linear-gradient(to bottom, #FFF9EB 10%, #FFF0CA 40%, #DEB6EA);
display: flex;
flex-direction: column;
align-items: center;
Expand Down Expand Up @@ -590,6 +592,17 @@ a:active{color: white;}
.move_button_hidden{
display: none;
}
.hidden_stamp{
top: 500px;
position: absolute;
display: none;
/* z-index: -999; */
}
.show{
top: 500px;
position: absolute;
z-index: 1000;
}
/*--------kit--------*/
.kit_clip_img{
top: 820px;
Expand Down
Binary file added app/static/image/completed_stamp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 7 additions & 96 deletions app/static/js/diet.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,99 +23,10 @@ $(function(){

});

//개인정보 입력 완료 안내 창
// function personal() {
// let answer = document.getElementById("personal_submit").Value;
// if(answer == null){
// alert("개인정보 입력 후 버튼을 눌러주세요 :)")
// }
// }

// function personal(){
// thrForm=document.personal_form;
// if(theForm.gender.value == ""){
// alert("개인정보 입력 후 버튼을 눌러주세요 :)")
// }
// if(theForm.age == ""){
// alert("개인정보 입력 후 버튼을 눌러주세요 :)")
// }
// if(theForm.weight == ""){
// alert("개인정보 입력 후 버튼을 눌러주세요 :)")
// }
// if(theForm.height == ""){
// alert("개인정보 입력 후 버튼을 눌러주세요 :)")
// }
// if(theForm.activity == ""){
// alert("개인정보 입력 후 버튼을 눌러주세요 :)")
// }
// theForm.submit();
// }

// $("#personal_submit").click(function(){
// if($.trim($(".gender").val())==""){
// alert("개인정보 입력 후 버튼을 눌러주세요 :)")
// return false
// }else{
// $("#form_personal").submit();
// }
// });

function personal_submit() {
if (!check_gender(form.gender.value)){
return false;
} else if (!check_age(form.age.value)){
return false;
} else if (!check_weight(form.weight.value)){
return false;
} else if (!check_height(form.height.value)){
return false;
} else if (!check_activity(form.activity.value)){
return false;
}
return true;
}

function exist_data(value, dataname) {
if (value == "") {
alert(dataname + " 입력해주세요!");
return false;
}
return true;
}
// 성별 입력
function check_gender(gender) {
if (!exist_data(gender, "성별을"))
return false;

return true;
}
// 나이 입력
function check_age(age) {
if (!exist_data(age, "나이를"))
return false;

return true;
}
// 몸무게 입력
function check_weight(weight) {
if (!exist_data(weight, "몸무게를"))
return false;

return true;
}
// 키 입력
function check_height(height) {
if (!exist_data(height, "키를"))
return false;

return true;
}
// 활동량 입력
function check_activity(activity) {
if (!exist_data(activity, "활동량을"))
return false;

return true;
}

console.log("hi")
// personal submit 버튼 입력시 스크롤 이동
$(document).ready(function() {
$("#personal_submit").click(function(event) {
window.scrollTo(200, 500);
$('html, body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
});
21 changes: 3 additions & 18 deletions app/static/js/diet_result.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
// var memberCountConTxt= 0.423453;
// let memberCountConTxt = {{ result|safe }};
// var memberCountConTxt = {{ result | tojson}};
// var memberCountConTxt = JSON.parse( {{ result|safe }} );
// var memberCountConTxt = '{{ result }}' ;
// var memberCountConTxt = test_func({{result}})

var memberCountConTxt = $('#my-data').data().name;

// $({ val : 0 }).animate({ val : memberCountConTxt }, {
// duration: 2000,
// step: function() {
// var num = numberWithCommas(Math.floor(this.val));
// $(".number_count").text(num);
// },
// complete: function() {
// var num = numberWithCommas(Math.floor(this.val));
// $(".number_count").text(num);
// }
// });

$({ val : 0 }).animate({ val : memberCountConTxt }, {
duration: 2000,
step: function() {
Expand All @@ -35,4 +20,4 @@ function numberWithCommas(x) {

function test_func(data) {
data;
}
}
39 changes: 19 additions & 20 deletions app/static/js/index.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
setTimeout(typing, 3000);

// question detail 타이핑 모션//
const content = "의학적 전문성이 아닌, 데이터 기반의 해석을 통해 식단을 제공 받을 수 있을까?";
const text = document.querySelector(".question_detail");
let i = 0;

function sleep(delay){
const start = new Date().getTime();
while (new Date().getTime() < start + delay);
function typing(){
text.textContent += content[i++];
if (i > content.length) {
text.textContent = ""
i = 0;
time.sleep(3000);
};
}
setInterval(typing, 140)

window.onload=function() {
function typing(){
text.textContent += content[i++];
if (i > content.length) {
text.textContent = ""
i = 0;
sleep(3000);
}
}
setInterval(typing, 140)
}

// //diet, visual hover 효과
// $(".hover").mouseleave(
// function() {
// $(this).removeClass("hover");
// }
// );

// function sleep(ms) {
// return new Promise((r) => setTimeout(r, ms));
// }

// async function test() {
// console.log("typing");
// await sleep(3000);
// }
1 change: 1 addition & 0 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/aos.css">
<link rel="stylesheet" href="../static/css/diet_chart.css">
<link rel="stylesheet" href="../static/css/foodSearch.css">
<!-- <link rel="stylesheet" href="../static/css/food_direction.css"> -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=M+PLUS+1:wght@100;200;300;400;500;600;700;800&display=swap" rel="stylesheet">
<link href='//spoqa.github.io/spoqa-han-sans/css/SpoqaHanSansNeo.css' rel='stylesheet' type='text/css'>
Expand Down
1 change: 0 additions & 1 deletion app/templates/check.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<span>
<!-- {{ result }} -->
</span>
<!-- <div class="number_count"> </div> -->
<div class="number_count", id="my-data" data-name= "{{ result }}"> </div>

</div>
Expand Down
28 changes: 5 additions & 23 deletions app/templates/diet.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,8 @@
<div class="diet_clip_img">
<img src="../static/image/clip.png" alt="file_clip">
</div>
<!-- flask flash 기능 -->
{% with messages = get_flashed_messages() %}
{% if messages %}
<script type="text/javascript">
alert("{{messages[0]}}");
</script>
{% endif %}
{% endwith %}

<div class="diet_personal_board">
<form action="/diet" method="POST" id="form_personal" name="personal_form" onsubmit="return personal_submit()">
<form action="/diet" method="POST" id="form_personal" name="personal_form">
<div class="gender">
<span>성별</span>
<div class="gender_checker">
Expand Down Expand Up @@ -64,15 +55,16 @@
</div>
</div>
<div>
<input type="submit" id="personal_submit" name="btn" value='form_personal' class="move_button_hidden">
<input type="submit" id="personal_submit" name="btn" value='form_personal' href='#food_doctor' class="move_button_hidden">
<label for="personal_submit" id="personal_submit" class="submit_button">제출 하기</label>
</div>
</form>
</div>

</div>
<div class="doctor">
<img src="../static/image/smile.png" alt="Doctor">
<div class="doctor_bubble" name="bubble">
<img src="../static/image/smile.png" alt="Doctor" name="doctor_diet_img">
<div id="food_doctor" class="doctor_bubble" name="bubble">
<span>오늘 먹었던 음식을 검색 창에 입력하고 목록에서 고르면 ' + ' 버튼으로</span>
<span>추가할 수 있습니다!</span>
<span>음식을 바꾸고 싶을 땐 해시 태그의 ' - ' 버튼을 눌러주세요!</span>
Expand All @@ -84,15 +76,5 @@
</div>
</div>
</div>
<!-- <script>
function personal_submit(){
let form = document.personal_form
if(form.age.value == ""){
alert("개인정보 입력 후 버튼을 눌러주세요 :)")
return false
}
return true
}
</script> -->
<script src="../static/js/diet.js" defer="defer"></script>
{% endblock %}
8 changes: 8 additions & 0 deletions app/templates/food_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
{% block food_search %}
<div class="food_search_wrapper">
<div class="search_input">
<!-- flask flash 기능 -->
{% with messages = get_flashed_messages() %}
{% if messages %}
<script type="text/javascript">
alert("{{messages[0]}}");
</script>
{% endif %}
{% endwith %}
<form action="/diet" method="POST" id="form_food" class="search_form" autocomplete="off">
<div class="food_search">
<!--<a href="" target="_blank" hidden></a>-->
Expand Down
10 changes: 10 additions & 0 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ <h3>Member</h3>
<span class="ydp01">손창엽</span>
<span class="ydp01">정현우</span>
</div>
<div>
<div>
<h3>
Data Source
</h3>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
<script src="../static/js/index.js" defer="defer"></script>
{% endblock %}
15 changes: 7 additions & 8 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ def diet_food():
Z = cal_nutrients.body_classifier(sex, age, height)
nutrients = cal_nutrients.nutrient(Z, sex, age, activity)

flash("정보가 안전하게 제출되었습니다")
return redirect(url_for("diet_food"))
flash("정보가 안전하게 제출되었습니다! :)")
return redirect(url_for('diet_food'))
else:
flash("개인정보 입력 후 버튼을 눌러주세요 :)")

if request.method == "POST" and request.form.get('btn2'):
if nutrients == None:
flash("해시태그 추가 후 음식 제출 버튼을 눌러주세요 :)")
return redirect(url_for("diet_food"))

food_lst = request.form.get('btn2')
Expand Down Expand Up @@ -175,12 +176,10 @@ def diet_result():
global nutrients, result, food_lst, foods_nutrients
return render_template("check.html",nutrients=nutrients,food_lst=food_lst,foods_nutrients=foods_nutrients,result=result)

@app.route("/food_direction")
def food_direction():
return render_template("food_direction.html")

@app.route("/visual")
def visualization():
return render_template("visual.html")

@app.route('/cleaning')
def cleaning():
# food = Food.query.order_by(Food.niacin.desc()).all()
food = Food.query.filter(Food.food_name =='젖산음료, 복숭아맛').first()
return jsonify({'':food.food_name})
Loading

0 comments on commit 0b88292

Please sign in to comment.