From 47d2beb81cad2d6d6e062c4360e7aa20be61fd08 Mon Sep 17 00:00:00 2001 From: taohebin Date: Tue, 12 Sep 2023 17:15:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9getsysteminfo=E7=AD=89?= =?UTF-8?q?api=E7=9A=84=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F=E3=80=81?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=8A=A5=E9=94=99=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../get-app-base-info/get-app-base-info.uvue | 21 ++++++++--------- .../API/get-device-info/get-device-info.uvue | 21 ++++++++--------- .../API/get-system-info/get-system-info.uvue | 23 +++++++++---------- .../API/get-window-info/get-window-info.uvue | 21 ++++++++--------- .../websocket-global/websocket-global.uvue | 2 +- pages/component/long-list/detail/detail.uvue | 6 +++-- pages/component/long-list/long-list.uvue | 2 +- .../scroll-view-refresher-props.uvue | 1 - 8 files changed, 47 insertions(+), 50 deletions(-) diff --git a/pages/API/get-app-base-info/get-app-base-info.uvue b/pages/API/get-app-base-info/get-app-base-info.uvue index 4d603059..96c05868 100644 --- a/pages/API/get-app-base-info/get-app-base-info.uvue +++ b/pages/API/get-app-base-info/get-app-base-info.uvue @@ -37,17 +37,16 @@ methods: { getAppBaseInfo: function () { const res = uni.getAppBaseInfo(); - //类型对象暂时不支持forin或Object.keys(), 临时通过字符串进行转化。 - const json = JSON.stringify(res); - const result = JSON.parse>(json); - this.items = [] as Item[]; - result?.forEach((value, key) => { - const item = { - label: key, - value: "" + value - } as Item; - this.items.push(item); - }) + for(const key in res){ + const value = res[key]; + if(value != null){ + const item = { + label: key, + value: "" + ((typeof value == "object")? JSON.stringify(value) : value) + } as Item; + this.items.push(item); + } + } } } } diff --git a/pages/API/get-device-info/get-device-info.uvue b/pages/API/get-device-info/get-device-info.uvue index 69f3bdbc..40d3e1d8 100644 --- a/pages/API/get-device-info/get-device-info.uvue +++ b/pages/API/get-device-info/get-device-info.uvue @@ -56,17 +56,16 @@ export default { methods: { getDeviceInfo: function () { const res = uni.getDeviceInfo(); - //类型对象暂时不支持forin或Object.keys(), 临时通过字符串进行转化。 - const json = JSON.stringify(res); - const result = JSON.parse>(json); - this.items = [] as Item[]; - result?.forEach((value, key) => { - const item = { - label: key, - value: "" + value - } as Item; - this.items.push(item); - }) + for(const key in res){ + const value = res[key]; + if(value != null){ + const item = { + label: key, + value: "" + ((typeof value == "object")? JSON.stringify(value) : value) + } as Item; + this.items.push(item); + } + } } } } diff --git a/pages/API/get-system-info/get-system-info.uvue b/pages/API/get-system-info/get-system-info.uvue index 7acbba04..f766b132 100644 --- a/pages/API/get-system-info/get-system-info.uvue +++ b/pages/API/get-system-info/get-system-info.uvue @@ -56,18 +56,17 @@ export default { methods: { getSystemInfo: function () { uni.getSystemInfo({ - success: (res) => { - //类型对象暂时不支持forin或Object.keys(), 临时通过字符串进行转化。 - const json = JSON.stringify(res); - const result = JSON.parse>(json); - this.items = [] as Item[]; - result?.forEach((value, key) => { - const item = { - label: key, - value: "" + value - } as Item; - this.items.push(item); - }) + success: (res) => { + for(const key in res){ + const value = res[key]; + if(value != null){ + const item = { + label: key, + value: "" + ((typeof value == "object")? JSON.stringify(value) : value) + } as Item; + this.items.push(item); + } + } }, }) } diff --git a/pages/API/get-window-info/get-window-info.uvue b/pages/API/get-window-info/get-window-info.uvue index 42ffd05d..6e46c572 100644 --- a/pages/API/get-window-info/get-window-info.uvue +++ b/pages/API/get-window-info/get-window-info.uvue @@ -37,17 +37,16 @@ methods: { getWindowInfo: function () { const res = uni.getWindowInfo(); - //类型对象暂时不支持forin或Object.keys(), 临时通过字符串进行转化。 - const json = JSON.stringify(res); - const result = JSON.parse>(json); - this.items = [] as Item[]; - result?.forEach((value, key) => { - const item = { - label: key, - value: "" + value - } as Item; - this.items.push(item); - }) + for(const key in res){ + const value = res[key]; + if(value != null){ + const item = { + label: key, + value: "" + ((typeof value == "object")? JSON.stringify(value) : value) + } as Item; + this.items.push(item); + } + } } } } diff --git a/pages/API/websocket-global/websocket-global.uvue b/pages/API/websocket-global/websocket-global.uvue index 3f751f5d..72735bc8 100644 --- a/pages/API/websocket-global/websocket-global.uvue +++ b/pages/API/websocket-global/websocket-global.uvue @@ -137,7 +137,7 @@ export default { uni.sendSocketMessage({ data: 'from ' + - platform + + this.platform + ' : ' + parseInt((Math.random() * 10000).toString()).toString(), success(res: any) { diff --git a/pages/component/long-list/detail/detail.uvue b/pages/component/long-list/detail/detail.uvue index 118d8043..ba6b92c4 100644 --- a/pages/component/long-list/detail/detail.uvue +++ b/pages/component/long-list/detail/detail.uvue @@ -17,8 +17,10 @@ content: "", } }, - onLoad(event) { - this.content = event["content"] ?? ""; + onLoad(event) { + if(event != null){ + this.content = event["content"] ?? ""; + } }, methods: { } diff --git a/pages/component/long-list/long-list.uvue b/pages/component/long-list/long-list.uvue index 4aaa0a36..66c07957 100644 --- a/pages/component/long-list/long-list.uvue +++ b/pages/component/long-list/long-list.uvue @@ -73,7 +73,7 @@ for(let i = 0; i < 100; i++){ temp = temp.concat(items); } - listData = temp; + this.listData = temp; } setTimeout(()=>{ this.refresherTriggered = false diff --git a/pages/component/scroll-view/scroll-view-refresher-props.uvue b/pages/component/scroll-view/scroll-view-refresher-props.uvue index 90e57885..6ba3ec83 100644 --- a/pages/component/scroll-view/scroll-view-refresher-props.uvue +++ b/pages/component/scroll-view/scroll-view-refresher-props.uvue @@ -54,7 +54,6 @@ - -- GitLab