first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
$(".submitAdd").click(function() {
var name = $(".name").val();
var pwd = $(".pwd").val();
var repwd = $(".repwd").val();
if((name.length !=0 && pwd.length !=0 && repwd.length !=0) && pwd == repwd) {
$.ajax({
url: 'http://127.0.0.1:3000/admin/api/add',
type: 'POST',
data: {
name: name,
pwd: repwd
},
success: function(res) {
if(res.status == 200) {
if(confirm("注册成功,点击确定登录")) {
location.href = "/admin/login"
}
} else {
alert(res.message)
}
},
error: function(err) {
}
})
} else {
alert("有信息未填写,或者两次密码不相同")
}
})

View File

@@ -0,0 +1,31 @@
var E = window.wangEditor
var editor = new E('#editor')
editor.create()
$(".pushArticel").click(function() {
var title = $(".title").val()
var introduction = $(".introduction").val()
var author = $(".author").val()
var content = editor.txt.html()
// 验证用户是否输入内容,有没填写的给提示
// 对push接口实现token验证的调用
// 登录成功本地保存 token发送ajax请求头携带token
//
$.ajax({
url: 'http://127.0.0.1:3000/admin/api/push',
type: 'POST',
data: {
title: title,
introduction: introduction,
author: author,
content: content
},
success: function(res) {
console.log(res);
},
error: function(err) {}
})
});

View File

@@ -0,0 +1,34 @@
$(".submitLogin").click(function() {
var userName = $("input[type='text']").val()
var userPassword = $("input[type='password']").val()
if(userName.length == 0 || userPassword.length ==0) {
alert("账户密码为空")
} else {
$.ajax({
url: 'http://127.0.0.1:3000/admin/api/login',
type: 'POST',
headers: {
token: '645e8c56a66e32792f224730fd238711'
},
data: {
name: userName,
pwd: userPassword
},
success: function(res) {
if (res.status == 200) {
location.href = "/admin/home"
} else {
alert(res.message)
}
},
error: function(err) {
}
})
}
});

View File

@@ -0,0 +1 @@
console.log("js")