diff --git a/src/App.vue b/src/App.vue index 2d48bd7..bf2c52e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -91,4 +91,13 @@ vertical-align: baseline; margin-right: 10px; } + + .toolbar .el-form-item { + margin-bottom: 10px; + } + + .toolbar { + background: #fff; + padding: 10px 10px 0px 10px; + } \ No newline at end of file diff --git a/src/api/api.js b/src/api/api.js index 5818dc9..13afce3 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -2,4 +2,6 @@ import axios from 'axios'; let base = ''; -export const requestLogin = params => { return axios.post(`${ base }/login`, params).then(res => res.data); }; \ No newline at end of file +export const requestLogin = params => { return axios.post(`${ base }/login`, params).then(res => res.data); }; + +export const getUserList = params => { return axios.get(`${ base }/user/list`, {params: params}); }; \ No newline at end of file diff --git a/src/main.js b/src/main.js index 074659b..2be9bd0 100644 --- a/src/main.js +++ b/src/main.js @@ -14,7 +14,7 @@ import Home from './pages/Home.vue' import Main from './pages/Main.vue' import Table from './pages/nav1/Table.vue' import Form from './pages/nav1/Form.vue' -import Page3 from './pages/nav1/Page3.vue' +import user from './pages/nav1/user.vue' import Page4 from './pages/nav2/Page4.vue' import Page5 from './pages/nav2/Page5.vue' import Page6 from './pages/nav3/Page6.vue' @@ -44,7 +44,7 @@ const routes = [ //{ path: '/main', component: Main }, { path: '/table', component: Table, name: 'Table' }, { path: '/form', component: Form, name: 'Form' }, - { path: '/page3', component: Page3, name: '页面3' }, + { path: '/user', component: user, name: '列表' }, ] }, { diff --git a/src/mock/mock.js b/src/mock/mock.js index f94efe1..f94d415 100644 --- a/src/mock/mock.js +++ b/src/mock/mock.js @@ -1,6 +1,6 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; -import { LoginUsers } from '../mockdata/user'; +import { LoginUsers, Users } from '../mockdata/user'; export default { /** @@ -37,7 +37,22 @@ export default { } else { resolve([200, { code: 500, msg: '用户名或密码错误!!!' }]); } - }, Math.random() * 1000 + 1000); + }, 500); + }); + }); + + mock.onGet('/user/list').reply(config => { + let {name} = config.params; + let mockUsers = Users.filter(user => { + if (name && user.name.indexOf(name) == -1) return false; + return true; + }); + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve([200, { + users: mockUsers + }]); + }, 500); }); }); diff --git a/src/mockdata/user.js b/src/mockdata/user.js index c066165..0d613b6 100644 --- a/src/mockdata/user.js +++ b/src/mockdata/user.js @@ -8,18 +8,18 @@ const LoginUsers = [ } ]; -// const Users = []; -// const userCount = 200; +const Users = []; +const userCount = 8; -// for (let i = 0; i < userCount; i++) { -// Users.push(Mock.mock({ -// id: Mock.Random.guid(), -// name: Mock.Random.cname(), -// address: Mock.mock('@county(true)'), -// 'age|18-60': 1, -// date: Number(Mock.Random.datetime('T')) -// })); -// } +for (let i = 0; i < userCount; i++) { + Users.push(Mock.mock({ + id: Mock.Random.guid(), + name: Mock.Random.cname(), + addr: Mock.mock('@county(true)'), + 'age|18-60': 1, + birth: Mock.Random.date(), + sex: Mock.Random.integer(0, 1) + })); +} -//export { LoginUsers, Users }; -export { LoginUsers }; +export { LoginUsers, Users }; diff --git a/src/pages/nav1/Page3.vue b/src/pages/nav1/Page3.vue deleted file mode 100644 index 0714563..0000000 --- a/src/pages/nav1/Page3.vue +++ /dev/null @@ -1,28 +0,0 @@ - - \ No newline at end of file diff --git a/src/pages/nav1/Table.vue b/src/pages/nav1/Table.vue index b6d3594..1b15ac5 100644 --- a/src/pages/nav1/Table.vue +++ b/src/pages/nav1/Table.vue @@ -2,7 +2,7 @@
- + @@ -292,12 +292,4 @@ \ No newline at end of file diff --git a/src/pages/nav1/user.vue b/src/pages/nav1/user.vue new file mode 100644 index 0000000..77a2b88 --- /dev/null +++ b/src/pages/nav1/user.vue @@ -0,0 +1,73 @@ + + + + \ No newline at end of file