This commit is contained in:
zuiidea
2016-11-02 22:35:07 +08:00
parent bf6724f7f1
commit f4a108cfc1
4 changed files with 14 additions and 9 deletions
+4 -1
View File
@@ -11,6 +11,10 @@ if (!global.adminUsersData) {
{
username: 'guest',
password: 'guest'
},
{
username: '吴彦祖',
password: '123456'
}
]
adminUsersData = data
@@ -28,7 +32,6 @@ Watch.watch(adminUsersData, function () {
module.exports = {
'POST /api/login' (req, res) {
console.log(req);
const userItem = req.body
const response = {
success: false,
+1 -2
View File
@@ -22,7 +22,6 @@ const login = ({
validateFieldsAndScroll
}
}) => {
console.log(loginButtonLoading);
function handleOk() {
validateFieldsAndScroll((errors, values) => {
@@ -58,7 +57,7 @@ const login = ({
message: '请填写密码'
}
]
})(<Input size="large" placeholder="密码"/>)}
})(<Input size="large" type="password" placeholder="密码"/>)}
</FormItem>
<Row>
<Button type="primary" size="large" onClick={handleOk} loading={loginButtonLoading}>
-1
View File
@@ -65,7 +65,6 @@ function Users({ location, dispatch, users }) {
field,
keyword,
onSearch(fieldsValue) {
console.log(fieldsValue);
dispatch({
type: 'users/query',
payload: fieldsValue,
+9 -5
View File
@@ -1,5 +1,5 @@
const Mock = require('mockjs')
const mockData = [require("../../mock/users"),require("../../mock/app")]
const mockData = [require("../../mock/users"), require("../../mock/app")]
function serialize(str) {
let paramArray = str.split("&")
@@ -12,9 +12,13 @@ function serialize(str) {
for (let i in mockData) {
for (let key in mockData[i]) {
Mock.mock(eval("/"+key.split(" ")[1].replace(/\//g,"\\\/")+"/"), key.split(" ")[0].toLowerCase(), function (options) {
if(key.split(" ")[0].toLowerCase()=='get'){
options.query = !!options.url.split("?")[1] ? serialize(options.url.split("?")[1]) : (!!options.body ? serialize(options.body) : {})
Mock.mock(eval("/" + key.split(" ")[1].replace(/\//g, "\\\/") + "/"), key.split(" ")[0].toLowerCase(), function (options) {
if (key.split(" ")[0].toLowerCase() == 'get') {
options.query = !!options.url.split("?")[1]
? serialize(options.url.split("?")[1])
: (!!options.body
? serialize(options.body)
: {})
}
let res = {}
let result = {}
@@ -27,4 +31,4 @@ for (let i in mockData) {
}
}
Mock.setup({timeout: 400})
Mock.setup({timeout: '200-600'})