Speiseplan der Mensen der Georg-August-Universität Göttingen https://mensa.schneider-hosting.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.3 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <template>
  2. <div class="mensa">
  3. <h3 id="date">{{date}}</h3>
  4. <div class="meal" v-for="meal in meals">
  5. <h3>{{meal.category}}</h3>
  6. <p>{{meal.title}}</p>
  7. </div>
  8. </div>
  9. </template>
  10. <script>
  11. export default {
  12. name: 'mensa',
  13. data () {
  14. return {
  15. meals: [],
  16. date: '',
  17. days: [1, 2, 3, 4, 5, 6],
  18. dayOfWeek: {
  19. 1: 'Montag',
  20. 2: 'Dienstag',
  21. 3: 'Mittwoch',
  22. 4: 'Donnerstag',
  23. 5: 'Freitag',
  24. 6: 'Samstag'
  25. }
  26. }
  27. },
  28. watch: {
  29. '$route': function () {
  30. if (!this.$route.fullPath.endsWith('/')) {
  31. this.$router.replace(this.$route.fullPath + '/')
  32. }
  33. if (!this.$route.params.tag) {
  34. this.$router.push('' + (new Date().getDay() || 1))
  35. }
  36. this.loadMeals()
  37. }
  38. },
  39. methods: {
  40. loadMeals () {
  41. fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`)
  42. .then(res => res.json())
  43. .then(menu => {
  44. this.meals = menu.meals
  45. this.date = menu.date
  46. })
  47. }
  48. },
  49. created () {
  50. this.$router.replace(`/zentralmensa/${new Date().getDay() || 1}`)
  51. this.loadMeals()
  52. }
  53. }
  54. </script>
  55. <style>
  56. .meal{
  57. margin: 2em 0;
  58. }
  59. .meal>h3{
  60. margin-bottom:0em;
  61. }
  62. .meal>p{
  63. margin-top: 0.4em;
  64. }
  65. #date{
  66. margin-bottom: -1em;
  67. }
  68. .mensa{
  69. margin-bottom: 3em;
  70. }
  71. </style>