登录配置

This commit is contained in:
2023-05-24 09:58:28 +08:00
parent ce4c21e32e
commit ce3e78f13c
14 changed files with 355 additions and 166 deletions

View File

@@ -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
</style>

View File

@@ -13,7 +13,7 @@
</div>
<div class="dialog_footer">
<button class="button button--primary" @click="toCancle">取消</button>
<button class="button button--primary" @click="toSure">确定</button>
<button class="button button--primary" :class="{'button--info': unclick === true}" :disabled="disabled" @click="toSure">确定</button>
</div>
</div>
</div>
@@ -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)
}
}

View File

@@ -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
</style>

View File

@@ -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
})

View File

@@ -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) => {

View File

@@ -9,28 +9,131 @@
</div>
</div>
<div class="login-content">
<div class="login-content_wraper">
<div v-show="tab === 0" class="login-content_wraper">
<div class="dl">登录</div>
<div class="login-items-wraper">
<div class="login-item">
<input type="text" class="login-input">
<div class="login-label" @click="toFocus(1)">用户名</div>
<input type="text" class="login-input" ref="input1" v-model="username">
</div>
<div class="login-item">
<input type="password" class="login-input">
<div class="login-label" @click="toFocus(2)">密码</div>
<input type="password" class="login-input" ref="input2" v-model="password">
</div>
</div>
<div class="login-buttons-wraper">
<button class="button button--primary button-login">登录</button>
</div>
<div class="login-forget-wraper">
<div class="login-setup-wraper">
<div class="setup-info pointer" @click="toSetup">配置信息</div>
<router-link to="/home">忘记密码</router-link>
</div>
<div class="login-buttons-wraper">
<button class="button button--primary button-login" :disabled="disabled" @click="saveLogin">登录</button>
</div>
</div>
<div v-show="tab === 1" class="login-content_wraper">
<div class="dl">配置</div>
<div class="login-items-wraper">
<div class="login-item">
<div class="login-label" @click="toFocus(3)">域名地址</div>
<input type="text" class="login-input" ref="input3" v-model="baseUrl">
</div>
<div class="login-item">
<div class="login-label" @click="toFocus(4)">刷新时间</div>
<input type="number" class="login-input" ref="input4" v-model="setTime">
</div>
</div>
<div class="login-setup-wraper login-setup-wraper__r">
<div class="setup-info pointer" @click="toLogin">立即登录</div>
</div>
<div class="login-buttons-wraper">
<button class="button button--primary button-login" @click="saveSetup">配置</button>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import {authlogin} from '@config/getData2.js'
import {encrypt} from '../../../main.js'
export default {
data () {
return {
tab: 0,
username: '',
password: '',
baseUrl: this.$store.getters.baseUrl,
setTime: this.$store.getters.setTime / 1000,
disabled: false
}
},
mounted () {
// 点对点项目分辨率 1024 * 768
// alert(document.body.clientWidth, 'a')
// alert(document.body.clientHeight, 'b')
// alert(window.screen.width, 'c')
// alert(window.screen.height, 'd')
},
methods: {
toFocus (i) {
switch (i) {
case 1:
this.$refs.input1.focus()
break
case 2:
this.$refs.input2.focus()
break
case 3:
this.$refs.input3.focus()
break
case 4:
this.$refs.input4.focus()
break
}
},
toSetup () {
this.tab = 1
},
toLogin () {
this.tab = 0
},
saveSetup () {
let obj = {
baseUrl: this.baseUrl,
setTime: this.setTime * 1000
}
this.$store.dispatch('setConfig', obj)
this.toLogin()
},
saveLogin () {
this.disabled = true
if (!this.username) {
this.toast('请输入用户名')
this.disabled = false
return
}
if (!this.password) {
this.toast('请输入密码')
this.disabled = false
return
}
this._authlogin()
},
async _authlogin () {
try {
let res = await authlogin(this.username, encrypt(this.password))
let obj = {}
obj = Object.assign({}, res)
this.$store.dispatch('userInfo', JSON.stringify(obj))
this.$router.push('/homehome')
} catch (err) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
@import '~@style/mixin'
.login-container
@@ -40,7 +143,7 @@
_fj(center)
.login-wraper
_fj()
_wh(80vw, 65vh)
_wh(70vw, 65vh)
padding 20px
background-color #fff
border-radius 20px
@@ -64,36 +167,49 @@
padding 20px
.login-content_wraper
width 100%
max-width 200px
max-width 260px
margin 0 auto
_fj(center,,column)
.dl
width 100%
_font(16px, 28px, #333, bold, center)
margin-bottom 10px
margin-bottom 30px
.login-items-wraper
width 100%
.login-item
width 100%
_fj()
_wh(100%, 42px)
background-color #fff
padding 5px 12px
border 1px solid $gray2
border-radius 20px
+.login-item
margin-top 20px
.login-label
width 102px
line-height 30px
_font(14px, 30px, $gray1,,)
.login-input
width calc(100% - 102px)
line-height 30px
_font(14px, 30px, $gray1,,)
.login-setup-wraper
width 100%
height 40px
border 1px solid $gray2
padding 5px 12px
_font(14px, 16px, #323232,,)
border-radius 6px
.login-forget-wraper
width 100%
margin-top 15px
text-align right
margin-top 10px
_fj()
a
_font(14px, 20px, $red1,,)
.login-setup-wraper__r
justify-content flex-end
.setup-info
color $red1
.setup-info
_font(14px, 20px, $fc1,,)
.login-buttons-wraper
width 100%
margin-top 20px
margin-top 10px
.button-login
width 100%
border-radius 12px
border-radius 20px
letter-spacing 5px
</style>

View File

@@ -22,7 +22,7 @@
</div>
<div class="elec-txt">90%</div>
<div class="iconfont icon_admin"></div>
<div class="elec-txt">admin</div>
<div class="elec-txt">{{ username }}</div>
</div>
<div class="time-container">
<jxTime></jxTime>
@@ -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: '首页',

View File

@@ -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;

View File

@@ -43,4 +43,8 @@ _bis(url,w,h=auto,x=center,y=center,c=transparent)
_ct()
position: absolute
top: 50%
transform: translateY(-50%)
transform: translateY(-50%)
//
_shadow(w,c)
filter drop-shadow(w 0 0 c)

View File

@@ -124,6 +124,10 @@ input::-webkit-input-placeholder {
text-align: right;
}
.pointer {
cursor: pointer;
}
.mgb40 {
margin-bottom: .4rem !important;
}

View File

@@ -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) {

View File

@@ -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
}
}