You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
940 B
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Vue from 'vue'
import Vuex from 'vuex'
import fetch from '../common/httpRequest'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
//是否登录 项目中改为真实登录信息判断如token
isLogin: uni.getStorageSync("token") ? true : false,
//登录后跳转的页面路径 + 页面参数
returnUrl: "",
//app版本
version: "1.5.0",
//当前是否有网络连接
networkConnected: true,
isOnline: false
},
mutations: {
login(state, payload) {
// if (payload) {
// state.mobile = payload.mobile
// }
state.isLogin = true
},
logout(state) {
state.isLogin = false
state.returnUrl = ""
},
// setReturnUrl(state, returnUrl) {
// state.returnUrl = returnUrl
// },
networkChange(state, payload) {
state.networkConnected = payload.isConnected
},
setOnline(state, payload) {
state.isOnline = state.isOnline
}
},
actions: {
}
})
export default store