diff --git a/src/config/getData2.js b/src/config/getData2.js index aaba994..be6c337 100644 --- a/src/config/getData2.js +++ b/src/config/getData2.js @@ -1,39 +1,39 @@ -import {post} from '@config/http.js' +import {post2} from '@config/http.js' // 手持登录 -export const loginApi = (user, password) => post('api/pda/login', { +export const loginApi = (user, password) => post2('api/pda/login', { username: user, password: password }) // 手持登陆查询菜单权限 -export const authority = (id) => post('api/pda/authority', { +export const authority = (id) => post2('api/pda/authority', { accountId: id }) /** 站点管理 */ // 1.1查询所有区域信息 -// export const queryArea = () => post('api/hand/queryArea', {}) -export const queryArea = () => { - let res = { - result: [{region_code: '1', region_name: 'A1'}, {region_code: '2', region_name: 'A2'}, {region_code: '3', region_name: 'A2'}, {region_code: '4', region_name: 'A10'}] - } - return res -} +export const queryArea = () => post2('api/hand/queryArea', {}) +// export const queryArea = () => { +// let res = { +// result: [{region_code: '1', region_name: 'A1'}, {region_code: '2', region_name: 'A2'}, {region_code: '3', region_name: 'A2'}, {region_code: '4', region_name: 'A10'}] +// } +// return res +// } // 1.2根据区域查询设备编号及状态 -// export const queryPointByArea = (code) => post('api/hand/queryPointByArea', { -// areaCode: code -// }) -export const queryPointByArea = () => { - let res = { - result: [{device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}] - } - return res -} +export const queryPointByArea = (code) => post2('api/hand/queryPointByArea', { + areaCode: code +}) +// export const queryPointByArea = () => { +// let res = { +// result: [{device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}, {device_code: '1', device_name: 'JLDFJLLJ'}, {device_code: '2', device_name: 'JLDFJLLJ'}, {device_code: '3', device_name: 'JLDFJLLJ'}] +// } +// return res +// } /** 呼叫管理 */ // 1.1创建任务(确定起点) -export const callTask = (scodes, code) => post('api/hand/callTask', { +export const callTask = (scodes, code) => post2('api/hand/callTask', { start_device_codes: scodes, next_device_code: code }) diff --git a/src/config/http.js b/src/config/http.js index 200d9a6..c979be1 100644 --- a/src/config/http.js +++ b/src/config/http.js @@ -8,11 +8,11 @@ axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8' axios.interceptors.request.use( config => { - let token = '' - if (store.getters.userInfo !== '') { - token = JSON.parse(store.getters.userInfo).token - } - token && (config.headers.Authorization = token) + // let token = '' + // if (store.getters.userInfo !== '') { + // token = JSON.parse(store.getters.userInfo).token + // } + // token && (config.headers.Authorization = token) if (config.method === 'post') { if (!config.data.flag) { config.data = config.data @@ -49,20 +49,20 @@ axios.interceptors.response.use( } ) -export const post = (sevmethod, params) => { - return new Promise((resolve, reject) => { - axios.post(`${store.getters.baseUrl}/` + sevmethod, params) - .then(response => { - resolve(response.data) - }, error => { - Dialog(error.message) - reject(error.message) - }) - .catch((error) => { - reject(error) - }) - }) -} +// export const post = (sevmethod, params) => { +// return new Promise((resolve, reject) => { +// axios.post(`${store.getters.baseUrl}/` + sevmethod, params) +// .then(response => { +// resolve(response.data) +// }, error => { +// Dialog(error.message) +// reject(error.message) +// }) +// .catch((error) => { +// reject(error) +// }) +// }) +// } export const post2 = (sevmethod, params) => { return new Promise((resolve, reject) => { diff --git a/src/main.js b/src/main.js index 46d8f57..3381d24 100644 --- a/src/main.js +++ b/src/main.js @@ -9,7 +9,6 @@ import VueQrcodeReader from 'vue-qrcode-reader' import store from './vuex/store' import '@config/rem.js' import Print from 'vue-print-nb' -import {post} from '@config/http.js' import { Dialog, toast } from '@config/mUtils.js' import filter from '@config/filter.js' import { baseUrl } from '@config/env.js' @@ -24,7 +23,6 @@ Vue.use(infiniteScroll) Vue.use(Print) Vue.prototype.Dialog = Dialog Vue.prototype.toast = toast -Vue.prototype.$post = post Vue.prototype.baseUrl = baseUrl Vue.use(Print) for (let k in filter) { diff --git a/src/pages/login/Home.vue b/src/pages/login/Home.vue index 030e0a2..8778132 100644 --- a/src/pages/login/Home.vue +++ b/src/pages/login/Home.vue @@ -4,7 +4,7 @@
-

{{$store.getters.userInfo !== '' ? JSON.parse($store.getters.userInfo).nickName : ''}}

+

{{$store.getters.userInfo !== '' ? JSON.parse($store.getters.userInfo).user_name : ''}}

欢迎进入晟华手持系统!

diff --git a/src/pages/login/Login.vue b/src/pages/login/Login.vue index 21787a8..07d125b 100644 --- a/src/pages/login/Login.vue +++ b/src/pages/login/Login.vue @@ -56,9 +56,9 @@ export default { if (res.code === '1') { let obj = {} if (this.memberName) { - obj = Object.assign({}, res.result.user.user, {token: res.token, loginname: this.loginname}) + obj = Object.assign({}, res.result, {loginname: this.loginname}) } else { - obj = Object.assign({}, res.result.user.user, {token: res.result.token, loginname: ''}) + obj = Object.assign({}, res.result, {loginname: ''}) } this.$store.dispatch('setUserInfo', JSON.stringify(obj)) this.$router.push('/home') @@ -91,6 +91,8 @@ export default {