1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 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 H5
- baseURL:window.location.protocol + "//" + window.location.host,//请求地址配置
- // #endif
- // #ifndef H5
- baseURL: 'https://xinkong.vwetdd.cn', //正式地址配置
- // #endif
- urlFile: '/index', //项目部署所在文件夹
- loginInterceptor: false, //是否打开强制登录
- // #ifdef H5 || MP-WEIXIN
- weichatInfo: {}, //保存微信注册信息
- weichatObj: '', //微信对象
- isShowIllegality:true,
- // #endif
- // #ifdef APP
- isShowIllegality:false,
- // #endif
- langList: [
- {
- value: 'en',
- label: 'English'
- },
- {
- value: 'cn',
- label: '简体中文'
- },
- {
- value: 'tw',
- label: '繁體中文'
- }
- ],
- lang:uni.getStorageSync('lang')||'cn',
- },
- mutations: {
- // #ifdef APP
- // 设置http
- setHttp(state, provider){
- state.baseURL = provider
- },
- // #endif
- //保存微信信息
- 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
- },
- // 修改显示隐藏ios审核不允许显示的功能
- changeState(state, provider){
- console.log(provider,'provider');
- state.isShowIllegality = provider;
- }
- },
- modules: {
- user
- },
- actions: {
- // 设置当前语言
- setLang({ commit }, data) {
- commit('LANG', data)
- // commit('VANTLANG', data)
- },
- }
- })
- export default store
|