index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. import user from './model/user'
  4. import i18n from '../libs/i18n/index.js'
  5. Vue.use(Vuex)
  6. const store = new Vuex.Store({
  7. state: {
  8. // #ifdef H5
  9. baseURL:window.location.protocol + "//" + window.location.host,//请求地址配置
  10. // #endif
  11. // #ifndef H5
  12. baseURL: 'http://www.polkep.xyz', //正式地址配置
  13. // #endif
  14. urlFile: '/index', //项目部署所在文件夹
  15. loginInterceptor: false, //是否打开强制登录
  16. // #ifdef H5 || MP-WEIXIN
  17. weichatInfo: {}, //保存微信注册信息
  18. weichatObj: '', //微信对象
  19. isShowIllegality:true,
  20. // #endif
  21. // #ifdef APP
  22. isShowIllegality:false,
  23. // #endif
  24. langList: [
  25. {
  26. value: 'en',
  27. label: 'English'
  28. },
  29. {
  30. value: 'cn',
  31. label: '简体中文'
  32. },
  33. {
  34. value: 'tw',
  35. label: '繁體中文'
  36. }
  37. ],
  38. lang:uni.getStorageSync('lang')||'cn',
  39. },
  40. mutations: {
  41. //保存微信信息
  42. setWeiChatInfo(state, provider) {
  43. state.weichatInfo = provider;
  44. },
  45. //保存微信对象
  46. setWeiChatObj(state, provider) {
  47. state.weichatObj = provider;
  48. },
  49. LANG(state, data) {
  50. uni.setStorageSync('lang', data)
  51. i18n.locale = data
  52. state.lang = data
  53. },
  54. // 修改显示隐藏ios审核不允许显示的功能
  55. changeState(state, provider){
  56. console.log(provider,'provider');
  57. state.isShowIllegality = provider;
  58. }
  59. },
  60. modules: {
  61. user
  62. },
  63. actions: {
  64. // 设置当前语言
  65. setLang({ commit }, data) {
  66. commit('LANG', data)
  67. // commit('VANTLANG', data)
  68. },
  69. }
  70. })
  71. export default store