|
@@ -41,7 +41,7 @@
|
|
|
</view>
|
|
|
<view v-if="item.type === 1" class="btn">绑定设备</view>
|
|
|
</view>
|
|
|
- <view class="time">{{ item.ctime }}</view>
|
|
|
+ <view class="time">{{ formatTimestamp(item.ctime)}}</view>
|
|
|
<view class="dtl">{{ item.overview }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -71,12 +71,25 @@
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.isSys = options.isSys
|
|
|
+
|
|
|
},
|
|
|
- created() {
|
|
|
+ onShow(){
|
|
|
this.querySysMsgList()
|
|
|
this.queryDeviceMsg()
|
|
|
},
|
|
|
methods: {
|
|
|
+ formatTimestamp(timestamp, isUTC = false) {
|
|
|
+ const isSeconds = timestamp.toString().length === 10;
|
|
|
+ const date = isSeconds ? new Date(timestamp * 1000) : new Date(timestamp);
|
|
|
+
|
|
|
+ const pad = (num) => num.toString().padStart(2, '0');
|
|
|
+
|
|
|
+ if (isUTC) {
|
|
|
+ return `${date.getUTCFullYear()}-${pad(date.getUTCMonth() + 1)}-${pad(date.getUTCDate())} ${pad(date.getUTCHours())}:${pad(date.getUTCMinutes())}:${pad(date.getUTCSeconds())}`;
|
|
|
+ } else {
|
|
|
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
|
+ }
|
|
|
+ },
|
|
|
async readMessage() {
|
|
|
await request.postApi(config.API_MESSAGE_READ_MESSAGE, {
|
|
|
msg_type: 2,
|