index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="home_page">
  3. <div class="title">
  4. <span>咨询列表</span>
  5. </div>
  6. <div>
  7. <div
  8. v-for="(item, index) of 6"
  9. :key="index"
  10. class="li"
  11. >
  12. <div class="li_top">
  13. <div class="li_left">
  14. <span>标题</span>
  15. <span class="hint">作者</span>
  16. </div>
  17. <!-- <img src="@/assets/img/rightArrows.png" class="li_img" /> -->
  18. </div>
  19. <div class="text">
  20. <span>我是测试啊</span>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import { post } from "@/request/api.js";
  28. export default {
  29. data() {
  30. return {
  31. noticeList: [],
  32. page: 1,
  33. pageSize: 10, //页数
  34. totalPage: 0, //总页数
  35. loading: false,
  36. finished: false,
  37. };
  38. },
  39. methods: {
  40. //跳转
  41. init() {
  42. if (this.account) {
  43. this.getNoticeList();
  44. }
  45. },
  46. getNoticeList() {
  47. let data = {
  48. page: this.page,
  49. page_size: this.pageSize,
  50. };
  51. basicApi.noticeList(data).then((res) => {
  52. if (res.code == 200) {
  53. this.noticeList = this.noticeList.concat(res.data.list);
  54. this.totalPage = Math.ceil(res.data.total_count / this.pageSize);
  55. this.page++;
  56. this.loading = false;
  57. if (this.page > this.totalPage) return (this.finished = true);
  58. } else {
  59. this.$toast(res.msg);
  60. }
  61. });
  62. },
  63. switchovers(route, item) {
  64. if (route == "") return this.$toast(this.$t("lang.swap109"));
  65. this.$router.push({ name: route, query: { item: JSON.stringify(item) } });
  66. // this.$Router.pushPage({
  67. // name: route
  68. // })
  69. },
  70. },
  71. computed: {
  72. ...mapState(["account"]),
  73. },
  74. created() {
  75. this.init();
  76. },
  77. watch: {
  78. account() {
  79. this.init();
  80. },
  81. },
  82. };
  83. </script>
  84. <style lang="scss" scoped>
  85. .home_page {
  86. padding: 20px;
  87. }
  88. .title {
  89. color: #fff;
  90. margin: 20px 0;
  91. }
  92. .li {
  93. background: #232b3e;
  94. border-radius: 8px;
  95. padding: 10px;
  96. margin-bottom: 20px;
  97. .li_top {
  98. display: flex;
  99. justify-content: space-between;
  100. align-items: center;
  101. border-bottom: 1px solid #2a272a;
  102. padding-bottom: 10px;
  103. .li_left {
  104. display: flex;
  105. flex-direction: column;
  106. font-size: 14px;
  107. color: #fff;
  108. .hint {
  109. color: #999;
  110. font-size: 12px;
  111. margin-top: 6px;
  112. }
  113. }
  114. .li_img {
  115. width: 10px;
  116. height: 10px;
  117. }
  118. }
  119. .text {
  120. color: #999;
  121. font-size: 12px;
  122. margin-top: 10px;
  123. }
  124. }
  125. .bare {
  126. position: fixed;
  127. top: 50%;
  128. left: 50%;
  129. transform: translateX(-50%) translateY(-50%);
  130. display: flex;
  131. flex-direction: column;
  132. align-items: center;
  133. font-size: 14px;
  134. padding: 40px 0;
  135. .bare_img {
  136. width: 120px;
  137. height: 100px;
  138. margin-bottom: 8px;
  139. }
  140. }
  141. </style>