From 8d7ef3ae744c76690edee1668e653a2ae07402ca Mon Sep 17 00:00:00 2001 From: fangxiang Date: Fri, 2 Sep 2022 15:54:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E5=8D=93=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=A0=B9=E6=8D=AE=E5=90=8E=E5=8F=B0=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=AF=B9=E5=BA=94=E7=95=8C=E9=9D=A2=E7=9A=84?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pad/MainLayout.vue | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/pad/MainLayout.vue b/src/pad/MainLayout.vue index c589a18..ba8fa24 100644 --- a/src/pad/MainLayout.vue +++ b/src/pad/MainLayout.vue @@ -80,9 +80,11 @@ import BottomBar from "./BottomBar.vue"; import EventBus, { EventNamesDefine } from "src/common/EventBus"; import { useI18n } from "vue-i18n"; import { useQuasar } from "quasar"; +import { useStore } from "src/store"; import { api } from "src/boot/axios"; import GlobalData from "src/common/GlobalData"; import { HttpProtocol } from "src/entities/HttpProtocol"; +import { EProductNames } from "src/entities/ProductNames"; export default defineComponent({ name: "PadMainLayout", @@ -92,6 +94,7 @@ export default defineComponent({ setup() { const $q = useQuasar(); const $t = useI18n(); + const $store = useStore(); const show_back = ref(true); (window).isPad = true; // pad flag @@ -151,6 +154,40 @@ export default defineComponent({ xhr.onload = function () { url = new URL(xhr.responseURL); const back_pathname = url.pathname; + + // 设置产品 + url.pathname += "/media_control_client_product.js"; + api.get(url.toString()).then((data) => { + const start = (data.data as string).lastIndexOf("="); + const end = (data.data as string).lastIndexOf(";"); + let product = (data.data as string) + .substring(start + 1, end == -1 ? undefined : end) + ?.trim(); + try { + product = JSON.parse(product); + } catch (e) {} + + if ( + product == EProductNames.LED_PLAYER || + product == EProductNames.SPECIAL_VIDEO || + product == EProductNames.OLD_LED_PLAYER + ) { + (window).media_control_client_product = product; + $store.commit( + "setProductName", + (window).media_control_client_product + ); + + // 设置 AXIOS 默认请求头 + { + api.defaults.headers.common["X-Product-Name"] = (( + window + )).media_control_client_product; + } + } + }); + + url.pathname = back_pathname; url.pathname += "/store/version.txt"; api .get(url.toString())