Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
postbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wen Wei Li
postbox
Commits
b894a17c
Commit
b894a17c
authored
Mar 27, 2020
by
Wen Wei Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create main page
parent
33ffce0d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
10 deletions
+71
-10
app.py
app.py
+5
-2
requirement.txt
requirement.txt
+1
-0
static/js/pincode.js
static/js/pincode.js
+7
-7
templates/.index.html.swp
templates/.index.html.swp
+0
-0
templates/main_page.html
templates/main_page.html
+38
-0
templates/pincode.html
templates/pincode.html
+20
-1
No files found.
app.py
View file @
b894a17c
...
@@ -3,6 +3,7 @@ import json
...
@@ -3,6 +3,7 @@ import json
import
os
import
os
import
requests
import
requests
import
subprocess
import
subprocess
import
sqlite3
from
wifi_utils
import
*
from
wifi_utils
import
*
from
flask_bootstrap
import
Bootstrap
from
flask_bootstrap
import
Bootstrap
...
@@ -87,9 +88,11 @@ def wifi_conn():
...
@@ -87,9 +88,11 @@ def wifi_conn():
@
app
.
route
(
'/pin_setup'
,
methods
=
[
'GET'
])
@
app
.
route
(
'/pin_setup'
,
methods
=
[
'GET'
])
def
pin_setup
():
def
pin_setup
():
arr
=
[
1
,
2
,
3
,
4
,
5
,
6
]
return
render_template
(
'pincode.html'
)
return
render_template
(
'pincode.html'
,
ary_input
=
arr
)
@
app
.
route
(
'/pincode_storage'
,
methods
=
[
'POST'
])
def
pin_store
():
return
render_template
(
"main_page.html"
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
.
run
(
host
=
'0.0.0.0'
,
port
=
8080
,
debug
=
True
)
app
.
run
(
host
=
'0.0.0.0'
,
port
=
8080
,
debug
=
True
)
requirement.txt
View file @
b894a17c
flask
flask
flask-bootstrap
flask-bootstrap
sqlite3
static/js/pincode.js
View file @
b894a17c
...
@@ -15,13 +15,13 @@ let myKeyboard = new Keyboard({
...
@@ -15,13 +15,13 @@ let myKeyboard = new Keyboard({
}
}
});
});
let
ary_input
=
[];
let
pin_code
=
[];
let
index
=
1
;
let
index
=
1
;
function
onChange
(
input
)
{
function
onChange
(
input
)
{
if
(
ary_input
.
length
>
6
){
if
(
pin_code
.
length
>
6
){
ary_input
.
pop
();
pin_code
.
pop
();
}
}
console
.
log
(
"
Input changed
"
,
ary_input
);
console
.
log
(
"
Input changed
"
,
pin_code
);
}
}
...
@@ -32,14 +32,14 @@ function onKeyPress(button) {
...
@@ -32,14 +32,14 @@ function onKeyPress(button) {
index
=
index
-
1
;
index
=
index
-
1
;
n
=
"
slot-
"
+
index
;
n
=
"
slot-
"
+
index
;
document
.
querySelector
(
'
input[id="
'
+
n
+
'
"]
'
).
value
=
''
;
document
.
querySelector
(
'
input[id="
'
+
n
+
'
"]
'
).
value
=
''
;
ary_input
.
pop
();
pin_code
.
pop
();
}
else
if
(
String
(
button
)
==
"
{bksp}
"
&&
index
==
1
){
}
else
if
(
String
(
button
)
==
"
{bksp}
"
&&
index
==
1
){
console
.
log
(
"
back to the first pin code
"
);
console
.
log
(
"
back to the first pin code
"
);
}
else
if
(
index
<
7
){
}
else
if
(
index
<
7
){
n
=
"
slot-
"
+
index
;
n
=
"
slot-
"
+
index
;
document
.
querySelector
(
'
input[id="
'
+
n
+
'
"]
'
).
value
=
button
;
document
.
querySelector
(
'
input[id="
'
+
n
+
'
"]
'
).
value
=
button
;
index
=
index
+
1
;
index
=
index
+
1
;
ary_input
.
push
(
button
);
pin_code
.
push
(
button
);
}
else
{
}
else
{
console
.
log
(
"
index over 6
"
);
console
.
log
(
"
index over 6
"
);
}
}
...
...
templates/.index.html.swp
deleted
100644 → 0
View file @
33ffce0d
File deleted
templates/main_page.html
0 → 100644
View file @
b894a17c
{% extends "bootstrap/base.html" %}
{% block head %}
{{super()}}
<link
href=
"http://code.jquery.com/ui/1.9.0/themes/ui-darkness/jquery-ui.css"
rel=
"stylesheet"
>
<link
href=
"../static/css/keyboard.css"
rel=
"stylesheet"
>
<link
href=
"../static/css/style.css"
rel=
"stylesheet"
>
{% endblock %}
{% block content %}
<body
>
<div
class=
"col"
>
<button
type=
"submit"
>
Pincode Setup
</button>
</div>
<div
>
<button
type=
"submit"
>
Preference
</button>
</div>
{% block footer %}
<footer
class=
"footer"
>
<div
class=
"footer navbar-fixed-bottom text-center"
>
<p
class=
"text-muted"
>
©
NTUST PRLAB
</p>
</div>
</footer>
</div>
{% endblock footer %}
</body>
{% block scripts %}
{{super()}}
<script
src=
"http://code.jquery.com/ui/1.9.0/jquery-ui.min.js"
></script>
<script
src=
"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"
></script>
<script
src=
"../static/js/jquery.keyboard.js"
></script>
<script
src=
"../static/js/jquery.mousewheel.js"
></script>
<script
src=
"../static/js/jquery.keyboard.extension-typing.js"
></script>
<script
src=
"../static/js/jquery.keyboard.extension-autocomplete.js"
></script>
<script
src=
"../static/js/jquery.keyboard.extension-caret.js"
></script>
<script>
</script>
{% endblock scripts %}
{% endblock content %}
templates/pincode.html
View file @
b894a17c
...
@@ -53,7 +53,26 @@
...
@@ -53,7 +53,26 @@
<script
src=
"{{url_for('static', filename='js/keyboard.min.js')}}"
></script>
<script
src=
"{{url_for('static', filename='js/keyboard.min.js')}}"
></script>
<script
src=
"{{url_for('static', filename='js/pincode.js')}}"
></script>
<script
src=
"{{url_for('static', filename='js/pincode.js')}}"
></script>
<script>
<script>
$
(
'
#setup
'
)
.
click
(
function
(){
if
(
pin_code
.
length
==
6
){
console
.
log
(
pin_code
);
pin
=
pin_code
.
join
(
''
);
$
.
ajax
({
type
:
"
POST
"
,
url
:
"
http://localhost:8080/pincode_storage
"
,
data
:
pin
,
success
:
function
(
data
,
status
){
alert
(
"
PIN CODE SETUP SUCCESS
"
);
window
.
location
.
href
=
"
http://localhost:8080/main_page
"
;
},
error
:
function
(
data
,
status
){
alert
(
"
PIN CODE SETUP FAILED
"
)
}
});
}
else
{
alert
(
'
PINCODE LENGTH MUST BE 6
'
);
}
})
</script>
</script>
<!-- keyboard js-->
<!-- keyboard js-->
</body>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment