Files
apt-nl/src/pages/shells/index/index.vue

328 lines
8.1 KiB
Vue
Raw Normal View History

2023-05-05 18:11:56 +08:00
<template>
<div class="index-container">
<div class="header-container">
<div class="title-container">
<span class="company-logo"></span>
</div>
<div class="horizontal-menu-container">
2023-05-08 15:39:30 +08:00
<el-menu :default-active="activeIndex" mode="horizontal" @select="handleSelect">
<el-menu-item :index="menu.index" v-for="menu in menus" :key="menu.index">{{menu.label}}</el-menu-item>
2023-05-05 18:11:56 +08:00
</el-menu>
</div>
2023-05-08 15:39:30 +08:00
<div class="state-container">
2023-05-05 18:11:56 +08:00
<div class="state-item">运行</div>
<div class="state-line"></div>
<div class="state-item">自动</div>
<div class="state-line"></div>
<div class="state-item">中文<i class="icon_dropdown"></i></div>
2023-05-08 15:39:30 +08:00
</div>
<div class="user-container">
2023-05-05 18:11:56 +08:00
<div class="elec-qty-wrap">
<div class="elec-qty"></div>
</div>
<div class="elec-txt">90%</div>
2023-05-24 19:14:20 +08:00
<div class="header_user_wraper">
<div class="header_user_wraper_inn" @click="showDropdown">
<div class="iconfont icon_admin"></div>
<div class="elec-txt">{{ username }}</div>
</div>
<div v-show="dropdown" class="header_dropdown_wraper">
<ul>
<li @click="showDialog">修改密码</li>
<li @click="toEixt">退出</li>
</ul>
<div class="popper__arrow"></div>
</div>
</div>
2023-05-08 15:39:30 +08:00
</div>
<div class="time-container">
<jxTime></jxTime>
2023-05-05 18:11:56 +08:00
</div>
</div>
2023-05-08 15:39:30 +08:00
<router-view></router-view>
2023-05-24 19:14:20 +08:00
<jxDialog
ref="child"
title="修改密码"
:unclick="unclick"
@toSure="toSureDialog"
>
<div class="form_wraper">
<div class="form">
<div class="form_item">
<div class="form_item__label"><i>*</i>旧的密码</div>
<div class="form_item__content">
<input type="password" class="form_item__input" v-model="oldpassword">
</div>
</div>
</div>
<div class="form">
<div class="form_item">
<div class="form_item__label"><i>*</i>新的密码</div>
<div class="form_item__content">
<input type="password" class="form_item__input" v-model="newpassword1">
</div>
</div>
</div>
<div class="form">
<div class="form_item">
<div class="form_item__label"><i>*</i>新的密码</div>
<div class="form_item__content">
<input type="password" class="form_item__input" v-model="newpassword2">
</div>
</div>
</div>
</div>
</jxDialog>
2023-05-05 18:11:56 +08:00
</div>
</template>
<script>
2023-05-08 15:39:30 +08:00
import jxTime from '@components/time.vue'
2023-05-24 19:14:20 +08:00
import jxDialog from '@components/dialog.vue'
import { updatePass } from '@config/getData2.js'
2023-05-05 18:11:56 +08:00
export default {
2023-05-05 18:45:49 +08:00
components: {
2023-05-24 19:14:20 +08:00
jxTime,
jxDialog
2023-05-05 18:45:49 +08:00
},
2023-05-05 18:11:56 +08:00
data () {
return {
2023-05-24 09:58:28 +08:00
username: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user.username : '',
2023-05-08 15:39:30 +08:00
activeIndex: this.$store.getters.defaultActive,
2023-05-05 18:11:56 +08:00
menus: [{
label: '首页',
index: '1',
2023-05-08 15:39:30 +08:00
router: '/homehome'
2023-05-05 18:11:56 +08:00
}, {
label: '任务管理',
index: '2',
2023-05-09 15:57:38 +08:00
router: '/CarryPoint'
2023-05-05 18:11:56 +08:00
}, {
label: '故障管理',
index: '3',
2023-05-11 18:39:53 +08:00
router: '/ErrorDeal'
2023-05-05 18:11:56 +08:00
}, {
label: '车辆信息',
index: '4',
2023-05-08 15:39:30 +08:00
router: '/vehiclestatus'
2023-05-05 18:11:56 +08:00
}, {
label: '示教',
index: '5',
2023-05-08 15:39:30 +08:00
router: '/teach'
2023-05-05 18:11:56 +08:00
}, {
label: '地图',
index: '6',
router: ''
}, {
2023-05-11 14:54:41 +08:00
label: '系统管理',
2023-05-05 18:11:56 +08:00
index: '7',
2023-05-11 14:54:41 +08:00
router: '/user'
2023-05-24 19:14:20 +08:00
}],
dropdown: false,
oldpassword: '',
newpassword1: '',
newpassword2: '',
unclick: false
}
},
watch: {
oldpassword (val) {
if (val === '' || this.newpassword1 === '' || this.newpassword2 === '') {
this.unclick = true
} else {
this.unclick = false
}
},
newpassword1 (val) {
if (val === '' || this.oldpassword === '' || this.newpassword2 === '') {
this.unclick = true
} else {
this.unclick = false
}
},
newpassword2 (val) {
if (val === '' || this.oldpassword === '' || this.newpassword1 === '') {
this.unclick = true
} else {
this.unclick = false
}
2023-05-05 18:11:56 +08:00
}
2023-05-08 15:39:30 +08:00
},
methods: {
handleSelect (key) {
this.activeIndex = key
this.$store.dispatch('getDefaultActive', key)
2023-05-24 19:14:20 +08:00
this.dropdown = false
2023-05-08 15:39:30 +08:00
this.$router.push({
path: this.menus[Number(key) - 1].router
})
2023-05-24 19:14:20 +08:00
},
showDropdown () {
this.dropdown = !this.dropdown
},
showDialog () {
this.dropdown = false
this.$refs.child.active = true
this.oldpassword = ''
this.newpassword1 = ''
this.newpassword2 = ''
this.unclick = true
},
toSureDialog () {
this._updatePass()
},
async _updatePass () {
this.$refs.child.disabled = true
if (!this.oldpassword) {
this.toast('旧密码不能为空')
this.$refs.child.disabled = false
return
}
if (!this.newpassword1) {
this.toast('新密码不能为空')
this.$refs.child.disabled = false
return
}
if (!this.newpassword2) {
this.toast('输入新密码')
this.$refs.child.disabled = false
return
}
if (this.newpassword1 !== this.newpassword2) {
this.toast('新密码输入不一致,请重新输入')
this.$refs.child.disabled = false
return
}
try {
let res = await updatePass(this.newpassword1, this.oldpassword)
this.toast(res.desc)
this.$refs.child.active = false
this.$refs.child.disabled = false
} catch (e) {
this.$refs.child.active = false
this.$refs.child.disabled = false
}
},
toEixt () {
this.$store.dispatch('setSignOut')
this.$router.push('/login')
2023-05-08 15:39:30 +08:00
}
2023-05-05 18:11:56 +08:00
}
}
</script>
<style lang="stylus" scoped>
@import '~@style/mixin'
.index-container
2023-05-08 15:39:30 +08:00
_wh(100%, 100%)
2023-05-05 18:11:56 +08:00
.header-container
2023-05-05 18:45:49 +08:00
_fj()
_wh(100%, 61px)
padding 0 10px
border-bottom 2px solid #f1f1f1
2023-05-05 18:11:56 +08:00
.title-container
2023-05-05 18:45:49 +08:00
_fj(center)
_wh(130px, 61px)
2023-05-05 18:11:56 +08:00
.company-logo
display block
2023-05-05 18:45:49 +08:00
_wh(100%, 100%)
2023-05-08 15:39:30 +08:00
background url(../../../images/aio/logo_1.png) left center / 100% auto no-repeat
2023-05-05 18:11:56 +08:00
.horizontal-menu-container
height 61px
>>>.el-menu-item
2023-05-08 15:39:30 +08:00
padding 0 7px
.state-container
_fj()
2023-05-05 18:11:56 +08:00
.user-container
_fj()
2023-05-08 15:39:30 +08:00
.time-container
_fj()
2023-05-05 18:11:56 +08:00
.state-item
border 1px solid #54C0B3
border-radius 4px
_font(15px,25px,#54C0B3,,center)
padding 0 7px
.state-line
_wh(2px,20px)
opacity 0.3
background #8991A6
2023-05-08 15:39:30 +08:00
margin 0 10px
2023-05-05 18:11:56 +08:00
.elec-qty-wrap
position relative
width 15px
2023-05-08 15:39:30 +08:00
height 25px
2023-05-05 18:11:56 +08:00
border 1px solid #dddddd
2023-05-08 15:39:30 +08:00
margin-right 2px
2023-05-05 18:11:56 +08:00
.elec-qty
position absolute
width 100%
height 90%
left 0
bottom 0
background-color #54C0B3
// background-color #fa6400
.elec-txt
_font(15px, 25px, #909399,,left)
.icon_admin
2023-05-08 15:39:30 +08:00
_font(20px, 25px, #54C0B3,,left)
margin-right 2px
>>>.el-menu
border-right none
2023-05-24 19:14:20 +08:00
.header_user_wraper
padding 0 10px
height 59px
margin 0 10px
position relative
&:hover
background-color #f0f0f0
.header_user_wraper_inn
_fj()
_wh(100%, 100%)
.header_dropdown_wraper
position absolute
top 52px
left 0
z-index 1000
width 100%
background-color #fff
border 1px solid #ebeef5
border-radius 4px
box-shadow 0 2px 12px 0 rgba(0,0,0,.1)
padding 10px 0
ul
width 100%
li
width 100%
_font(14px, 36px, #909399,,center)
padding 0 10px
&:hover
background-color #ffc3a7
color #fd6a35
.popper__arrow
position absolute
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
filter: drop-shadow(0 2px 12px rgba(0,0,0,.03))
top: -6px;
left: 32px;
margin-right: 3px;
border-top-width: 0;
border-bottom-color: #ebeef5;
&:after
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
content: " ";
border-width: 6px;
top: 1px;
margin-left: -6px;
border-top-width: 0;
border-bottom-color: #fff;
2023-05-05 18:11:56 +08:00
</style>