notice-list.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div class="notice-list">
  3. <div class="content">
  4. <div class="crumbs">
  5. <nuxt-link to="/" class="item-a" v-if="shopId==0">{{$t('commonHead.home')}}</nuxt-link>
  6. <nuxt-link :to="`shopIndex?sid=${shopId}&shopName=${shopName}`" class="item-a" v-else>{{shopName}}-{{$t('freeShop.storeHome')}}</nuxt-link>
  7. <span class="arrow">></span>
  8. <span class="item-span">{{shopId==0 ? $t('lanhaiHeadlines') : $t('storeAnnouncement')}}</span>
  9. </div>
  10. <div class="list">
  11. <div class="item" v-for="item in noticeList" :key="item.id" @click="goNoticeDet(item.id)">
  12. <div class="tit">{{item.title}}</div>
  13. <div class="time">{{item.publishTime}}</div>
  14. </div>
  15. </div>
  16. <div v-if="!noticeList.length" class="empty-tips base">
  17. <img src="~/assets/images/emptyPic/not-found.png" />
  18. <p>{{$t('shopInfo.noData')}}</p>
  19. </div>
  20. <!-- 页码 -->
  21. <pagination v-model="current" :pages="pages" @changePage="getNoticeList"></pagination>
  22. <!-- /页码 -->
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import Pagination from '~/components/pagination'
  28. export default {
  29. components: { Pagination },
  30. data () {
  31. return {
  32. noticeList: [], // 公告列表
  33. pages: 1, // 总页数
  34. current: this.$route.query.current || 1, // 当前页数
  35. shopId: this.$route.query.shopId || 0,
  36. shopName : this.$route.query.shopName || ''
  37. }
  38. },
  39. mounted () {
  40. document.title = this.shopId == 0 ? this.$i18n.t('lanhaiHeadlines') : this.$i18n.t('storeAnnouncement')
  41. this.getNoticeList(1)
  42. },
  43. methods: {
  44. // 获取公告列表
  45. getNoticeList (cur) {
  46. this.$axios.get('/shop/notice/noticeList/' + this.shopId, {
  47. params: {
  48. current: cur, //当前页
  49. size: 10
  50. }
  51. }).then(({ data }) => {
  52. this.noticeList = data.records
  53. this.pages = data.pages
  54. })
  55. },
  56. // 去公告详情
  57. goNoticeDet (id) {
  58. this.$router.push({
  59. path: '/notice-detail',
  60. query: {
  61. id: id,
  62. shopId: this.shopId,
  63. shopName: this.shopName
  64. }
  65. })
  66. }
  67. },
  68. }
  69. </script>
  70. <style scoped src='~/assets/css/notice-list.css'></style>