index.vue.bak 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="m-right-block fr mh576" style="position: relative;">
  3. <div class="right-block-bd">
  4. <div class="right mh500 mt30" v-if="isPost">
  5. <div class="tr">
  6. <a class="ui-btn btn-gr btn-m" @click="isPost=false">
  7. 返回</a>
  8. </div>
  9. <div class="m-notice-detail ">
  10. <p class="fs18 tc bor-b mb30 pb20 pt20 b rel ng-binding">
  11. {{info.title}}
  12. </p>
  13. <p class="notice-info tc ng-binding">
  14. 发布时间:{{info.publishTime}}
  15. <span class="ml30 ng-binding">来源:{{info.author}}</span>
  16. <span class="ml30 ng-binding">阅读数:{{info.viewCount}}</span>
  17. </p>
  18. <span v-html="info.content"></span>
  19. </div>
  20. </div>
  21. <div v-else class="ng-scope">
  22. <div class="m-account">
  23. <div class="account-tit">
  24. <a @click="type='交流互动'" :class="{'current':type=='交流互动'}" href="javascript:void(0)">交流互动</a>
  25. <a @click="type='常见问题'" :class="{'current':type=='常见问题'}" href="javascript:void(0)">常见问题</a>
  26. </div>
  27. </div>
  28. <ul class="m-notice ng-scope" v-for="item in list" :key="item.postId">
  29. <li class="done">
  30. <span class="p-ico2" style="top: -2px"></span>
  31. <a href="javascript:void(0)" @click="gotoDetail(item.postId)" class="ng-binding">
  32. {{item.title}}
  33. </a>
  34. <span class="time ng-binding">{{item.publishTime|dateformat}}</span>
  35. </li>
  36. </ul>
  37. <el-pagination
  38. @current-change="handleCurrentChange"
  39. :current-page="page"
  40. :page-size="size"
  41. layout="total, prev, pager, next"
  42. class="m-pages"
  43. :total="total">
  44. </el-pagination>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import {httpServer} from "@/components/httpServer/httpServer.js";
  51. import {parseTime} from "@/utils/index.js";
  52. export default {
  53. name: 'cert',
  54. data() {
  55. return {
  56. page: 1, //初始页
  57. size: 10, // 每页的数据
  58. type:'通知',
  59. isPost:false,
  60. info:{},
  61. list: [],
  62. total: 0,
  63. listLoading: true
  64. }
  65. },
  66. filters:{
  67. dateformat(val){
  68. return parseTime( +new Date(val), '{y}-{m}-{d}')
  69. }
  70. },
  71. beforeMount() {
  72. this.getList()
  73. },
  74. watch: {
  75. type(res) {
  76. this.currentPage = 1
  77. this.getList()
  78. }
  79. },
  80. methods: {
  81. getList() {
  82. this.listLoading = true
  83. let page = this.page
  84. let type= this.type
  85. httpServer("Course.getPostList", {page,type }).then( ({data, code}) => {
  86. let { total, list } = data
  87. if (!list) list = [];
  88. this.list = list.map(v => {
  89. this.$set(v, 'edit', false)
  90. return v
  91. })
  92. this.total = total || 0;
  93. this.listLoading = false
  94. })
  95. },
  96. gotoDetail(postId) {
  97. httpServer("Course.getPostInfo", {postId}).then(({
  98. data,
  99. code
  100. }) => {
  101. this.info = data
  102. this.isPost = true
  103. this.listLoading = false
  104. })
  105. },
  106. handleCurrentChange: function(currentPage) {
  107. this.page = currentPage;
  108. this.getList()
  109. }
  110. }
  111. }
  112. </script>
  113. <style>
  114. @import url("./index.css");
  115. @import url("../../../assets/css/m-account.css");
  116. @import url("../../../assets/css/m-notice.css");
  117. </style>