This commit is contained in:
chenyang
2022-06-30 16:48:42 +08:00
parent 03b914a0f0
commit c7cc3cc5c4
6 changed files with 44 additions and 10 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-92%z)%dv$x)-254f2ixp(ctnua4%^@=db&(ha4i-i2p2er(+^&'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
ALLOWED_HOSTS = []
+10 -2
View File
@@ -1,17 +1,25 @@
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 *
urlpatterns = [
# ---------------------------------------------------
path('test', test), #
# ---------------------------------------------------
path('', to_list), # 跳转列表界面
path('detail', to_detail), # 跳转详情界面
path('dashboard', to_dashboard), #
# ---------------------------------------------------
path('create', JsMindView.as_view()), # 创建思维导图
path('delete', JsMindView.as_view()), # 删除思维导图
path('list', JsMindView.as_view()), # 查询思维导图
path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志
path('test', test), #
# ---------------------------------------------------
path('register', MindUserView.as_view()), # 用户注册
]
View File
+15
View File
@@ -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")
+18 -7
View File
@@ -66,11 +66,11 @@
// 注册
$('#register_button').click(function () {
const inputEmail = $('#inputEmail').val();
const userName = $('#userName').val();
const inputPassword = $('#inputPassword').val();
const inputPassword_ = $('#inputPassword_').val();
if (!inputEmail) {
if (!userName) {
reg_alert('请输入用户名')
return
}
@@ -83,8 +83,19 @@
// 校验输入是否一致
const validate = validate_pw_eq(this, inputPassword, inputPassword_)
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_) {
@@ -138,8 +149,8 @@
<!--register start-->
<div class="modal-body register_group" style="display: none;height: 360px;">
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
<label for="inputEmail" class="sr-only"></label>
<input type="email" id="inputEmail" class="form-control" placeholder="用户名" autocomplete="off" required autofocus>
<label for="userName" class="sr-only"></label>
<input type="email" id="userName" class="form-control" placeholder="用户名" autocomplete="off" required autofocus>
<label for="inputPassword" class="sr-only"></label>
<input type="password" id="inputPassword" class="form-control" placeholder="密码" required>
@@ -154,8 +165,8 @@
<!--pw_login start-->
<div class="modal-body pw_login_group" style="display: none;height: 360px;">
<h1 class="h3 mb-3 font-weight-normal">请输入用户名和密码</h1>
<label for="inputEmail" class="sr-only">Email address</label>
<input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
<label for="userName" class="sr-only">Email address</label>
<input type="email" id="userName" class="form-control" placeholder="Email address" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required>