OperationContainer.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import React from "react";
  2. import {connect} from "react-redux";
  3. import Operation from "../components/Operation";
  4. import {
  5. SHOW_PRINT_PREVIEW,
  6. CLOSE_PRINT_PREVIEW,
  7. SHOW_PREVIEW,
  8. CLOSE_PREVIEW,
  9. DIAG_SHOW
  10. } from "../store/types/print";
  11. import {saveMessage,clearMessages} from "../store/async-actions/print";
  12. import {saveTemplateDetail} from '@store/async-actions/tabTemplate';
  13. import {saveClickNum} from '@store/async-actions/homePage';
  14. // function mapStateToProps({print}) {
  15. function mapStateToProps(state) {
  16. const {print,homePage} = state;
  17. return ({
  18. print,
  19. winWidth:homePage.windowWidth
  20. });
  21. }
  22. function mapDispatchToProps(dispatch) {
  23. return {
  24. showPrintPreview: () => {
  25. dispatch({
  26. type: SHOW_PRINT_PREVIEW
  27. });
  28. },
  29. closePrintPreview: () => {
  30. dispatch({
  31. type: CLOSE_PRINT_PREVIEW
  32. });
  33. },
  34. showPreview: () => {
  35. dispatch({
  36. type: SHOW_PREVIEW
  37. });
  38. },
  39. closePreview: () => {
  40. dispatch({
  41. type: CLOSE_PREVIEW
  42. });
  43. },
  44. save: () => {
  45. dispatch(saveClickNum);
  46. dispatch(() => saveMessage())
  47. },
  48. clear: () => {
  49. clearMessages()
  50. },
  51. saveDataAll(val){
  52. dispatch(saveTemplateDetail(val))
  53. },
  54. diagShowTmp(bool){
  55. dispatch({
  56. type: DIAG_SHOW,
  57. data:bool
  58. });
  59. }
  60. };
  61. }
  62. const OperationComtainer = connect(
  63. mapStateToProps,
  64. mapDispatchToProps
  65. )(Operation);
  66. export default OperationComtainer;