diff --git a/package.json b/package.json index 4b7358f..7aefc7c 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "babel-polyfill": "^6.26.0", "element-ui": "^2.8.2", "fastclick": "^1.0.6", - "jsencrypt": "^3.2.1", + "jsencrypt": "^3.3.2", "vant": "^2.11.2", "vue": "^2.5.2", "vue-i18n": "^8.26.1", diff --git a/src/components/alert.vue b/src/components/alert.vue index 2ba8045..5fb28ce 100644 --- a/src/components/alert.vue +++ b/src/components/alert.vue @@ -73,6 +73,7 @@ export default { top 50% left 50% width 45% + max-width 420px transition .3s transform translate3d(-50%, -50%, 0) overflow hidden @@ -85,15 +86,19 @@ export default { color #929292 z-index 2018 .text - padding .1rem + padding 10px 15px max-height 60vh + min-height 44px overflow-y auto text-align center -webkit-overflow-scrolling touch white-space pre-wrap + font-size 14px + line-height 24px color #606266 [class*='hairline'] position relative + padding 5px 0 0 [class*='hairline']::after content ' ' position absolute @@ -109,8 +114,9 @@ export default { border-top-width 1px .button--large width 100% - height .5rem - line-height .5rem + height 40px + line-height 40px + font-size 14px color #e74f1a background-color #dadee2 diff --git a/src/components/dialog.vue b/src/components/dialog.vue index f888df4..1fadcf1 100644 --- a/src/components/dialog.vue +++ b/src/components/dialog.vue @@ -13,7 +13,7 @@ @@ -26,11 +26,16 @@ export default { name: 'jxDialog', props: { title: String, - type: String + type: String, + unclick: { + type: Boolean, + default: false + } }, data () { return { - active: false + active: false, + disabled: false } }, methods: { @@ -39,7 +44,6 @@ export default { this.$emit('toCancle', this.type) }, toSure () { - this.active = false this.$emit('toSure', this.type) } } diff --git a/src/components/toast.vue b/src/components/toast.vue index 183d717..ff347af 100644 --- a/src/components/toast.vue +++ b/src/components/toast.vue @@ -26,19 +26,20 @@ export default { position fixed z-index 10001 width 100% - height 1rem - line-height 1rem + height 48px text-align center left 50% top 50% transform translate(-50%, -50%) .text + height 48px + line-height 18px display inline-block width auto text-align center - padding 0 .5rem - border-radius 10px + padding 15px + border-radius 4px background #858586 - font-size .32rem + font-size 16px color #fff diff --git a/src/config/getData2.js b/src/config/getData2.js index 6f5c2ca..c40033f 100644 --- a/src/config/getData2.js +++ b/src/config/getData2.js @@ -12,13 +12,30 @@ export const parameterSetting = (num, word) => post('api/developer/parameterSett password: word }) -export const queryVehicleStatus = () => post('api/vehicle/queryVehicleStatus', {}) +// new +// 登录 +export const authlogin = (username, password) => post('auth/login', { + username: username, + password: password +}) +// 车辆状态 +// 1.1查询车辆状态 +export const queryVehicleStatus = (username, password) => post('api/vehicle/queryVehicleStatus', { +}) +// 1.2查询传感器状态 export const querrySensor = () => post('api/vehicle/querrySensor', {}) - +// 1.3软启动 export const softStart = () => post('api/vehicle/softStart', {}) +// 1.4跳过起点 export const skipStartPoint = () => post('api/vehicle/skipStartPoint', {}) -export const ShutDown = () => post('api/vehicle/Shut_down', {}) +// 1.5关机,显示屏控制、TCS控制、RC控制、Joy控制 +export const ShutDown = (type, bool) => post('api/vehicle/Shut_down', { + type: type, + bool: bool +}) +// 1.6查询初始化坐标 export const queryRestPoint = () => post('api/vehicle/queryRestPoint', {}) +// 1.7初始化坐标确定 export const restCoordinate = (code, name, x, y, t) => post('api/vehicle/restCoordinate', { point_code: code, point_name: name, @@ -26,5 +43,36 @@ export const restCoordinate = (code, name, x, y, t) => post('api/vehicle/restCoo y: y, t: t }) +// 1.8查询agv的状态 export const queryAgvStatus = () => post('api/vehicle/queryAgv_Status', {}) +// 1.9退出 export const quitNow = () => post('api/vehicle/quitNow', {}) + +// 系统管理 +// 1.1 用户列表 +export const usersQuery = (page, size) => post('api/users/query', { + page: page, + size: size +}) +// 1.2 添加用户 +export const usersAdd = (username, personName, gender, phone, rolesIds, password) => post('api/users/add', { + username: username, + personName: personName, + gender: gender, + phone: phone, + rolesIds: rolesIds, + password: password +}) +// 1.3 修改用户、重置密码 +export const usersEdit = (obj) => post('api/users/edit', obj) +// 1.4 删除用户 +export const usersDelete = (userId) => post('api/users/delete', { + usersIds: userId +}) + +// 角色管理 +// 1.1 角色列表 +export const sysRoleQuery = (page, size) => post('api/sysRole/query', { + page: page, + size: size +}) diff --git a/src/config/http.js b/src/config/http.js index f1f5bbe..e21446f 100644 --- a/src/config/http.js +++ b/src/config/http.js @@ -1,17 +1,17 @@ import axios from 'axios' -// import qs from 'qs' import { Dialog } from './utils.js' -// import { Dialog, toast } from './utils.js' import store from '../vuex/store' -// import router from './../router' +import router from '@/router' axios.defaults.timeout = 50000 -// axios.defaults.retry = 5 -// axios.defaults.retryDelay = 10000 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) if (config.method === 'post') { if (!config.data.flag) { config.data = config.data @@ -32,46 +32,19 @@ axios.interceptors.response.use( return Promise.resolve(response) }, error => { - // let condata = error.config.data.split('&') - // console.log('condata', condata) - // if (condata[1] === '_SRVMETHOD=queryProduceOrderReprot' || condata[1] === '_SRVMETHOD=queryQCRecord' || condata[1] === '_SRVMETHOD=queryEquipWorkTeam') { - // toast(error.message) - // setTimeout(() => { - // router.replace({ - // path: '/login' - // }) - // }, 10000) - // } else { - // if (condata[1] === '_SRVMETHOD=queryEquip') { - // toast(error.message) - // } else { - // Dialog(error.message) - // } - // // Dialog(error.message) - // } - // toast(error.message) - // - 20201215-x - // router.push({ - // path: '/500', - // query: {redirect: router.currentRoute.fullPath} - // }) - // - 20201215-x - return Promise.reject(error) - // let config = error.config - // if (!config || !config.retry) return Promise.reject(error) - // config.__retryCount = config.__retryCount || 0 - // if (config.__retryCount >= config.retry) { - // return Promise.reject(error) - // } - // config.__retryCount += 1 - // let backoff = new Promise(resolve => { - // setTimeout(() => { - // resolve() - // }, config.retryDelay || 1) - // }) - // return backoff.then(() => { - // return axios(config) - // }) + if (error && error.response) { + switch (error.response.status) { + case 400: + break + case 401: + store.dispatch('setSignOut') + router.push('/login') + break + } + return Promise.reject(error.response.data) + } else { + return Promise.reject(error) + } } ) @@ -79,11 +52,9 @@ export const post = (sevmethod, params) => { return new Promise((resolve, reject) => { axios.post(`${store.getters.baseUrl}/` + sevmethod, params) .then(response => { - // if (response.data.code === '0') { - // Dialog(response.data.desc) - // } resolve(response.data) }, error => { + Dialog(error.message) reject(error.message) }) .catch((error) => { diff --git a/src/pages/modules/login/login.vue b/src/pages/modules/login/login.vue index 6a290e8..8898968 100644 --- a/src/pages/modules/login/login.vue +++ b/src/pages/modules/login/login.vue @@ -9,28 +9,131 @@
-
+
+ + diff --git a/src/pages/shells/index/index.vue b/src/pages/shells/index/index.vue index 12e4c8e..7e4109d 100644 --- a/src/pages/shells/index/index.vue +++ b/src/pages/shells/index/index.vue @@ -22,7 +22,7 @@
90%
-
admin
+
{{ username }}
@@ -40,6 +40,7 @@ export default { }, data () { return { + username: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user.username : '', activeIndex: this.$store.getters.defaultActive, menus: [{ label: '首页', diff --git a/src/style/common.styl b/src/style/common.styl index 594ffc2..906cabd 100644 --- a/src/style/common.styl +++ b/src/style/common.styl @@ -49,6 +49,7 @@ _wh(calc(100% - 120px), 100%) .site_container + _fj() _wh(100%, calc(100% - 82px)) overflow hidden .left_side @@ -134,6 +135,10 @@ padding: 12px 20px; font-size: 14px; border-radius: 18px; + &:disabled + color: #fff; + background-color: $gray; + border-color: $gray1; .button+.button margin-left: 10px; .button--primary @@ -195,7 +200,7 @@ width 100% .form width 100% - _fj(flex-start) + _fj(flex-start, flex-start) .form_item width 48% margin-bottom: 20px @@ -422,60 +427,65 @@ .state_wrap width 100% _fj(, flex-start) - margin-bottom 20px .state_tip - _wh(200px, 100px) + _wh(150px, 50px) _fj(center) - _font(28px, 40px, #ffffff,,center) + _font(18px, 15px, #ffffff,,center) border 1px solid $red background-color #ffc3a7 - border-radius 16px + border-radius 6px margin-right 70px overflow hidden .state_content - width calc(100% - 270px) + width calc(100% - 220px) _fj(flex-start) flex-wrap wrap .state_item_1 - _wh(260px, 100px) + _wh(150px, 50px) _fj(center) border 1.6px solid #54C0B3 background-color #fff - _font(32px,45px,#54C0B3,,center) - border-radius 16px -.state_item_2 - _wh(284px, 100px) - _fj(center) - border 12px solid #DFE1E6 - background-color #fff - border-radius 16px - margin-bottom 24px + _font(18px,25px,#54C0B3,,center) + border-radius 6px + margin-bottom 20px margin-right 24px +.state_item_2 + _wh(calc(33.333333% - 16px), 60px) + _fj(center) + border 10px solid #DFE1E6 + background-color #fff + border-radius 6px + margin-bottom 20px + margin-right 24px + &:nth-child(3n) + margin-right 0 .state_item_2_dot display block - _wh(32px,32px) - background-color #00C852 + _wh(24px,24px) + background-color #ffffff border-radius 50% - margin-right 24px + margin-right 20px .state_item_2_txt display block - _font(32px,45px,#696969,,) + _font(18px,25px,#696969,,) .state_item_3 - _wh(310px, 100px) + _wh(calc(33.333333% - 16px), 50px) _fj(flex-start) border 1.6px solid #8B90A6 background-color #fff border-radius 16px - margin-bottom 24px + margin-bottom 20px margin-right 24px padding 10px 20px + &:nth-child(3n) + margin-right 0 .state_item_3_txt1 display block - _font(32px,45px,#696969,,) + _font(18px,25px,#696969,,) margin-right 12px .state_item_3_txt2 display block - _font(32px,45px,#FA6400,,) + _font(18px,25px,#FA6400,,) .state_item_switch display: inline-flex; align-items: center; @@ -483,6 +493,11 @@ line-height: 50px; height: 50px; vertical-align: middle; + margin-bottom 20px + margin-right 24px + outline none + background none + cursor pointer .switch__input position: absolute; width: 0; @@ -503,8 +518,8 @@ cursor: pointer; transition: border-color .3s,background-color .3s; vertical-align: middle; - border-color: rgb(255, 73, 73); - background-color: rgb(255, 73, 73); + border-color: $gray2; + background-color: $gray3; &::after content: ""; position: absolute; diff --git a/src/style/mixin.styl b/src/style/mixin.styl index bbaeafa..693c560 100644 --- a/src/style/mixin.styl +++ b/src/style/mixin.styl @@ -43,4 +43,8 @@ _bis(url,w,h=auto,x=center,y=center,c=transparent) _ct() position: absolute top: 50% - transform: translateY(-50%) \ No newline at end of file + transform: translateY(-50%) + +// 背景图片改变颜色 +_shadow(w,c) + filter drop-shadow(w 0 0 c) \ No newline at end of file diff --git a/src/style/reset.css b/src/style/reset.css index 537f692..f0ac087 100644 --- a/src/style/reset.css +++ b/src/style/reset.css @@ -124,6 +124,10 @@ input::-webkit-input-placeholder { text-align: right; } +.pointer { + cursor: pointer; +} + .mgb40 { margin-bottom: .4rem !important; } diff --git a/src/vuex/modules/com.js b/src/vuex/modules/com.js index 179fdd1..12e0526 100644 --- a/src/vuex/modules/com.js +++ b/src/vuex/modules/com.js @@ -1,14 +1,11 @@ import * as types from '../types' import { getStore, setStore } from '@config/utils.js' -const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.155:8013' : 'http://192.168.81.155:8013' -const imgBaseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.100/' : 'http://192.168.46.5/' +const baseUrl = process.env.NODE_ENV === 'development' ? 'http://43.139.166.161:8018' : 'http://43.139.166.16:8018' const setTime = '5000' const state = { baseUrl: getStore('baseUrl') || baseUrl, setTime: getStore('setTime') || setTime, - imgBaseUrl: getStore('imgBaseUrl') || imgBaseUrl, - lockTime: getStore('lockTime') || 0, loading: false, showToast: false, showAlert: false, @@ -21,8 +18,6 @@ const state = { const getters = { baseUrl: state => state.baseUrl, setTime: state => state.setTime, - imgBaseUrl: state => state.imgBaseUrl, - lockTime: state => state.lockTime, loading: state => state.loading, showToast: state => state.showToast, showAlert: state => state.showAlert @@ -32,8 +27,6 @@ const actions = { setConfig ({commit}, res) { setStore('baseUrl', res.baseUrl) setStore('setTime', res.setTime) - setStore('imgBaseUrl', res.imgBaseUrl) - setStore('lockTime', res.lockTime) commit(types.COM_CONFIG, res) }, setLoadingState ({ commit }, status) { @@ -63,8 +56,6 @@ const mutations = { [types.COM_CONFIG] (state, res) { state.baseUrl = res.baseUrl state.setTime = res.setTime - state.imgBaseUrl = res.imgBaseUrl - state.lockTime = res.lockTime }, [types.COM_LOADING_STATUS] (state, status) { diff --git a/src/vuex/modules/user.js b/src/vuex/modules/user.js index 15a9df0..3ffd2e2 100644 --- a/src/vuex/modules/user.js +++ b/src/vuex/modules/user.js @@ -1,62 +1,90 @@ import * as types from '../types' import { getStore, setStore } from '@config/utils.js' +// const state = { +// accountId: getStore('accountId') || '', +// accountName: getStore('accountName') || '', +// userName: getStore('userName') || '', +// deptName: getStore('deptName') || '', +// deviceUuid: getStore('deviceUuid') || '', +// deviceCode: getStore('deviceCode') || '' +// } + +// const getters = { +// accountId: state => state.accountId, +// accountName: state => state.accountName, +// userName: state => state.userName, +// deptName: state => state.deptName, +// deviceUuid: state => state.deviceUuid, +// deviceCode: state => state.deviceCode +// } + +// const actions = { +// setUserInfo ({ commit }, res) { +// setStore('accountId', res.account_id) +// setStore('accountName', res.account_name) +// setStore('userName', res.user_name) +// setStore('deptName', res.dept_name) +// commit(types.SET_USER_INFO, res) +// }, +// setSignOut ({ commit }) { +// localStorage.removeItem('accountId') +// localStorage.removeItem('accountName') +// localStorage.removeItem('userName') +// localStorage.removeItem('deptName') +// commit(types.SET_SIGN_OUT) +// }, +// setDevice ({commit}, res) { +// setStore('deviceUuid', res.deviceUuid) +// setStore('deviceCode', res.deviceCode) +// commit(types.SET_DEVICE, res) +// } +// } + +// const mutations = { +// [types.SET_USER_INFO] (state, res) { +// state.accountId = res.account_id +// state.accountName = res.account_name +// state.userName = res.user_name +// state.deptName = res.dept_name +// }, +// [types.SET_SIGN_OUT] (state) { +// state.accountId = '' +// state.accountName = '' +// state.userName = '' +// state.deptName = '' +// }, +// [types.SET_DEVICE] (state, res) { +// state.deviceUuid = res.deviceUuid +// state.deviceCode = res.deviceCode +// } +// } + const state = { - accountId: getStore('accountId') || '', - accountName: getStore('accountName') || '', - userName: getStore('userName') || '', - deptName: getStore('deptName') || '', - deviceUuid: getStore('deviceUuid') || '', - deviceCode: getStore('deviceCode') || '' + userInfo: getStore('userInfo') || '' // 用户信息 } const getters = { - accountId: state => state.accountId, - accountName: state => state.accountName, - userName: state => state.userName, - deptName: state => state.deptName, - deviceUuid: state => state.deviceUuid, - deviceCode: state => state.deviceCode + userInfo: state => state.userInfo } const actions = { - setUserInfo ({ commit }, res) { - setStore('accountId', res.account_id) - setStore('accountName', res.account_name) - setStore('userName', res.user_name) - setStore('deptName', res.dept_name) + userInfo ({ commit }, res) { + setStore('userInfo', res) commit(types.SET_USER_INFO, res) }, setSignOut ({ commit }) { - localStorage.removeItem('accountId') - localStorage.removeItem('accountName') - localStorage.removeItem('userName') - localStorage.removeItem('deptName') + localStorage.removeItem('userInfo') commit(types.SET_SIGN_OUT) - }, - setDevice ({commit}, res) { - setStore('deviceUuid', res.deviceUuid) - setStore('deviceCode', res.deviceCode) - commit(types.SET_DEVICE, res) } } const mutations = { [types.SET_USER_INFO] (state, res) { - state.accountId = res.account_id - state.accountName = res.account_name - state.userName = res.user_name - state.deptName = res.dept_name + state.userInfo = res }, [types.SET_SIGN_OUT] (state) { state.accountId = '' - state.accountName = '' - state.userName = '' - state.deptName = '' - }, - [types.SET_DEVICE] (state, res) { - state.deviceUuid = res.deviceUuid - state.deviceCode = res.deviceCode } } diff --git a/yarn.lock b/yarn.lock index 3c5e387..5a62f91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5190,10 +5190,10 @@ jsdom@^11.5.1: ws "^5.2.0" xml-name-validator "^3.0.0" -jsencrypt@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/jsencrypt/-/jsencrypt-3.2.1.tgz#09766983cc760088ff26b12fe7e574252af97727" - integrity sha512-k1sD5QV0KPn+D8uG9AdGzTQuamt82QZ3A3l6f7TRwMU6Oi2Vg0BsL+wZIQBONcraO1pc78ExMdvmBBJ8WhNYUA== +jsencrypt@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/jsencrypt/-/jsencrypt-3.3.2.tgz#b0f1a2278810c7ba1cb8957af11195354622df7c" + integrity sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A== jsesc@^1.3.0: version "1.3.0"