mutations.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. export const mutations = {
  2. setScatter (state, scatter) {
  3. state.scatter = scatter
  4. },
  5. setEos (state, eosjs) {
  6. state.eos = eosjs
  7. },
  8. setAccount (state, account) {
  9. state.account = account
  10. },
  11. setToAccount (state, name) {
  12. state.toAccount = name
  13. },
  14. setBalance (state, balance) {
  15. state.balance = balance
  16. },
  17. setMoney (state, money) {
  18. state.money = money
  19. },
  20. setGt (state, gt) {
  21. state.gt = gt
  22. },
  23. setMainnet (state, mainnet) {
  24. state.mainnet = mainnet
  25. },
  26. setGTError (state, count) {
  27. state.gtErrorCount = count
  28. },
  29. setEOSError (state, count) {
  30. state.eosErrorCount = count
  31. },
  32. setPublicKey (state, string) {
  33. state.publicKey = string
  34. },
  35. setUserId (state, string) {
  36. state.userId = string
  37. },
  38. setToken (state, string) {
  39. state.token = string
  40. },
  41. changeSessionId (state, data) {
  42. state.curSession = data
  43. },
  44. setUserInfo (state, data) {
  45. state.userInfo = data
  46. },
  47. setUserUserName (state, data) {
  48. state.userInfo.user_name = data
  49. },
  50. setUserNickName (state, data) {
  51. state.userInfo.nick_name = data
  52. },
  53. updateUserPhoto (state, data) {
  54. state.userInfo.cover_photo = data
  55. },
  56. setLogining (state, isLogining) {
  57. state.isLogining = isLogining
  58. },
  59. setCopyText (state, data) {
  60. state.copyText = data
  61. },
  62. /**
  63. * @des 更新热门群组推荐加群状态
  64. * @param {Number} data.groupId 群id
  65. * @param {Number} data.isJoin {1:加入,0退出}
  66. */
  67. changeHotGroupStatus (state, data) {
  68. if (state.hotList.length <= 0) return
  69. let index = state.hotList.findIndex((item, index) => {
  70. return item.group_id == data.groupId
  71. })
  72. if (index > -1) {
  73. state.hotList[index].is_join = data.isJoin
  74. // 更新人数
  75. data.isJoin > 0 ? ++state.hotList[index].member_num : --state.hotList[index].member_num
  76. }
  77. }
  78. }