Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hunter-ht.cn
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘莹莹
hunter-ht.cn
Commits
9aab450f
Commit
9aab450f
authored
Apr 28, 2020
by
liuyingying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
忽然充不上电吓死了
parent
c8d96667
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
40 deletions
+119
-40
detail.html
Hunter_ht/hunter/templates/hunter/detail.html
+9
-3
index.html
Hunter_ht/hunter/templates/hunter/index.html
+4
-1
profile.html
Hunter_ht/hunter/templates/hunter/profile.html
+83
-31
user.html
Hunter_ht/hunter/templates/hunter/user.html
+11
-4
urls.py
Hunter_ht/hunter/urls.py
+2
-1
views.py
Hunter_ht/hunter/views.py
+10
-0
No files found.
Hunter_ht/hunter/templates/hunter/detail.html
View file @
9aab450f
...
...
@@ -2,7 +2,7 @@
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
hunter.detail
</title>
<title>
HT-个人详情页
</title>
{% load static %}
<link
rel=
"icon"
href=
"{% static 'hunter/images/logo.ico' %}"
type=
"text/icon"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'hunter/detail.css' %}"
>
...
...
@@ -17,7 +17,7 @@
<span>
{{ user.mailAddress }}
</span>
{% endif %}
{% if user.personal_website %}
<a
href=
"javascript:goUrl({{ user.personal_website }})"
target=
"_blank"
>
{{ user.personal_website }}
</a>
<a
id=
"mysite"
href=
"javascript:goUrl()"
>
{{ user.personal_website }}
</a>
{% endif %}
</div>
</div>
...
...
@@ -80,8 +80,14 @@
</div>
</div>
<script>
function
goUrl
(
url
){
function
goUrl
(){
let
url
=
$
(
"#mysite"
).
text
();
if
(
url
.
indexOf
(
'http'
)
!==-
1
){
window
.
open
(
url
);
}
else
{
window
.
open
(
'http://'
+
url
);
}
}
</script>
</body>
...
...
Hunter_ht/hunter/templates/hunter/index.html
View file @
9aab450f
...
...
@@ -300,7 +300,9 @@
if
(
!
storage
[
"userID"
]
&&!
storage
[
"username"
]){
}
else
{
login_success
(
storage
[
'username'
],
storage
[
'userID'
])
$
(
'#top_bar'
).
empty
();
$
(
'#top_bar'
).
append
(
"<ul><li onclick='logout()'>退出</li><li title='点击进入个人中心'><a href='/user/"
+
storage
[
"userID"
]
+
"/' target='_blank'>"
+
storage
[
"username"
]
+
"</a></li></ul>"
);
hide_log
();
}
};
...
...
@@ -376,6 +378,7 @@
$
(
'#top_bar'
).
empty
();
$
(
'#top_bar'
).
append
(
"<ul><li onclick='logout()'>退出</li><li title='点击进入个人中心'><a href='/user/"
+
userid
+
"/' target='_blank'>"
+
name
+
"</a></li></ul>"
);
hide_log
();
window
.
open
(
"/user/"
+
userid
);
}
function
login_fail
(
message
){
$
(
'#error_log'
).
empty
();
...
...
Hunter_ht/hunter/templates/hunter/profile.html
View file @
9aab450f
...
...
@@ -3,6 +3,8 @@
<head>
<meta
charset=
"UTF-8"
>
<title>
修改个人信息
</title>
{% load static %}
<script
src=
"{% static 'hunter/jquery-1.9.1.min.js' %}"
></script>
</head>
<style
type=
"text/css"
>
*
{
...
...
@@ -37,8 +39,8 @@
height
:
30px
;
border
:
solid
1px
#f1f1f1
;
cursor
:
pointer
;
float
:
lef
t
;
margin
:
5
px
;
float
:
righ
t
;
margin
:
5px
10
px
;
}
#hunter
{
width
:
40%
;
...
...
@@ -48,13 +50,13 @@
}
#hunter
>
span
{
font-family
:
"Bitstream Vera Sans Mono"
,
Monaco
,
"Courier New"
,
Courier
,
monospace
;
font-size
:
38
px
;
font-size
:
20
px
;
font-weight
:
bold
;
height
:
40px
;
height
:
40px
;
line-height
:
40px
;
display
:
block
;
position
:
absolute
;
left
:
25px
;
bottom
:
25px
;
left
:
25px
;
}
#bar
{
width
:
60%
;
...
...
@@ -77,9 +79,58 @@
background-color
:
#306cc5
;
}
#profile
{
min-width
:
800px
;
min-height
:
100%
;
padding-top
:
50px
;
width
:
800px
;
min-height
:
100%
;
padding-top
:
50px
;
margin
:
0
auto
;
}
.item
{
height
:
50px
;
width
:
100%
;
padding
:
10px
10px
;
}
.item
label
{
width
:
150px
;
text-align
:
right
;
line-height
:
40px
;
margin-right
:
10px
;
}
.item
input
{
height
:
40px
;
border
:
solid
1px
#f1f1f1
;
border-radius
:
4px
;
width
:
200px
;
padding-left
:
5px
;
}
.item
.required
{
color
:
red
;
font-size
:
12px
;
margin
:
15px
5px
0
;
}
.item
.hint
{
font-size
:
12px
;
color
:
#9c9c9c
;
margin
:
15px
7px
0
;
}
.item
button
{
float
:
right
;
}
#error_log
{
color
:
red
;
height
:
40px
;
font-size
:
14px
;
margin-left
:
150px
;
line-height
:
40px
;
}
#username
{
color
:
grey
;
background-color
:
#f7f7f7
;
}
.item
*
{
float
:
left
;
}
</style>
...
...
@@ -91,8 +142,7 @@
</div>
<div
id=
"bar"
>
<div
class=
"btn"
>
<button
onclick=
"close_window()"
class=
"close_btn"
>
关闭
</button>
<button
onclick=
"submit_profile()"
class=
"submit_btn"
>
确认
</button>
<button
onclick=
"close_window()"
class=
"close_btn"
>
返回
</button>
</div>
</div>
</div>
...
...
@@ -101,21 +151,24 @@
<div
class=
"item"
>
<label
for=
"username"
>
用户名:
</label>
<input
id=
"username"
disabled
type=
"text"
value=
"{{ user.name }}"
>
<span
class=
"hint"
>
不可更改
</span>
<span
class=
"hint"
>
不可更改
(统一为姓名拼音)
</span>
</div>
<div
class=
"item"
>
<label
for=
"name_hanzi"
>
姓名
:
</label>
<label
for=
"name_hanzi"
>
姓名
:
</label>
<input
id=
"name_hanzi"
name=
"name_hanzi"
type=
"text"
value=
"{{ user.name_hanzi }}"
>
<span
class=
"required"
>
*
</span>
<span
class=
"hint"
>
真实姓名:在首页成员列表显示
</span>
</div>
<div
class=
"item"
>
<label
for=
"name_eng"
>
Name:
</label>
<label
for=
"name_eng"
>
英文名字:
</label>
<input
id=
"name_eng"
name=
"name_eng"
type=
"text"
placeholder=
"Pin Yin or Tom"
value=
"{{ user.name_eng }}"
>
<span
class=
"required"
>
*
</span>
<span
class=
"hint"
>
在个人详情页面显示(自定义:Xiao Ming or Tom)
</span>
</div>
<div
class=
"item"
>
<label
for=
"pwd"
>
新密码:
</label>
<input
id=
"pwd"
name=
"pwd"
type=
"text"
>
<span
class=
"hint"
>
留空则不更改密码
</span>
</div>
<div
class=
"item"
>
<label
for=
"confirm_pwd"
>
确认密码:
</label>
...
...
@@ -124,52 +177,50 @@
<div
class=
"item"
>
<label
for=
"mail"
>
邮箱:
</label>
<input
id=
"mail"
name=
"mail"
type=
"text"
value=
"{{ user.mailAddress }}"
>
<span
class=
"
required"
>
</span>
<span
class=
"
hint"
>
在首页成员列表➕个人详情页面显示
</span>
</div>
<div
class=
"item"
>
<label
for=
"personal_web"
>
个人网站:
</label>
<input
id=
"personal_web"
name=
"personal_web"
type=
"text"
value=
"{{ user.personal_website }}"
>
<span
class=
"
required"
>
</span>
<span
class=
"
hint"
>
可选填,在个人信息页面显示
</span>
</div>
<div
class=
"item"
>
<span
class=
"error_log"
></span>
<button
onclick=
"close_window()"
class=
"close_btn"
>
关闭
</button>
<button
onclick=
"submit_profile()"
class=
"submit_btn"
>
确认
</button>
<span
class=
"error_log"
id=
"error_log"
></span>
</div>
</div>
<script
type=
"text/javascript"
>
window
.
onload
=
function
(){
let
storage
=
window
.
localStorage
;
if
(
!
storage
[
'userID'
]){
let
list
=
window
.
location
.
href
.
split
(
'/'
);
let
userID
=
list
[
list
.
length
-
2
];
if
(
!
storage
[
'userID'
]
||
userID
!==
storage
[
'userID'
]){
alert
(
"请先登录"
);
close_window
();
window
.
open
(
'/'
);
}
};
function
close_window
(){
window
.
open
(
'www.hunter-ht.cn'
);
window
.
close
(
);
}
function
submit_profile
()
{
let
storage
=
window
.
localStorage
;
let
userID
=
storage
.
userID
;
let
name_hanzi
=
$
(
"
input[name='name_hanzi']
"
).
val
();
let
name_eng
=
$
(
"
input[name='name_eng']
"
).
val
();
let
name_hanzi
=
$
(
"
#name_hanzi
"
).
val
();
let
name_eng
=
$
(
"
#name_eng
"
).
val
();
let
pwd
=
$
(
"#pwd"
).
val
();
let
mail
=
$
(
"#mail"
).
val
()
||
" "
;
let
website
=
$
(
"#personal_web"
).
val
()
||
" "
;
if
(
pwd
!==
$
(
"#confirm_pwd"
).
val
()){
$
(
"#error_log"
).
innerHTML
=
"密码不一致"
;
}
else
if
(
name_eng
&&
name_hanzi
)
}
else
if
(
!
name_eng
&&!
name_hanzi
)
{
$
(
"#error_log"
).
innerHTML
=
"请填写中英文姓名"
;
}
else
{
let
storage
=
window
.
localStorage
;
let
userID
=
storage
.
userID
;
let
name_hanzi
=
$
(
"input[name='name_hanzi']"
).
val
();
let
name_eng
=
$
(
"input[name='name_eng']"
).
val
();
let
pwd
=
$
(
"#pwd"
).
val
();
let
mail
=
$
(
"#mail"
).
val
();
let
website
=
$
(
"#personal_web"
).
val
();
$
.
ajax
({
url
:
'/profile_
ed
it/'
,
url
:
'/profile_
subm
it/'
,
type
:
'post'
,
dataType
:
'json'
,
data
:{
...
...
@@ -185,7 +236,8 @@
console
.
log
(
response
);
if
(
response
[
'message'
]){
alert
(
'修改成功'
);
window
.
location
.
href
=
'www.hunter-ht.cn'
;
window
.
close
();
window
.
open
(
'/'
);
}
else
{
alert
(
"提交失败,请反馈"
);
}
...
...
Hunter_ht/hunter/templates/hunter/user.html
View file @
9aab450f
...
...
@@ -25,13 +25,18 @@
<nav>
<div>
<div
id=
"hunter"
>
<span><a
href=
"/"
>
HUNTER
</a></span>
<span><a
href=
"
../..
/"
>
HUNTER
</a></span>
</div>
<div
id=
"bar"
class=
""
>
<div
class=
"smaller_bottom_bar"
>
<a
href=
""
class=
"main_bar"
onclick=
"exit()"
>
退出
</a>
<a
href=
""
class=
"main_bar userID"
id=
""
>
修改个人信息
</a>
<span
id=
"username"
class=
"main_bar"
>
{{ usr.name }}
</span>
<a
href=
""
class=
"main_bar"
onclick=
"exit()"
>
退出登录
</a>
<a
href=
"../../"
class=
"main_bar"
>
返回首页
</a>
<a
href=
"{% url 'hunter:profile_edit' user.userID %}"
target=
"_blank"
class=
"main_bar userID"
id=
""
>
修改个人信息
</a>
<a
href=
"{% url 'hunter:detail' user.userID %}"
class=
"main_bar"
target=
"_blank"
>
查看个人详情页
</a>
<a
href=
"{% url 'hunter:detail' user.userID %}"
id=
"username"
class=
"main_bar"
target=
"_blank"
>
{{ usr.name }}
</a>
</div>
</div>
</div>
...
...
@@ -254,11 +259,13 @@
isFind
=
1
;
var
$h1
=
' <ul><li class="big_text li_long"><a href="/static/hunter/publications/'
+
myfile
.
name
+
'" target="_blank">'
+
title
+
'</a></li><li class="right"><button class="dele_img" onclick="delePub('
+
response
[
'pubID'
]
+
')"></button></li><li class="middle_text right">'
+
date_month
+
'</li><li class="right">'
+
journalname
+
'</li><li class="right">'
+
type
+
'</li><li class="small_text">'
+
authors
+
'</li></ul>'
;
$
(
this
).
after
(
$h1
);
window
.
location
.
reload
();
}
});
if
(
!
isFind
){
var
$h2
=
'<blockquote><p>'
+
year
+
'</p></blockquote><ul><li class="big_text li_long"><a href="/static/hunter/publications/'
+
myfile
.
name
+
'" target="_blank">'
+
title
+
'</a></li> <li class="right"><button class="dele_img" onclick="delePub('
+
response
[
'pubID'
]
+
')"></button></li><li class="middle_text right">'
+
date_month
+
'</li><li class="right">'
+
journalname
+
'</li><li class="right">'
+
type
+
'</li><li class="small_text">'
+
authors
+
'</li></ul>'
;
$
(
'#publish .wrap'
)[
0
].
prepend
(
$h2
);
window
.
location
.
reload
();
}
}
else
{
$
(
'#error_log'
).
append
(
response
[
'error'
]);
...
...
Hunter_ht/hunter/urls.py
View file @
9aab450f
...
...
@@ -8,7 +8,8 @@ urlpatterns = [
# path('<int:pk>/', views.UserDetail.as_view(), name='user'),
# path('<int:pk>/article/', views.ArticleDetail.as_view(), name='article'),
path
(
'user/<int:user_id>/'
,
views
.
user
,
name
=
'user'
),
path
(
'user/edit/profile/<int:user_id>/'
,
views
.
detail
,
name
=
'detail'
),
path
(
'user/edit/profile/<int:user_id>/'
,
views
.
profile_edit
,
name
=
'profile_edit'
),
path
(
'profile_submit/'
,
views
.
profile_submit
,
name
=
'profile_submit'
),
path
(
'user/detail/<int:user_id>/'
,
views
.
detail
,
name
=
'detail'
),
path
(
'write/'
,
views
.
write_art
,
name
=
'write_art'
),
path
(
'uploadImg/'
,
views
.
uploadImg
,
name
=
'uploadImg'
),
...
...
Hunter_ht/hunter/views.py
View file @
9aab450f
...
...
@@ -7,6 +7,7 @@ from django.views.decorators.csrf import csrf_exempt
import
os
from
django.db.utils
import
ProgrammingError
import
datetime
from
operator
import
itemgetter
,
attrgetter
from
django.shortcuts
import
redirect
from
django.core.exceptions
import
ValidationError
import
json
...
...
@@ -160,6 +161,8 @@ def user(request, user_id):
my_publication_year_list
[
year
]
.
append
(
pub
)
else
:
my_publication_year_list
[
year
]
=
[
pub
]
for
item
in
my_publication_year_list
:
my_publication_year_list
[
item
]
=
sorted
(
my_publication_year_list
[
item
],
key
=
attrgetter
(
'date'
),
reverse
=
True
)
my_article_list
=
Articles
.
objects
.
filter
(
authorID
=
user_id
)
.
order_by
(
'-editDateTime'
)
my_article_year_list
=
{}
...
...
@@ -456,8 +459,15 @@ def profile_submit(request):
pwd
=
request
.
POST
[
"pwd"
]
mail
=
request
.
POST
[
"mail"
]
website
=
request
.
POST
[
"website"
]
if
len
(
str
(
pwd
)
.
strip
())
>
0
:
try
:
User
.
objects
.
filter
(
userID
=
userID
)
.
update
(
name_hanzi
=
name_hanzi
,
name_eng
=
name_eng
,
pwd
=
pwd
,
mailAddress
=
mail
,
personal_website
=
website
)
return
JsonResponse
({
'message'
:
1
})
except
ObjectDoesNotExist
as
e
:
return
JsonResponse
({
"message"
:
0
,
'error'
:
e
})
else
:
try
:
User
.
objects
.
filter
(
userID
=
userID
)
.
update
(
name_hanzi
=
name_hanzi
,
name_eng
=
name_eng
,
mailAddress
=
mail
,
personal_website
=
website
)
return
JsonResponse
({
'message'
:
1
})
except
ObjectDoesNotExist
as
e
:
return
JsonResponse
({
"message"
:
0
,
'error'
:
e
})
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