update_notice.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="box boxMinHeight">
  3. <PageHeadTwo title="系统通知列表"></PageHeadTwo>
  4. <div class="main flex-box">
  5. <div class="main-left scroll-bar">
  6. <el-tree
  7. v-show="announcement.length != 0"
  8. ref="tree"
  9. :data="announcement"
  10. :props="defaultProps"
  11. node-key="id"
  12. @node-click="dept_click"
  13. :expand-on-click-node="false"
  14. :highlight-current="true"
  15. class="cate-tree"
  16. ></el-tree>
  17. <noData v-show="announcement.length == 0" content="暂无数据" imgW="120px" imgH="80px"></noData>
  18. </div>
  19. <div class="main-right flex-1" v-loading="noticeLoad">
  20. <div class="title">
  21. <span class="fontColorC" style="position: absolute;">{{aAtripOfDetails.publish_time}}</span>
  22. <div style="font-size: 18px;padding-right: 10px;text-align: center;">{{ aAtripOfDetails.title}}</div>
  23. </div>
  24. <div class="RuleRight scroll-bar">
  25. <div v-html="html"></div>
  26. <NoData v-if="!html"></NoData>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import PageHeadTwo from '@/components/PageHeadTwo';
  34. export default {
  35. name: 'update_notice',
  36. components: { PageHeadTwo },
  37. data() {
  38. return {
  39. id:0,
  40. announcement: [],
  41. noticeLoad: false,
  42. defaultProps: {
  43. label: 'title'
  44. },
  45. aAtripOfDetails:{},
  46. html:'',
  47. };
  48. },
  49. created() {
  50. if(this.$route.query.id){
  51. this.id=this.$route.query.id;
  52. }
  53. this.noticeList();
  54. },
  55. methods: {
  56. noticeList() {
  57. this.noticeLoad = true;
  58. let params = {page:1,page_size:2000,type:0};
  59. this.$axiosUser('get', 'api/pro/announcement/list',params).then(res => {
  60. if (res.data.code == 1) {
  61. let list = res.data.data.list;
  62. this.announcement = list;
  63. this.$nextTick(() => {
  64. if(!this.id&&list[0]) {
  65. this.id = list[0].id;
  66. }
  67. this.$refs.tree.setCurrentKey(this.id);
  68. this.noticeDetails();
  69. });
  70. }
  71. }).finally(() => {
  72. this.noticeLoad = false;
  73. });
  74. },
  75. noticeDetails() {
  76. if(!this.id){
  77. return false
  78. }
  79. this.html='';
  80. this.noticeLoad = true;
  81. this.$axiosUser('get', '/api/pro/announcement/info', { announcement_id: this.id }).then(res => {
  82. this.aAtripOfDetails = res.data.data;
  83. this.html = res.data.data.focus + res.data.data.update_msg;
  84. }).finally(() => {
  85. this.noticeLoad = false;
  86. });
  87. },
  88. dept_click(item) {
  89. this.id = item.id;
  90. setTimeout(() => {
  91. this.noticeDetails();
  92. }, 500);
  93. }
  94. }
  95. };
  96. </script>
  97. <style scoped lang="scss">
  98. .title {
  99. background-color: #fff;
  100. height: 56px;
  101. line-height: 56px;
  102. border-bottom: 1px solid #f1f1f1;
  103. }
  104. .RuleRight {
  105. height: 690px;
  106. overflow-y: auto;
  107. }
  108. ::v-deep .el-tree-node__label {
  109. display: inline-block;
  110. width: 160px;
  111. overflow: hidden;
  112. text-overflow: ellipsis;
  113. white-space: nowrap;
  114. }
  115. ::v-deep .el-tree--highlight-current {
  116. .el-tree-node {
  117. border-bottom: 1px #f0f0f0 solid;
  118. }
  119. .el-tree-node__content {
  120. background-color: #fff;
  121. height: 56px;
  122. line-height: 56px;
  123. }
  124. .is-current {
  125. .el-tree-node__content {
  126. .el-icon-caret-right {
  127. // color:#409EFF !important;
  128. }
  129. .el-tree-node__label {
  130. color: #409EFF !important;
  131. }
  132. }
  133. .el-tree-node__children {
  134. .el-icon-caret-right {
  135. color: #c0c4cc !important;
  136. }
  137. .el-tree-node__label {
  138. color: #606266 !important;
  139. }
  140. }
  141. }
  142. }
  143. .tabs ::v-deep.el-badge__content.is-fixed {
  144. position: absolute;
  145. top: 50%;
  146. right: -2px;
  147. }
  148. .box {
  149. padding: 20px;
  150. font-size: 14px;
  151. position: relative;
  152. background-color: #fff;
  153. }
  154. .main {
  155. margin-top: 40px;
  156. }
  157. /* bug: 我在flex布局的元素中使用了elementui的table组件,饿了么的table上会被加一个动态的宽度, 当第一次改变flex元素宽度的时候。table的动态宽度会变化,第二次和以后就不会变化了。*/
  158. /* 给使用flex的元素加上 overflow-x:hidden */
  159. .main-right {
  160. margin-left: 20px;
  161. overflow-x: hidden;
  162. }
  163. .main-left {
  164. width: 200px;
  165. border-radius: 3px;
  166. box-sizing: border-box;
  167. // padding-right: 20px;
  168. max-height: 700px;
  169. overflow: auto;
  170. }
  171. .main-left::after {
  172. position: absolute;
  173. content: '';
  174. width: 1px;
  175. height: auto;
  176. left: 220px;
  177. top: 0;
  178. bottom: 0;
  179. background-color: #f1f1f1;
  180. }
  181. ::v-deep .has-gutter {
  182. display: none;
  183. }
  184. .li {
  185. height: 53px;
  186. line-height: 53px;
  187. padding: 0 20px;
  188. border-bottom: 1px solid #f1f1f1;
  189. color: #777777;
  190. width: 100%;
  191. }
  192. .li:hover {
  193. background-color: #f5f7fa;
  194. }
  195. .li:hover .el-icon-more {
  196. display: block;
  197. }
  198. .index-name {
  199. width: 170px;
  200. }
  201. .ul {
  202. max-height: calc(100vh - 230px);
  203. overflow: auto;
  204. width: 200px;
  205. }
  206. .isActiveLi {
  207. background-color: #f5f7fa;
  208. color: #409EFF !important;
  209. position: relative;
  210. }
  211. .isActiveLi::after {
  212. width: 3px;
  213. content: ' ';
  214. background-color: #409EFF;
  215. left: 0;
  216. bottom: 0;
  217. top: 0;
  218. position: absolute;
  219. }
  220. .item {
  221. font-size: 14px;
  222. cursor: pointer;
  223. padding: 8px;
  224. border-bottom: 1px solid #e8e8e8;
  225. }
  226. .item:hover {
  227. background-color: #f5f7fa;
  228. }
  229. .content {
  230. padding: 0 10px;
  231. }
  232. </style>