正在显示
4 个修改的文件
包含
81 行增加
和
18 行删除
| @@ -29,8 +29,8 @@ | @@ -29,8 +29,8 @@ | ||
| 29 | "babel-core": "^6.22.1", | 29 | "babel-core": "^6.22.1", |
| 30 | "babel-loader": "^6.2.10", | 30 | "babel-loader": "^6.2.10", |
| 31 | "babel-plugin-transform-runtime": "^6.22.0", | 31 | "babel-plugin-transform-runtime": "^6.22.0", |
| 32 | - "babel-preset-env": "^1.2.1", | ||
| 33 | "babel-polyfill": "^6.16.0", | 32 | "babel-polyfill": "^6.16.0", |
| 33 | + "babel-preset-env": "^1.2.1", | ||
| 34 | "babel-preset-es2015": "^6.0.0", | 34 | "babel-preset-es2015": "^6.0.0", |
| 35 | "babel-preset-stage-2": "^6.22.0", | 35 | "babel-preset-stage-2": "^6.22.0", |
| 36 | "babel-register": "^6.22.0", | 36 | "babel-register": "^6.22.0", |
| @@ -46,13 +46,13 @@ | @@ -46,13 +46,13 @@ | ||
| 46 | "function-bind": "^1.0.2", | 46 | "function-bind": "^1.0.2", |
| 47 | "html-webpack-plugin": "^2.28.0", | 47 | "html-webpack-plugin": "^2.28.0", |
| 48 | "http-proxy-middleware": "^0.17.3", | 48 | "http-proxy-middleware": "^0.17.3", |
| 49 | - "webpack-bundle-analyzer": "^2.2.1", | ||
| 50 | "json-loader": "^0.5.4", | 49 | "json-loader": "^0.5.4", |
| 51 | "mockjs": "^1.0.1-beta3", | 50 | "mockjs": "^1.0.1-beta3", |
| 52 | "node-sass": "^4.5.0", | 51 | "node-sass": "^4.5.0", |
| 53 | "opn": "^4.0.2", | 52 | "opn": "^4.0.2", |
| 54 | "optimize-css-assets-webpack-plugin": "^1.3.0", | 53 | "optimize-css-assets-webpack-plugin": "^1.3.0", |
| 55 | "ora": "^1.0.0", | 54 | "ora": "^1.0.0", |
| 55 | + "qs": "^6.7.0", | ||
| 56 | "rimraf": "^2.6.0", | 56 | "rimraf": "^2.6.0", |
| 57 | "sass-loader": "^6.0.0", | 57 | "sass-loader": "^6.0.0", |
| 58 | "semver": "^5.3.0", | 58 | "semver": "^5.3.0", |
| @@ -62,6 +62,7 @@ | @@ -62,6 +62,7 @@ | ||
| 62 | "vue-style-loader": "^2.0.0", | 62 | "vue-style-loader": "^2.0.0", |
| 63 | "vue-template-compiler": "^2.2.4", | 63 | "vue-template-compiler": "^2.2.4", |
| 64 | "webpack": "^2.2.1", | 64 | "webpack": "^2.2.1", |
| 65 | + "webpack-bundle-analyzer": "^2.2.1", | ||
| 65 | "webpack-dev-middleware": "^1.10.0", | 66 | "webpack-dev-middleware": "^1.10.0", |
| 66 | "webpack-hot-middleware": "^2.16.1", | 67 | "webpack-hot-middleware": "^2.16.1", |
| 67 | "webpack-merge": "^2.6.1" | 68 | "webpack-merge": "^2.6.1" |
| 1 | import axios from 'axios' | 1 | import axios from 'axios' |
| 2 | import Vue from 'vue' | 2 | import Vue from 'vue' |
| 3 | - | 3 | +import qs from 'qs' |
| 4 | // let base = 'http://127.0.0.1:7003'; | 4 | // let base = 'http://127.0.0.1:7003'; |
| 5 | axios.defaults.baseURL = 'http://localhost:8082/api'; | 5 | axios.defaults.baseURL = 'http://localhost:8082/api'; |
| 6 | Vue.prototype.$http = axios; | 6 | Vue.prototype.$http = axios; |
| @@ -9,16 +9,17 @@ export const requestLogin = params => { | @@ -9,16 +9,17 @@ export const requestLogin = params => { | ||
| 9 | return axios({ | 9 | return axios({ |
| 10 | method: 'POST', | 10 | method: 'POST', |
| 11 | url: '/login', | 11 | url: '/login', |
| 12 | - data: params, | 12 | + data: qs.stringify(params), |
| 13 | withCredentials: true, | 13 | withCredentials: true, |
| 14 | - transformRequest: [function (data) { | ||
| 15 | - // Do whatever you want to transform the data | ||
| 16 | - let ret = '' | ||
| 17 | - for (let it in data) { | ||
| 18 | - ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&' | ||
| 19 | - } | ||
| 20 | - return ret | ||
| 21 | - }], | 14 | + //下面转换成urlencode参数,也可以用QS包处理,qs.stringify(data) |
| 15 | + // transformRequest: [function (data) { | ||
| 16 | + // // Do whatever you want to transform the data | ||
| 17 | + // let ret = '' | ||
| 18 | + // for (let it in data) { | ||
| 19 | + // ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&' | ||
| 20 | + // } | ||
| 21 | + // return ret | ||
| 22 | + // }], | ||
| 22 | headers: { | 23 | headers: { |
| 23 | 'Content-Type': 'application/x-www-form-urlencoded' | 24 | 'Content-Type': 'application/x-www-form-urlencoded' |
| 24 | } | 25 | } |
| @@ -48,7 +49,7 @@ export const removeUser = params => { return axios({ | @@ -48,7 +49,7 @@ export const removeUser = params => { return axios({ | ||
| 48 | } | 49 | } |
| 49 | })}; | 50 | })}; |
| 50 | 51 | ||
| 51 | -export const batchRemoveUser = params => { return axios.get(`${base}/user/batchremove`, { params: params }); }; | 52 | +export const batchRemoveUser = params => { return axios.get(`/user/batchremove`, { params: params }); }; |
| 52 | 53 | ||
| 53 | export const editUser = params => { return axios({ | 54 | export const editUser = params => { return axios({ |
| 54 | method: 'PUT', | 55 | method: 'PUT', |
src/api/http.js
0 → 100644
| 1 | +import axios from 'axios' | ||
| 2 | +axios.defaults.baseURL = 'http://localhost:8082/api'; | ||
| 3 | +let base = axios.defaults.baseURL+'/role'; | ||
| 4 | + | ||
| 5 | +axios.interceptors.request.use(config => { | ||
| 6 | + // 这里可以加一些动作, 比如来个进度条开始动作, | ||
| 7 | + return config | ||
| 8 | +}, error => { | ||
| 9 | + return Promise.reject(error) | ||
| 10 | +}); | ||
| 11 | + | ||
| 12 | +axios.interceptors.response.use(response => response, error => Promise.resolve(error.response)); | ||
| 13 | + | ||
| 14 | +export default { | ||
| 15 | + post(url, data) { | ||
| 16 | + return axios({ | ||
| 17 | + method: 'post', // 请求协议 | ||
| 18 | + url: url, // 请求的地址 | ||
| 19 | + data: qs.stringify(data), // post 请求的数据 | ||
| 20 | + timeout: 30000, // 超时时间, 单位毫秒 | ||
| 21 | + headers: { | ||
| 22 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 23 | + } | ||
| 24 | + }) | ||
| 25 | + }, | ||
| 26 | + get(url, params) { | ||
| 27 | + return axios.get(`${base}/${url}`, { params: params }); | ||
| 28 | + }, | ||
| 29 | + put(url, params){ | ||
| 30 | + return axios({ | ||
| 31 | + method: 'PUT', | ||
| 32 | + url: `${base}/${url}`, | ||
| 33 | + data: params, | ||
| 34 | + headers: { | ||
| 35 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 36 | + } | ||
| 37 | + }) | ||
| 38 | + }, | ||
| 39 | + del: (url,params) => { | ||
| 40 | + return axios({ | ||
| 41 | + method: 'DELETE', | ||
| 42 | + url: `${base}/${url}`, | ||
| 43 | + data: params, | ||
| 44 | + headers: { | ||
| 45 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 46 | + } | ||
| 47 | + }) | ||
| 48 | + } | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +// { | ||
| 52 | +// // 服务器提供的响应 | ||
| 53 | +// data: {}, | ||
| 54 | +// // 服务器响应的HTTP状态代码 | ||
| 55 | +// status: 200, | ||
| 56 | +// // 服务器响应的HTTP状态消息 | ||
| 57 | +// statusText: 'OK', | ||
| 58 | +// // 服务器响应头 | ||
| 59 | +// headers: {}, | ||
| 60 | +// // axios 的配置 | ||
| 61 | +// config: {} | ||
| 62 | +// } |
| @@ -183,7 +183,7 @@ | @@ -183,7 +183,7 @@ | ||
| 183 | <script> | 183 | <script> |
| 184 | import util from '../../common/js/util' | 184 | import util from '../../common/js/util' |
| 185 | import NProgress from 'nprogress' | 185 | import NProgress from 'nprogress' |
| 186 | - import { getUserListPage, removeUser, batchRemoveUser, editUser, addUser, setUserRole } from '../../api/api'; | 186 | + import { getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole } from '../../api/api'; |
| 187 | import { getList} from '../../api/role_api'; | 187 | import { getList} from '../../api/role_api'; |
| 188 | import moment from 'moment' | 188 | import moment from 'moment' |
| 189 | export default { | 189 | export default { |
| @@ -196,7 +196,7 @@ | @@ -196,7 +196,7 @@ | ||
| 196 | users: [], | 196 | users: [], |
| 197 | total: 0, | 197 | total: 0, |
| 198 | pageNum: 1, | 198 | pageNum: 1, |
| 199 | - pageSize: 5, | 199 | + pageSize: 10, |
| 200 | faceImageUrl: '', | 200 | faceImageUrl: '', |
| 201 | listLoading: false, | 201 | listLoading: false, |
| 202 | sels: [],//列表选中列 | 202 | sels: [],//列表选中列 |
| @@ -273,7 +273,7 @@ | @@ -273,7 +273,7 @@ | ||
| 273 | realname: this.filters.realname | 273 | realname: this.filters.realname |
| 274 | }; | 274 | }; |
| 275 | this.listLoading = true; | 275 | this.listLoading = true; |
| 276 | - getUserListPage(para).then((res) => { | 276 | + getUserList(para).then((res) => { |
| 277 | this.total = res.data.total; | 277 | this.total = res.data.total; |
| 278 | this.users = res.data.list; | 278 | this.users = res.data.list; |
| 279 | this.listLoading = false; | 279 | this.listLoading = false; |
| @@ -379,7 +379,6 @@ | @@ -379,7 +379,6 @@ | ||
| 379 | para.authorities = null; | 379 | para.authorities = null; |
| 380 | para.permissions = null; | 380 | para.permissions = null; |
| 381 | para.roles = null; | 381 | para.roles = null; |
| 382 | - para.username=null;//后端不能也不接收针对username的更新 | ||
| 383 | // para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); | 382 | // para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); |
| 384 | /* | 383 | /* |
| 385 | 查询之后格式this.filters.column.create_start_date中日期发生变化; | 384 | 查询之后格式this.filters.column.create_start_date中日期发生变化; |
| @@ -479,7 +478,7 @@ | @@ -479,7 +478,7 @@ | ||
| 479 | this.faceImageUrl = 'http://127.0.0.1:7003/'+response.data; | 478 | this.faceImageUrl = 'http://127.0.0.1:7003/'+response.data; |
| 480 | }, | 479 | }, |
| 481 | beforeAvatarUpload: function () { | 480 | beforeAvatarUpload: function () { |
| 482 | - | 481 | + |
| 483 | } | 482 | } |
| 484 | }, | 483 | }, |
| 485 | mounted() { | 484 | mounted() { |
-
请 注册 或 登录 后发表评论