123456789101112131415161718192021222324252627282930313233 |
- import {defineStore} from "pinia";
- import storage from "@/utils/storage";
- export const useUserStore = defineStore({
- id: 'user',
- state: () => ({
- mac: null,
- token: null,
- }),
- getters: {},
- actions: {
- _init() {
- console.log('user _init')
- this.checkLogin()
- this.getMachineInfo()
- },
- checkLogin() {
- let token = storage.getKey('LOGIN_TEACHER_TOKEN')
- if (token) {
- this.token = token
- this.getMachineInfo()
- }
- },
- logout() {
- this.token = null
- },
- getMachineInfo() {
- console.log('132')
- this.mac = '123'
- console.log('456')
- },
- }
- })
|