diff --git a/stage1/Zhangruihan/requirements.txt b/stage1/Zhangruihan/requirements.txt new file mode 100644 index 0000000..2581d33 --- /dev/null +++ b/stage1/Zhangruihan/requirements.txt @@ -0,0 +1,7 @@ +click==6.6 +itsdangerous==0.24 +Jinja2==2.8 +MarkupSafe==0.23 +requests==2.11.1 +virtualenv==15.1.0 +Werkzeug==0.11.11 diff --git a/stage1/Zhangruihan/static/hust.jpg b/stage1/Zhangruihan/static/hust.jpg new file mode 100644 index 0000000..cf9f0d3 Binary files /dev/null and b/stage1/Zhangruihan/static/hust.jpg differ diff --git a/stage1/Zhangruihan/static/plus.css b/stage1/Zhangruihan/static/plus.css new file mode 100644 index 0000000..881811e --- /dev/null +++ b/stage1/Zhangruihan/static/plus.css @@ -0,0 +1 @@ +p {font-size:300%;color:red;} \ No newline at end of file diff --git a/stage1/Zhangruihan/static/step2.js b/stage1/Zhangruihan/static/step2.js new file mode 100644 index 0000000..7275160 --- /dev/null +++ b/stage1/Zhangruihan/static/step2.js @@ -0,0 +1,5 @@ +document.getElementById("target").onclick=function(){click()}; +function click() +{ +alert("hello dalao"); +} \ No newline at end of file diff --git a/stage1/Zhangruihan/task.py b/stage1/Zhangruihan/task.py new file mode 100644 index 0000000..dc77018 --- /dev/null +++ b/stage1/Zhangruihan/task.py @@ -0,0 +1,19 @@ +from flask import Flask,render_template +app = Flask(__name__) + +@app.route('/step1') +def step1(): + return 'Hello, World!' + +@app.route('/step2') +def step2(): + return render_template('hello_world.html') + +@app.route('/step3//<name>') +def step3(title,name): + list=['萌新','油条','大腿','dalao','juju','咸鱼'] + for tag in list: + if tag==title: + return render_template('step3.html',title=tag,name=name,list=list) + return render_template('step3.html',title='other',name=name,list=list) + \ No newline at end of file diff --git a/stage1/Zhangruihan/templates/base.html b/stage1/Zhangruihan/templates/base.html new file mode 100644 index 0000000..7d237af --- /dev/null +++ b/stage1/Zhangruihan/templates/base.html @@ -0,0 +1,8 @@ +<html> +<body> + {% block step3_hello %} + {% endblock %} + {% block step3_other %} + {% endblock %} +</body> +</html> \ No newline at end of file diff --git a/stage1/Zhangruihan/templates/hello_world.html b/stage1/Zhangruihan/templates/hello_world.html new file mode 100644 index 0000000..c046fc5 --- /dev/null +++ b/stage1/Zhangruihan/templates/hello_world.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='plus.css')}}" /> +</head> + +<body> +<p>hello world</p> +<img src="../static/hust.jpg" /> +<button id="target" onclick="click()">Click me!</button> +<script src="{{url_for('static',filename='step2.js')}}"></script> +</body> +</html> \ No newline at end of file diff --git a/stage1/Zhangruihan/templates/step3.html b/stage1/Zhangruihan/templates/step3.html new file mode 100644 index 0000000..7efdc41 --- /dev/null +++ b/stage1/Zhangruihan/templates/step3.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} + +{% block step3_hello %} +<p>Hello, {{name}}! You are {{title}}.</p> +{% endblock %} + +{% block step3_other %} +{% for rank in list %} + {% if rank==title %} + <h2><font color='blue'>{{rank}}</font></h2> + {% else %} + <h2>{{rank}}</h2> + {% endif %} +{% endfor %} +{% if title=='other' %} + <h2><font color='red'>other</font></h2> +{% else %} + <h2>other</h2> +{% endif %} +{% endblock %} \ No newline at end of file