Merge branches 'gin-vue-admin_v1_stable' and 'master' of https://github.com/piexlmax/gin-vue-admin into gin-vue-admin_v1_stable
This commit is contained in:
commit
2467522d30
|
@ -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}}列表
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = {}) {
|
||||||
|
|
|
@ -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.setTab(to)
|
||||||
this.historys.push(to)
|
sessionStorage.setItem("historys",JSON.stringify(this.historys))
|
||||||
}
|
|
||||||
this.activeValue = to.name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -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…
Reference in New Issue