mock data

v1.0
bobi 2019-05-17 23:50:54 +08:00
parent 01acd14bd4
commit 125fc53ded
11 changed files with 43 additions and 9 deletions

5
data/user/add.json Normal file
View File

@ -0,0 +1,5 @@
{
"status": 1000,
"msg": "操作成功",
"data": {}
}

5
data/user/batchDel.json Normal file
View File

@ -0,0 +1,5 @@
{
"status": 1000,
"msg": "操作成功",
"data": {}
}

View File

@ -0,0 +1,5 @@
{
"status": 1000,
"msg": "操作成功",
"data": {}
}

5
data/user/batchStop.json Normal file
View File

@ -0,0 +1,5 @@
{
"status": 1000,
"msg": "操作成功",
"data": {}
}

5
data/user/edit.json Normal file
View File

@ -0,0 +1,5 @@
{
"status": 1000,
"msg": "操作成功",
"data": {}
}

8
data/user/login.json Normal file
View File

@ -0,0 +1,8 @@
{
"status": 1000,
"msg": "操作成功",
"data": {
"username": "bobi",
"email": "bobi1234@foxmail.com"
}
}

View File

@ -1,6 +1,6 @@
{
"code": 0,
"msg": "",
"msg": "操作成功",
"count": 11,
"data": [
{

View File

@ -57,7 +57,7 @@
// 登陆逻辑
form.on('submit(login)', function (data) {
okUtils.ajax("/login", "post", data.field).done(function (response) {
okUtils.ajax("../../data/user/login.json", "post", data.field).done(function (response) {
console.log(response)
okLayer.msg.greenTick("登陆成功", function () {
window.location = "../../index.html";

View File

@ -123,7 +123,7 @@
});
form.on("submit(add)", function (data) {
okUtils.ajax("/user/add", "post", data.field).done(function (response) {
okUtils.ajax("../../data/user/add.json", "post", data.field).done(function (response) {
console.log(response)
okLayer.msg.greenTick("添加成功", function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));

View File

@ -123,7 +123,7 @@
});
form.on("submit(edit)", function (data) {
okUtils.ajax("/user/edit", "post", data.field).done(function (response) {
okUtils.ajax("../../data/user/edit.json", "post", data.field).done(function (response) {
console.log(response)
okLayer.msg.greenTick("编辑成功", function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));

View File

@ -53,7 +53,8 @@
var userTable = table.render({
elem: "#tableId",
url: "../../data/user.json",
url: "../../data/user/user.json",
method: "post",
limit: 10,
page: true,
toolbar: true,
@ -118,7 +119,7 @@
layer.close(index);
var idsStr = okUtils.table.batchCheck(table);
if (idsStr) {
okUtils.ajax("/user/batchNormal", "post", {idsStr: idsStr}).done(function (response) {
okUtils.ajax("../../data/user/batchNormal.json", "post", {idsStr: idsStr}).done(function (response) {
console.log(response)
okUtils.table.successMsg("批量启用成功");
}).fail(function (error) {
@ -133,7 +134,7 @@
layer.close(index);
var idsStr = okUtils.table.batchCheck(table);
if (idsStr) {
okUtils.ajax("/user/batchStop", "post", {idsStr: idsStr}).done(function (response) {
okUtils.ajax("../../data/user/batchStop.json", "post", {idsStr: idsStr}).done(function (response) {
console.log(response)
okUtils.table.successMsg("批量停用成功");
}).fail(function (error) {
@ -148,7 +149,7 @@
layer.close(index);
var idsStr = okUtils.table.batchCheck(table);
if (idsStr) {
okUtils.ajax("/user/batchDel", "post", {idsStr: idsStr}).done(function (response) {
okUtils.ajax("../../data/user/batchDel.json", "post", {idsStr: idsStr}).done(function (response) {
console.log(response)
okUtils.table.successMsg("批量删除成功");
}).fail(function (error) {
@ -172,7 +173,7 @@
function del (id) {
okLayer.confirm("确定要删除吗?", function () {
okUtils.ajax("/user/batchDel", "post", {idsStr: id}).done(function (response) {
okUtils.ajax("../../data/user/batchDel.json", "post", {idsStr: id}).done(function (response) {
console.log(response)
okUtils.table.successMsg("删除成功");
}).fail(function (error) {