Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. <template>
  2. <v-app style="background-color: #ffffff;">
  3. <Navigations
  4. :nav_elements="nav_elements"
  5. v-show="!loading"
  6. />
  7. <v-layout
  8. row
  9. style="margin-top: 1%; margin-left: 8%; margin-right: 8%"
  10. v-show="!loading"
  11. >
  12. <v-container
  13. class="custom-app-containers justify-center text-left display-1"
  14. >
  15. <b>{{ title }}</b>
  16. </v-container>
  17. <v-flex
  18. md3
  19. v-for="course in courses"
  20. :key="course.id"
  21. >
  22. <CourseCards :course="course"/>
  23. </v-flex>
  24. </v-layout>
  25. <Loading
  26. class="text-center"
  27. v-show="loading"
  28. />
  29. <Help
  30. :show="politics_show"
  31. />
  32. </v-app>
  33. </template>
  34.  
  35. <script>
  36. import CourseCards from "../components/courses/Card";
  37. import Loading from "../components/Loading";
  38. import CoursesValidators from "../plugins/validators/courses";
  39. import Navigations from "../components/Navigations";
  40. import logger from '../plugins/logger';
  41. import Help from "../components/courses/Help";
  42. export default {
  43. name: 'Courses',
  44. components: {Help, Loading, CourseCards, Navigations },
  45. created: async function () {
  46. this.politics_show = false;
  47. this.loading = true;
  48. this.courses = await this.$store.dispatch('getCourses');
  49. if (this.courses.length === 0) {
  50. window.location.href = 'https://fless.pro';
  51. // Если сюда добавить this.loading = false;, то будет ощущение лагов (для отладки)
  52. return;
  53. }
  54. try {
  55. CoursesValidators.multiplyCourseValidator(this.courses);
  56. } catch (e) {
  57. logger.fatalComponent(this, e);
  58. await this.$router.push('/checking');
  59. }
  60. this.loading = false;
  61. },
  62. data: () => ({
  63. title: 'Your courses',
  64. loading: true,
  65. courses: [],
  66. politics_show: null,
  67. nav_elements: [
  68. {
  69. 'icon': 'mdi-account',
  70. 'to': '/account',
  71. },
  72. {
  73. 'icon': 'mdi-exit-run',
  74. 'to': '/login',
  75. },
  76. {
  77. 'icon': 'mdi-alert-circle',
  78. 'to': '/courses',
  79. 'middleware': () => { this.politics_show = true; },
  80. },
  81. ],
  82. }),
  83. };
  84. </script>
  85.  
  86. <style>
  87. @import "../assets/css/app.css";
  88. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement