update
This commit is contained in:
@@ -23,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
SECRET_KEY = 'django-insecure-92%z)%dv$x)-254f2ixp(ctnua4%^@=db&(ha4i-i2p2er(+^&'
|
SECRET_KEY = 'django-insecure-92%z)%dv$x)-254f2ixp(ctnua4%^@=db&(ha4i-i2p2er(+^&'
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -1,17 +1,25 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from server.views import *
|
from server.views.mind_map import *
|
||||||
|
from server.views.user import *
|
||||||
from server.view_test import *
|
from server.view_test import *
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
# ---------------------------------------------------
|
||||||
|
path('test', test), #
|
||||||
|
|
||||||
|
# ---------------------------------------------------
|
||||||
path('', to_list), # 跳转列表界面
|
path('', to_list), # 跳转列表界面
|
||||||
path('detail', to_detail), # 跳转详情界面
|
path('detail', to_detail), # 跳转详情界面
|
||||||
path('dashboard', to_dashboard), #
|
path('dashboard', to_dashboard), #
|
||||||
|
|
||||||
|
# ---------------------------------------------------
|
||||||
path('create', JsMindView.as_view()), # 创建思维导图
|
path('create', JsMindView.as_view()), # 创建思维导图
|
||||||
path('delete', JsMindView.as_view()), # 删除思维导图
|
path('delete', JsMindView.as_view()), # 删除思维导图
|
||||||
path('list', JsMindView.as_view()), # 查询思维导图
|
path('list', JsMindView.as_view()), # 查询思维导图
|
||||||
path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志
|
path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志
|
||||||
|
|
||||||
path('test', test), #
|
# ---------------------------------------------------
|
||||||
|
path('register', MindUserView.as_view()), # 用户注册
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
from rest_framework.views import APIView
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
|
||||||
|
class MindUserView(APIView):
|
||||||
|
"""
|
||||||
|
用户注册
|
||||||
|
"""
|
||||||
|
|
||||||
|
def post(self, request):
|
||||||
|
data_dict = request.POST
|
||||||
|
user_name = data_dict.get('userName')
|
||||||
|
input_password = data_dict.get('inputPassword')
|
||||||
|
print('userName:%s,inputPassword:%s' % (user_name, input_password))
|
||||||
|
return HttpResponse("success")
|
||||||
@@ -66,11 +66,11 @@
|
|||||||
|
|
||||||
// 注册
|
// 注册
|
||||||
$('#register_button').click(function () {
|
$('#register_button').click(function () {
|
||||||
const inputEmail = $('#inputEmail').val();
|
const userName = $('#userName').val();
|
||||||
const inputPassword = $('#inputPassword').val();
|
const inputPassword = $('#inputPassword').val();
|
||||||
const inputPassword_ = $('#inputPassword_').val();
|
const inputPassword_ = $('#inputPassword_').val();
|
||||||
|
|
||||||
if (!inputEmail) {
|
if (!userName) {
|
||||||
reg_alert('请输入用户名')
|
reg_alert('请输入用户名')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -83,8 +83,19 @@
|
|||||||
// 校验输入是否一致
|
// 校验输入是否一致
|
||||||
const validate = validate_pw_eq(this, inputPassword, inputPassword_)
|
const validate = validate_pw_eq(this, inputPassword, inputPassword_)
|
||||||
if (validate) {
|
if (validate) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "register",
|
||||||
|
data: {userName: userName, inputPassword: inputPassword},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data)
|
||||||
|
},
|
||||||
|
async: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function validate_pw_eq(obj, inputPassword, inputPassword_) {
|
function validate_pw_eq(obj, inputPassword, inputPassword_) {
|
||||||
@@ -138,8 +149,8 @@
|
|||||||
<!--register start-->
|
<!--register start-->
|
||||||
<div class="modal-body register_group" style="display: none;height: 360px;">
|
<div class="modal-body register_group" style="display: none;height: 360px;">
|
||||||
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
|
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
|
||||||
<label for="inputEmail" class="sr-only"></label>
|
<label for="userName" class="sr-only"></label>
|
||||||
<input type="email" id="inputEmail" class="form-control" placeholder="用户名" autocomplete="off" required autofocus>
|
<input type="email" id="userName" class="form-control" placeholder="用户名" autocomplete="off" required autofocus>
|
||||||
|
|
||||||
<label for="inputPassword" class="sr-only"></label>
|
<label for="inputPassword" class="sr-only"></label>
|
||||||
<input type="password" id="inputPassword" class="form-control" placeholder="密码" required>
|
<input type="password" id="inputPassword" class="form-control" placeholder="密码" required>
|
||||||
@@ -154,8 +165,8 @@
|
|||||||
<!--pw_login start-->
|
<!--pw_login start-->
|
||||||
<div class="modal-body pw_login_group" style="display: none;height: 360px;">
|
<div class="modal-body pw_login_group" style="display: none;height: 360px;">
|
||||||
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
|
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
|
||||||
<label for="inputEmail" class="sr-only">Email address</label>
|
<label for="userName" class="sr-only">Email address</label>
|
||||||
<input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
|
<input type="email" id="userName" class="form-control" placeholder="Email address" required autofocus>
|
||||||
|
|
||||||
<label for="inputPassword" class="sr-only">Password</label>
|
<label for="inputPassword" class="sr-only">Password</label>
|
||||||
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
|
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
|
||||||
|
|||||||
Reference in New Issue
Block a user