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