第一次提交
This commit is contained in:
43
store/index.js
Normal file
43
store/index.js
Normal file
@ -0,0 +1,43 @@
|
||||
// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 140 7 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
|
||||
// #ifdef MP
|
||||
import http from '../common/fui-request'
|
||||
// #endif
|
||||
// #ifndef VUE3
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
Vue.use(Vuex)
|
||||
const store = new Vuex.Store({
|
||||
// #endif
|
||||
|
||||
// #ifdef VUE3
|
||||
import {
|
||||
createStore
|
||||
} from 'vuex'
|
||||
const store = createStore({
|
||||
// #endif
|
||||
state: {
|
||||
//是否登录
|
||||
isLogin: uni.getStorageSync("firstui_m_token") ? true : false
|
||||
},
|
||||
mutations: {
|
||||
//登录
|
||||
login(state, payload) {
|
||||
if (payload) {
|
||||
state.token = payload.token
|
||||
uni.setStorageSync('firstui_m_token',payload.token)
|
||||
}
|
||||
state.isLogin = true
|
||||
},
|
||||
//退出登录
|
||||
logout(state) {
|
||||
state.token = ""
|
||||
state.isLogin = false
|
||||
uni.removeStorageSync('firstui_m_token')
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
export default store
|
Reference in New Issue
Block a user