Commit 89410cb8 by liuyingying

拿来管理员页面

parent d31c66e2
*{
margin:0;
padding: 0;
}
.userlist{
width:100%;
margin:70px auto;
}
button{
outline:none;
background-color: transparent;
border:none;
}
a{
color:#ff9800;
}
ul{
list-style: none;
}
nav{
width:100%;
height:50px;
color:#FF9800;
background-color: black;
}
#adminname, #hunterLogo{
width:200px;
height:50px;
line-height: 50px;
font-size: 24px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#hunterLogo{
float:left;
margin-left: 50px;
}
.logout{
width:50px;
height:50px;
line-height: 50px;
font-size: 20px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
float:right;
color:#ff9800;
text-align: right;
margin-right: 10px;
cursor: pointer;
text-decoration: none;
}
a:hover{
color:#ff7000;
}
#adminname{
float:right;
text-align: right;
margin-right: 50px;
}
.adminForm{
width:100%;
}
#adduserform{
width:100%;
}
#adduserform > .form-group{
float:left;
margin:10px;
}
.adduserbtn, .deluserbtn, .resetPwd{
display:inline-block;
width:100px;
height: 40px;
line-height: 40px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size:16px;
border:none;
border-radius:2px;
vertical-align: middle;
}
.adduserbtn{
color:#FF9800;
background-color: black;
}
.adduserbtn:hover{
color:#FF7000;
}
.deluserbtn{
width:20px;
height:20px;
margin-top:-15px;
}
.deluserbtn{
color:#FF9800;
}
.deluserbtn:hover{
color: #FF7000;
}
.resetPwd{
color:#FF9800;
}
.resetPwd:hover{
color: #FF7000;
}
@media (max-width: 767px){
.userlist{
width:100%;
margin:100px auto;
}
}
#leftBar{
width:170px;
height:100%;
padding-top:20px;
margin-top:-20px;
float: left;
color:black;
}
#leftBar > ul{
margin-top:-20px;
}
#leftBar > ul > li{
width:100%;
height:50px;
line-height: 50px;
text-align: center;
font-size: 16px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
cursor: pointer;
-webkit-transition:all 0.2s ease-in-out;
transition:all 0.2s ease-in-out;
}
#leftBar > ul > li:hover{
width:100%;
height:50px;
background-color: navajowhite;
}
.rightCnt{
width:70%;
float: left;
margin-left:10%;
}
svg{
width:100%;
height:100%;
}
.editbtn, .delebtn{
width:20px;
height:20px;
float: right;
border:none;
background:white;
margin:0 10px;
}
.editbtn :hover, .delebtn :hover{
width:25px;
height:25px;
}
.article-content > p{
float: left;
width:70%;
height:20px;
overflow:hidden;
}
.article-content > a{
cursor: pointer;
}
.article-content > p{
margin:10px 0;
}
.article-content > span {
float: right;
margin-left: 10px;
}
.article-content>button{
outline:none;
background:none;
border:none;
color: #FF9800;
}
.article-content > button:hover{
color:#c59a6d;
}
.title{
width:60%;
font-size:20px;
text-align: left;
}
#articles{
position: relative;
}
#articleList{
position:absolute;
width:50%;
}
.lastStep{
width:30px;
height:30px;
}
#writenoticeLi>a{
color:black;
}
#artTitle{
width:100%;
height:auto;
line-height: 50px;
text-align: center;
font-size:24px;
font-weight: bold;
}
#authorName{
width:100%;
height:30px;
margin-top:10px;
line-height: 30px;
text-align: right;
font-style: italic;
}
#content{
width:100%;
margin-top:50px;
background-color: #eaeaea;
}
#addScore{
width:100%;
height:60px;
line-height:60px;
}
#user_score_List,#score_history_List{
display: block;
height:35px;
line-height:35px;
font-size: 18px;
float: left;
margin:10px;
cursor: pointer;
}
#user_score_List{
border-right:solid 3px black;
padding-right:20px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.user_score_List{
margin-left:10px;
}
#editScoreBtn{
width:30px;
height:30px;
margin-top: 10px;
margin-left: 20px;
float:right;
margin-right:10%;
}
#addScoreForm{
width:100%;
height:50px;
-webkit-transition:all 0.2s ease-in-out;
transition:all 0.2s ease-in-out;
}
#addScoreForm > .form-group{
float:left;
margin:10px;
}
.select_0{
width:150px;
}
.select_1{
width:60px;
}
.select_0,.select_1{
height: 34px;
background: transparent;
border:solid 1px #ccc;
}
.addScorebtn{
width: 50px;
height: 34px;
background-color: rgba(0,0,0,0.8);
color: #ff9800;
border-radius: 2px;
}
.list_head,.list_score_body,.list_records_body{
width:100%;
height:45px;
line-height: 45px;
}
.user_score_List>.list_head >ul> li,.list_score_body > li{
width:25%;
float: left;
}
.user_score_List,.score_history_List{
-webkit-transition:all 0.2s ease-in-out;
transition:all 0.2s ease-in-out;
}
.list_records_body > li,.score_history_List>.list_head>ul>li{
width:33%;
float: left;
}
.addOrsub{
width: 30px;
height: 30px;
font-size: 22px;
line-height: 25px;
border: solid 2px #ccc;
border-radius: 15px;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
{% load static %}
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Title</title> <title>Title</title>
<link rel="stylesheet" href="{% static 'hunter/admin.css' %}">
<link rel="stylesheet" href="{% static 'hunter/bootstrap.css' %}">
<script src="{% static 'hunter/jquery-1.9.1.min.js' %}"></script>
<script src="{% static 'hunter/jquery.form.js' %}"></script>
<script type="text/javascript" src="{% static 'hunter/md/showdown.js' %}"></script>
</head> </head>
<body> <body>
<div id="scoreRecords" class="userlist"> <nav class="navbar" >
<div id="hunterLogo">Hunter</div>
<a class="logout" onclick="logout()">EXIT</a>
<div id="adminname" ></div>
</nav>
<div id="leftBar">
<ul>
<li id="useradminLi" onclick="change(this)" style="background-color:navajowhite">用户管理</li>
<li id="paperadminLi" onclick="change(this)">论文管理</li>
<li id="privateArtadminLi" onclick="change(this)">内部文章</li>
<li id="writenoticeLi"><a href="/write/" target="_blank">发布通知</a></li>
<li id="scoreLi" onclick="change(this)">积分管理</li>
</ul>
</div>
<div class="rightCnt">
<div id="paperadmin" class="userlist">
<table class="table tableList">
<thead>
</thead>
<tbody>
{% for publication in publications %}
<tr>
<td class="col-sm-2 col-md-2">
{{ publication.date }}
</td>
<td class="col-sm-8 col-md-8 col-md-offset-2">
<p><a href={{ publication.link }} target="_blank">{{ publication.title }}</a></p>
<p>{{ publication.authors }}</p>
<p>{{ publication.journalname }} </p>
</td>
<td class="col-sm-2 col-md-2 col-md-offset-2">
<button class="delpubbtn" onclick="delPub(this)"><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1539054739914" class="icon" style="" height="20" width="20" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2718" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M861.012317 164.091494C765.809507 68.885661 639.229448 16.455901 504.590713 16.455901S243.372927 68.885661 148.170117 164.091494C52.965291 259.293296 0.534525 385.874363 0.534525 520.51209c0 134.639743 52.430767 261.217786 147.635592 356.422612 95.20281 95.20281 221.782869 147.633577 356.420596 147.633577s261.217786-52.430767 356.420596-147.633577c95.204825-95.204825 147.635592-221.783877 147.635592-356.422612C1008.646902 385.874363 956.217143 259.293296 861.012317 164.091494zM791.219829 810.54584c-4.394084 4.393077-10.152441 6.590623-15.910797 6.590623-5.759364 0-11.518728-2.197546-15.911805-6.590623L504.590713 555.740334 249.785207 810.54584c-4.394084 4.393077-10.152441 6.590623-15.911805 6.590623-5.758356 0-11.516713-2.197546-15.910797-6.590623-8.788169-8.788169-8.788169-23.036448 0-31.824617L472.767104 523.916725 219.336953 270.485566c-8.788169-8.788169-8.788169-23.036448 0-31.824617 8.788169-8.785146 23.035441-8.785146 31.823609 0l253.431158 253.431158 253.431158-253.431158c8.788169-8.785146 23.035441-8.785146 31.823609 0 8.788169 8.788169 8.788169 23.036448 0 31.824617L536.41533 523.916725l254.804499 254.805506C800.007998 787.509392 800.007998 801.757672 791.219829 810.54584z" p-id="2719" fill="#ff9800"></path></svg>
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div id="useradmin" class="userlist" >
<div class="adminForm">
<div id="adduserform" class="form-horizontal" >
<div class="form-group">
<div>
<input name="username" class="form-control" type="text" class="form-control" placeholder="Name" required autofocus>
</div>
</div>
<div class="form-group">
<div>
<input name="password" class="form-control" style="-webkit-text-security:disc;text-security:disc;" type="text" autocomplete="off" placeholder="Password" required>
</div>
</div>
<div class="form-group">
<div>
<button id="submitAddUser" class="adduserbtn" >添加</button>
<p style="color:red">{{ message }}</p>
</div>
</div>
</div>
</div>
<table class="table tableList">
<thead>
<div id="addScoreForm" > </thead>
<div style="margin-left:-150px;"> <tbody>
{% for user in users %}
<tr>
<td class="col-xm-4 col-md-4">{{ user.name }}</td>
<td class="col-xm-4 col-md-4 col-md-offset-2">
<p>{{ user.nake_name }}</p>
</td>
<td class="col-xm-4 col-md-4 col-md-offset-2">{{ user.identity }}</td>
<td><button class="col-xm-2 col-md-2 resetPwd" onclick="changeIdentity(this)">更改权限</button></td>
<td><button class="col-xm-2 col-md-2 resetPwd" onclick="resetPWD(this)">重置密码</button></td>
<td class="col-xm-2 col-md-2"><button class="deluserbtn" onclick="delUser(this)" ><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1539054739914" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2718" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M861.012317 164.091494C765.809507 68.885661 639.229448 16.455901 504.590713 16.455901S243.372927 68.885661 148.170117 164.091494C52.965291 259.293296 0.534525 385.874363 0.534525 520.51209c0 134.639743 52.430767 261.217786 147.635592 356.422612 95.20281 95.20281 221.782869 147.633577 356.420596 147.633577s261.217786-52.430767 356.420596-147.633577c95.204825-95.204825 147.635592-221.783877 147.635592-356.422612C1008.646902 385.874363 956.217143 259.293296 861.012317 164.091494zM791.219829 810.54584c-4.394084 4.393077-10.152441 6.590623-15.910797 6.590623-5.759364 0-11.518728-2.197546-15.911805-6.590623L504.590713 555.740334 249.785207 810.54584c-4.394084 4.393077-10.152441 6.590623-15.911805 6.590623-5.758356 0-11.516713-2.197546-15.910797-6.590623-8.788169-8.788169-8.788169-23.036448 0-31.824617L472.767104 523.916725 219.336953 270.485566c-8.788169-8.788169-8.788169-23.036448 0-31.824617 8.788169-8.785146 23.035441-8.785146 31.823609 0l253.431158 253.431158 253.431158-253.431158c8.788169-8.785146 23.035441-8.785146 31.823609 0 8.788169 8.788169 8.788169 23.036448 0 31.824617L536.41533 523.916725l254.804499 254.805506C800.007998 787.509392 800.007998 801.757672 791.219829 810.54584z" p-id="2719" fill="#ff9800"></path></svg></button> </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div id="privateArtadmin" class="userlist" >
<ul id="articleList" class="node-list">
{% for article in articles %}
<li>
<div class="article-content">
<button class="title" onclick=getArticle({{ article.articleID }})>{{ article.title }}</button>
<span>{{ article.publish }}</span>
<span>{{ article.editDateTime }}</span>
<a class="editbtn" title="编辑" target="_blank" href="/write/?title={{ article.title }}"><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1538270903865" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3673" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M607.232 896a32 32 0 1 1 0 64H192a96 96 0 0 1-96-96V160a96 96 0 0 1 96-96h544a96 96 0 0 1 96 96 32 32 0 0 1-64 0 32 32 0 0 0-32-32H192a32 32 0 0 0-32 32v704a32 32 0 0 0 32 32h415.232zM832 585.76v146.656c0 42.656-64 42.656-64 0v-146.656c0-42.688 64-42.688 64 0z" p-id="3674" fill="#ea6f5a"></path><path d="M288 320a32 32 0 1 1 0-64h224a32 32 0 0 1 0 64H288zM288 480a32 32 0 0 1 0-64h128a32 32 0 0 1 0 64H288zM639.424 926.592a32 32 0 1 1-64 0L576 800a96 96 0 0 1 96-96l127.744 1.152a32 32 0 1 1 0 64L672 768a32 32 0 0 0-32 32l-0.576 126.592z" p-id="3675" fill="#ea6f5a"></path><path d="M637.92 947.648a32 32 0 1 1-44.32-46.208l180.384-172.992a32 32 0 1 1 44.288 46.176l-180.352 173.024zM880.896 334.528a31.424 31.424 0 0 0 3.328-44.416l-0.416-0.512a32 32 0 0 0-44.896-3.36L408.32 652.288l-15.2 51.84 58.336-4.544 429.44-365.056z m51.616-86.4a95.36 95.36 0 0 1-9.408 134.496l-438.08 372.448a32 32 0 0 1-18.24 7.52l-114.944 8.896a32 32 0 0 1-33.184-40.928l30.944-105.472a32 32 0 0 1 9.984-15.36L797.408 237.504a96 96 0 0 1 134.688 10.112l0.416 0.512z" p-id="3676" fill="#ea6f5a"></path></svg></a>
<button class="delebtn" title="删除" onclick="deleteArt(this)"><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1539054739914" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2718" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M861.012317 164.091494C765.809507 68.885661 639.229448 16.455901 504.590713 16.455901S243.372927 68.885661 148.170117 164.091494C52.965291 259.293296 0.534525 385.874363 0.534525 520.51209c0 134.639743 52.430767 261.217786 147.635592 356.422612 95.20281 95.20281 221.782869 147.633577 356.420596 147.633577s261.217786-52.430767 356.420596-147.633577c95.204825-95.204825 147.635592-221.783877 147.635592-356.422612C1008.646902 385.874363 956.217143 259.293296 861.012317 164.091494zM791.219829 810.54584c-4.394084 4.393077-10.152441 6.590623-15.910797 6.590623-5.759364 0-11.518728-2.197546-15.911805-6.590623L504.590713 555.740334 249.785207 810.54584c-4.394084 4.393077-10.152441 6.590623-15.911805 6.590623-5.758356 0-11.516713-2.197546-15.910797-6.590623-8.788169-8.788169-8.788169-23.036448 0-31.824617L472.767104 523.916725 219.336953 270.485566c-8.788169-8.788169-8.788169-23.036448 0-31.824617 8.788169-8.785146 23.035441-8.785146 31.823609 0l253.431158 253.431158 253.431158-253.431158c8.788169-8.785146 23.035441-8.785146 31.823609 0 8.788169 8.788169 8.788169 23.036448 0 31.824617L536.41533 523.916725l254.804499 254.805506C800.007998 787.509392 800.007998 801.757672 791.219829 810.54584z" p-id="2719" fill="#ea6f5a"></path></svg></button>
</div>
</li>
{% endfor %}
</ul>
<div id="articleView" class="hide" >
<button class="lastStep" onclick="returnToList()"><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1541063213171" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2135" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M939.880137 487.72513l-782.215258 0 358.804922-318.92975c12.389168-11.011798 13.505595-29.980825 2.492774-42.369993-11.011798-12.386098-29.977755-13.505595-42.367947-2.492774L64.602344 490.13911c-6.407943 5.693676-10.073426 13.858636-10.073426 22.430872s3.665483 16.737196 10.073426 22.430872l411.993309 366.204449c5.717212 5.083785 12.83533 7.580652 19.925818 7.580652 8.274454 0 16.514115-3.403516 22.442128-10.07445 11.011798-12.387122 9.896394-31.357172-2.492774-42.367947L169.687704 548.100196 939.880137 548.100196c16.57449 0 30.011524-13.613042 30.011524-30.187533S956.454628 487.72513 939.880137 487.72513z" p-id="2136" fill="#FF9800"></path></svg></button>
<div id="artTitle"><h1></h1></div>
<div id="authorName"></div>
<div id="content"></div>
</div>
</div>
<div id="scoreRecords" class="userlist">
<div style="width:100%;height:50px;">
<span id="user_score_List" style="color:#ff9800" onclick="changeScoreList(this)">积分列表</span>
<span id="score_history_List" onclick="changeScoreList(this)">详细记录</span>
<button id="editScoreBtn" title="更改积分" onclick="showAddScore()" ><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1538270903865" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3673" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M607.232 896a32 32 0 1 1 0 64H192a96 96 0 0 1-96-96V160a96 96 0 0 1 96-96h544a96 96 0 0 1 96 96 32 32 0 0 1-64 0 32 32 0 0 0-32-32H192a32 32 0 0 0-32 32v704a32 32 0 0 0 32 32h415.232zM832 585.76v146.656c0 42.656-64 42.656-64 0v-146.656c0-42.688 64-42.688 64 0z" p-id="3674" fill="#000"></path><path d="M288 320a32 32 0 1 1 0-64h224a32 32 0 0 1 0 64H288zM288 480a32 32 0 0 1 0-64h128a32 32 0 0 1 0 64H288zM639.424 926.592a32 32 0 1 1-64 0L576 800a96 96 0 0 1 96-96l127.744 1.152a32 32 0 1 1 0 64L672 768a32 32 0 0 0-32 32l-0.576 126.592z" p-id="3675" fill="#ff9800"></path><path d="M637.92 947.648a32 32 0 1 1-44.32-46.208l180.384-172.992a32 32 0 1 1 44.288 46.176l-180.352 173.024zM880.896 334.528a31.424 31.424 0 0 0 3.328-44.416l-0.416-0.512a32 32 0 0 0-44.896-3.36L408.32 652.288l-15.2 51.84 58.336-4.544 429.44-365.056z m51.616-86.4a95.36 95.36 0 0 1-9.408 134.496l-438.08 372.448a32 32 0 0 1-18.24 7.52l-114.944 8.896a32 32 0 0 1-33.184-40.928l30.944-105.472a32 32 0 0 1 9.984-15.36L797.408 237.504a96 96 0 0 1 134.688 10.112l0.416 0.512z" p-id="3676" fill="#ff9800"></path></svg></button>
</div>
<div id="addScoreForm" class="form-horizontal" >
<div class="form-group" style="margin-left:-150px;">
<select class="select_0"> <select class="select_0">
{% for user in users %} {% for user in users %}
<option value="{{ user.userID }}">{{ user.name }}</option> <option value="{{ user.userID }}">{{ user.name }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div style="width:40%;"> <div class="form-group" style="width:40%;">
<div> <div>
<input id="reason" name="reason" type="text" autocomplete="off" placeholder="加积分或抵扣积分理由" required> <input id="reason" name="reason" class="form-control" type="text" autocomplete="off" placeholder="加积分或抵扣积分理由" required>
</div> </div>
</div> </div>
<div class = "addScore"> <div class="form-group" class = "addScore">
<select class="select_1"> <select class="select_1">
<option value="1" selected>奖励</option> <option value="1" selected>奖励</option>
<option value="0">抵扣</option> <option value="0">抵扣</option>
...@@ -32,7 +148,7 @@ ...@@ -32,7 +148,7 @@
<button class="addOrsub" onclick="addScoreBtn()">+</button> <button class="addOrsub" onclick="addScoreBtn()">+</button>
</div> </div>
<div> <div class="form-group">
<div> <div>
<button id="submitScore" class="addScorebtn" onclick="submitScore()" >确定</button> <button id="submitScore" class="addScorebtn" onclick="submitScore()" >确定</button>
<p style="color:red">{{ message }}</p> <p style="color:red">{{ message }}</p>
...@@ -80,7 +196,293 @@ ...@@ -80,7 +196,293 @@
</div> </div>
</div> </div>
<script> </div>
<script>
$(document).ready(function() {
var h= window.innerHeight;
$('#leftBar').height(h-50);
$('#submitAddUser').click(function() {
var data = [];
data['username']= $('input')[0].value;
data['password']= $('input')[1].value;
data['actiontype']='0'; //0 添加用户 1 删除用户
encryptSend('/operator/', data); // Jsencrypt.do对应服务端处理地址
});
var storage=window.sessionStorage;
var username=storage.username;
var identity=storage.identity;
if(username != null&&username.toString().length>0){
if(identity=='0'){
alert("请以管理员身份登录");
{#window.location.href="/signin/";#}
}else{
$("#adminname").text(username);
}
}else{
alert("请先登录");
{#window.location.href="/signin/";#}
}
});
function returnToList() {
$("#articleList").removeClass("hide");
$("#articleView").addClass("hide");
}
function getArticle (articleID){
$.ajax({
url:'/index/',
type:'get',
data:{
"articleID":articleID,
},
success:function(response){
{#var result = $.parseJSON(response);#}
var result=response;
$("#articleList").addClass("hide");
$("#articleView").removeClass("hide");
var converter = new showdown.Converter();
var content = converter.makeHtml(result["content"]);
$("#content").empty();
$("#content").append(content);
$("#artTitle").empty();
$("#artTitle").append(result["title"]);
$("#authorName").empty();
$("#authorName").append(result["authorname"]);
},
error:function (xhr) {
console.error('something went wrong...');
}
})
}
function deleteArt(thisbtn){
var title = thisbtn.parentElement.firstElementChild.innerHTML;
$.ajax({
url:'/index/',
type:'post',
data:{
"title":title,
},
success:function(response){
if (response["warning"]=="文章删除成功"){
thisbtn.parentElement.parentElement.remove();
}else{
alert(response["warning"]);
}
},
error:function (xhr) {
console.error('something went wrong...');
}
})
}
function logout() {
var storage = window.sessionStorage;
storage.clear();
{#window.location.href = "/signin/";#}
}
function changeScoreList(thisbtn){
var clickedName = $(thisbtn).attr('id');
thisbtn.style.color = "#d68206";
if(clickedName == 'user_score_List'){
$('.user_score_List').removeClass('hide');
$('.score_history_List').addClass('hide');
$('#score_history_List').css('color','black');
}else{
$('.user_score_List').addClass('hide');
$('.score_history_List').removeClass('hide');
$('#user_score_List').css('color','black');
}
}
function change(thisbtn) {
var divname = $(thisbtn).attr('id');
thisbtn.style.backgroundColor = 'navajowhite';
if (divname == 'useradminLi') {
$('#useradmin').css('display', 'block');
$('#paperadmin').css('display', 'none');
$('#privateArtadmin').css('display','none');
$('#scoreRecords').css('display','none');
$('#paperadminLi').css('background-color', 'white');
$('#privateArtadminLi').css('background-color', 'white');
$('#scoreLi').css('background-color', 'white');
} else if(divname=='paperadminLi') {
$('#useradmin').css('display', 'none');
$('#paperadmin').css('display', 'block');
$('#privateArtadmin').css('display','none');
$('#scoreRecords').css('display','none');
$('#useradminLi').css('background-color', 'white');
$('#privateArtadminLi').css('background-color', 'white');
$('#scoreLi').css('background-color', 'white');
}else if(divname=='privateArtadminLi'){
$('#useradmin').css('display', 'none');
$('#paperadmin').css('display', 'none');
$('#privateArtadmin').css('display','block');
$('#scoreRecords').css('display','none');
$('#useradminLi').css('background-color', 'white');
$('#paperadminLi').css('background-color', 'white');
$('#scoreLi').css('background-color', 'white');
}else if(divname=='scoreLi'){
$('#useradmin').css('display', 'none');
$('#paperadmin').css('display', 'none');
$('#privateArtadmin').css('display','none');
$('#scoreRecords').css('display','block');
$('#useradminLi').css('background-color', 'white');
$('#paperadminLi').css('background-color', 'white');
$('#privateArtadminLi').css('background-color', 'white');
calUserScore();
}
}
function calUserScore(){
var current_score_lists = document.getElementsByClassName('list_score_body');
for(var i=0;i<current_score_lists.length;i++){
if('普通用户'==current_score_lists[i].lastElementChild.innerText.toString().trim()){
var current_score_list = current_score_lists[i];
var user_score = parseInt(current_score_list.children[1].innerText);
var user_score_used = parseInt(current_score_list.children[2].innerText);
current_score_list.children[3].innerText = user_score-user_score_used;
}else{
{#current_score_lists[i].innerHTML="";#}
{#current_score_lists[i].className="";#}
current_score_lists[i].style.display='none';
}
}
}
function delUser(thisbtn) {
var delname = thisbtn.parentElement.parentElement.firstElementChild.innerHTML;
$.ajax({
url: '/operator/',
type: 'post',
data: {
"delname": delname,
"actiontype": '1',
},
dataType: 'json',
success: function (message) {
alert(message["warning"]);
if (message["warning"] == "删除成功") {
thisbtn.parentElement.parentElement.remove();
}
},
error: function (xhr) {
console.error('Something went wrong....');
}
});
}
function delPub(thisbtn) {
var delpub = thisbtn.parentElement.parentElement.children[1].firstElementChild.firstElementChild.innerHTML;
alert(delpub);
var pubFileNameURL = thisbtn.parentElement.previousElementSibling.children[0].children[0];
pubFileNameURL = $(pubFileNameURL).attr("href").split('/');
var pubFileName = pubFileNameURL[pubFileNameURL.length - 1];
$.ajax({
url: '/operator/',
type: 'post',
data: {
"delpub": delpub,
"pubFileName": pubFileName,
"actiontype": '4', //删除论文
},
dataType: 'json',
success: function (message) {
if (message["warning"] == "1") {
thisbtn.parentElement.parentElement.remove();
}
},
error: function (xhr) {
console.error('Something went wrong....');
}
});
}
function changeIdentity(thisbtn) {
var username = thisbtn.parentElement.parentElement.firstElementChild.innerHTML;
var nowIdentity = thisbtn.parentElement.parentElement.children[2].textContent.replace(/[\r\n]/g, "").replace(/[ ]/g, "");
var identity = '1';
if (nowIdentity == "管理员") {
identity = '0';
}
$.ajax({
url: '/operator/',
type: 'post',
data: {
"username": username,
"identity": identity,
"actiontype": '3', //更换用户身份
},
dataType: 'json',
success: function (message) {
alert(message["warning"]);
if (message["flag"] == "1") {
if (identity == '0') {
thisbtn.parentElement.parentElement.children[2].innerHTML = "普通用户";
} else {
thisbtn.parentElement.parentElement.children[2].innerHTML = "管理员";
}
}
},
error: function (xhr) {
console.error('Something went wrong....');
}
});
}
function resetPWD(thisbtn) {
var resetname = thisbtn.parentElement.parentElement.firstElementChild.innerHTML;
var resetPwd = hex_md5(resetname);
$.ajax({
url: '/operator/',
type: 'post',
data: {
"resetPwd": resetPwd,
"actiontype": '2',
"resetname": resetname,
},
dataType: 'json',
success: function (message) {
alert(message["warning"]);
},
});
}
//$(function() {
//});
function encryptSend(url, data) {
var enData = new Object();
enData["username"] = data["username"];
enData["password"] = hex_md5(data["password"]);
$.ajax({
url: url,
type: 'post',
data: {
"username": enData["username"],
"password": enData["password"],
"actiontype": data["actiontype"],
},
dataType: 'json',
success: function (message) {
alert(message["warning"]);
if (message["warning"] == "添加成功") {
var addElement = '<tr>\n' +
'\t\t \t\t\t<td class="col-xm-4 col-md-4">' + data["username"] + '</td>\n' +
' <td class="col-xm-4 col-md-4 col-md-offset-2">\n' +
' \t<p>{{ user.nake_name }}</p>\n' +
' </td>\n' +
' <td class="col-xm-2 col-md-2"><button class="deluserbtn" onclick="delUser(this)" style="float:right">删除</button> </td>\n' +
'<td><button class="resetPwd">重置密码</button></td>' +
'\t\t \t\t</tr>';
$('tbody').append(addElement);
}
},
});
};
function showAddScore(){ function showAddScore(){
var addScoreForm = document.getElementById("addScoreForm"); var addScoreForm = document.getElementById("addScoreForm");
addScoreForm.style.display='block'; addScoreForm.style.display='block';
...@@ -126,7 +528,7 @@ ...@@ -126,7 +528,7 @@
userUl.children[1].innerText=parseInt(userUl.children[1].innerText)+parseInt(scoreNum); userUl.children[1].innerText=parseInt(userUl.children[1].innerText)+parseInt(scoreNum);
userUl.children[3].innerText=parseInt(userUl.children[3].innerText)+parseInt(scoreNum); userUl.children[3].innerText=parseInt(userUl.children[3].innerText)+parseInt(scoreNum);
}else{ }else{
console.log("减积分") console.log("减积分");
userUl.children[2].innerText=parseInt(userUl.children[2].innerText)+parseInt(scoreNum); userUl.children[2].innerText=parseInt(userUl.children[2].innerText)+parseInt(scoreNum);
userUl.children[3].innerText=parseInt(userUl.children[3].innerText)-parseInt(scoreNum); userUl.children[3].innerText=parseInt(userUl.children[3].innerText)-parseInt(scoreNum);
} }
......
...@@ -718,13 +718,19 @@ def admin(request): ...@@ -718,13 +718,19 @@ def admin(request):
if User.objects.last().userID > 0: if User.objects.last().userID > 0:
users = User.objects.all() users = User.objects.all()
publications = Publications.objects.all() publications = Publications.objects.all()
articles = Articles.objects.filter(isPrivate='1')
for article in articles:
if article.publish == '1':
article.publish = '已发布'
else:
article.publish = '未发布'
for user in users: for user in users:
if user.identity=='0': if user.identity == '0':
user.identity = '普通用户' user.identity = '普通用户'
else: else:
user.identity = '管理员' user.identity = '管理员'
if ScoreRecords.objects.last() is None: if ScoreRecords.objects.last() is None:
records=0 records = 0
else: else:
records = ScoreRecords.objects.all() records = ScoreRecords.objects.all()
return render(request,"hunter/admin.html",locals()) return render(request,"hunter/admin.html",locals())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment