copyRight.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import {get, post, json} from "@utils/ajax";
  2. import {GET_COPY_MESSAGE, GET_DISCLAIMER_MESSAGE, GET_VERSION} from "../types/copyRight";
  3. import { storageLocal } from "@utils/tools"
  4. export const getMessage = (dispatch, getState) => {
  5. const state = getState();
  6. // 请求地址
  7. post('/versionInfo/getVersionInfoAlls')
  8. .then((data) => {
  9. const versionInfo = JSON.parse(storageLocal.get('versionInfo'));
  10. if(versionInfo) {
  11. if(versionInfo.data.data.name !== data.data.data.name) {
  12. storageLocal.set('hasNewVersion','true');
  13. storageLocal.set('versionInfo',data);
  14. dispatch({
  15. type: GET_VERSION,
  16. hasNewVersion: true
  17. })
  18. }
  19. } else {
  20. storageLocal.set('hasNewVersion','true');
  21. storageLocal.set('versionInfo',data);
  22. }
  23. dispatch({
  24. type: GET_COPY_MESSAGE,
  25. data:data
  26. });
  27. })
  28. };
  29. export const getDisMessage = (dispatch, getState) => {
  30. const state = getState();
  31. // 请求地址
  32. post('/disclaimerInformation/getDisclaimerInformations')
  33. .then((data) => {
  34. dispatch({
  35. type: GET_DISCLAIMER_MESSAGE,
  36. data:data
  37. });
  38. })
  39. };