6c7c27c7be2ad1f5fced012402dfeb270ad7c048.svn-base 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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: 'StMorningPlate', //publicFun.getItem('activity'),//活动类别
  11. ball_code: 'zq', //publicFun.getItem('ballId'),//球类代码
  12. paly_code: 'CO', //玩法代码默认早盘玩法concede_size
  13. controlRouting:'',//控制路由
  14. loading:'',//Loading组件的状态显隐
  15. // isShow:false,//登录按钮点击显示登录页
  16. rgShow:false,//注册组件显示
  17. macth_id: '', //publicFun.getItem('macth_id'),//赛事id
  18. betting:[],//JSON.parse(publicFun.getItem('betting')),//投注数据
  19. passBetting:'',//串式投注数据
  20. bettingType:1,// 1为单式、2为串式
  21. leagueChoose:'',//联赛赛事选择
  22. leagueData:[],//联赛数据
  23. // isBetting:publicFun.getItem('isBetting'),//是否展示投注窗口
  24. deleteType:'',//投注框数据删除id或类型
  25. token:'', //用户凭证
  26. limit:0,//限制投注窗投注数量
  27. passLimit:'',//限制投注窗投注数量
  28. // headTitle:JSON.parse(publicFun.getItem('headTitle')),//头部导航数据信息
  29. // noRoll:false, // 禁止背景滚动
  30. playAlias:'',//玩法别名
  31. }
  32. /**
  33. * 实时监听state里面值的变法(最新变法)
  34. */
  35. const getters = {
  36. getGameRatio(state){
  37. return state.gameRatio;
  38. },
  39. getActivity(state) {
  40. return state.activity;
  41. },
  42. getBallCode(state) {
  43. return state.ball_code;
  44. },
  45. getPaly_code(state) {
  46. return state.paly_code;
  47. },
  48. getControlRouting(state) {
  49. return state.controlRouting;
  50. },
  51. getLoading(state){
  52. return state.loading;
  53. },
  54. // getIsShow(state){
  55. // return state.isShow;
  56. // },
  57. getRgShow(state){
  58. return state.rgShow;
  59. },
  60. getMatchId(state){
  61. return state.macth_id;
  62. },
  63. getBetting(state){
  64. return state.betting;
  65. },
  66. getPassBetting(state){
  67. return state.passBetting == '' ? JSON.parse(publicFun.getItem('passBetting')) : state.passBetting;
  68. },
  69. getBettingType(state){
  70. return state.bettingType;
  71. },
  72. getLeagueChoose(state){
  73. return state.leagueChoose;
  74. },
  75. getLeagueData(state){
  76. return state.leagueData;
  77. },
  78. // getIsBetting(state){
  79. // return state.isBetting;
  80. // },
  81. getDeleteType(state){
  82. return state.deleteType;
  83. },
  84. getToken(state) {
  85. return state.token;
  86. },
  87. getLimit(state){
  88. return state.limit;
  89. },
  90. getPassLimit(state){
  91. return state.passLimit =='' ? publicFun.getItem('passLimit') :state.passLimit;
  92. },
  93. // getHeadTitle(state){
  94. // return state.headTitle;
  95. // },
  96. // getNoRoll(state){
  97. // return state.noRoll
  98. // },
  99. getPlayAlias(state){
  100. return state.playAlias == '' ? JSON.parse(publicFun.getItem('playAlias')) : state.playAlias;
  101. },
  102. }
  103. /**
  104. * 设置对外可调用的方法
  105. */
  106. const mutations = {
  107. newGameRatio(state,val){
  108. //publicFun.getCache('activity')
  109. state.gameRatio = val;
  110. },
  111. newActivity(state, val) {
  112. state.activity = val;
  113. //publicFun.setItem('activity',val)
  114. },
  115. newBallCode(state, val) {
  116. state.ball_code = val;
  117. //publicFun.setItem('ballId',val)
  118. },
  119. newPaly_code(state, val) {
  120. state.paly_code = val;
  121. },
  122. newControlRouting(state, val) {
  123. state.controlRouting = val;
  124. },
  125. newLoading(state,val){
  126. state.loading = val;
  127. },
  128. // newisShow(state,val){
  129. // state.isShow = val;
  130. // },
  131. newRgShow(state,val){
  132. state.rgShow = val;
  133. },
  134. newMacth_id(state,val){
  135. state.macth_id = val;
  136. // publicFun.setItem('macth_id',val);
  137. },
  138. newBetting(state,val){
  139. let index =0;
  140. if(val){
  141. val.forEach(e=> {
  142. index += e.data.length
  143. });
  144. }
  145. state.betting = val;
  146. state.limit =index;
  147. },
  148. newPassBetting(state,val){
  149. let index =0;
  150. if(val){
  151. val.forEach(e=> {
  152. index += e.data.length
  153. });
  154. }
  155. state.passBetting = val;
  156. publicFun.setItem('passBetting',val);
  157. state.passLimit =index;
  158. publicFun.setItem('passLimit',index);
  159. },
  160. newBettingType(state,val){
  161. state.bettingType = val;
  162. },
  163. newLeagueChoose(state,val){
  164. state.leagueChoose = val;
  165. },
  166. newLeagueData(state,val){
  167. state.leagueData = val;
  168. },
  169. // newIsBetting(state,val){
  170. // state.isBetting = val;
  171. // publicFun.setItem('isBetting',val);
  172. // },
  173. newToken(state, val) {
  174. state.token = val;
  175. publicFun.setItem('token', val);
  176. },
  177. newDeleteType(state,val){
  178. state.deleteType = val;
  179. },
  180. // newLimit(state,val){
  181. // state.limit = val;
  182. // publicFun.setItem('limit',val);
  183. // },
  184. newPassLimit(state,val){
  185. state.limit = val;
  186. publicFun.setItem('passLimit',val);
  187. },
  188. // newHeadTitle(state,val){
  189. // state.headTitle = val;
  190. // publicFun.setItem('ehadTitle',val);
  191. // },
  192. // newNoRoll(state,val){
  193. // state.noRoll = val
  194. // },
  195. newPlayAlias(state,val){
  196. state.playAlias = val;
  197. publicFun.setItem('playAlias',val);
  198. },
  199. }
  200. /**
  201. * 这里面的方法是用来异步触发mutations里面的方法
  202. */
  203. const actions = {
  204. SETACTIVITY(context, val) {
  205. context.commit('newActivity', val);
  206. },
  207. SET_BALL_CODE(context, val) {
  208. context.commit('newBallCode', val);
  209. },
  210. SET_PALY_CODE(context, val) {
  211. context.commit('newPaly_code', val);
  212. },
  213. SET_CONTROLROUTING(context, val) {
  214. context.commit('newControlRouting', val);
  215. },
  216. GETLOADING(context,val){
  217. context.commit('newLoading',val)
  218. },
  219. // GET_ISSHOW(context,val){
  220. // context.commit('newisShow',val)
  221. // },
  222. GETRGSHOW(context,val){
  223. context.commit('newRgShow',val)
  224. },
  225. MACTH_ID(context,val){
  226. context.commit('newMacth_id',val)
  227. },
  228. SET_BETTING(context,val){
  229. context.commit('newBetting',val)
  230. },
  231. SET_PASSBETTING(context,val){
  232. context.commit('newPassBetting',val)
  233. },
  234. SET_BETTINGTYPE(context,val){
  235. context.commit('newBettingType',val)
  236. },
  237. SET_LEAGUECHOOSE(context,val){
  238. context.commit('newLeagueChoose',val)
  239. },
  240. SET_LEAGUEDATA(context,val){
  241. context.commit('newLeagueData',val)
  242. },
  243. // ISBETTING(context,val){
  244. // context.commit('newIsBetting',val)
  245. // },
  246. DEL_TYPE(context,val){
  247. context.commit('newDeleteType',val)
  248. },
  249. SET_TOKEN(context, val) {
  250. context.commit('newToken', val)
  251. },
  252. // SET_LIMIT(context,val){
  253. // context.commit('newLimit',val)
  254. // },
  255. SET_PASSLIMIT(context,val){
  256. context.commit('newPassLimit',val)
  257. },
  258. // SET_HEADTITLE(context,val){
  259. // context.commit('newHeadTitle',val)
  260. // },
  261. // SET_NOROLL(context,val){
  262. // context.commit('newNoRoll',val)
  263. // },
  264. GETGAMERATIO(context,val){
  265. context.commit('newGameRatio',val)
  266. },
  267. SET_PLAYALIAS(context,val){
  268. context.commit('newPlayAlias',val)
  269. },
  270. }
  271. const store = new Vuex.Store({
  272. state,
  273. getters,
  274. mutations,
  275. actions
  276. });
  277. export default store;