修复安卓无法根据后台产品显示对应界面的BUG
This commit is contained in:
parent
50d811054f
commit
8d7ef3ae74
|
@ -80,9 +80,11 @@ import BottomBar from "./BottomBar.vue";
|
||||||
import EventBus, { EventNamesDefine } from "src/common/EventBus";
|
import EventBus, { EventNamesDefine } from "src/common/EventBus";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
import { useStore } from "src/store";
|
||||||
import { api } from "src/boot/axios";
|
import { api } from "src/boot/axios";
|
||||||
import GlobalData from "src/common/GlobalData";
|
import GlobalData from "src/common/GlobalData";
|
||||||
import { HttpProtocol } from "src/entities/HttpProtocol";
|
import { HttpProtocol } from "src/entities/HttpProtocol";
|
||||||
|
import { EProductNames } from "src/entities/ProductNames";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "PadMainLayout",
|
name: "PadMainLayout",
|
||||||
|
@ -92,6 +94,7 @@ export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const $t = useI18n();
|
const $t = useI18n();
|
||||||
|
const $store = useStore();
|
||||||
|
|
||||||
const show_back = ref(true);
|
const show_back = ref(true);
|
||||||
(<any>window).isPad = true; // pad flag
|
(<any>window).isPad = true; // pad flag
|
||||||
|
@ -151,6 +154,40 @@ export default defineComponent({
|
||||||
xhr.onload = function () {
|
xhr.onload = function () {
|
||||||
url = new URL(xhr.responseURL);
|
url = new URL(xhr.responseURL);
|
||||||
const back_pathname = url.pathname;
|
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
|
||||||
|
) {
|
||||||
|
(<any>window).media_control_client_product = product;
|
||||||
|
$store.commit(
|
||||||
|
"setProductName",
|
||||||
|
(<any>window).media_control_client_product
|
||||||
|
);
|
||||||
|
|
||||||
|
// 设置 AXIOS 默认请求头
|
||||||
|
{
|
||||||
|
api.defaults.headers.common["X-Product-Name"] = (<any>(
|
||||||
|
window
|
||||||
|
)).media_control_client_product;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
url.pathname = back_pathname;
|
||||||
url.pathname += "/store/version.txt";
|
url.pathname += "/store/version.txt";
|
||||||
api
|
api
|
||||||
.get(url.toString())
|
.get(url.toString())
|
||||||
|
|
Loading…
Reference in New Issue