index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div>
  3. <nuxt-link to="/admin/advertising/create">
  4. <v-btn elevation="2"> Создать рекламу</v-btn>
  5. </nuxt-link>
  6. <nuxt-link to="/admin/advertising/create-section">
  7. <v-btn elevation="2"> Создать секцию</v-btn>
  8. </nuxt-link>
  9. <div v-for="section in adsList">
  10. <v-expansion-panels v-model="panel" multiple>
  11. <v-expansion-panel v-for="(adsItem, i) in section" :key="i">
  12. <v-expansion-panel-header>
  13. <span>
  14. Секция:
  15. {{ adsItem.advertising_section_display_name }}
  16. </span>
  17. <span>
  18. {{ adsItem.display_title }}
  19. </span>
  20. <span> </span>
  21. <span> </span>
  22. <v-divider vertical></v-divider>
  23. Время:
  24. {{ convertDate(adsItem.begin_showing_time) }} -
  25. {{ convertDate(adsItem.end_showing_time) }}
  26. </v-expansion-panel-header>
  27. <v-expansion-panel-content>
  28. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
  29. eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
  30. ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
  31. aliquip ex ea commodo consequat.
  32. </v-expansion-panel-content>
  33. <nuxt-link
  34. :to="{
  35. name: 'admin-advertising-adsId',
  36. params: { adsItem: adsItem, adsId: adsItem.id },
  37. }"
  38. >
  39. <v-btn tile color="success">
  40. <v-icon left> mdi-pencil </v-icon>
  41. изменить
  42. </v-btn>
  43. </nuxt-link>
  44. <v-btn tile color="warning" @click="deleteItem(adsItem)">
  45. <v-icon left> mdi-pencil </v-icon>
  46. Удалить
  47. </v-btn>
  48. <v-btn tile color="primary" @click="copy(adsItem)">
  49. <v-icon left> mdi-pencil </v-icon>
  50. копировать
  51. </v-btn>
  52. </v-expansion-panel>
  53. </v-expansion-panels>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. adsList: "",
  62. sectionsList: ''
  63. }
  64. },
  65. layout: "admin",
  66. mounted() {
  67. this.$axios.$post("/authorized/admin/advertising/list")
  68. .then((res) => {
  69. console.log(res.data);
  70. this.adsList = res.data;
  71. return res.data;
  72. });
  73. this.$axios.$get("/advertising/sections/all")
  74. .then((res) => {
  75. console.log(res.data);
  76. this.sectionsList = res.data;
  77. return res.data;
  78. });
  79. },
  80. methods: {
  81. convertDate(dateTampstamp) {
  82. const date = new Date(dateTampstamp * 1000);
  83. const dateString =
  84. ("0" + date.getDate()).slice(-2) +
  85. "." +
  86. ("0" + (date.getMonth() + 1)).slice(-2) +
  87. "." +
  88. date.getFullYear() +
  89. " " +
  90. ("0" + date.getHours()).slice(-2) +
  91. ":" +
  92. ("0" + date.getMinutes()).slice(-2);
  93. return dateString;
  94. },
  95. deteleItem(item) {
  96. this.$axios.post("authorized/admin/advertising/delete", { id: item.id });
  97. },
  98. },
  99. };
  100. </script>
  101. <style>
  102. </style>