[add] 裝置碼

This commit is contained in:
建喵 2022-08-03 14:32:20 +08:00
parent 61bffe4315
commit 8edd4b29b7
6 changed files with 629 additions and 513 deletions

View File

@ -3,7 +3,7 @@
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite --host",
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vite build", "build": "vite build",
"build1": "vue-tsc --noEmit && vite build", "build1": "vue-tsc --noEmit && vite build",

View File

@ -1,6 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { ElDialog } from 'element-plus';
import { ref } from "vue"; import { ref } from "vue";
import { BJ_Casino_Deeplink } from "../script/BJ_Casino_Deeplink"; import { BJ_Casino_Deeplink } from "../script/BJ_Casino_Deeplink";
import Popup from './Popup.vue';
const servertypeDefault = ref('') const servertypeDefault = ref('')
const hostportDefault = ref('') const hostportDefault = ref('')
@ -9,6 +11,8 @@ const servertype = ref(0)
const hostport = ref(0) const hostport = ref(0)
const patch = ref(0) const patch = ref(0)
const iscustom = ref(false) const iscustom = ref(false)
const isBtn_WanOpen = ref(false)
const PopupVisible = ref(false)
const input3 = ref('') const input3 = ref('')
const self = { const self = {
servertypeDefault: servertypeDefault, servertypeDefault: servertypeDefault,
@ -18,14 +22,21 @@ const self = {
hostport: hostport, hostport: hostport,
patch: patch, patch: patch,
iscustom: iscustom, iscustom: iscustom,
isBtn_WanOpen: isBtn_WanOpen,
PopupVisible: PopupVisible,
Script: null
} }
const Script = new BJ_Casino_Deeplink(self); const Script = new BJ_Casino_Deeplink(self);
self.Script = Script;
const ServertypeData = Script.GetServerType(); const ServertypeData = Script.GetServerType();
const HostportData = Script.GetHostport(); const HostportData = Script.GetHostport();
const Patch = Script.GetPatch(); const Patch = Script.GetPatch();
</script> </script>
<template> <template>
<el-dialog v-model="PopupVisible" :show-close="false">
<Popup :APP="self" />
</el-dialog>
<div> <div>
<h1> <h1>
<div> <div>
@ -60,6 +71,11 @@ const Patch = Script.GetPatch();
</div> </div>
<el-button type="success" @click.native="() => { Script.OnclickOpen() }" size="large" round>開啟遊戲&gt;&gt; <el-button type="success" @click.native="() => { Script.OnclickOpen() }" size="large" round>開啟遊戲&gt;&gt;
</el-button> </el-button>
<span v-show="isBtn_WanOpen">
<el-button type="success" @click.native="() => { Script.OnclickWanOpen() }" size="large" round>
外網開啟遊戲&gt;&gt;
</el-button>
</span>
<br> <br>
<el-button type="primary" @click.native="() => { Script.Install_Debug() }" size="large" round> <el-button type="primary" @click.native="() => { Script.Install_Debug() }" size="large" round>
安裝Debug&gt;&gt; 安裝Debug&gt;&gt;
@ -71,19 +87,22 @@ const Patch = Script.GetPatch();
<el-button type="primary" @click.native="() => { Script.Install_Release_Debug() }" size="large" round> <el-button type="primary" @click.native="() => { Script.Install_Release_Debug() }" size="large" round>
安裝Release(可看log)&gt;&gt;</el-button> 安裝Release(可看log)&gt;&gt;</el-button>
<br> <br>
<el-button type="primary" @click.native="() => { Script.Install_B2B() }" size="large" round>安裝B2B&gt;&gt; <el-button type="primary" @click.native="() => { Script.Install_B2B() }" size="large" round>
安裝B2B&gt;&gt;
</el-button> </el-button>
<br> <br>
<el-button type="primary" @click.native="() => { Script.Install_JM() }" size="large" round>安裝建喵版&gt;&gt; <el-button type="primary" @click.native="() => { Script.Install_JM() }" size="large" round>安裝建喵版&gt;&gt;
</el-button> </el-button>
<br> <br>
<el-button type="primary" @click.native="() => { Script.Install_Store() }" size="large" round>APP商店&gt;&gt; <el-button type="primary" @click.native="() => { Script.Install_Store() }" size="large" round>
APP商店&gt;&gt;
</el-button> </el-button>
<br> <br>
<el-button type="primary" @click.native="() => { Script.Install_Bowei() }" size="large" round>安裝柏威版&gt;&gt; <el-button type="primary" @click.native="() => { Script.Install_Bowei() }" size="large" round>
安裝柏威版&gt;&gt;
</el-button> </el-button>
<div> <div>
<el-button type="warning" @click.native="() => { Script.Install_InternalTest(input3) }" size="large" <el-button type="warning" @click.native="() => { Script.Install_InternalTest(+input3) }" size="large"
round> round>
前往 前往
</el-button> </el-button>

18
src/components/Popup.vue Normal file
View File

@ -0,0 +1,18 @@
<script setup lang="ts">
import { ref } from 'vue';
const props = defineProps<{ APP: any }>()
const input = ref('')
const APP = props.APP
function Send(content: string) {
APP.Script.OnclickOpen(true, { deviceid: content });
APP.PopupVisible.value = false;
}
</script>
<template>
<el-input v-model="input" placeholder="請輸入裝置碼" />
<el-button type="primary" @click.native="() => { Send(input) }" size="large" round>確定
</el-button>
</template>

View File

@ -1,9 +1,10 @@
export class BJ_Casino_Deeplink { export class BJ_Casino_Deeplink {
//#region public //#region public
public Servertype: any[] = [5, ["不選擇版本", "Web", "Out", "Submit", "Internal_release", "Internal_Dev"]]; public Servertype: any[] = [5, ["不選擇版本", "Web", "Out", "Submit", "Internal_release", "Internal_Dev"]];
public Hostport: any[] = [1, ["不選擇環境", "內版", "肉乾", "賴宏", "40", "送審", "外版", "testing1", "testing2", "testing3"]]; public Hostport: any[] = [1, ["不選擇環境", "內版", "肉乾9006", "肉乾9007", "肉乾9008", "肉乾9009", "賴宏", "40", "送審", "外版", "testing1", "testing2", "testing3"]];
public Patch: any[] = [1, [ public Patch: any[] = [1, [
"不選擇資源路徑", "不選擇資源路徑",
"內版", "內版",
@ -51,6 +52,11 @@ export class BJ_Casino_Deeplink {
this._client.servertypeDefault.value = this.Servertype[1][this._client.servertype.value]; this._client.servertypeDefault.value = this.Servertype[1][this._client.servertype.value];
this._client.hostportDefault.value = this.Hostport[1][this._client.hostport.value]; this._client.hostportDefault.value = this.Hostport[1][this._client.hostport.value];
this._client.patchDefault.value = this.Patch[1][this._client.patch.value]; this._client.patchDefault.value = this.Patch[1][this._client.patch.value];
// this.GetLanIP();
if (!this._isAndroid && !this._isiOS) {
this._client.isBtn_WanOpen.value = true;
}
} }
//#endregion //#endregion
@ -115,6 +121,34 @@ export class BJ_Casino_Deeplink {
return options; return options;
} }
// public async GetLanIP(): Promise<string> {
// let run: boolean = true;
// let ip: string = "";
// // var url: string = "http://192.168.5.36/page/Net/";
// var url: string = "http://220.134.195.1/public/bonus_casino/html5/jianmiau/Net/";
// var xhr: XMLHttpRequest = new XMLHttpRequest();
// xhr.onreadystatechange = function (): void {
// if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 400)) {
// ip = xhr.responseText;
// run = false;
// }
// };
// xhr.open("GET", url);
// xhr.timeout = 500; // 超时时间,单位是毫秒
// xhr.ontimeout = function (e) {
// // XMLHttpRequest 超时。在此做某事。
// run = false;
// };
// xhr.send();
// while (run) {
// await Tools.Sleep(1000);
// }
// if (ip !== "") {
// this._isWan = false;
// }
// return ip;
// }
//#endregion //#endregion
//#region Custom //#region Custom
@ -207,7 +241,12 @@ export class BJ_Casino_Deeplink {
} }
} }
public OnclickOpen() { public OnclickWanOpen() {
this._client.PopupVisible.value = true;
// this.OnclickOpen(true);
}
public OnclickOpen(isWan: boolean = false, obj: Object = {}) {
let hostport = this._client.hostport.value; let hostport = this._client.hostport.value;
let servertype = +this._client.servertype.value; let servertype = +this._client.servertype.value;
let patch = +this._client.patch.value; let patch = +this._client.patch.value;
@ -215,6 +254,10 @@ export class BJ_Casino_Deeplink {
let iscustom = E_iscustom.checked; let iscustom = E_iscustom.checked;
let URLscheme: any = {}; let URLscheme: any = {};
if (obj["deviceid"]) {
URLscheme["deviceid"] = obj["deviceid"];
}
switch (servertype) { switch (servertype) {
case 0: { case 0: {
break; break;
@ -239,57 +282,78 @@ export class BJ_Casino_Deeplink {
break; break;
} }
// 肉乾 // 肉乾9006
case 2: { case 2: {
URLscheme["host"] = "http://192.168.5.230"; URLscheme["host"] = "http://192.168.5.230";
URLscheme["port"] = "9006"; URLscheme["port"] = "9006";
break; break;
} }
// 賴宏 // 肉乾9007
case 3: { case 3: {
URLscheme["host"] = "http://192.168.5.230";
URLscheme["port"] = "9007";
break;
}
// 肉乾9008
case 4: {
URLscheme["host"] = "http://192.168.5.230";
URLscheme["port"] = "9008";
break;
}
// 肉乾9009
case 5: {
URLscheme["host"] = "http://192.168.5.230";
URLscheme["port"] = "9009";
break;
}
// 賴宏
case 6: {
URLscheme["host"] = "http://192.168.5.134"; URLscheme["host"] = "http://192.168.5.134";
URLscheme["port"] = "9005"; URLscheme["port"] = "9005";
break; break;
} }
// 40 // 40
case 4: { case 7: {
URLscheme["host"] = "http://192.168.5.12"; URLscheme["host"] = "http://192.168.5.12";
URLscheme["port"] = "9487"; URLscheme["port"] = "9487";
break; break;
} }
// 送審 // 送審
case 5: { case 8: {
URLscheme["host"] = "https://submit.online-bj.com"; URLscheme["host"] = "https://submit.online-bj.com";
URLscheme["port"] = "9005"; URLscheme["port"] = "9005";
break; break;
} }
// 外版 // 外版
case 6: { case 9: {
URLscheme["host"] = "https://game.online-bj.com"; URLscheme["host"] = "https://game.online-bj.com";
URLscheme["port"] = "9005"; URLscheme["port"] = "9005";
break; break;
} }
// testing1 // testing1
case 7: { case 10: {
URLscheme["host"] = "http://bj-testing1.casino.catan.com.tw"; URLscheme["host"] = "http://bj-testing1.casino.catan.com.tw";
URLscheme["port"] = "9005"; URLscheme["port"] = "9005";
break; break;
} }
// testing2 // testing2
case 8: { case 11: {
URLscheme["host"] = "http://bj-testing2.casino.catan.com.tw"; URLscheme["host"] = "http://bj-testing2.casino.catan.com.tw";
URLscheme["port"] = "9005"; URLscheme["port"] = "9005";
break; break;
} }
// testing3 // testing3
case 9: { case 12: {
URLscheme["host"] = "http://bj-testing3.casino.catan.com.tw"; URLscheme["host"] = "http://bj-testing3.casino.catan.com.tw";
URLscheme["port"] = "9005"; URLscheme["port"] = "9005";
break; break;
@ -410,12 +474,16 @@ export class BJ_Casino_Deeplink {
} }
let url = ""; let url = "";
let gameUrl = "220.134.195.1:17456";
if (!isWan) {
gameUrl = "192.168.5.108:7456";
}
if (iscustom) { if (iscustom) {
let URLscheme = new URL(location.href); let URLscheme = new URL(location.href);
if (this._isiOS || this._isAndroid) { if (this._isiOS || this._isAndroid) {
url = `bjcasino://get/message${URLscheme.search}`; url = `bjcasino://get/message${URLscheme.search}`;
} else { } else {
url = `http://220.134.195.1:17456/phone.html${URLscheme.search}`; url = `http://${gameUrl}/phone.html${URLscheme.search}`;
} }
} else { } else {
let _URLSearchParams = new URLSearchParams(URLscheme).toString(); let _URLSearchParams = new URLSearchParams(URLscheme).toString();
@ -423,7 +491,7 @@ export class BJ_Casino_Deeplink {
if (this._isiOS || this._isAndroid) { if (this._isiOS || this._isAndroid) {
url = `bjcasino://get/message${_decodeURI ? `?${_decodeURI}` : ""}`; url = `bjcasino://get/message${_decodeURI ? `?${_decodeURI}` : ""}`;
} else { } else {
url = `http://220.134.195.1:17456/phone.html${_decodeURI ? `?${_decodeURI}` : ""}`; url = `http://${gameUrl}/phone.html${_decodeURI ? `?${_decodeURI}` : ""}`;
} }
} }
if (this._isiOS || this._isAndroid) { if (this._isiOS || this._isAndroid) {

11
src/script/Tools.ts Normal file
View File

@ -0,0 +1,11 @@
export class Tools {
//#region Custom
public static Sleep(ms: any): Promise<unknown> {
return new Promise(resolve => setTimeout(resolve, ms));
}
//#endregion
}

View File

@ -4,7 +4,7 @@
"useDefineForClassFields": true, "useDefineForClassFields": true,
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"strict": true, // "strict": true,
"jsx": "preserve", "jsx": "preserve",
"sourceMap": true, "sourceMap": true,
"resolveJsonModule": true, "resolveJsonModule": true,