Browse Source

Merge branches 'gin-vue-admin_v1_stable' and 'master' of https://github.com/piexlmax/gin-vue-admin into gin-vue-admin_v1_stable

main
QM303176530 5 years ago
parent
commit
bea9816fb6
  1. 1
      QMPlusVuePage/src/store/module/user.js
  2. 29
      QMPlusVuePage/src/view/layout/aside/historyComponent/history.vue
  3. 4
      QMPlusVuePage/src/view/login/login.vue

1
QMPlusVuePage/src/store/module/user.js

@ -31,6 +31,7 @@ export const user = {
state.token = "" state.token = ""
state.expiresAt = "" state.expiresAt = ""
router.push({ name: 'login', replace: true }) router.push({ name: 'login', replace: true })
sessionStorage.clear()
window.location.reload() window.location.reload()
}, },
ResetUserInfo(state, userInfo = {}) { ResetUserInfo(state, userInfo = {}) {

29
QMPlusVuePage/src/view/layout/aside/historyComponent/history.vue

@ -16,18 +16,32 @@ export default {
name:"HistoryComponent", name:"HistoryComponent",
data(){ data(){
return{ return{
historys:[
historys:[],
activeValue:"dashbord"
}
},
created(){
const initHistorys = [
{ {
name:"dashbord", name:"dashbord",
meta:{ meta:{
title:"仪表盘" title:"仪表盘"
} }
} }
],
activeValue:"dashbord"
}
]
this.historys = JSON.parse(sessionStorage.getItem("historys")) || initHistorys
this.setTab(this.$route)
}, },
methods:{ methods:{
setTab(route){
if(!this.historys.some(item=>item.name==route.name)){
const obj = {}
obj.name = route.name
obj.meta = route.meta
this.historys.push(obj)
}
this.activeValue = this.$route.name
},
changeTab(tab){ changeTab(tab){
this.$router.push({name:tab.name}) this.$router.push({name:tab.name})
}, },
@ -50,11 +64,10 @@ export default {
watch:{ watch:{
$route( to ){ $route( to ){
this.historys = this.historys.filter(item=>!item.meta.hidden) this.historys = this.historys.filter(item=>!item.meta.hidden)
if(!this.historys.some(item=>item.name==to.name)){
this.historys.push(to)
}
this.activeValue = to.name
this.setTab(to)
sessionStorage.setItem("historys",JSON.stringify(this.historys))
} }
} }
} }
</script> </script>

4
QMPlusVuePage/src/view/login/login.vue

@ -86,13 +86,15 @@ export default {
async submitForm() { async submitForm() {
this.$refs.loginForm.validate(async v => { this.$refs.loginForm.validate(async v => {
if (v) { if (v) {
await this.login()
this.login()
this.loginVefify()
} else { } else {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '请正确填写登录信息', message: '请正确填写登录信息',
showClose: true showClose: true
}) })
this.loginVefify()
return false return false
} }
}) })

Loading…
Cancel
Save