diff --git a/package.json b/package.json index 5c11a29..2702f71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "media_player_client", - "version": "1.4.22", + "version": "1.5.1", "description": "A Quasar Framework app", "productName": "MediaPlayerClient", "author": "fangxiang ", diff --git a/public/media_control_client_language.js b/public/media_control_client_language.js index 5141003..140333e 100644 --- a/public/media_control_client_language.js +++ b/public/media_control_client_language.js @@ -1 +1,2 @@ +// window.media_control_client_language = "en-US"; window.media_control_client_language = "zh-CN"; diff --git a/public/media_control_client_product.js b/public/media_control_client_product.js new file mode 100644 index 0000000..e3fa936 --- /dev/null +++ b/public/media_control_client_product.js @@ -0,0 +1,2 @@ +// window.media_control_client_product = "LED_PLAYER"; +window.media_control_client_product = "SPECIAL_VIDEO"; diff --git a/src/App.vue b/src/App.vue index bd211eb..b39c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,6 +12,8 @@ import { useI18n } from "vue-i18n"; import EventBus, { EventNamesDefine } from "src/common/EventBus"; import { useStore } from "src/store"; import GlobalData from "./common/GlobalData"; +import { EProductNames } from "./entities/ProductNames"; +import { api } from "./boot/axios"; export default defineComponent({ name: "App", @@ -39,6 +41,28 @@ export default defineComponent({ }); } + // 设置产品 + if ( + !( + (window).media_control_client_product == + EProductNames.LED_PLAYER || + (window).media_control_client_product == + EProductNames.SPECIAL_VIDEO + ) + ) { + console.error("can't get product, use default led_player"); + (window).media_control_client_product = EProductNames.LED_PLAYER; + } + console.log((window).media_control_client_product); + $store.commit("setProductName", (window).media_control_client_product); + + // 设置 AXIOS 默认请求头 + { + api.defaults.headers.common["X-Product-Name"] = (( + window + )).media_control_client_product; + } + // 导入对应的quasar 语言包 try { { diff --git a/src/boot/axios.ts b/src/boot/axios.ts index ae7122b..9827f34 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -17,7 +17,6 @@ const api = axios.create({ baseURL: window.location.origin, timeout: 15000, }); -api.defaults.headers.common["X-Product-Name"] = "RK_3568"; export default boot(({ app }) => { // for use inside Vue files (Options API) through this.$axios and this.$api diff --git a/src/components/BackgroundImageDialog.vue b/src/components/BackgroundImageDialog.vue index 6a36857..31ed1a0 100644 --- a/src/components/BackgroundImageDialog.vue +++ b/src/components/BackgroundImageDialog.vue @@ -134,7 +134,7 @@ export default defineComponent({ return [ { name: HttpProtocol.kHeaderXProductName, - value: HttpProtocol.kHeaderDefaultValueXProductName, + value: HttpProtocol.getProductName($store), }, { name: HttpProtocol.kHeaderXFileLength, diff --git a/src/components/FileManageDialog.vue b/src/components/FileManageDialog.vue index 3e8954e..b142679 100644 --- a/src/components/FileManageDialog.vue +++ b/src/components/FileManageDialog.vue @@ -873,7 +873,7 @@ export default defineComponent({ return [ { name: HttpProtocol.kHeaderXProductName, - value: HttpProtocol.kHeaderDefaultValueXProductName, + value: HttpProtocol.getProductName($store), }, { name: HttpProtocol.kHeaderXFileLength, diff --git a/src/components/RecoveryDatabaseDialog.vue b/src/components/RecoveryDatabaseDialog.vue index bfaa774..22a152b 100644 --- a/src/components/RecoveryDatabaseDialog.vue +++ b/src/components/RecoveryDatabaseDialog.vue @@ -123,7 +123,7 @@ export default defineComponent({ return [ { name: HttpProtocol.kHeaderXProductName, - value: HttpProtocol.kHeaderDefaultValueXProductName, + value: HttpProtocol.getProductName($store), }, { name: HttpProtocol.kHeaderXFileLength, diff --git a/src/components/UpgradeDialog.vue b/src/components/UpgradeDialog.vue index 0eb445d..719a5e9 100644 --- a/src/components/UpgradeDialog.vue +++ b/src/components/UpgradeDialog.vue @@ -159,7 +159,7 @@ export default defineComponent({ return [ { name: HttpProtocol.kHeaderXProductName, - value: HttpProtocol.kHeaderDefaultValueXProductName, + value: HttpProtocol.getProductName($store), }, { name: HttpProtocol.kHeaderXFileLength, diff --git a/src/entities/HttpProtocol.ts b/src/entities/HttpProtocol.ts index f2476ab..9956eff 100644 --- a/src/entities/HttpProtocol.ts +++ b/src/entities/HttpProtocol.ts @@ -22,5 +22,12 @@ export namespace HttpProtocol { export const kHeaderXFileLength = "X-File-Length"; export const kHeaderXFileMD5 = "X-File-MD5"; export const kHeaderXProductName = "X-Product-Name"; - export const kHeaderDefaultValueXProductName = "RK_3568"; + const kHeaderDefaultValueXProductName = "LED_PLAYER"; + + export const getProductName = ($store: any): String => { + if ($store && $store.state && $store.state.product_name) { + return $store.state.product_name; + } + return kHeaderDefaultValueXProductName; + }; } diff --git a/src/entities/ProductNames.ts b/src/entities/ProductNames.ts new file mode 100644 index 0000000..b0894c7 --- /dev/null +++ b/src/entities/ProductNames.ts @@ -0,0 +1,4 @@ +export enum EProductNames { + LED_PLAYER = "LED_PLAYER", + SPECIAL_VIDEO = "SPECIAL_VIDEO", +} diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index 04e4f7a..0e99f7b 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -2596,26 +2596,42 @@ export namespace Protocol { } export enum EDeviceAttribute { - None_All = 0x0000, + None_UnKNow = 0x0000, - None = 0x0001, - OutputBoard = 0x0002, - CenterControl = 0x0004, - MirroringOutput = 0x0008, - CustomISV = 0x0010, - Reserve4 = 0x0020, - Reserve5 = 0x0040, - Reserve6 = 0x0080, - Reserve7 = 0x0100, - Reserve8 = 0x0200, - Reserve9 = 0x0400, - Reserve10 = 0x0800, - Reserve11 = 0x1000, - Reserve12 = 0x2000, - Reserve13 = 0x4000, - Reserve14 = 0x8000, + None = 0x00000001, + OutputBoard = 0x00000002, + CenterControl = 0x00000004, + MirroringOutput = 0x00000008, + CustomISV = 0x00000010, + Reserve5 = 0x00000020, + Reserve6 = 0x00000040, + Reserve7 = 0x00000080, + Reserve8 = 0x00000100, + Reserve9 = 0x00000200, + Reserve10 = 0x00000400, + Reserve11 = 0x00000800, + Reserve12 = 0x00001000, + Reserve13 = 0x00002000, + Reserve14 = 0x00004000, + Reserve15 = 0x00008000, + Reserve16 = 0x00010000, + Reserve17 = 0x00020000, + Reserve18 = 0x00040000, + Reserve19 = 0x00080000, + Reserve20 = 0x00100000, + Reserve21 = 0x00200000, + Reserve22 = 0x00400000, + Reserve23 = 0x00800000, + Reserve24 = 0x01000000, + Reserve25 = 0x02000000, + Reserve26 = 0x04000000, + Reserve27 = 0x08000000, + Reserve28 = 0x10000000, + Reserve29 = 0x20000000, + Reserve30 = 0x40000000, + Reserve31 = 0x80000000, - All = 0xffff, + All = 0xffffffff, } export class GetDeviceAttributeRequestEntity extends PacketEntity { diff --git a/src/index.template.html b/src/index.template.html index aaac0fa..d3c7fce 100644 --- a/src/index.template.html +++ b/src/index.template.html @@ -54,7 +54,10 @@ /> + + +