70429ca481d5c907efe998ddc34833db3ccb7721.svn-base 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. }
  27. /**
  28. * 实时监听state里面值的变法(最新变法)
  29. */
  30. const getters={
  31. getNoRoll(state){
  32. return state.noRoll
  33. },
  34. getGameRatio(state){
  35. return state.gameRatio;
  36. },
  37. getActivity(state){
  38. return state.activity;
  39. },
  40. getBallId(state){
  41. return state.ballId;
  42. },
  43. getShow(state){
  44. return state.show;
  45. },
  46. getIsShow(state){
  47. return state.isShow;
  48. },
  49. getRgShow(state){
  50. return state.rgShow;
  51. },
  52. getMatchId(state){
  53. return state.macth_id;
  54. },
  55. getBetting(state){
  56. return state.betting;
  57. },
  58. getIsBetting(state){
  59. return state.isBetting;
  60. },
  61. getDeleteType(state){
  62. return state.deleteType;
  63. },
  64. getToken(state){
  65. return state.token;
  66. },
  67. getLimit(state){
  68. return state.limit;
  69. },
  70. getHeadTitle(state){
  71. return state.headTitle;
  72. },
  73. getPlayAlias(state){
  74. return state.playAlias;
  75. },
  76. getHomeRollBall(state){
  77. return state.homeRollBall;
  78. },
  79. getLimitingCond(state){
  80. state.limitingCond
  81. },
  82. }
  83. /**
  84. * 设置对外可调用的方法
  85. */
  86. const mutations = {
  87. newNoRoll(state,val){
  88. state.noRoll = val
  89. },
  90. newGameRatio(state,val){
  91. //publicFun.getCache('activity')
  92. state.gameRatio = val;
  93. },
  94. newActivity(state,val){
  95. state.activity = val;
  96. publicFun.setItem('activity',val)
  97. },
  98. newBallId(state,val){
  99. state.ballId = val;
  100. publicFun.setItem('ballId',val)
  101. },
  102. newShow(state,val){
  103. state.show = val;
  104. },
  105. newisShow(state,val){
  106. state.isShow = val;
  107. },
  108. newRgShow(state,val){
  109. state.rgShow = val;
  110. },
  111. newMacth_id(state,val){
  112. state.macth_id = val;
  113. publicFun.setItem('macth_id',val);
  114. },
  115. newBetting(state,val){
  116. let index =0;
  117. if(val){
  118. val.forEach(e=> {
  119. index += e.data.length
  120. });
  121. }
  122. state.betting = val;
  123. publicFun.setItem('betting',val);
  124. state.limit =index;
  125. publicFun.setItem('limit',index);
  126. },
  127. newIsBetting(state,val){
  128. state.isBetting = val;
  129. publicFun.setItem('isBetting',val);
  130. },
  131. newToken(state,val){
  132. state.token = val;
  133. publicFun.setItem('token',val);
  134. },
  135. newDeleteType(state,val){
  136. state.deleteType = val;
  137. },
  138. newLimit(state,val){
  139. state.limit = val;
  140. publicFun.setItem('limit',val);
  141. },
  142. newHeadTitle(state,val){
  143. state.headTitle = val;
  144. publicFun.setItem('headTitle',val);
  145. },
  146. newPlayAlias(state,val){
  147. state.playAlias = val;
  148. publicFun.setItem('playAlias',val);
  149. },
  150. newHomeRollBall(state,val){
  151. state.homeRollBall = val;
  152. },
  153. newLimitingCond(state,val){
  154. state.limitingCond = val;
  155. // console.log(val);
  156. publicFun.setItem('limitingCond',val)
  157. },
  158. }
  159. /**
  160. * 这里面的方法是用来异步触发mutations里面的方法
  161. */
  162. const actions={
  163. GETGAMERATIO(context,val){
  164. context.commit('newGameRatio',val)
  165. },
  166. GETACTIVITY(context,val){
  167. context.commit('newActivity',val);
  168. },
  169. GET_BALL_ID(context,val){
  170. context.commit('newBallId',val);
  171. },
  172. GETSHOW(context,val){
  173. context.commit('newShow',val)
  174. },
  175. GET_ISSHOW(context,val){
  176. context.commit('newisShow',val)
  177. },
  178. GETRGSHOW(context,val){
  179. context.commit('newRgShow',val)
  180. },
  181. MACTH_ID(context,val){
  182. context.commit('newMacth_id',val)
  183. },
  184. BETTING(context,val){
  185. context.commit('newBetting',val)
  186. },
  187. ISBETTING(context,val){
  188. context.commit('newIsBetting',val)
  189. },
  190. DEL_TYPE(context,val){
  191. context.commit('newDeleteType',val)
  192. },
  193. SET_TOKEN(context,val){
  194. context.commit('newToken',val)
  195. },
  196. SET_LIMIT(context,val){
  197. context.commit('newLimit',val)
  198. },
  199. SET_HEADTITLE(context,val){
  200. context.commit('newHeadTitle',val)
  201. },
  202. SET_NOROLL(context,val){
  203. context.commit('newNoRoll',val)
  204. },
  205. SET_PLAYALIAS(context,val){
  206. context.commit('newPlayAlias',val)
  207. },
  208. SET_HOMEROLLBALL(context,val){
  209. context.commit('newHomeRollBall',val)
  210. },
  211. SET_LIMITINGCOND(context,val){
  212. context.commit('newLimitingCond',val)
  213. },
  214. }
  215. const store =new Vuex.Store({
  216. state,
  217. getters,
  218. mutations,
  219. actions
  220. });
  221. export default store;