You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.6 KiB

3 years ago
  1. var iterationKey='xm-iteration-store';
  2. var productKey='xm-product-store';
  3. var projectKey='xm-project-info-store';
  4. var testCasedbKey='xm-test-casedb-store';
  5. const xm = {
  6. state: {
  7. xmIteration: null,
  8. xmProduct:null,
  9. projectInfo:null,
  10. testCasedb:null,
  11. },
  12. mutations: {
  13. SET_XM_ITERATION: (state, xmIteration) => {
  14. state.xmIteration=xmIteration
  15. if(xmIteration && xmIteration!='null' && xmIteration!='undefined' ){
  16. sessionStorage.setItem(iterationKey,JSON.stringify(xmIteration))
  17. }else{
  18. sessionStorage.removeItem(iterationKey)
  19. }
  20. },
  21. SET_XM_PRODUCT: (state, xmProduct) => {
  22. state.xmProduct=xmProduct
  23. if(xmProduct && xmProduct!='null' && xmProduct!='undefined' ){
  24. sessionStorage.setItem(productKey,JSON.stringify(xmProduct))
  25. }else{
  26. sessionStorage.removeItem(productKey)
  27. }
  28. },
  29. SET_PROJECT_INFO: (state, projectInfo) => {
  30. state.projectInfo=projectInfo
  31. if(projectInfo && projectInfo!='null' && projectInfo!='undefined' ){
  32. sessionStorage.setItem(projectKey,JSON.stringify(projectInfo))
  33. }else{
  34. sessionStorage.removeItem(projectKey)
  35. }
  36. },
  37. SET_TEST_CASEDB: (state, testCasedb) => {
  38. state.testCasedb=testCasedb
  39. if(testCasedb && testCasedb!='null' && testCasedb!='undefined' ){
  40. sessionStorage.setItem(testCasedbKey,JSON.stringify(testCasedb))
  41. }else{
  42. sessionStorage.removeItem(testCasedbKey)
  43. }
  44. },
  45. },
  46. actions: {
  47. setXmIteration({ commit }, xmIteration) {
  48. commit('SET_XM_ITERATION', xmIteration)
  49. },
  50. setXmProduct({ commit }, xmProduct) {
  51. commit('SET_XM_PRODUCT', xmProduct)
  52. },
  53. setProjectInfo({ commit }, projectInfo) {
  54. commit('SET_PROJECT_INFO', projectInfo)
  55. },
  56. setTestCasedb({ commit }, testCasedb) {
  57. commit('SET_TEST_CASEDB', testCasedb)
  58. }
  59. }
  60. }
  61. var iterationStr=sessionStorage.getItem(iterationKey)
  62. if(iterationStr && iterationStr!='null' && iterationStr!='undefined' ){
  63. xm.state.xmIteration=JSON.parse(iterationStr)
  64. }
  65. var xmProductStr=sessionStorage.getItem(productKey)
  66. if(xmProductStr && xmProductStr!='null' && xmProductStr!='undefined' ){
  67. xm.state.xmProduct=JSON.parse(xmProductStr)
  68. }
  69. var projectStr=sessionStorage.getItem(projectKey)
  70. if(projectStr && projectStr!='null' && projectStr!='undefined' ){
  71. xm.state.projectInfo=JSON.parse(projectStr)
  72. }
  73. var testCasedbStr=sessionStorage.getItem(testCasedbKey)
  74. if(testCasedbStr && testCasedbStr!='null' && testCasedbStr!='undefined' ){
  75. xm.state.testCasedb=JSON.parse(testCasedbStr)
  76. }
  77. export default xm