From e058cd0db986972d6af77afaa7e57fc08e70c63e Mon Sep 17 00:00:00 2001 From: Ting-Jun Wang Date: Mon, 18 Jan 2021 20:21:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E9=A0=81=E9=9D=A2=E7=9A=84=E5=89=8D=E7=AB=AF=E8=88=87=E5=BE=8C?= =?UTF-8?q?=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.py | 17 +++++++ index.html | 1 + js/components/share.vue | 103 ++++++++++++++++++++++++++++++++++++++++ js/index.vue | 4 +- 4 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 js/components/share.vue diff --git a/api.py b/api.py index 7931079..4df8e93 100644 --- a/api.py +++ b/api.py @@ -68,6 +68,23 @@ def save(): else: return '{"status": "error access code"}', 403 +@app.route('/shared/', methods=['GET']) +def shared(uid): + with sqlite3.connect('data.db') as conn: + sql = "SELECT `json` FROM `courseTables` WHERE `uid`=?" + + data = conn.execute(sql, [uid]).fetchone() + + if data: + ansJSON = data[0] + return json.dumps({ + "status": "ok", + "data": ansJSON + }), 200 + else: + return json.dumps({ + "status": "not found", + }), 404 if __name__ == '__main__': app.debug = True app.run(host='0.0.0.0') diff --git a/index.html b/index.html index b1bfc7f..2fc59e7 100644 --- a/index.html +++ b/index.html @@ -45,6 +45,7 @@ +