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. 2
      QMPlusServer/tpl/te/router.go.tpl
  2. 1
      QMPlusVuePage/src/store/module/user.js
  3. 29
      QMPlusVuePage/src/view/layout/aside/historyComponent/history.vue
  4. 4
      QMPlusVuePage/src/view/login/login.vue

2
QMPlusServer/tpl/te/router.go.tpl

@ -12,7 +12,7 @@ func Init{{.StructName}}Router(Router *gin.RouterGroup) {
{{.StructName}}Router.POST("create{{.StructName}}", api.Create{{.StructName}}) // 新建{{.StructName}} {{.StructName}}Router.POST("create{{.StructName}}", api.Create{{.StructName}}) // 新建{{.StructName}}
{{.StructName}}Router.POST("delete{{.StructName}}", api.Delete{{.StructName}}) //删除{{.StructName}} {{.StructName}}Router.POST("delete{{.StructName}}", api.Delete{{.StructName}}) //删除{{.StructName}}
{{.StructName}}Router.POST("update{{.StructName}}", api.Update{{.StructName}}) //更新{{.StructName}} {{.StructName}}Router.POST("update{{.StructName}}", api.Update{{.StructName}}) //更新{{.StructName}}
{{.StructName}}Router.POST("find{{.StructName}} ", api.Find{{.StructName}}) // 根据ID获取{{.StructName}}
{{.StructName}}Router.POST("find{{.StructName}}", api.Find{{.StructName}}) // 根据ID获取{{.StructName}}
{{.StructName}}Router.POST("get{{.StructName}}List", api.Get{{.StructName}}List) //获取{{.StructName}}列表 {{.StructName}}Router.POST("get{{.StructName}}List", api.Get{{.StructName}}List) //获取{{.StructName}}列表
} }
} }

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