diff --git a/package.json b/package.json index f9d1a56..27a4d54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "media_player_client", - "version": "1.4.7", + "version": "1.4.8", "description": "A Quasar Framework app", "productName": "MediaPlayerClient", "author": "fangxiang ", diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index f64382c..01a57ba 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -1064,6 +1064,16 @@ export default class ClientConnection { } } + public async getCityList() { + try { + return await this.doRpc( + new Protocol.GetCityListRequestEntity() + ); + } catch (e) { + console.error(e); + } + } + public destory() { if (this.ws) { this.ws.onclose = null; diff --git a/src/components/ClockSignalSourceDialog.vue b/src/components/ClockSignalSourceDialog.vue index 0363575..bc96a3e 100644 --- a/src/components/ClockSignalSourceDialog.vue +++ b/src/components/ClockSignalSourceDialog.vue @@ -80,7 +80,16 @@ {{ $t("font size") }} - + @@ -487,7 +496,12 @@ export default defineComponent({ if (json) { try { const temp = JSON.parse(json); - clock_entity.value = temp; + + for (const item of Object.keys(clock_entity.value)) { + if (typeof temp[item] != "undefined") { + (clock_entity.value)[item] = temp[item]; + } + } } catch {} } }; diff --git a/src/components/RegisterDialog.vue b/src/components/RegisterDialog.vue index 407d4b6..9bc4779 100644 --- a/src/components/RegisterDialog.vue +++ b/src/components/RegisterDialog.vue @@ -466,7 +466,6 @@ export default defineComponent({ if (result && !result.result.err) { licence_str = result.result.lic; } - console.log(result); clearTimeout(timeout_handler); resolve(true); } catch { diff --git a/src/components/SignalSourceDialog.vue b/src/components/SignalSourceDialog.vue index b9e2837..078394c 100644 --- a/src/components/SignalSourceDialog.vue +++ b/src/components/SignalSourceDialog.vue @@ -157,12 +157,15 @@ ? doSelectFile('.jpg;.png') : item_data.window_type == 'EwindowType::Clock' ? showClockDialog() + : item_data.window_type == 'EwindowType::Weather' + ? showWeatherDialog() : showPlaylistDialog('.mp4;.avi;.ts;') " v-model="item_data.media_url" :readonly=" media_url_label.startsWith($t('file path')) || - media_url_label.startsWith($t('clock')) + media_url_label.startsWith($t('clock')) || + media_url_label.startsWith($t('weather')) " :label="media_url_label" :hint=" @@ -170,6 +173,8 @@ ? $t('dbclick select file') : media_url_label.startsWith($t('clock')) ? $t('dbclick config clock') + : media_url_label.startsWith($t('weather')) + ? $t('dbclick config weather') : $t('please input') + media_url_label.substr(0, media_url_label.length - 1) " @@ -283,6 +288,7 @@ + @@ -312,11 +318,18 @@ import { SignalSourceEntity } from "src/entities/SignalSourceEntity"; import FileManageDialog from "src/components/FileManageDialog.vue"; import PlaylistDialog from "src/components/PlaylistDialog.vue"; import ClockSignalSourceDialog from "src/components/ClockSignalSourceDialog.vue"; +import WeatherSignalSourceDialog from "src/components/WeatherSignalSourceDialog.vue"; + import FileEntity from "src/entities/FileEntity"; export default defineComponent({ name: "ComponentSignalSourceDialog", - components: { FileManageDialog, PlaylistDialog, ClockSignalSourceDialog }, + components: { + FileManageDialog, + PlaylistDialog, + ClockSignalSourceDialog, + WeatherSignalSourceDialog, + }, setup() { let $store = useStore(); @@ -332,6 +345,7 @@ export default defineComponent({ let loading = ref(false); let playlist_dialog: any = ref(null); let clock_dialog: any = ref(null); + let weather_dialog: any = ref(null); let file_manage_dialog: any = ref(null); let suppored_window_types = new Set([ @@ -340,6 +354,7 @@ export default defineComponent({ "EwindowType::Image", "EwindowType::Rtsp", "EwindowType::Clock", + "EwindowType::Weather", ]); let signal_source_options = [ @@ -363,6 +378,10 @@ export default defineComponent({ label: $t.t("clock"), value: "EwindowType::Clock", }, + { + label: $t.t("weather"), + value: "EwindowType::Weather", + }, ]; const tree_nodes = computed({ @@ -399,6 +418,9 @@ export default defineComponent({ case "EwindowType::Clock": media_url_label.value = $t.t("clock setting") + ":"; break; + case "EwindowType::Weather": + media_url_label.value = $t.t("weather setting") + ":"; + break; default: media_url_label.value = $t.t("file path") + ":"; break; @@ -456,6 +478,7 @@ export default defineComponent({ tree_nodes, playlist_dialog, clock_dialog, + weather_dialog, file_manage_dialog, showDialog(options: any) { if (options) { @@ -512,6 +535,17 @@ export default defineComponent({ item_data.media_url = decodeURI(result); } }, + async showWeatherDialog() { + if (item_data.window_type != "EwindowType::Weather") { + return; + } + const result = await weather_dialog.value.showDialogAsync( + item_data.media_url + ); + if (result) { + item_data.media_url = decodeURI(result); + } + }, async showPlaylistDialog(filter: string) { if (item_data.window_type != "EwindowType::Multimedia") { return; diff --git a/src/components/WeatherSignalSourceDialog.vue b/src/components/WeatherSignalSourceDialog.vue new file mode 100644 index 0000000..d29b4a0 --- /dev/null +++ b/src/components/WeatherSignalSourceDialog.vue @@ -0,0 +1,596 @@ + + + + + diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index 6a335cf..a5e7155 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -424,6 +424,10 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "RpcSetHdmiInDecodeType"; } + public static get kRpcGetCityList() { + return Commands.PROTOCOL_PREFIX + "RpcGetCityList"; + } + static _all_commands = new Set([ Commands.kUnKnowCommand, Commands.kSearchDevice, @@ -529,6 +533,7 @@ export namespace Protocol { Commands.kRpcGetTimingTasks, Commands.kRpcGetSystemNetworkInfo, Commands.kRpcSetHdmiInDecodeType, + Commands.kRpcGetCityList, ]); public static get AllCommands() { return this._all_commands; @@ -559,7 +564,7 @@ export namespace Protocol { } export class NoneResponse extends PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); } export class LoginRequest extends PacketEntity { user_name = ""; @@ -584,8 +589,7 @@ export namespace Protocol { } export class GetSignalSourcesRequest extends PacketEntity { - timestamp = new Date().getMilliseconds(); - + timestamp = Date.now(); constructor(rpcid?: number) { super(); this.rpc_id = rpcid ?? 0; @@ -604,7 +608,7 @@ export namespace Protocol { } export class GetModesRequestEntity extends PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rpcid?: number) { super(); @@ -624,7 +628,7 @@ export namespace Protocol { } export class GetPlansRequestEntity extends PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rpcid?: number) { super(); @@ -644,7 +648,7 @@ export namespace Protocol { } export class GetApplicationConfigRequestEntity extends PacketEntity { - timestamp: number = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rpcid?: number) { super(); @@ -663,7 +667,7 @@ export namespace Protocol { } export class GetWindowsRequestEntity extends PacketEntity { - timestamp: number = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rpcid?: number) { super(); @@ -1423,7 +1427,7 @@ export namespace Protocol { } export class GetCurrentRunningPlanRequestEntity extends Protocol.PacketEntity { - timestamp: number = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rcp_id?: number) { super(); this.rpc_id = rcp_id ?? 0; @@ -1457,7 +1461,7 @@ export namespace Protocol { } export class StopCurrentRunningPlanRequestEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor() { super(); @@ -1532,7 +1536,7 @@ export namespace Protocol { } export class GetSubtitleRequestEntity extends Protocol.PacketEntity { - timestamp: number = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rcp_id?: number) { super(); this.rpc_id = rcp_id ?? 0; @@ -1550,7 +1554,7 @@ export namespace Protocol { } export class GetRegisterInfoRequestEntity extends Protocol.PacketEntity { - timestamp: number = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rcp_id?: number) { super(); this.rpc_id = rcp_id ?? 0; @@ -1573,7 +1577,7 @@ export namespace Protocol { } export class RegisterDeviceRequestEntity extends Protocol.PacketEntity { - timestamp: number = new Date().getMilliseconds(); + timestamp = Date.now(); register_code: string = ""; secret_key: string = ""; active_code: string = ""; @@ -1592,7 +1596,7 @@ export namespace Protocol { super(); this.rpc_id = rcp_id ?? 0; this.command = Protocol.Commands.kRpcRegisterDevice; - this.timestamp = new Date().getMilliseconds(); + this.timestamp = Date.now(); this.register_code = register_code; this.active_code = active_code; @@ -1638,7 +1642,7 @@ export namespace Protocol { } export class GetScreenSizeRequestEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rcp_id?: number) { super(); @@ -1680,7 +1684,7 @@ export namespace Protocol { } export class SetSystemNetworkResponseEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor() { super(); @@ -1730,7 +1734,7 @@ export namespace Protocol { } export class SetSystemOtherResponseEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor() { super(); @@ -1739,7 +1743,7 @@ export namespace Protocol { } export class GetSupportResolutionsRequestEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rcp_id?: number) { super(); @@ -1767,7 +1771,7 @@ export namespace Protocol { } export class GetOutputBoardSettingRequestEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rcp_id?: number) { super(); @@ -1812,7 +1816,7 @@ export namespace Protocol { } export class SetOutputBoardSettingResponseEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor() { super(); @@ -1821,7 +1825,7 @@ export namespace Protocol { } export class RestoreOutputBoardRequestEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rcp_id?: number) { super(); @@ -1831,7 +1835,7 @@ export namespace Protocol { } export class RestoreOutputBoardResponseEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor() { super(); @@ -1919,7 +1923,7 @@ export namespace Protocol { } export class GetBuildInfoRequestEntity extends Protocol.PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rcp_id?: number) { super(); @@ -2058,7 +2062,7 @@ export namespace Protocol { } export class GetSystemTimesRequestEntity extends PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rpcid?: number) { super(); @@ -2081,7 +2085,7 @@ export namespace Protocol { } export class GetUsbDevicesRequestEntity extends PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rpcid?: number) { super(); @@ -2100,7 +2104,7 @@ export namespace Protocol { } export class GetPollingsRequestEntity extends PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rpcid?: number) { super(); @@ -2144,7 +2148,7 @@ export namespace Protocol { } export class GetEdgeBlendingInfoRequestEntity extends PacketEntity { - timestamp = new Date().getMilliseconds(); + timestamp = Date.now(); constructor(rpcid?: number) { super(); @@ -2696,4 +2700,23 @@ export namespace Protocol { success = false; note = ""; } + + export class GetCityListRequestEntity extends PacketEntity { + constructor(rpc_id = 0) { + super(); + super.command = Commands.kRpcGetCityList; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + } + timestamp = Date.now(); + } + + export class GetCityListResponseEntity extends PacketEntity { + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + + city_list = []; + } } diff --git a/src/entities/WeatherWindowParamEntity.ts b/src/entities/WeatherWindowParamEntity.ts new file mode 100644 index 0000000..e02c066 --- /dev/null +++ b/src/entities/WeatherWindowParamEntity.ts @@ -0,0 +1,8 @@ +export default class WeatherWindowParamEntity { + auto_location = true; + location_code = "101010100"; + background_color = "#478DD2"; + text_color = "#FFFFFF"; + font_size = 25; + background_transparent = false; +} diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 6f9653f..dd0c404 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -535,4 +535,14 @@ export default { "only normal clock support time hiding": "只有普通时钟支持时间隐藏", "only normal clock support multiple lines": "只有普通时钟支持换行", "only normal clock support": "只有普通时钟支持", + weather: "天气", + "weather setting": "天气设置", + "dbclick config weather": "双击配置天气", + "auto location": "自动获取位置", + city_country: "国家", + city_province: "省份", + city_city: "市", + city_area: "区", + location: "位置", + city_city_area: "市区", };