fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<template>
  <div class="msg-Notification-style">
    <div v-for="(item,index) in list" :key="index" class="item">
      <div class="item-left" @click="viewMsgInfo(item)">
        <div class="title-style">
          <span>{{item.title}}</span>
          <el-tag :type="item.readFlag === '0' ? 'success' : 'info'" size="small" class="tag">
            {{item.readFlag === '0' ? '未读' : '已读'}}
          </el-tag>
        </div>
        <div v-if="item.sendTime" class="time-style">
          <span>{{item.sendTime}}</span>
        </div>
        <div class="info-style">{{item.content}}</div>
      </div>
      <div @click="delMsg(item.id)" class="item-right">
        <i class="el-icon-delete"></i>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  name: "msgNotificationModule",
  props: {
    list: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    return {}
  },
  methods: {
    delMsg(id) {
      this.$confirm('删除后无法恢复,确认要删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$emit("del", id)
      }).catch(() => {
        //取消删除
      });
    },
    viewMsgInfo(item) {
      this.$emit("clickInfo", item)
    }
  }
}
</script>
 
<style lang="scss">
.msg-Notification-style {
  .item {
    padding: 12px 10px;
    border-bottom: 1px solid #ebeef5;
    cursor: pointer;
    position: relative;
    .item-right {
      position: absolute;
      top: 13px;
      font-size: 16px;
      color: #909399;
      width: 30px;
      text-align: right;
    }
    .item-left {
      width: calc(100% - 30px);
    }
    .item-left,
    .item-right {
      display: inline-block;
    }
    .read-style {
      .title-style,
      .time-style,
      .info-style {
        color: #999 !important;
      }
    }
    .title-style {
      font-size: 15px;
      font-weight: bold;
      position: relative;
    }
    .time-style {
      color: #999;
      font-size: 13px;
    }
    .info-style {
      color: #666;
      font-size: 14px;
    }
    .time-style,
    .title-style {
      margin-bottom: 8px;
    }
  }
  .item:last-child {
    border-bottom: none;
  }
  .tag {
    margin-left: 10px;
    position: relative;
    bottom: 0;
  }
}
</style>