|
@@ -24,84 +24,112 @@
|
|
|
style="display: flex;align-items: center;justify-content: center;height: 80vh;">
|
|
|
您还没有设备消息
|
|
|
</view>
|
|
|
-
|
|
|
- <view v-if="isSys==='1' && sysMsgList.length > 0 " style="margin-top: 20rpx;" class="sys-msg-wrap base-wrap" >
|
|
|
- <view class="title">{{ $t('系统消息') }}</view>
|
|
|
-
|
|
|
- <view class="msg-item" v-for="(item, index) in sysMsgList" :key="index" @tap="toSystemMsgPage(item)">
|
|
|
- <view class="msg">
|
|
|
- {{ item.title }}
|
|
|
- <view v-if="item.type === 1" class="btn">绑定设备</view>
|
|
|
- </view>
|
|
|
- <view class="time">{{ item.ctime }}</view>
|
|
|
- <view class="dtl">{{ item.overview }}</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view v-if="isSys==='1' && sysMsgList.length === 0 " style="display: flex;align-items: center;justify-content: center;height: 80vh;">
|
|
|
+
|
|
|
+ <view v-if="isSys==='1' && sysMsgList.length > 0 " style="margin-top: 20rpx;" class="sys-msg-wrap base-wrap">
|
|
|
+
|
|
|
+ <view class="row">
|
|
|
+ <view class="title" style="display: flex;">
|
|
|
+ <view>{{ $t('系统消息') }}</view>
|
|
|
+ <view v-if="unreadCount > 0" class="bage">{{ unreadCount }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view @click="gotoDetail(item)" class="msg-item" v-for="(item, index) in sysMsgList" :key="index">
|
|
|
+ <view class="msg">
|
|
|
+ <view class="flex">
|
|
|
+ <view v-if="item.read === '0'" class="dot"></view>
|
|
|
+ {{ item.title }}
|
|
|
+ </view>
|
|
|
+ <view v-if="item.type === 1" class="btn">绑定设备</view>
|
|
|
+ </view>
|
|
|
+ <view class="time">{{ item.ctime }}</view>
|
|
|
+ <view class="dtl">{{ item.overview }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view v-if="isSys==='1' && sysMsgList.length === 0 "
|
|
|
+ style="display: flex;align-items: center;justify-content: center;height: 80vh;">
|
|
|
您还没有系统消息
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-const config = require('@/common/config.js');
|
|
|
-const http = require('@/common/http.js');
|
|
|
-const request = require('@/common/request.js');
|
|
|
-const common = require('@/common/common.js');
|
|
|
-export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- value: 10,
|
|
|
- sysMsgList: [],
|
|
|
- deviceList: [],
|
|
|
- deviceInfo: {},
|
|
|
- isSys:'1'
|
|
|
- }
|
|
|
- },
|
|
|
- onLoad(options){
|
|
|
- this.isSys = options.isSys || '0'
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.querySysMsgList()
|
|
|
- this.queryDeviceMsg()
|
|
|
- this.readMessage()
|
|
|
- },
|
|
|
- methods: {
|
|
|
- async readMessage(){
|
|
|
- await request.postApi(config.API_MESSAGE_READ_MESSAGE,{msg_type:2,car_id:0})
|
|
|
+ const config = require('@/common/config.js');
|
|
|
+ const http = require('@/common/http.js');
|
|
|
+ const request = require('@/common/request.js');
|
|
|
+ const common = require('@/common/common.js');
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ value: 10,
|
|
|
+ sysMsgList: [],
|
|
|
+ deviceList: [],
|
|
|
+ deviceInfo: {},
|
|
|
+ isSys: '1',
|
|
|
+ unreadCount: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.isSys = options.isSys
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.querySysMsgList()
|
|
|
+ this.queryDeviceMsg()
|
|
|
+ // this.readMessage()
|
|
|
},
|
|
|
- toDeviceMsgPage(itemData) {
|
|
|
- const { id } = itemData
|
|
|
- uni.navigateTo({ url: `/pages/message/deviceInfo?car_id=${car_id}` })
|
|
|
- },
|
|
|
- toSystemMsgPage(itemData) {
|
|
|
- const { id } = itemData
|
|
|
- uni.navigateTo({ url: `/pages/message/systemInfo?id=${id}` })
|
|
|
- },
|
|
|
- queryDeviceMsg() {
|
|
|
- http.postApi(config.API_DEVICE_MSG, {}, res => {
|
|
|
- if (res.succeed) {
|
|
|
- this.deviceList = res.body.data
|
|
|
- this.deviceList.map(item => {
|
|
|
- item.message_date = common.formatTime(item.message_date)
|
|
|
- item.image = item.image.split(',')[0]
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- querySysMsgList() {
|
|
|
- http.postApi(config.API_MESSAGE_LIST, { msg_type: 'PLAT' }, res => {
|
|
|
- if (res.succeed) {
|
|
|
- this.sysMsgList= res.body.data.list
|
|
|
- this.sysMsgList.map(item => {
|
|
|
- item.ctime = common.formatTime(item.ctime)
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ methods: {
|
|
|
+ async readMessage() {
|
|
|
+ await request.postApi(config.API_MESSAGE_READ_MESSAGE, {
|
|
|
+ msg_type: 2,
|
|
|
+ car_id: 0
|
|
|
+ })
|
|
|
+ },
|
|
|
+ gotoDetail(item) {
|
|
|
+ request.postApi(config.API_MESSAGE_READ_MESSAGE, {
|
|
|
+ msg_type: 2,
|
|
|
+ msg_id: item.plat_msg_id,
|
|
|
+ car_id: ''
|
|
|
+ })
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/message/detail?id=${item.plat_msg_id}`
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toDeviceMsgPage(item) {
|
|
|
+ request.postApi(config.API_MESSAGE_READ_MESSAGE, {
|
|
|
+ msg_type: 1,
|
|
|
+ car_id: item.car_id
|
|
|
+ })
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/message/detail?id=${item.car_id}`
|
|
|
+ })
|
|
|
+ },
|
|
|
+ queryDeviceMsg() {
|
|
|
+ http.postApi(config.API_DEVICE_MSG, {}, res => {
|
|
|
+ if (res.succeed) {
|
|
|
+ this.deviceList = res.body.data
|
|
|
+ this.deviceList.map(item => {
|
|
|
+ item.message_date = common.formatTime(item.message_date)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ querySysMsgList() {
|
|
|
+ http.postApi(config.API_MESSAGE_LIST, {
|
|
|
+ msg_type: 'PLAT'
|
|
|
+ }, res => {
|
|
|
+ if (res.succeed) {
|
|
|
+ this.sysMsgList = res.body.data.list
|
|
|
+ this.sysMsgList.map(item => {
|
|
|
+ item.ctime = common.formatTime(item.ctime)
|
|
|
+ })
|
|
|
+ this.unreadCount = this.sysMsgList.filter(item => item.read === "0").length;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|