index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. Vue.use(Vuex)
  4. const store = new Vuex.Store({
  5. state: {
  6. picTitle:"",
  7. hasLogin: false,
  8. userInfo: {},
  9. myConfList:[],
  10. leavelist:[],
  11. vest:{},
  12. bagNote:"",
  13. alreadysublist:[],
  14. allwords:[],
  15. seleImage:[],
  16. // config:[
  17. // {
  18. // confAlias: "DNS_URl",
  19. // confNote: "oss图片访问前缀",
  20. // confNum: "https://cdn.pailiying.com/",
  21. // },
  22. // {
  23. // confAlias: "ANIMATION_IMG_ONE",
  24. // confNote: "动画图1",
  25. // confNum: "https://cdn.pailiying.com/confResource/animation_img_one_202105251328.gif",
  26. // },
  27. // {
  28. // confAlias: "ANIMATION_IMG_TWO",
  29. // confNote: "动画图2",
  30. // confNum: "https://cdn.pailiying.com/confResource/animation_img_two_202105261605.gif"
  31. // },
  32. // {
  33. // confAlias: "BUBBLE_IMG_LIST",
  34. // confNote: "点赞气泡配置图集合",
  35. // confNum: "https://cdn.pailiying.com/confResource/2021_05_27_16_34_1拍.png,https://cdn.pailiying.com/confResource/2021_05_27_16_34_2立.png,https://cdn.pailiying.com/confResource/2021_05_27_16_34_3映.png,https://cdn.pailiying.com/confResource/2021_05_27_16_34_4照.png,https://cdn.pailiying.com/confResource/2021_05_27_16_34_5片.png,https://cdn.pailiying.com/confResource/2021_05_27_16_34_6直.png,https://cdn.pailiying.com/confResource/2021_05_27_16_34_7播.png"
  36. // }]
  37. config:[]
  38. },
  39. mutations: {
  40. setconfig(state, provider){
  41. state.picTitle = provider.find((i)=>{return i.confAlias=='DNS_URl'}).confNum
  42. uni.setStorageSync('h5_address', provider.find((i)=>{return i.confAlias=='H5_URL'}).confNum)
  43. state.config = provider
  44. },
  45. clearImage(state, provider){
  46. state.seleImage = []
  47. },
  48. changseleImage(state, provider){
  49. if(provider.key=="add"){
  50. state.seleImage.push(provider.item)
  51. }else{
  52. state.seleImage.splice(provider.item,1)
  53. }
  54. },
  55. setallwords(state, provider){
  56. state.allwords = provider;
  57. },
  58. deletesublist(state, provider){
  59. let idx = state.alreadysublist.findIndex((i)=>{return i.id == provider.id})
  60. state.alreadysublist.splice(idx,1)
  61. },
  62. setsublist(state, provider){
  63. if(provider){
  64. let idx = state.alreadysublist.findIndex((i)=>{return i.id == provider.id})
  65. if(idx!=-1){
  66. state.alreadysublist[idx] = provider
  67. }else{
  68. state.alreadysublist.push(provider);
  69. }
  70. }else{
  71. state.alreadysublist = []
  72. }
  73. },
  74. deleteSublist(state, index){
  75. state.alreadysublist.splice(index, 1);
  76. },
  77. setbagNote(state, provider){
  78. state.bagNote = provider;
  79. },
  80. setleavelist(state, provider){
  81. state.leavelist = provider;
  82. },
  83. setmyConfList(state, provider){
  84. state.myConfList = provider;
  85. },
  86. login(state, provider) {
  87. if(provider=="" || !provider){
  88. state.hasLogin = false;
  89. return;
  90. }
  91. state.hasLogin = true;
  92. state.userInfo = provider;
  93. uni.setStorage({//缓存用户登陆状态
  94. key: 'userInfo',
  95. data: provider
  96. })
  97. //uni.setStorageSync('userInfo', provider);
  98. },
  99. acylogin(state, provider){
  100. if(provider=="" || !provider){
  101. state.hasLogin = false;
  102. return;
  103. }
  104. state.hasLogin = true;
  105. state.userInfo = provider;
  106. // uni.setStorage({//缓存用户登录状态
  107. // key: 'userInfo',
  108. // data: provider
  109. // })
  110. uni.setStorageSync('userInfo', provider);
  111. },
  112. logout(state) {
  113. state.hasLogin = false;
  114. state.userInfo = {};
  115. uni.removeStorageSync("userInfo")
  116. // uni.removeStorage({
  117. // key: 'userInfo'
  118. // })
  119. },
  120. setVest(state, provider){
  121. state.vest = provider;
  122. },
  123. },
  124. actions: {
  125. }
  126. })
  127. export default store