完善不同页面加载方式下的表现

This commit is contained in:
zhl 2021-06-21 20:54:26 +08:00
parent 9395f1126c
commit ab7f83229e
5 changed files with 19 additions and 4 deletions

View File

@ -21,7 +21,7 @@ export default class extends Vue {
if (mini && token) { if (mini && token) {
console.log(`link from partner, token: ${token}`) console.log(`link from partner, token: ${token}`)
AppModule.SetMini(1) AppModule.SetMini(1)
// UserModule.updatePageToken(token) UserModule.updatePageToken(token)
} }
} }
} }

View File

@ -1,5 +1,5 @@
import { VuexModule, Module, Mutation, Action, getModule } from 'vuex-module-decorators' import { VuexModule, Module, Mutation, Action, getModule } from 'vuex-module-decorators'
import { getSidebarStatus, getSize, setSidebarStatus, setLanguage, setSize } from '@/utils/cookies' import { getSidebarStatus, getSize, setSidebarStatus, setLanguage, setSize, setMini, getMini } from '@/utils/cookies'
import { getLocale } from '@/lang' import { getLocale } from '@/lang'
import store from '@/store' import store from '@/store'
@ -29,7 +29,7 @@ class App extends VuexModule implements IAppState {
public device = DeviceType.Desktop public device = DeviceType.Desktop
public language = getLocale() public language = getLocale()
public size = getSize() || 'medium' public size = getSize() || 'medium'
public mini = 0 public mini = getMini() ? Number(getMini()) : 0
@Mutation @Mutation
private TOGGLE_SIDEBAR(withoutAnimation: boolean) { private TOGGLE_SIDEBAR(withoutAnimation: boolean) {
@ -69,6 +69,7 @@ class App extends VuexModule implements IAppState {
@Mutation @Mutation
private SET_MINI(mini: number) { private SET_MINI(mini: number) {
this.mini = mini this.mini = mini
setMini(mini + '')
} }
@Action @Action
@ -99,7 +100,7 @@ class App extends VuexModule implements IAppState {
@Action @Action
public SetMini(mini: number) { public SetMini(mini: number) {
this.SET_MINI(mini) this.SET_MINI(mini)
this.CloseSideBar(false) if (mini) this.CloseSideBar(false)
} }
} }

View File

@ -13,6 +13,10 @@ const sizeKey = 'size'
export const getSize = () => Cookies.get(sizeKey) export const getSize = () => Cookies.get(sizeKey)
export const setSize = (size: string) => Cookies.set(sizeKey, size) export const setSize = (size: string) => Cookies.set(sizeKey, size)
const miniKey = 'mini'
export const getMini = () => Cookies.get(miniKey)
export const setMini = (mini: string) => Cookies.set(miniKey, mini)
// User // User
const tokenKey = 'vue_typescript_admin_access_token' const tokenKey = 'vue_typescript_admin_access_token'
export const getToken = () => Cookies.get(tokenKey) export const getToken = () => Cookies.get(tokenKey)

View File

@ -25,6 +25,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator' import { Component, Vue } from 'vue-property-decorator'
import { UserModule } from '@/store/modules/user' import { UserModule } from '@/store/modules/user'
import { AppModule } from '@/store/modules/app'
@Component({ @Component({
name: 'Dashboard' name: 'Dashboard'
@ -45,6 +46,10 @@ export default class extends Vue {
get deptname() { get deptname() {
return UserModule.deptname return UserModule.deptname
} }
created() {
AppModule.SetMini(0)
}
} }
</script> </script>

View File

@ -95,6 +95,7 @@ import { UserModule } from '@/store/modules/user'
import { isValidUsername } from '@/utils/validate' import { isValidUsername } from '@/utils/validate'
import LangSelect from '@/components/LangSelect/index.vue' import LangSelect from '@/components/LangSelect/index.vue'
import SocialSign from './components/SocialSignin.vue' import SocialSign from './components/SocialSignin.vue'
import { AppModule } from '@/store/modules/app'
@Component({ @Component({
name: 'Login', name: 'Login',
@ -149,6 +150,10 @@ export default class extends Vue {
} }
} }
created() {
AppModule.SetMini(0)
}
mounted() { mounted() {
if (this.loginForm.username === '') { if (this.loginForm.username === '') {
(this.$refs.username as Input).focus() (this.$refs.username as Input).focus()