agency.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div class="full-width flex flex-col">
  3. <div class="bold font-16 full-width text-left mb-10">{{ title }}</div>
  4. <el-empty
  5. v-if="agencyList && agencyList.length === 0"
  6. description="暂无数据"
  7. />
  8. <div
  9. v-else
  10. class="flex flex-center flex-justify-between mt-10 pointer"
  11. v-for="item in agencyList"
  12. @click="open(item)"
  13. >
  14. <div class="main-color">{{ item.content }}</div>
  15. <div class="flex flex-center">
  16. <span class="mr-20 grey-9 font-13">{{ item.createTime }}</span>
  17. <div v-if="item.isRead === 0" class="no-read"></div>
  18. <div v-else class="read"></div>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. name: 'agency',
  26. props: {
  27. type: {
  28. type: Number,
  29. default: 1
  30. }
  31. },
  32. watch: {
  33. type: {
  34. handler(val) {
  35. if (val === 2) {
  36. this.title = '内容更新'
  37. }
  38. },
  39. immediate: true
  40. }
  41. },
  42. data() {
  43. return {
  44. title: '代办事项',
  45. params: {
  46. current: 1,
  47. size: 10,
  48. isRead: 0
  49. },
  50. agencyList: []
  51. }
  52. },
  53. created() {
  54. this.getAgencyList()
  55. },
  56. methods: {
  57. getAgencyList() {
  58. if (this.type === 1) {
  59. this.$api.dash.agencyList(this.params).then(res => {
  60. if (res.code === 200) {
  61. this.agencyList = res.data.records
  62. } else {
  63. this.$message.error(res.msg)
  64. }
  65. })
  66. } else {
  67. this.$api.dash.newInfoList(this.params).then(res => {
  68. if (res.code === 200) {
  69. this.agencyList = res.data.records
  70. } else {
  71. this.$message.error(res.msg)
  72. }
  73. })
  74. }
  75. },
  76. open(item) {
  77. this.$api.dash.messageDetail({ id: item.id }).then(res => {
  78. if (res.code === 200) {
  79. this.$router.push({
  80. path: item.openUrl
  81. })
  82. } else {
  83. this.$message.error(res.msg)
  84. }
  85. })
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .read {
  92. background: white;
  93. border-radius: 10px;
  94. width: 9px;
  95. height: 9px;
  96. margin-left: -12px;
  97. }
  98. .no-read {
  99. background: #b64b33;
  100. border-radius: 10px;
  101. width: 9px;
  102. height: 9px;
  103. margin-left: -12px;
  104. }
  105. </style>