123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import Vue from 'vue'
- import Vuex from 'vuex'
- import user from './model/user'
- Vue.use(Vuex)
- const store = new Vuex.Store({
- state: {
- baseURL: 'http://www.babido.cn' ,
- // baseURL: 'https://zhibo.liuniu946.com', //请求地址配置
- urlFile:'/index',//项目部署所在文件夹
- hasLogin: false, //是否登录
- userInfo: {}, //登录信息
- loginInterceptor: false, //是否打开强制登录
- orderInfo: {}, //订单信息
- token:'',
- // #ifdef H5
- setWeiChatInfo:'',
- weichatInfo: {}, //保存微信注册信息
- weichatObj: '', //微信对象
- weichatBrowser: '' ,//当前是否为微信内置浏览器
- // #endif
- },
- mutations: {
- // 登录
- login(state) {
- state.hasLogin = true;
- },
- // 退出登录
- logout(state) {
- state.hasLogin = false;
- state.userInfo = {};
- uni.removeStorage({
- key: 'userInfo'
- })
- // uni.removeStorage({
- // key: 'mystore'
- // })
- },
- // 保存用户信息
- setUserInfo(state, provider) {
- state.userInfo = provider;
- uni.setStorageSync('userInfo',provider)
- // if(provider.store_info){
- console.log(provider.store_info && !(uni.getStorageSync('mystore')||false));
-
- // uni.showModal({
- // title: '打印',
- // // content: !(uni.getStorageSync('mystore')||false)+'box:'+JSON.stringify(provider)
- // content: (uni.getStorageSync('mystore'))
- // });
- if(provider.store_info && !(uni.getStorageSync('mystore')||false)){
- uni.setStorageSync('mystore',provider.store_info.id);
-
- }
- else {
- let value = uni.getStorageSync('mystore');
- console.log('---mystore-8-8-',value);
- }
- },
- // #ifdef H5
- //保存微信信息
- setWeiChatInfo(state, provider) {
- state.weichatInfo = provider;
- },
- //保存微信对象
- setWeiChatObj(state, provider) {
- state.weichatObj = provider;
- console.log('保存微信对象',state.weichatObj)
- }
- // #endif
- },
- modules:{
- user
- },
- actions: {}
- })
-
- export default store
|