[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,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"serve": "vue-cli-service serve",
"build": "vite build",
"build1": "vue-tsc --noEmit && vite build",

View File

@ -1,6 +1,8 @@
<script setup lang="ts">
import { ElDialog } from 'element-plus';
import { ref } from "vue";
import { BJ_Casino_Deeplink } from "../script/BJ_Casino_Deeplink";
import Popup from './Popup.vue';
const servertypeDefault = ref('')
const hostportDefault = ref('')
@ -9,6 +11,8 @@ const servertype = ref(0)
const hostport = ref(0)
const patch = ref(0)
const iscustom = ref(false)
const isBtn_WanOpen = ref(false)
const PopupVisible = ref(false)
const input3 = ref('')
const self = {
servertypeDefault: servertypeDefault,
@ -18,14 +22,21 @@ const self = {
hostport: hostport,
patch: patch,
iscustom: iscustom,
isBtn_WanOpen: isBtn_WanOpen,
PopupVisible: PopupVisible,
Script: null
}
const Script = new BJ_Casino_Deeplink(self);
self.Script = Script;
const ServertypeData = Script.GetServerType();
const HostportData = Script.GetHostport();
const Patch = Script.GetPatch();
</script>
<template>
<el-dialog v-model="PopupVisible" :show-close="false">
<Popup :APP="self" />
</el-dialog>
<div>
<h1>
<div>
@ -60,6 +71,11 @@ const Patch = Script.GetPatch();
</div>
<el-button type="success" @click.native="() => { Script.OnclickOpen() }" size="large" round>開啟遊戲&gt;&gt;
</el-button>
<span v-show="isBtn_WanOpen">
<el-button type="success" @click.native="() => { Script.OnclickWanOpen() }" size="large" round>
外網開啟遊戲&gt;&gt;
</el-button>
</span>
<br>
<el-button type="primary" @click.native="() => { Script.Install_Debug() }" size="large" round>
安裝Debug&gt;&gt;
@ -71,19 +87,22 @@ const Patch = Script.GetPatch();
<el-button type="primary" @click.native="() => { Script.Install_Release_Debug() }" size="large" round>
安裝Release(可看log)&gt;&gt;</el-button>
<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>
<br>
<el-button type="primary" @click.native="() => { Script.Install_JM() }" size="large" round>安裝建喵版&gt;&gt;
</el-button>
<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>
<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>
<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>
前往
</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 {
//#region public
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, [
"不選擇資源路徑",
"內版",
@ -51,6 +52,11 @@ export class BJ_Casino_Deeplink {
this._client.servertypeDefault.value = this.Servertype[1][this._client.servertype.value];
this._client.hostportDefault.value = this.Hostport[1][this._client.hostport.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
@ -115,6 +121,34 @@ export class BJ_Casino_Deeplink {
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
//#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 servertype = +this._client.servertype.value;
let patch = +this._client.patch.value;
@ -215,6 +254,10 @@ export class BJ_Casino_Deeplink {
let iscustom = E_iscustom.checked;
let URLscheme: any = {};
if (obj["deviceid"]) {
URLscheme["deviceid"] = obj["deviceid"];
}
switch (servertype) {
case 0: {
break;
@ -239,57 +282,78 @@ export class BJ_Casino_Deeplink {
break;
}
// 肉乾
// 肉乾9006
case 2: {
URLscheme["host"] = "http://192.168.5.230";
URLscheme["port"] = "9006";
break;
}
// 賴宏
// 肉乾9007
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["port"] = "9005";
break;
}
// 40
case 4: {
case 7: {
URLscheme["host"] = "http://192.168.5.12";
URLscheme["port"] = "9487";
break;
}
// 送審
case 5: {
case 8: {
URLscheme["host"] = "https://submit.online-bj.com";
URLscheme["port"] = "9005";
break;
}
// 外版
case 6: {
case 9: {
URLscheme["host"] = "https://game.online-bj.com";
URLscheme["port"] = "9005";
break;
}
// testing1
case 7: {
case 10: {
URLscheme["host"] = "http://bj-testing1.casino.catan.com.tw";
URLscheme["port"] = "9005";
break;
}
// testing2
case 8: {
case 11: {
URLscheme["host"] = "http://bj-testing2.casino.catan.com.tw";
URLscheme["port"] = "9005";
break;
}
// testing3
case 9: {
case 12: {
URLscheme["host"] = "http://bj-testing3.casino.catan.com.tw";
URLscheme["port"] = "9005";
break;
@ -410,12 +474,16 @@ export class BJ_Casino_Deeplink {
}
let url = "";
let gameUrl = "220.134.195.1:17456";
if (!isWan) {
gameUrl = "192.168.5.108:7456";
}
if (iscustom) {
let URLscheme = new URL(location.href);
if (this._isiOS || this._isAndroid) {
url = `bjcasino://get/message${URLscheme.search}`;
} else {
url = `http://220.134.195.1:17456/phone.html${URLscheme.search}`;
url = `http://${gameUrl}/phone.html${URLscheme.search}`;
}
} else {
let _URLSearchParams = new URLSearchParams(URLscheme).toString();
@ -423,7 +491,7 @@ export class BJ_Casino_Deeplink {
if (this._isiOS || this._isAndroid) {
url = `bjcasino://get/message${_decodeURI ? `?${_decodeURI}` : ""}`;
} else {
url = `http://220.134.195.1:17456/phone.html${_decodeURI ? `?${_decodeURI}` : ""}`;
url = `http://${gameUrl}/phone.html${_decodeURI ? `?${_decodeURI}` : ""}`;
}
}
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,
"module": "esnext",
"moduleResolution": "node",
"strict": true,
// "strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,