Gogs vor 3 Wochen
Ursprung
Commit
9db95a536d
5 geänderte Dateien mit 76 neuen und 15 gelöschten Zeilen
  1. 32 1
      README.md
  2. 1 1
      lzma.coffee
  3. 1 1
      vue/app/pages/Events/index.coffee
  4. 2 2
      vue/app/shared/EventDetailModal/index.pug
  5. 40 10
      vue/app/temp.coffee

+ 32 - 1
README.md

@@ -1,6 +1,7 @@
 # Текущая ззадача
 
-напиши все файлы app/shared/SuccessModal
+исправь ошибку, учт, при необходимости измени, я метод реализации:
+ EventBus.$on is not a function
 
 
 # применяй правила:
@@ -68,7 +69,37 @@ app.use(VueRouter.createRouter({
 # подключаем в body ОБЯЗАТЕЛЬНО!!!
 app.mount('body')
 ```
+## определение шаблонов для слотов
+template(#body)       - не правильно
+template(v-slot:body) - правильно
 
+## определение глобальной шины событий в  app/temp.coffee
+```
+# Создаем глобальную шину событий
+class AppEventBus
+    constructor: ->
+        @events = {}
+    
+    on: (event, callback) ->
+        if !@events[event]
+            @events[event] = []
+        @events[event].push(callback)
+    
+    emit: (event, data) ->
+        if @events[event]
+            for callback in @events[event]
+                try
+                    callback(data)
+                catch error
+                    debug.log "Event bus error: " + error
+    
+    off: (event, callback) ->
+        if @events[event]
+            @events[event] = @events[event].filter (cb) -> cb != callback
+
+# Создаем глобально
+globalThis.EventBus = new AppEventBus()
+```
 
 ## Радота с кодом
 всегда приводи полный листинг файлов

+ 1 - 1
lzma.coffee

@@ -10,7 +10,7 @@ ic = ()->
        window.location.reload()
     else if  not globalThis['appReady']
        initCount++
-       setTimeout ic, 200
+       #setTimeout ic, 200
 ic()
 
 

+ 1 - 1
vue/app/pages/Events/index.coffee

@@ -207,7 +207,7 @@ module.exports =
         component: 'SuccessModal'
         props: {
           title: 'Билет забронирован!'
-          content: "Вы успешно забронировали билет на \"#{event.title}\". Подробности отправлены на вашу почту."
+          content: "Вы успешно забронировали билет на "+event.title+". Подробности отправлены на вашу почту."
         }
       })
 

+ 2 - 2
vue/app/shared/EventDetailModal/index.pug

@@ -5,7 +5,7 @@ ModalWindow(
     :contentClass="'max-w-4xl'"
     :showFooter="false"
 )
-    template(#body)
+    template([body])
         div(class="event-detail")
             div(class="grid grid-cols-1 lg:grid-cols-2 gap-8")
                 div(class="event-visual")
@@ -82,7 +82,7 @@ ModalWindow(
                                 path(stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z")
                             span В календарь
 
-    template(#footer)
+    template([footer])
         div(class="flex justify-between items-center w-full")
             div(class="social-share flex space-x-2")
                 button(

+ 40 - 10
vue/app/temp.coffee

@@ -62,6 +62,10 @@ class CouchDBService
                 category: event.category
 
 # Маршруты
+routes = [
+    { path: '/', component: require 'app/pages/Home' }
+]
+components = {}
 routes = [
     { path: '/', component: require 'app/pages/Home' }
     { path: '/events', component: require 'app/pages/Events' }
@@ -69,6 +73,17 @@ routes = [
     { path: '/contacts', component: require 'app/pages/Contacts' }
 ]
 
+components =
+        'themetoggle':      require 'app/shared/ThemeToggle'
+        'multilevelmenu':   require 'app/shared/MultiLevelMenu'
+        'imageslider':      require 'app/shared/ImageSlider'
+        'modalwindow':      require 'app/shared/ModalWindow'
+        'formvalidator':    require 'app/shared/FormValidator'
+        'filtersort':       require 'app/shared/FilterSort'
+        'eventdetailmodal': require 'app/shared/EventDetailModal'
+        'successmodal':     require 'app/shared/SuccessModal'
+
+
 # Глобальное определение vuejs приложения
 app = Vue.createApp
     name: 'app'
@@ -210,18 +225,33 @@ app = Vue.createApp
         closeModal: ->
             @modalState.currentModal = null
             @modalState.modalProps = {}
-    components:
-        'themetoggle':    require 'app/shared/ThemeToggle'
-        'multilevelmenu': require 'app/shared/MultiLevelMenu'
-        'imageslider':    require 'app/shared/ImageSlider'
-        'modalwindow':    require 'app/shared/ModalWindow'
-        'formvalidator':  require 'app/shared/FormValidator'
-        'filtersort':     require 'app/shared/FilterSort'
-        'eventdetailmodal': require 'app/shared/EventDetailModal'
-        'successmodal':   require 'app/shared/SuccessModal'
+    components: components
+
 
 # Создаем глобальную шину событий
-globalThis.EventBus = new Vue()
+class AppEventBus
+    constructor: ->
+        @events = {}
+    
+    on: (event, callback) ->
+        if !@events[event]
+            @events[event] = []
+        @events[event].push(callback)
+    
+    emit: (event, data) ->
+        if @events[event]
+            for callback in @events[event]
+                try
+                    callback(data)
+                catch error
+                    debug.log "Event bus error: " + error
+    
+    off: (event, callback) ->
+        if @events[event]
+            @events[event] = @events[event].filter (cb) -> cb != callback
+
+# Создаем глобально
+globalThis.EventBus = new AppEventBus()
 
 app.use(VueRouter.createRouter({
     routes: routes