aa4d15152d35b48a365495b5210c1cdcd34be9d5.svn-base 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import publicFun from '@/assets/publicFunction';
  4. Vue.use(Vuex);
  5. /**
  6. * 设置全局访问的state对象
  7. */
  8. const state={
  9. gameRatio:'', //玩法比率数据
  10. activity:publicFun.getItem('activity'),//活动类别
  11. ballId:publicFun.getItem('ballId'),//球类Id
  12. show:'',//Loading组件的状态显隐
  13. isShow:false,//登录按钮点击显示登录页
  14. rgShow:false,//注册组件显示
  15. macth_id:publicFun.getItem('macth_id'),//赛事id
  16. betting:JSON.parse(publicFun.getItem('betting')),//投注数据
  17. isBetting:publicFun.getItem('isBetting'),//是否展示投注窗口
  18. deleteType:'',//投注框数据删除id或类型
  19. token:'',//用户凭证
  20. limit:publicFun.getItem('limit'),//限制投注窗投注数量
  21. headTitle:JSON.parse(publicFun.getItem('headTitle')),//头部导航数据信息
  22. noRoll:false,// 禁止背景滚动
  23. playAlias:JSON.parse(publicFun.getItem('playAlias')),//玩法别名
  24. homeRollBall:'',//首页滚球数据
  25. limitingCond:{},//下注上下限条件 "lower_limit": 10,"upper_limit": 10000
  26. messageDetail:JSON.parse(publicFun.getItem('messageDetail'))
  27. }
  28. /**
  29. * 实时监听state里面值的变法(最新变法)
  30. */
  31. const getters={
  32. getNoRoll(state){
  33. return state.noRoll
  34. },
  35. getGameRatio(state){
  36. return state.gameRatio;
  37. },
  38. getActivity(state){
  39. return state.activity;
  40. },
  41. getBallId(state){
  42. return state.ballId;
  43. },
  44. getShow(state){
  45. return state.show;
  46. },
  47. getIsShow(state){
  48. return state.isShow;
  49. },
  50. getRgShow(state){
  51. return state.rgShow;
  52. },
  53. getMatchId(state){
  54. return state.macth_id;
  55. },
  56. getBetting(state){
  57. return state.betting;
  58. },
  59. getIsBetting(state){
  60. return state.isBetting;
  61. },
  62. getDeleteType(state){
  63. return state.deleteType;
  64. },
  65. getToken(state){
  66. return state.token;
  67. },
  68. getLimit(state){
  69. return state.limit;
  70. },
  71. getHeadTitle(state){
  72. return state.headTitle;
  73. },
  74. getPlayAlias(state){
  75. return state.playAlias;
  76. },
  77. getHomeRollBall(state){
  78. return state.homeRollBall;
  79. },
  80. getLimitingCond(state){
  81. state.limitingCond
  82. },
  83. getMessageDetail(state){
  84. return state.messageDetail
  85. }
  86. }
  87. /**
  88. * 设置对外可调用的方法
  89. */
  90. const mutations = {
  91. newNoRoll(state,val){
  92. state.noRoll = val
  93. },
  94. newGameRatio(state,val){
  95. //publicFun.getCache('activity')
  96. state.gameRatio = val;
  97. },
  98. newActivity(state,val){
  99. state.activity = val;
  100. publicFun.setItem('activity',val)
  101. },
  102. newBallId(state,val){
  103. state.ballId = val;
  104. publicFun.setItem('ballId',val)
  105. },
  106. newShow(state,val){
  107. state.show = val;
  108. },
  109. newisShow(state,val){
  110. state.isShow = val;
  111. },
  112. newRgShow(state,val){
  113. state.rgShow = val;
  114. },
  115. newMacth_id(state,val){
  116. state.macth_id = val;
  117. publicFun.setItem('macth_id',val);
  118. },
  119. newBetting(state,val){
  120. let index =0;
  121. if(val){
  122. val.forEach(e=> {
  123. index += e.data.length
  124. });
  125. }
  126. state.betting = val;
  127. publicFun.setItem('betting',val);
  128. state.limit =index;
  129. publicFun.setItem('limit',index);
  130. },
  131. newIsBetting(state,val){
  132. state.isBetting = val;
  133. publicFun.setItem('isBetting',val);
  134. },
  135. newToken(state,val){
  136. state.token = val;
  137. publicFun.setItem('token',val);
  138. },
  139. newDeleteType(state,val){
  140. state.deleteType = val;
  141. },
  142. newLimit(state,val){
  143. state.limit = val;
  144. publicFun.setItem('limit',val);
  145. },
  146. newHeadTitle(state,val){
  147. state.headTitle = val;
  148. publicFun.setItem('headTitle',val);
  149. },
  150. newPlayAlias(state,val){
  151. state.playAlias = val;
  152. publicFun.setItem('playAlias',val);
  153. },
  154. newHomeRollBall(state,val){
  155. state.homeRollBall = val;
  156. },
  157. newLimitingCond(state,val){
  158. state.limitingCond = val;
  159. // console.log(val);
  160. publicFun.setItem('limitingCond',val)
  161. },
  162. newMessageDetail(state,val){
  163. state.messageDetail = val;
  164. publicFun.setItem('messageDetail',val)
  165. },
  166. }
  167. /**
  168. * 这里面的方法是用来异步触发mutations里面的方法
  169. */
  170. const actions={
  171. GETGAMERATIO(context,val){
  172. context.commit('newGameRatio',val)
  173. },
  174. GETACTIVITY(context,val){
  175. context.commit('newActivity',val);
  176. },
  177. GET_BALL_ID(context,val){
  178. context.commit('newBallId',val);
  179. },
  180. GETSHOW(context,val){
  181. context.commit('newShow',val)
  182. },
  183. GET_ISSHOW(context,val){
  184. context.commit('newisShow',val)
  185. },
  186. GETRGSHOW(context,val){
  187. context.commit('newRgShow',val)
  188. },
  189. MACTH_ID(context,val){
  190. context.commit('newMacth_id',val)
  191. },
  192. BETTING(context,val){
  193. context.commit('newBetting',val)
  194. },
  195. ISBETTING(context,val){
  196. context.commit('newIsBetting',val)
  197. },
  198. DEL_TYPE(context,val){
  199. context.commit('newDeleteType',val)
  200. },
  201. SET_TOKEN(context,val){
  202. context.commit('newToken',val)
  203. },
  204. SET_LIMIT(context,val){
  205. context.commit('newLimit',val)
  206. },
  207. SET_HEADTITLE(context,val){
  208. context.commit('newHeadTitle',val)
  209. },
  210. SET_NOROLL(context,val){
  211. context.commit('newNoRoll',val)
  212. },
  213. SET_PLAYALIAS(context,val){
  214. context.commit('newPlayAlias',val)
  215. },
  216. SET_HOMEROLLBALL(context,val){
  217. context.commit('newHomeRollBall',val)
  218. },
  219. SET_LIMITINGCOND(context,val){
  220. context.commit('newLimitingCond',val)
  221. },
  222. SET_MESSAGEDETAIl(context,val){
  223. context.commit('newMessageDetail',val)
  224. }
  225. }
  226. const store =new Vuex.Store({
  227. state,
  228. getters,
  229. mutations,
  230. actions
  231. });
  232. export default store;