1 line
11 KiB
JSON
1 line
11 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\nimport { computed, ref, watch, nextTick } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useRouter } from \"vue-router\";\nimport { requestFullScreen, showfloatBtn } from \"./plugins/fox.config\";\nimport NoSleep from \"@/assets/js/NoSleep.js\";\nimport aPlayer from \"@/components/aPlayer\";\nimport Record from \"@/components/Record\";\nimport { showToast, showSuccessToast } from \"vant\";\nexport default {\n components: {\n aPlayer,\n Record\n },\n setup() {\n const showChipPop = ref(false);\n const langselect = ref(false);\n const store = useStore();\n const router = useRouter();\n const settingMenu = [{\n key: \"chips\",\n name: \"筹码设置\"\n }, {\n key: \"set\",\n name: \"系统设置\"\n }, {\n key: \"record\",\n name: \"投注记录\"\n }, {\n key: \"help\",\n name: \"帮助\"\n }];\n const langList = {\n en: \"English\",\n tw: \"繁體中文\",\n cn: \"简体中文\",\n yn: \"Việt nam\",\n kr: \"한국어\",\n tl: \"แบบไทย\",\n in: \"Indonesia\"\n };\n const switchSound = ref(true);\n const switchVideo = ref(true);\n const musicVal = computed(() => store.state.config.musicVolume);\n const effectsVal = computed(() => store.state.config.effectsVolume);\n const otherChipVal = computed(() => store.state.config.showOtherChip);\n const musicVolume = ref(musicVal.value);\n const effectsVolume = ref(effectsVal.value);\n const showOtherChip = ref(otherChipVal.value);\n const userInfo = computed(() => store.state.app.userInfo);\n const Type = computed(() => store.state.config.$Type);\n const Lang = computed(() => store.state.config.$lang);\n const showMenu = computed(() => store.state.config.showMenu);\n const chipArry = computed(() => store.state.config.chipArry);\n const fullScreen = computed(() => store.state.config.fullScreen);\n const showAplayer = computed(() => store.state.config.showAplayer);\n const showSetFree = computed(() => store.state.config.showSetFree);\n const baccaratType = computed(() => store.state.config.baccaratType);\n const showTableInfo = computed(() => store.state.config.showTableInfo);\n const showShare = computed(() => store.state.config.showShare);\n const showBaccaratPlayType = computed(() => store.state.config.showBaccaratPlayType);\n const showOnLine = computed(() => store.state.config.showOnLine);\n const showRecord = computed(() => store.state.config.showRecord);\n const showSystem = computed(() => store.state.config.showSystem);\n const volume = computed(() => store.state.config.volume);\n const toggleAplayer = () => {\n store.commit(\"config/showAplayer\");\n };\n const closeMenu = () => {\n store.commit(\"config/showMenu\", false);\n store.commit(\"config/showTableInfo\", false);\n };\n const chooseMenu = type => {\n switch (type) {\n case \"chips\":\n toggleChipPop();\n break;\n case \"record\":\n if (userInfo.value.is_sw == 1) {\n showToast(Lang.value[Type.value].is_sw);\n } else {\n toggleRecord();\n }\n break;\n case \"set\":\n toggleSystem();\n break;\n case \"help\":\n router.push({\n path: \"/help\"\n });\n break;\n }\n closeMenu();\n };\n const setChip = item => {\n const list = chipArry.value.filter(v => v.show == true);\n if (item.show && list.length == 1) {\n showToast(Lang.value[Type.value].cannot_less_one);\n } else if (!item.show && list.length > 5) {\n showToast(Lang.value[Type.value].no_more_6);\n } else {\n item.show = !item.show;\n }\n };\n const toggleChipPop = () => {\n showChipPop.value = !showChipPop.value;\n };\n const setBaccaratType = type => {\n if (type == 0) {\n showToast(Lang.value[Type.value].switch_free_text_0);\n } else {\n showToast(Lang.value[Type.value].switch_free_text_1);\n }\n store.commit(\"config/setBaccaratType\", type);\n };\n const closeSetFree = () => {\n store.commit(\"config/showSetFree\");\n };\n const toggleRecord = () => {\n store.commit(\"config/showRecord\");\n };\n const toggleSystem = () => {\n store.commit(\"config/showSystem\");\n };\n const showLangselect = state => {\n langselect.value = state;\n };\n const choseLang = lang => {\n store.commit(\"config/updateLang\", lang);\n langselect.value = false;\n };\n const shareFn = state => {\n store.commit(\"config/showMenu\", false);\n store.commit(\"config/showShare\", state);\n };\n const copyUrl = () => {\n const protocol = document.location.protocol;\n const hostname = document.location.hostname;\n const port = document.location.port;\n let url = \"\";\n if (port) {\n url = `${protocol}//${hostname}:${port}`;\n } else {\n url = `${protocol}//${hostname}`;\n }\n const input = document.createElement(\"input\");\n input.style.cssText = \"opacity: 0\";\n input.type = \"text\";\n input.value = url;\n document.body.appendChild(input);\n input.select();\n document.execCommand(\"copy\");\n input.remove();\n store.commit(\"config/showShare\", false);\n showSuccessToast(Lang.value[Type.value].coyp_successful);\n };\n const setVolume = (name, type) => {\n store.commit(\"config/volumeSeting\", {\n name,\n type\n });\n };\n const collect = () => {\n // 判断是否支持浏览器API\n if (\"navigator\" in window && \"standalone\" in window.navigator && !window.navigator.standalone) {\n // 判断是否为苹果设备\n if (/iphone|ipod|ipad/i.test(navigator.userAgent)) {\n const addToHomeScreen = confirm(\"Add to Home Screen?\");\n if (addToHomeScreen) {\n const icon = require(\"./assets/images/en_baccarat_icon.png\"); // 替换为你的图标路径\n const title = \"AgGame\"; // 替换为你的应用标题\n const url = window.location.href; // 获取当前页面的URL\n const meta = document.createElement(\"meta\");\n meta.setAttribute(\"name\", \"apple-mobile-web-app-capable\");\n meta.setAttribute(\"content\", \"yes\");\n document.head.appendChild(meta);\n const link = document.createElement(\"link\");\n link.setAttribute(\"rel\", \"apple-touch-icon\");\n link.setAttribute(\"href\", icon);\n document.head.appendChild(link);\n const titleElement = document.createElement(\"title\");\n titleElement.innerText = title;\n document.head.appendChild(titleElement);\n window.location.href = url;\n }\n } else if (/android/i.test(navigator.userAgent)) {\n const addToHomeScreen = confirm(\"Add to Home Screen?\");\n if (addToHomeScreen) {\n const icon = require(\"./assets/images/en_baccarat_icon.png\"); // 替换为你的图标路径\n const title = \"AgGame\"; // 替换为你的应用标题\n const url = window.location.href; // 获取当前页面的URL\n const meta = document.createElement(\"meta\");\n meta.setAttribute(\"name\", \"mobile-web-app-capable\");\n meta.setAttribute(\"content\", \"yes\");\n document.head.appendChild(meta);\n const link = document.createElement(\"link\");\n link.setAttribute(\"rel\", \"icon\");\n link.setAttribute(\"type\", \"image/png\");\n link.setAttribute(\"href\", icon);\n document.head.appendChild(link);\n const titleElement = document.createElement(\"title\");\n titleElement.innerText = title;\n document.head.appendChild(titleElement);\n window.location.href = url;\n }\n }\n }\n showSuccessToast(Lang.value[Type.value].collection_successful);\n };\n // 从新计算待机时长\n const touchScreen = () => {\n store.commit(\"app/standbyTime\");\n };\n showfloatBtn({\n store\n });\n const noSleep = new NoSleep();\n document.addEventListener(\"click\", function enableNoSleep() {\n document.removeEventListener(\"click\", enableNoSleep, false);\n noSleep.enable();\n }, false);\n\n //\n\n // nextTick(() => {\n // showDialog({\n // // title: Lang.value[Type.value].tips,\n // message: Lang.value[Type.value].msg_waiting_development,\n // confirmButtonText: Lang.value[Type.value].Confirm\n // }).then(() => {\n // store.state.app.musicPlayer.play()\n // })\n // })\n\n // 视频开关\n watch(() => [switchVideo], ([type]) => {\n store.commit(\"config/switchVideo\", type);\n }, {\n immediate: true,\n deep: true\n });\n watch(() => [musicVal.value], ([type]) => {\n musicVolume.value = type;\n }, {\n immediate: true,\n deep: true\n });\n // 音乐开关\n watch(() => [musicVolume.value], ([type]) => {\n store.commit(\"config/setValue\", {\n name: \"musicVolume\",\n type\n });\n });\n // 音效开关\n watch(() => [effectsVolume.value], ([type]) => {\n store.commit(\"config/setValue\", {\n name: \"effectsVolume\",\n type\n });\n });\n // 下注筹码显示\n watch(() => [showOtherChip.value], ([type]) => {\n store.commit(\"config/setValue\", {\n name: \"showOtherChip\",\n type\n });\n });\n // 总声音控制\n watch(() => [switchSound.value], ([type]) => {\n nextTick(() => {\n store.commit(\"config/switchSound\", type);\n const Audio = document.getElementById(\"Audio\");\n Audio.muted = !type;\n });\n }, {\n immediate: true,\n deep: true\n });\n return {\n Type,\n Lang,\n fullScreen,\n showAplayer,\n showMenu,\n settingMenu,\n chipArry,\n showChipPop,\n baccaratType,\n showSetFree,\n showBaccaratPlayType,\n showTableInfo,\n showOnLine,\n showRecord,\n showSystem,\n switchSound,\n switchVideo,\n langList,\n langselect,\n showShare,\n volume,\n musicVolume,\n effectsVolume,\n showOtherChip,\n requestFullScreen,\n toggleAplayer,\n chooseMenu,\n setChip,\n toggleChipPop,\n closeMenu,\n setBaccaratType,\n closeSetFree,\n toggleRecord,\n toggleSystem,\n showLangselect,\n choseLang,\n shareFn,\n copyUrl,\n collect,\n touchScreen,\n setVolume\n };\n }\n};","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]} |