GamePortrait/node_modules/.cache/babel-loader/7ebd72d7861503e026e835043bc5076bf503e0327e05e0fdc6e6320cf3b45e37.json

1 line
8.7 KiB
JSON

{"ast":null,"code":"import { ref, watch, nextTick, computed } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { Waybill, WaybillbigRoad, NNcanvas, ToningWaybill, DiceWaybill, RouletteWaybill } from \"@/assets/js/waybill.js\";\nexport default {\n components: {},\n props: {\n dutch: {\n type: Boolean,\n default: true\n },\n wayType: {\n type: String,\n default: \"allway\"\n },\n data: {\n type: Object,\n default: () => {}\n },\n index: {\n type: Number,\n default: 0\n },\n routerName: {\n type: String,\n default: \"allway\"\n }\n },\n setup(props) {\n const store = useStore();\n const refItem = ref(null);\n const Type = computed(() => store.state.config.$Type);\n const Lang = computed(() => store.state.config.$lang);\n const timeStamp = computed(() => store.state.config.timeStamp);\n const probability = computed(() => {\n const tabData = props.data;\n const totle = tabData.number_tab_number - 1;\n // console.log(tabData)\n let data = {};\n if (tabData.game_id == 1 || tabData.game_id == 2) {\n data.banker = totle ? parseInt(tabData.bankerCount / totle * 100) : 0;\n data.tie = totle ? parseInt(tabData.tieCount / totle * 100) : 0;\n data.palyer = totle ? parseInt(tabData.playerCount / totle * 100) : 0;\n data.bankerNum = data.banker;\n data.tieNum = data.tie;\n data.palyerNum = data.palyer;\n } else if (tabData.game_id == 4 || tabData.game_id == 5) {\n data.player1 = totle ? parseInt(tabData.player_1_count / totle * 100) : 0;\n data.player2 = totle ? parseInt(tabData.player_2_count / totle * 100) : 0;\n data.player3 = totle ? parseInt(tabData.player_3_count / totle * 100) : 0;\n data.player1Num = data.player1;\n data.player2Num = data.player2;\n data.player3Num = data.player3;\n } else if (tabData.game_id == 6) {\n try {\n data.zero_count = totle ? parseInt(tabData.count.zero_count / totle * 100) : 0;\n data.one_count = totle ? parseInt(tabData.count.one_count / totle * 100) : 0;\n data.two_count = totle ? parseInt(tabData.count.two_count / totle * 100) : 0;\n data.three_count = totle ? parseInt(tabData.count.three_count / totle * 100) : 0;\n data.four_count = totle ? parseInt(tabData.count.four_count / totle * 100) : 0;\n data.zeroNum = data.zero_count;\n data.oneNum = data.one_count;\n data.twoNum = data.two_count;\n data.threeNum = data.three_count;\n data.fourNum = data.four_count;\n } catch (err) {\n console.log(err);\n }\n } else if (tabData.game_id == 7) {\n try {\n data.big_count = totle ? parseInt(tabData.count.big_count / totle * 100) : 0;\n data.leopard_count = totle ? parseInt(tabData.count.leopard_count / totle * 100) : 0;\n data.small_count = totle ? parseInt(tabData.count.small_count / totle * 100) : 0;\n data.bigNum = data.big_count;\n data.leopardNum = data.leopard_count;\n data.smallNum = data.small_count;\n } catch (err) {\n console.log(err);\n }\n }\n if (data.player1 == 0 && data.player2 == 0 && data.player3 == 0) {\n data.player1 = 33;\n data.player2 = 33;\n data.player3 = 33;\n }\n if (data.banker == 0 && data.tie == 0 && data.palyer == 0) {\n data.banker = 33;\n data.tie = 33;\n data.palyer = 33;\n }\n if (data.big_count == 0 && data.leopard_count == 0 && data.small_count == 0) {\n data.big_count = 33;\n data.leopard_count = 33;\n data.small_count = 33;\n }\n if (data.zero_count == 0 && data.one_count == 0 && data.two_count == 0 && data.four_count == 0) {\n data.zero_count = 20;\n data.one_count = 20;\n data.two_count = 20;\n data.three_count = 20;\n data.four_count = 20;\n }\n return data;\n });\n watch(() => [props.data.ludan, props.wayType, timeStamp.value, Type.value], ([data, type]) => {\n const waybill = data?.waybill || {\n showRoad: [],\n bigRoad: [],\n bigEyeRoad: [],\n pathway: [],\n roach: [],\n sanxingRoad: [],\n bigRoadBS: [],\n bigRoadSP: []\n };\n const {\n showRoad = [],\n bigRoad = [],\n bigEyeRoad = [],\n pathway = [],\n roach = [],\n sanxingRoad = [],\n bigRoadBS = [],\n bigRoadSP = []\n } = waybill;\n let Ludan = [];\n if (props.data.game_id == 4 || props.data.game_id == 5) {\n Ludan = data || {\n waybill: []\n };\n } else {\n Ludan = {\n showRoad,\n bigRoad,\n bigEyeRoad,\n pathway,\n roach,\n sanxingRoad,\n bigRoadBS,\n bigRoadSP\n };\n }\n nextTick(() => {\n switch (type) {\n case \"bigway\":\n case \"allway\":\n resizeCanvas({\n game_id: props.data.game_id,\n ludan: Ludan\n }, refItem.value, type);\n break;\n case \"totle\":\n break;\n }\n });\n }, {\n immediate: true,\n deep: true\n });\n // 路单配置\n const resizeCanvas = (data, canvas, type) => {\n const getPixelRatio = context => {\n const backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1;\n return (window.devicePixelRatio || 1) / backingStore;\n };\n const ctb = canvas.getContext(\"2d\"),\n dpr = getPixelRatio(ctb),\n height = canvas.clientHeight,\n width = canvas.clientWidth;\n let rows, cols, unit, path;\n if (data.game_id == 1 || data.game_id == 2) {\n rows = 6;\n unit = parseInt(height / rows) * dpr;\n cols = parseInt(width / (unit / dpr));\n if (cols % 2 != 0) {\n cols = cols - 1;\n }\n path = false;\n var ask = false,\n askroad = false;\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n if (type == \"bigway\") {\n path = data.ludan?.bigRoad || [];\n WaybillbigRoad(ctb, unit, rows, cols, path, data.game_id, ask, askroad);\n } else {\n path = data.ludan;\n Waybill(ctb, unit, rows, cols, path, data.game_id, ask, askroad);\n }\n } else if (data.game_id == 4 || data.game_id == 5) {\n rows = 4;\n const unit_y = height / rows * dpr,\n unit_x = unit_y * 1.05;\n cols = parseInt(width / (unit_x / dpr));\n path = false;\n canvas.setAttribute(\"width\", unit_x * cols);\n canvas.setAttribute(\"height\", unit_y * rows);\n if (data.ludan.waybill) {\n path = data.ludan.waybill;\n }\n NNcanvas(data.game_id, ctb, unit_x, unit_y, rows, cols, path);\n } else if (data.game_id == 6) {\n rows = 6;\n unit = parseInt(height / rows) * dpr;\n cols = parseInt(width / (unit / dpr));\n if (cols % 2 != 0) {\n cols = cols - 1;\n }\n path = false;\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n path = data.ludan;\n let billnumber = 2,\n showBigWay = false;\n if (type == \"bigway\") {\n billnumber = 1;\n showBigWay = true;\n }\n path = data.ludan;\n ToningWaybill(ctb, unit, rows, cols, path, data.game_id, billnumber, showBigWay);\n } else if (data.game_id == 7) {\n rows = 6;\n const unit = height / rows * dpr,\n cols = parseInt(width / (unit / dpr));\n path = false;\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n if (data.ludan) {\n path = data.ludan;\n }\n DiceWaybill(ctb, unit, rows, cols, path);\n } else if (data.game_id == 8) {\n rows = 6;\n const unit = height / rows * dpr,\n cols = parseInt(width / (unit / dpr));\n path = false;\n canvas.setAttribute(\"width\", unit * cols);\n canvas.setAttribute(\"height\", unit * rows);\n if (data.ludan) {\n path = data.ludan;\n }\n RouletteWaybill(ctb, unit, rows, cols, path);\n }\n };\n return {\n Type,\n Lang,\n probability,\n refItem\n };\n }\n};","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}