This commit is contained in:
2022-11-30 10:27:22 +08:00
parent d0eec752e4
commit efea4046c0
8 changed files with 62 additions and 132 deletions

View File

@@ -1,8 +1,8 @@
import {post} from '@config/http.js'
// 手持登录
export const loginApi = (user, password) => post('api/pda/handlogin', {
user: user,
export const loginApi = (user, password) => post('api/pda/login', {
username: user,
password: password
})
// 手持登陆查询菜单权限

View File

@@ -1,5 +1,5 @@
import axios from 'axios'
import { Dialog, toast } from './mUtils.js'
import { Dialog } from './mUtils.js'
import store from '../vuex/store'
import router from '@/router'
@@ -30,17 +30,14 @@ axios.interceptors.request.use(
axios.interceptors.response.use(
response => {
if (response.status === 200) {
return Promise.resolve(response)
} else {
return Promise.reject(response)
}
return Promise.resolve(response)
},
error => {
if (error && error.response) {
switch (error.response.status) {
case 400:
break
case 401:
toast(error.response.data.message)
store.dispatch('setSignOut')
router.push('/login')
break
@@ -58,7 +55,11 @@ export const post = (sevmethod, params) => {
.then(response => {
resolve(response.data)
}, error => {
Dialog(error.message)
if (error.message === null) {
Dialog('null')
} else {
Dialog(error.message)
}
reject(error.message)
})
.catch((error) => {
@@ -69,7 +70,7 @@ export const post = (sevmethod, params) => {
export const post2 = (sevmethod, params) => {
return new Promise((resolve, reject) => {
axios.post(`${store.getters.acsUrl}/` + sevmethod, params)
axios.post(`${store.getters.acsip}/` + sevmethod, params)
.then(response => {
resolve(response.data)
}, error => {

View File

@@ -4,7 +4,7 @@
<section class="content" style="margin-bottom: 0">
<div class="userInfo">
<div class="fxcol">
<p class="p1">{{$store.getters.userInfo !== '' ? JSON.parse($store.getters.userInfo).nick_name : ''}}</p>
<p class="p1">{{$store.getters.userInfo !== '' ? JSON.parse($store.getters.userInfo).nickName : ''}}</p>
<p class="p2">欢迎进入晟华手持系统</p>
</div>
<div class="exit" @click="Quit">
@@ -15,16 +15,17 @@
</section>
<div class="con">
<ul>
<li v-for="e in menuList" :key="e.menu_id" @click="toPage(e)">{{e.name}}</li>
<!-- <li @click="goInner('/TaskManage')">任务管理</li>
<!-- <li v-for="e in menuList" :key="e.menu_id" @click="toPage(e)">{{e.name}}</li> -->
<li @click="goInner('/ZlManage')">指令管理</li>
<li @click="goInner('/Password')">修改密码</li>
<li @click="goInner('/TaskManage')">任务管理</li>
<li @click="goInner('/SendMater')">送料</li>
<li @click="goInner('/PressCallMater')">压制叫料</li>
<li @click="goInner('/SendEmptyPallet')">送空托盘</li>
<li @click="goInner('/CallEmptyPallet')">呼叫空托盘</li>
<li @click="goInner('/MechineOutstore')">液压机出库</li>
<li @click="goInner('/BindPalletPoint')">托盘点位绑定</li>
<li @click="goInner('/CheckManage')">盘点管理</li> -->
<li @click="goInner('/CheckManage')">盘点管理</li>
<li @click="goInner('/Password')">修改密码</li>
</ul>
</div>
</section>
@@ -46,7 +47,7 @@ export default {
this.$store.dispatch('receiveMaterObj', {})
},
created () {
this._authority()
// this._authority()
},
methods: {
toPage (e) {

View File

@@ -11,6 +11,8 @@
<i class="icon-eye" :class="type === 'password' ? 'icon-eye-close' : 'icon-eye-open'" @click="changeType"></i>
</div>
<div class="fxrow check-box">
<i class="icon-name-check" :class="{'icon-name-checked': memberName}" @click="Remember"></i>
<span class="fxcol">记住用户名</span>
<router-link :to="{path: '/setup'}" class="fxcol" style="text-align:right;color:#6798ef">设置</router-link>
</div>
<button class="login-btn" :disabled="disabled" @click="_Login">确认登录</button>
@@ -28,43 +30,40 @@ export default {
loginname: '',
password: '',
type: 'password',
jobnum: '',
qrcode: '',
memberName: false,
disabled: false
}
},
created () {
if (this.$store.getters.userInfo !== '') {
this.loginname = JSON.parse(this.$store.getters.userInfo).loginname
this.memberName = this.loginname !== ''
}
},
mounted () {
document.getElementsByTagName('body')[0].className = 'login-bg'
// window.getSystemInfoCallback = this.getSystemInfoCallback
// window.location.href = 'getSystemInfo'
},
methods: {
// getSystemInfoCallback (result) {
// window.localStorage.setItem('hhtId', result)
// },
// handleTest () {
// this.test = false
// setTimeout(() => {
// this.test = true
// this.testNumber = this.testNumber === 1 ? 2 : 1
// }, 200)
// },
changeType () {
this.type = this.type === 'password' ? 'text' : 'password'
},
Remember () {
this.memberName = !this.memberName
},
async loginApi () {
try {
let res = await loginApi(this.loginname, encrypt(this.password))
if (res.code === '1') {
this.$store.dispatch('userInfo', JSON.stringify(res.result))
this.$router.push('/home')
let obj = {}
if (this.memberName) {
obj = Object.assign({}, res.user.user, {token: res.token, loginname: this.loginname})
} else {
this.Dialog(res.desc)
obj = Object.assign({}, res.user.user, {token: res.token, loginname: ''})
}
this.$store.dispatch('userInfo', JSON.stringify(obj))
this.$router.push('/home')
this.disabled = false
} catch (err) {
this.disabled = false
this.Dialog(err)
}
},
_Login () {

View File

@@ -4,7 +4,7 @@
<section class="content">
<ul class="pwd-manage-content">
<li>
<span>wms地址:</span>
<span>lms地址:</span>
<input type="text" v-model="addrip">
</li>
<li>
@@ -12,21 +12,9 @@
<input type="text" v-model="acsip">
</li>
<!-- <li>
<span>服务器地址:</span>
<input type="text" v-model="addrip">
</li> -->
<!-- <li>
<span>图片域名地址:</span>
<input type="text" v-model="imgip">
</li>
<li>
<span>标签打印地址:</span>
<span>打印地址:</span>
<input type="text" v-model="printip">
</li>
<li>
<span>单据打印地址:</span>
<input type="text" v-model="billPrintip">
</li>
<li>
<span>刷新时间(s):</span>
<input type="text" v-model="setTime">
@@ -45,13 +33,9 @@ export default {
data () {
return {
addrip: this.$store.getters.baseUrl,
acsip: this.$store.getters.acsUrl,
imgip: this.$store.getters.imgip,
printip: this.$store.getters.printUrl || 'http://10.5.29.104:8000',
billPrintip: this.$store.getters.billPrintUrl || 'http://10.5.29.191:8000',
setTime: this.$store.getters.setTime,
factid: '1',
storeid: '1'
acsip: this.$store.getters.acsip,
printip: this.$store.getters.printUrl,
setTime: this.$store.getters.setTime
}
},
methods: {
@@ -64,56 +48,19 @@ export default {
this.toast('请填写acs地址')
return
}
// if (this.addrip === '') {
// this.toast('请填写服务器地址')
// return
// }
// if (this.imgip === '') {
// this.toast('请填写图片域名地址')
// return
// }
// if (this.printip === '') {
// this.toast('请填写标签打印地址')
// return
// }
// if (this.billPrintip === '') {
// this.toast('请填写单据打印地址')
// this.toast('请填写打印地址')
// return
// }
// if (this.setTime === '') {
// this.toast('请填写刷新时间')
// return
// }
// 删除id为printid的DOM节点
// var printid = document.getElementById('printid')
// if (printid) {
// printid.parentNode.removeChild(printid)
// }
// 动态添加script
// var script = document.createElement('script')
// script.setAttribute('id', 'printid')
// script.src = this.printip + '/CLodopfuncs.js'
// document.getElementsByTagName('head')[0].appendChild(script)
// 2
// 删除id为billPrintid的DOM节点
// var billPrintid = document.getElementById('billPrintid')
// if (billPrintid) {
// billPrintid.parentNode.removeChild(billPrintid)
// }
// 动态添加script
// var script2 = document.createElement('script')
// script2.setAttribute('id', 'billPrintid')
// script2.src = this.billPrintip + '/CLodopfuncs.js'
// document.getElementsByTagName('head')[0].appendChild(script2)
// 存值
this.$store.dispatch('setBaseUrl', this.addrip)
this.$store.dispatch('setAcsUrl', this.acsip)
this.$store.dispatch('setImgIp', this.imgip)
this.$store.dispatch('setPrintUrl', this.printip)
this.$store.dispatch('setBillPrintUrl', this.billPrintip)
this.$store.dispatch('setRefreshTime', this.setTime)
this.$store.dispatch('setAcsIp', this.acsip)
// this.$store.dispatch('setPrintUrl', this.printip)
// this.$store.dispatch('setRefreshTime', this.setTime)
this.$router.push('/login')
}
}

View File

@@ -1,22 +1,17 @@
import * as types from '../types'
import { getStore, setStore } from '@config/mUtils.js'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.153:8010' : 'http://192.168.81.153:8010'
// const printUrl = 'http://192.168.81.82:8000'
const acsUrl = 'http://192.168.81.153:8010'
const imgip = 'http://192.168.81.155:8080'
const printUrl = ''
const billPrintUrl = ''
const setTime = '15'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.69:8011' : 'http://192.168.81.69:8011'
const acsip = process.env.NODE_ENV === 'development' ? 'http://192.168.81.69:8010' : 'http://192.168.81.69:8010'
const printUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.139:8000' : 'http://192.168.81.139:8000'
const setTime = '10'
/**
* App通用配置
*/
const state = {
baseUrl: getStore('baseUrl') || baseUrl,
acsUrl: getStore('acsUrl') || acsUrl,
imgip: getStore('imgip') || imgip,
acsip: getStore('acsip') || acsip,
printUrl: getStore('printUrl') || printUrl,
billPrintUrl: getStore('billPrintUrl') || billPrintUrl,
setTime: getStore('setTime') || setTime,
loading: false,
showToast: false,
@@ -32,22 +27,14 @@ const actions = {
setStore('baseUrl', str)
commit(types.COM_BASE_URL, str)
},
setAcsUrl ({commit}, str) {
setStore('acsUrl', str)
commit(types.COM_ACS_URL, str)
},
setImgIp ({commit}, str) {
setStore('imgip', str)
commit(types.COM_IMG_IP, str)
setAcsIp ({commit}, str) {
setStore('acsip', str)
commit(types.COM_ACS_IP, str)
},
setPrintUrl ({commit}, str) {
setStore('printUrl', str)
commit(types.COM_PRINT_URL, str)
},
setBillPrintUrl ({commit}, str) {
setStore('billPrintUrl', str)
commit(types.COM_BILL_PRINT_URL, str)
},
setRefreshTime ({commit}, str) {
setStore('setTime', str)
commit(types.COM_SET_TIME, str)
@@ -77,10 +64,8 @@ const actions = {
const getters = {
baseUrl: state => state.baseUrl,
acsUrl: state => state.acsUrl,
imgip: state => state.imgip,
acsip: state => state.acsip,
printUrl: state => state.printUrl,
billPrintUrl: state => state.billPrintUrl,
setTime: state => state.setTime,
loading: state => state.loading,
showToast: state => state.showToast,
@@ -91,18 +76,13 @@ const mutations = {
[types.COM_BASE_URL] (state, str) {
state.baseUrl = str
},
[types.COM_ACS_URL] (state, str) {
state.acsUrl = str
},
[types.COM_IMG_IP] (state, str) {
state.imgip = str
[types.COM_ACS_IP] (state, str) {
state.acsip = str
},
[types.COM_PRINT_URL] (state, str) {
state.printUrl = str
},
[types.COM_BILL_PRINT_URL] (state, str) {
state.billPrintUrl = str
},
[types.COM_SET_TIME] (state, str) {
state.setTime = str
},

View File

@@ -20,6 +20,9 @@ const actions = {
let obj = {loginname: loginname}
localStorage.setItem('userInfo', JSON.stringify(obj))
}
// var LODOP = document.getElementById('LODOP')
// var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement
// if (LODOP) head.removeChild(LODOP)
commit(types.SET_SIGN_OUT)
}
}
@@ -29,7 +32,6 @@ const mutations = {
state.userInfo = res
},
[types.SET_SIGN_OUT] (state) {
state.accountId = ''
}
}

View File

@@ -1,6 +1,6 @@
// 公共
export const COM_BASE_URL = 'COM_BASE_URL' // 主域名
export const COM_ACS_URL = 'COM_ACS_URL' // acs域名
export const COM_ACS_IP = 'COM_ACS_IP' // acs域名
export const COM_IMG_IP = 'COM_IMG_IP' // 图片域名地址
export const COM_PRINT_URL = 'COM_PRINT_URL' // 标签打印地址
export const COM_BILL_PRINT_URL = 'COM_BILL_PRINT_URL' // 单据打印地址