shared-ritm 1.0.27 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ import ApiService from '@/api/settings/ApiService';
2
+ type LoginResponse = {
3
+ token: string;
4
+ user: any;
5
+ };
6
+ declare class AuthService extends ApiService {
7
+ login(email: string, password: string): Promise<LoginResponse>;
8
+ logout(): Promise<LoginResponse>;
9
+ configs(): Promise<any>;
10
+ }
11
+ export default function useAuthService(): AuthService;
12
+ export {};
@@ -15,7 +15,7 @@ export default class ApiService {
15
15
  constructor();
16
16
  private getToken;
17
17
  private removeToken;
18
- private logout;
18
+ logout(): void;
19
19
  private handleError;
20
20
  protected get<T>(url: string, options?: AxiosRequestConfig): Promise<T>;
21
21
  protected delete<T>(url: string, options?: AxiosRequestConfig): Promise<AxiosResponse<T, any>>;
@@ -7,12 +7,13 @@ import AppSelect from '@/common/app-select/AppSelect.vue';
7
7
  import AppWrapper from '@/common/app-wrapper/AppWrapper.vue';
8
8
  import AppSidebar from '@/common/app-sidebar/AppSidebar.vue';
9
9
  import AppLayoutHeader from '@/common/app-layout/components/AppLayoutHeader.vue';
10
+ import AppLoader from '@/common/app-loader/index.vue';
10
11
  import useGanttService from '@/api/services/GanttService';
11
12
  import useMetricsService from '@/api/services/MetricsService';
12
13
  import useProjectsService from '@/api/services/ProjectsService';
13
14
  import useRepairsService from '@/api/services/RepairsService';
14
15
  import useTasksService from '@/api/services/TasksService';
15
- export { AppButton, AppInput, AppToggle, AppInputSearch, AppLayout, AppSelect, AppWrapper, AppSidebar, AppLayoutHeader };
16
+ export { AppButton, AppInput, AppToggle, AppInputSearch, AppLayout, AppSelect, AppWrapper, AppSidebar, AppLayoutHeader, AppLoader, };
16
17
  export { useGanttService, useMetricsService, useProjectsService, useRepairsService, useTasksService };
17
18
  export * from '@/api/types/Api_Repairs';
18
19
  export * from '@/api/types/Api_Tasks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared-ritm",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -0,0 +1,37 @@
1
+ import ApiService from '@/api/settings/ApiService'
2
+
3
+ type LoginPayload = {
4
+ email: string
5
+ password: string
6
+ }
7
+
8
+ type LoginResponse = {
9
+ token: string
10
+ user: any
11
+ }
12
+
13
+ type ConfigResponse = any
14
+
15
+ class AuthService extends ApiService {
16
+ public login(email: string, password: string) {
17
+ return this.post<LoginPayload, LoginResponse>(`/login`, {
18
+ email,
19
+ password,
20
+ })
21
+ }
22
+
23
+ public logout() {
24
+ return this.post<null, LoginResponse>(`/logout`, null)
25
+ }
26
+
27
+ public configs() {
28
+ return this.get<ConfigResponse>(`/configs`)
29
+ }
30
+ }
31
+
32
+ let api: AuthService
33
+
34
+ export default function useAuthService() {
35
+ if (!api) api = new AuthService()
36
+ return api
37
+ }
@@ -57,7 +57,7 @@ export default class ApiService {
57
57
  localStorage.removeItem('token')
58
58
  }
59
59
 
60
- private logout(): void {
60
+ public logout(): void {
61
61
  this.removeToken()
62
62
  window.location.href = '/sign-in'
63
63
  }
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <div :class="{ 'loader-backdrop': backdrop && loading }">
3
+ <q-spinner v-if="loading" :size="size" class="loader-spinner" :thickness="thickness" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ interface Props {
9
+ backdrop: boolean
10
+ loading: boolean
11
+ thickness: number
12
+ size: string
13
+ }
14
+ const props = withDefaults(defineProps<Props>(), {
15
+ backdrop: false,
16
+ loading: false,
17
+ thickness: 2,
18
+ size: 'md',
19
+ })
20
+
21
+ // <app-loader :loading="logged" :backdrop="true" />
22
+ </script>
23
+
24
+ <style scoped lang="scss">
25
+ .loader {
26
+ &-backdrop {
27
+ width: 100%;
28
+ height: 100%;
29
+ background-color: rgba(255, 255, 255, 0.45);
30
+ position: absolute;
31
+ z-index: 9999;
32
+ }
33
+ &-spinner {
34
+ position: absolute;
35
+ color: #3f8cff;
36
+ top: 50%;
37
+ left: 48%;
38
+ z-index: 2;
39
+ }
40
+ }
41
+ </style>
@@ -1,122 +1,122 @@
1
- <template lang="pug">
2
- q-page#content(:class="$style['page-container']")
3
- q-toolbar(:class="$style['toolbar']")
4
- q-toolbar-title(:class="$style.title") {{ title }}
5
- div(:class="$style['action-buttons']")
6
- app-button(
7
- rounded
8
- :class="$style['button-new']"
9
- :label="'Новый ремонт'"
10
- @click="emits('create-repair')"
11
- color="#fff"
12
- icon="add"
13
- )
14
- app-button(rounded :class="$style['button-video-wall']" @click="emits('routing-to-video-wall')")
15
- video-wall-icon
16
- span Видеостена
17
- app-button(rounded :class="$style.button" @click="openFullScreenWidgets")
18
- q-tooltip на весь экран
19
- q-icon(name="open_in_full")
20
- //app-button(rounded :class="$style.button")
21
- // graph-icon
22
- //app-button(rounded :class="$style.button")
23
- // time-line-icon
24
- slot
25
- </template>
26
-
27
- <script setup lang="ts">
28
- import { defineProps, defineEmits, defineAsyncComponent } from 'vue'
29
- import AppButton from '@/common/app-button/AppButton.vue'
30
- import { useQuasar } from 'quasar'
31
- import VideoWallIcon from '@/icons/page-header/videoWallIcon.vue'
32
-
33
- const $q = useQuasar()
34
-
35
- const FullScreenDialog = defineAsyncComponent(() => import('@/components/dialogs/full-screen-widgets/index.vue'))
36
- // import GraphIcon from '@/icons/page-header/graphIcon.vue'
37
- // import TimeLineIcon from '@/icons/page-header/timeLineIcon.vue'
38
- interface Props {
39
- title: string
40
- }
41
- const props = defineProps<Props>()
42
- const emits = defineEmits(['create-repair', ''])
43
-
44
- const openFullScreenWidgets = () => {
45
- $q.dialog({
46
- component: FullScreenDialog,
47
- })
48
- }
49
- </script>
50
- <style module lang="scss">
51
- .toolbar {
52
- padding: 0;
53
- margin-top: 16px;
54
- }
55
- .page-container {
56
- padding: 0 4px 0 0;
57
- max-width: 1300px;
58
- margin: 0 auto;
59
- max-height: 600px;
60
- overflow: auto;
61
- &::-webkit-scrollbar-thumb {
62
- height: 88px;
63
- background-color: #d3dbeb;
64
- border-radius: 6px;
65
- }
66
- }
67
- .button {
68
- padding: 12px;
69
- background: white;
70
- }
71
-
72
- .button-new {
73
- padding: 12px 18px;
74
- background: #3f8cff;
75
- }
76
- .button-video-wall {
77
- padding: 10px 18px;
78
- background: white;
79
- span {
80
- color: #3f8cff;
81
- margin-left: 8px;
82
- font-size: 16px;
83
- font-weight: 700;
84
- }
85
- }
86
- .title {
87
- color: #fff;
88
- font-family: Montserrat, sans-serif;
89
- font-size: 32px;
90
- font-style: normal;
91
- font-weight: 700;
92
- line-height: normal;
93
- }
94
-
95
- .action-buttons {
96
- position: relative;
97
- display: flex;
98
- align-items: center;
99
- column-gap: 16px;
100
- }
101
-
102
- @media (max-width: 1440px) {
103
- .page-container {
104
- max-width: 874px;
105
- }
106
- .action-buttons {
107
- column-gap: 8px;
108
- }
109
- .title {
110
- font-size: 24px;
111
- line-height: normal;
112
- }
113
- .button {
114
- padding: 10px;
115
- background: white;
116
- }
117
- .button-new {
118
- padding: 10px 12px;
119
- background: #3f8cff;
120
- }
121
- }
122
- </style>
1
+ <template lang="pug">
2
+ q-page#content(:class="$style['page-container']")
3
+ q-toolbar(:class="$style['toolbar']")
4
+ q-toolbar-title(:class="$style.title") {{ title }}
5
+ div(:class="$style['action-buttons']")
6
+ app-button(
7
+ rounded
8
+ :class="$style['button-new']"
9
+ :label="'Новый ремонт'"
10
+ @click="emits('create-repair')"
11
+ color="#fff"
12
+ icon="add"
13
+ )
14
+ app-button(rounded :class="$style['button-video-wall']" @click="emits('routing-to-video-wall')")
15
+ video-wall-icon
16
+ span Видеостена
17
+ app-button(rounded :class="$style.button" @click="openFullScreenWidgets")
18
+ q-tooltip на весь экран
19
+ q-icon(name="open_in_full")
20
+ //app-button(rounded :class="$style.button")
21
+ // graph-icon
22
+ //app-button(rounded :class="$style.button")
23
+ // time-line-icon
24
+ slot
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import { defineProps, defineEmits, defineAsyncComponent } from 'vue'
29
+ import AppButton from '@/common/app-button/AppButton.vue'
30
+ import { useQuasar } from 'quasar'
31
+ import VideoWallIcon from '@/icons/page-header/videoWallIcon.vue'
32
+
33
+ const $q = useQuasar()
34
+
35
+ const FullScreenDialog = defineAsyncComponent(() => import('@/components/dialogs/full-screen-widgets/index.vue'))
36
+ // import GraphIcon from '@/icons/page-header/graphIcon.vue'
37
+ // import TimeLineIcon from '@/icons/page-header/timeLineIcon.vue'
38
+ interface Props {
39
+ title: string
40
+ }
41
+ const props = defineProps<Props>()
42
+ const emits = defineEmits(['create-repair', ''])
43
+
44
+ const openFullScreenWidgets = () => {
45
+ $q.dialog({
46
+ component: FullScreenDialog,
47
+ })
48
+ }
49
+ </script>
50
+ <style module lang="scss">
51
+ .toolbar {
52
+ padding: 0;
53
+ margin-top: 16px;
54
+ }
55
+ .page-container {
56
+ padding: 0 4px 0 0;
57
+ max-width: 1300px;
58
+ margin: 0 auto;
59
+ max-height: 600px;
60
+ overflow: auto;
61
+ &::-webkit-scrollbar-thumb {
62
+ height: 88px;
63
+ background-color: #d3dbeb;
64
+ border-radius: 6px;
65
+ }
66
+ }
67
+ .button {
68
+ padding: 12px;
69
+ background: white;
70
+ }
71
+
72
+ .button-new {
73
+ padding: 12px 18px;
74
+ background: #3f8cff;
75
+ }
76
+ .button-video-wall {
77
+ padding: 10px 18px;
78
+ background: white;
79
+ span {
80
+ color: #3f8cff;
81
+ margin-left: 8px;
82
+ font-size: 16px;
83
+ font-weight: 700;
84
+ }
85
+ }
86
+ .title {
87
+ color: #fff;
88
+ font-family: Montserrat, sans-serif;
89
+ font-size: 32px;
90
+ font-style: normal;
91
+ font-weight: 700;
92
+ line-height: normal;
93
+ }
94
+
95
+ .action-buttons {
96
+ position: relative;
97
+ display: flex;
98
+ align-items: center;
99
+ column-gap: 16px;
100
+ }
101
+
102
+ @media (max-width: 1440px) {
103
+ .page-container {
104
+ max-width: 874px;
105
+ }
106
+ .action-buttons {
107
+ column-gap: 8px;
108
+ }
109
+ .title {
110
+ font-size: 24px;
111
+ line-height: normal;
112
+ }
113
+ .button {
114
+ padding: 10px;
115
+ background: white;
116
+ }
117
+ .button-new {
118
+ padding: 10px 12px;
119
+ background: #3f8cff;
120
+ }
121
+ }
122
+ </style>
@@ -56,7 +56,7 @@
56
56
  </template>
57
57
 
58
58
  <script setup lang="ts">
59
- import { computed, defineProps, ref, watch } from 'vue'
59
+ import { computed, defineProps, defineEmits, ref, watch } from 'vue'
60
60
  import SidebarMenu from './components/SidebarMenu.vue'
61
61
 
62
62
  import { useQuasar } from 'quasar'
@@ -67,6 +67,7 @@ interface Props {
67
67
  minify?: boolean
68
68
  menuItems?: any[]
69
69
  }
70
+ const emits = defineEmits(['logout'])
70
71
  const props = defineProps<Props>()
71
72
  const $q = useQuasar()
72
73
 
@@ -89,7 +90,7 @@ function openDrawerIsTablet() {
89
90
  }
90
91
 
91
92
  function logout(): void {
92
- window.location.href = '/sign-out'
93
+ emits('logout')
93
94
  }
94
95
 
95
96
  watch(
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ import AppSelect from '@/common/app-select/AppSelect.vue'
7
7
  import AppWrapper from '@/common/app-wrapper/AppWrapper.vue'
8
8
  import AppSidebar from '@/common/app-sidebar/AppSidebar.vue'
9
9
  import AppLayoutHeader from '@/common/app-layout/components/AppLayoutHeader.vue'
10
+ import AppLoader from '@/common/app-loader/index.vue'
10
11
 
11
12
  import useGanttService from '@/api/services/GanttService'
12
13
  import useMetricsService from '@/api/services/MetricsService'
@@ -14,7 +15,18 @@ import useProjectsService from '@/api/services/ProjectsService'
14
15
  import useRepairsService from '@/api/services/RepairsService'
15
16
  import useTasksService from '@/api/services/TasksService'
16
17
 
17
- export { AppButton, AppInput, AppToggle, AppInputSearch, AppLayout, AppSelect, AppWrapper, AppSidebar, AppLayoutHeader }
18
+ export {
19
+ AppButton,
20
+ AppInput,
21
+ AppToggle,
22
+ AppInputSearch,
23
+ AppLayout,
24
+ AppSelect,
25
+ AppWrapper,
26
+ AppSidebar,
27
+ AppLayoutHeader,
28
+ AppLoader,
29
+ }
18
30
 
19
31
  export { useGanttService, useMetricsService, useProjectsService, useRepairsService, useTasksService }
20
32