index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div class="admin_search">
  3. <div>
  4. <h2>Поиск</h2>
  5. <v-row>
  6. <form class="row" @submit.prevent>
  7. <v-text-field @keyup.enter="searchTrigger" label="Введите чтобы начать поиск" v-model="string">
  8. </v-text-field>
  9. <v-btn @click="searchTrigger">Поиск</v-btn>
  10. </form>
  11. </v-row>
  12. <v-expansion-panels multiple v-if="searchList">
  13. <v-expansion-panel v-for="news in searchList.data" :key="news.id">
  14. <v-expansion-panel-header>
  15. <v-col cols="6">
  16. <b v-html="news.title"></b>
  17. </v-col>
  18. <v-col cols="1">
  19. <!--Категория:-->
  20. {{ news.category_for_admin ? news.category_for_admin.title : '' }}
  21. </v-col>
  22. <v-col cols="2">
  23. <!--Время:--> {{ news.start_activity}}
  24. </v-col>
  25. <v-col cols="3">
  26. <v-btn link tile color="success" :to="{name: 'admin-publications-id', params: { id: news.id}}">
  27. <v-icon left> mdi-pencil </v-icon>
  28. <!--изменить-->
  29. </v-btn>
  30. <v-btn tile color="error" @click="deleteNews(news.id)">
  31. <v-icon left> mdi-delete-outline </v-icon>
  32. <!--удалить-->
  33. </v-btn>
  34. <v-btn tile color="primary" @click="copy(news)">
  35. <v-icon left> mdi-content-copy </v-icon>
  36. инжект
  37. </v-btn>
  38. </v-col>
  39. </v-expansion-panel-header>
  40. <v-expansion-panel-content v-html="news.text" class="text" max-width="500">
  41. </v-expansion-panel-content>
  42. </v-expansion-panel> <v-pagination
  43. v-model="counter"
  44. :length="Math.floor(searchList.total/40)"
  45. ref="pagination"
  46. @input="searchTrigger"
  47. :next-icon="'>'"
  48. :prev-icon="'<'"
  49. :next-aria-label="'next-text'"
  50. :prev-aria-label="'prev-text'"
  51. :page-aria-label="'page-text'"
  52. :current-page-aria-label="'current-page'"
  53. total-visible="10"
  54. ></v-pagination>
  55. </v-expansion-panels>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. export default {
  61. layout: "admin",
  62. data() {
  63. return {
  64. string: "",
  65. searchList: [],
  66. counter: 1
  67. };
  68. },
  69. methods :{
  70. searchTrigger() {
  71. this.$axios
  72. .get("admin/news/search/" + this.string + '/page_' + this.counter)
  73. .then((res) => {
  74. this.searchList = res.data.data;
  75. return res
  76. });
  77. },
  78. copy(item) {
  79. let res = "##news_" + item.id + "##";
  80. this.$clipboard(res);
  81. },
  82. }
  83. };
  84. </script>
  85. <style lang="less">
  86. .admin_search{
  87. padding: 40px;
  88. form{
  89. margin: 20px 10px;
  90. input{
  91. margin: 0;
  92. border: 0;
  93. height: auto;
  94. }
  95. }
  96. }
  97. </style>