123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import Vue from 'vue'
- import Vuex from 'vuex'
- import user from './model/user'
- import i18n from '../libs/i18n/index.js'
- Vue.use(Vuex)
- const store = new Vuex.Store({
- state: {
- // #ifdef APP || MP
- baseURL: 'http://andreessens.com', //测试请求地址配置
- // baseURL: 'http://wap.vgst168.com', //请求地址配置
- // #endif
- // #ifdef H5
- baseURL:window.location.protocol + "//" + window.location.host, //请求地址配置
- // #endif
- urlFile: '/index', //项目部署所在文件夹
- loginInterceptor: false, //是否打开强制登录
- // #ifdef H5 || MP-WEIXIN
- weichatInfo: {}, //保存微信注册信息
- weichatObj: '', //微信对象
- // #endif
- langList: [
- {
- value: 'EN',
- label: 'English'
- },
- {
- value: 'CN',
- label: '简体中文'
- },
- {
- value: 'TW',
- label: '繁體中文'
- }
- ],
- lang:uni.getStorageSync('lang')||'TW',
- },
- mutations: {
- //保存微信信息
- setWeiChatInfo(state, provider) {
- state.weichatInfo = provider;
- },
- //保存微信对象
- setWeiChatObj(state, provider) {
- state.weichatObj = provider;
- },
- LANG(state, data) {
- uni.setStorageSync('lang', data)
- i18n.locale = data
- state.lang = data
- },
- },
- modules: {
- user
- },
- actions: {
- // 设置当前语言
- setLang({ commit }, data) {
- commit('LANG', data)
- // commit('VANTLANG', data)
- },
- }
- })
- export default store
|