Kobus преди 5 години
родител
ревизия
281ab04c80
променени са 5 файла, в които са добавени 83 реда и са изтрити 8 реда
  1. 8
    0
      src/assets/staticData/alertTypes.js
  2. 44
    0
      src/components/shared/alert.vue
  3. 20
    5
      src/components/shared/navBar.vue
  4. 10
    2
      src/components/user/loginPage.vue
  5. 1
    1
      vue.config.js

+ 8
- 0
src/assets/staticData/alertTypes.js Целия файл

@@ -0,0 +1,8 @@
1
+const types = Object.freeze({
2
+  SUCCESS: 'Success',
3
+  INFO: 'Info',
4
+  WARNING: 'Warning',
5
+  ERROR: 'Error',
6
+});
7
+
8
+export default types;

+ 44
- 0
src/components/shared/alert.vue Целия файл

@@ -0,0 +1,44 @@
1
+<template>
2
+  <div class="container">
3
+    <!-- eslint-disable max-len -->
4
+    <div class="alert alert-success" v-if="type === 'SUCCESS'">
5
+      <eva-icon name="checkmark-outline"></eva-icon>
6
+      <strong>{{ text }}</strong>
7
+    </div>
8
+    <div class="alert alert-info" v-if="type === 'INFO'">
9
+      <eva-icon name="info-outline"></eva-icon>
10
+      <strong>{{ text }}</strong>
11
+    </div>
12
+    <div class="alert alert-warning" v-if="type === 'WARNING'">
13
+      <eva-icon name="alert-circle-outline"></eva-icon>
14
+      <strong>{{ text }}</strong>
15
+    </div>
16
+    <div class="alert alert-danger" v-if="type === 'ERROR'">
17
+      <eva-icon name="slash-outline"></eva-icon>
18
+      <strong>{{ text }}</strong>
19
+    </div>
20
+  </div>
21
+</template>
22
+
23
+<script>
24
+export default {
25
+  name: 'Alert',
26
+  data() {
27
+    return {
28
+      alertTypes: {
29
+        SUCCESS: 'Success',
30
+        INFO: 'Info',
31
+        WARNING: 'Warning',
32
+        ERROR: 'Error',
33
+      },
34
+    };
35
+  },
36
+  props: {
37
+    text: null,
38
+    type: null,
39
+  },
40
+};
41
+</script>
42
+
43
+<style>
44
+</style>

+ 20
- 5
src/components/shared/navBar.vue Целия файл

@@ -60,6 +60,7 @@
60 60
                   @click="routerGoTo('/timeshare/sell')"
61 61
                 >To Sell</a>
62 62
                 <a
63
+                  v-if="showLogout"
63 64
                   class="dropdown-item cursor-pointer"
64 65
                   @click="routerGoTo('/timeshare/sell')"
65 66
                 >My Timeshare Weeks</a>
@@ -103,12 +104,14 @@
103 104
                   class="dropdown-item cursor-pointer"
104 105
                   @click="routerGoTo('/property/Residential/Rental')"
105 106
                 >To Rent Residential Properties</a>
106
-                <hr />
107
+                <hr v-if="showLogout" />
107 108
                 <a
109
+                  v-if="showLogout"
108 110
                   class="dropdown-item cursor-pointer"
109 111
                   @click="routerGoTo('/property/list/Commercial/MyListings')"
110 112
                 >My Commercial Properties</a>
111 113
                 <a
114
+                  v-if="showLogout"
112 115
                   class="dropdown-item cursor-pointer"
113 116
                   @click="routerGoTo('/property/list/Residential/MyListings')"
114 117
                 >My Residential Properties</a>
@@ -184,6 +187,7 @@
184 187
             <li class="nav-item dropdown">
185 188
               <a
186 189
                 class="nav-link"
190
+                v-if="hideLogin"
187 191
                 @click="routerGoTo('/user/login')"
188 192
                 id="navbarDropdown"
189 193
                 role="button"
@@ -192,6 +196,18 @@
192 196
                 aria-expanded="false"
193 197
               >Login</a>
194 198
             </li>
199
+            <li class="nav-item dropdown">
200
+              <span v-if="showLogout">
201
+                <a class="nav-link" @click="logout()">Logout</a>
202
+              </span>
203
+              <span v-else></span>
204
+            </li>
205
+            <li>
206
+              <span v-if="showLogout">
207
+                <a>Welcome! {{ }}</a>
208
+              </span>
209
+              <span v-else></span>
210
+            </li>
195 211
           </ul>
196 212
         </div>
197 213
       </div>
@@ -207,10 +223,6 @@
207 223
         </button>
208 224
       </div>
209 225
     </div>
210
-    <span v-if="showLogout">
211
-      <a @click="logout()">Logout</a>
212
-    </span>
213
-    <span v-else></span>
214 226
   </nav>
215 227
 </template>
216 228
 
@@ -225,6 +237,9 @@ export default {
225 237
     showLogout() {
226 238
       return this.$store.state.authentication.status === 'success';
227 239
     },
240
+    hideLogin() {
241
+      return this.$store.state.authentication.status !== 'success';
242
+    },
228 243
     Logout() {
229 244
       return this.$store.state.authentication.methods.logout;
230 245
     },

+ 10
- 2
src/components/user/loginPage.vue Целия файл

@@ -8,6 +8,11 @@
8 8
             <h4>Login</h4>
9 9
             <br />
10 10
           </div>
11
+          <!-- <alert :text="'Login successful'" :type="'SUCCESS'" />
12
+          <alert :text="'User does not exist, please register'" :type="'ERROR'" />
13
+          <alert :text="'Username is incorrect'" :type="'WARNING'" />
14
+          <alert :text="'Password is incorrect'" :type="'WARNING'" />
15
+          <alert :text="'Caps Lock is on'" :type="'INFO'" />-->
11 16
           <div class="row">
12 17
             <div class="col-md-11" style="margin-bottom: 1em">
13 18
               <div class="input-group mb-3">
@@ -76,6 +81,7 @@
76 81
         <div class="form">
77 82
           <h5>Trouble signing in?</h5>
78 83
           <div>
84
+            <!-- <alert :text="'Username & password request email sent'" :type="'SUCCESS'" /> -->
79 85
             <div class="row">
80 86
               <div class="input-group-prepend">
81 87
                 <span class="input-group-text">
@@ -97,11 +103,13 @@
97 103
 
98 104
 <script>
99 105
 import { mapActions, mapState } from 'vuex';
100
-// import axios from 'axios';
101
-// import User from '../../assets/Log';
106
+// import alert from '../shared/alert.vue';
102 107
 
103 108
 export default {
104 109
   name: 'Login',
110
+  components: {
111
+    // alert,
112
+  },
105 113
   data() {
106 114
     return {
107 115
       username: '',

+ 1
- 1
vue.config.js Целия файл

@@ -2,7 +2,7 @@ module.exports = {
2 2
   devServer: {
3 3
     proxy: {
4 4
       '/api': {
5
-        target: 'http://192.168.6.188:5000',
5
+        target: 'http://localhost:57260',
6 6
         changeOrigin: true,
7 7
       },
8 8
     },

Loading…
Отказ
Запис