detailPage.nvue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="media-item view" @click="click">
  3. <view class="list">
  4. <view class="left" :style="{background:newsItem.alarmLevel == 0 ?'#0581FD' :newsItem.alarmLevel == 1 ? '#EDC436':newsItem.alarmLevel == 2 ? '#EA78B7' :'#E55959'}">
  5. <text class="icon" :style="{background:newsItem.alarmLevel == 0 ?'#0581FD' :newsItem.alarmLevel == 1 ? '#EDC436':newsItem.alarmLevel == 2 ? '#EA78B7' :'#E55959'}">&#xe607;</text>
  6. </view>
  7. <view class="right">
  8. <text class="title">{{newsItem.alarmType | alarmType}}</text>
  9. <text class="color3">[{{newsItem.alarmFor}}]{{newsItem.discernResult}}</text>
  10. <text class="color9">{{newsItem.createTime}}</text>
  11. </view>
  12. <uni-badge v-if="newsItem.readFlag == 0" class="r-abdge" :custom-style="{background:'#EE0303'}" :is-dot="true" text="1">
  13. </uni-badge>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. var domModule = weex.requireModule('dom');
  19. domModule.addRule('fontFace', {
  20. 'fontFamily': "iconfont",
  21. 'src': "url('/static/iconfont.ttf')"
  22. })
  23. export default {
  24. props: {
  25. newsItem: {
  26. type: Object,
  27. default: function(e) {
  28. return {
  29. title: 1
  30. }
  31. }
  32. },
  33. type: {
  34. type: [Number, String],
  35. default: ''
  36. },
  37. },
  38. filters:{
  39. alarmType(val){
  40. return val == 1 ? '设备异常告警信息' :val == 2 ?'环境异常告警信息': val == 3 ? '机器人异常告警信息' :'其他告警信息'
  41. }
  42. },
  43. methods: {
  44. click() {
  45. this.$emit('click');
  46. },
  47. close(e) {
  48. e.stopPropagation();
  49. this.$emit('close');
  50. }
  51. }
  52. }
  53. </script>
  54. <style scoped lang="scss">
  55. .icon {
  56. font-family: iconfont;
  57. font-size: 26px;
  58. color: #fff;
  59. }
  60. .media-item {
  61. .list {
  62. margin: 0rpx 0 0rpx 0;
  63. background: #fff;
  64. border-bottom:1px solid #E5E5E5;
  65. height: 180rpx;
  66. align-items: center;
  67. padding: 0 30rpx;
  68. flex-direction: row;
  69. position: relative;
  70. .r-abdge{
  71. position: absolute;
  72. right: 20rpx;
  73. color: #EE0303;
  74. top: 30rpx;
  75. }
  76. .left{
  77. width: 91rpx;
  78. height: 91rpx;
  79. background: #0581FD;
  80. border-radius: 91rpx;
  81. align-items: center;
  82. justify-content: center;
  83. }
  84. .right{
  85. margin-left: 22rpx;
  86. word-wrap: anywhere;
  87. .title{
  88. font-size: 32rpx;
  89. color: #000000;
  90. font-weight: bold;
  91. }
  92. .color3 {
  93. color: #666;
  94. overflow: hidden;
  95. lines:1;
  96. word-break: break-all;
  97. padding:5px 0;
  98. word-wrap: anywhere;
  99. text-overflow: ellipsis;
  100. font-size: 30rpx;
  101. }
  102. .color9 {
  103. color: #8E8E8E;
  104. font-size: 22rpx;
  105. }
  106. }
  107. }
  108. }
  109. </style>