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.

80 lines
1.4 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. let day = (new Date().getDay() || 1)
  35. if (new Date().getHours() > 15) {
  36. // show next day
  37. ++day
  38. }
  39. this.$router.push('' + day)
  40. }
  41. this.loadMeals()
  42. }
  43. },
  44. methods: {
  45. loadMeals () {
  46. fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`)
  47. .then(res => res.json())
  48. .then(menu => {
  49. this.meals = menu.meals
  50. this.date = menu.date
  51. })
  52. }
  53. },
  54. created () {
  55. this.$router.replace(`/zentralmensa/${new Date().getDay() || 1}`)
  56. this.loadMeals()
  57. }
  58. }
  59. </script>
  60. <style>
  61. .meal{
  62. margin: 2em 0;
  63. }
  64. .meal>h3{
  65. margin-bottom:0em;
  66. }
  67. .meal>p{
  68. margin-top: 0.4em;
  69. }
  70. #date{
  71. margin-bottom: -1em;
  72. }
  73. .mensa{
  74. margin-bottom: 3em;
  75. }
  76. </style>