Blame view

src/components/Profile.vue 10.5 KB
f06677bfc   Digvijay Singh   profile screen added
1
2
  <template>
    <main class="landing-page">
298fff252   Digvijay Singh   new design added
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
      <!-- profile -->
      <div class="popup-wrp" style="display: none">
        <div class="overlay"></div>
        <div class="popup-set">
          <div class="popup-header">
            <img src="../assets/images/user.png" />
            <ul>
              <li>
                <a href="#"
                  ><img src="../assets/images/replace.svg" /><span
                    >Replace Avatar</span
                  ></a
                >
              </li>
              <li>
                <a href="#"
                  ><img src="../assets/images/randomise.svg" /><span
                    >Randomise Avatar</span
                  ></a
                >
              </li>
            </ul>
          </div>
          <!-- header -->
          <div class="popup-body">
            <form class="popup-forms">
              <div class="row">
                <div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
                  <div class="form-group floating-label">
                    <input
                      type="text"
                      class="form-control"
                       v-model="userData.name" 
                      placeholder=" "
                      id="fname"
                    />
                    <label for="fname">First Name</label>
                  </div>
                </div>
                <!-- input -->
                <div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
                  <div class="form-group floating-label">
                    <input
                      type="text"
                      class="form-control"
                      value=""
                      placeholder=" "
                      id="lname"
                    />
                    <label for="lname" class="lname">Last Name</label>
                  </div>
                </div>
                <!-- input -->
                <div class="col-sm-5 col-md-5 col-lg-5 col-xl-5">
                  <div class="form-group floating-label">
                    <input
                      type="text"
                      class="form-control"
                      value=""
                      v-model="userData.designation" 
                      placeholder=" "
                      id="designation"
                    />
                    <label for="designation">Designation</label>
                  </div>
                </div>
                <!-- input -->
                <div class="col-sm-7 col-md-7 col-lg-7 col-xl-7">
                  <div class="form-group floating-label">
                    <input
                      type="text"
                      class="form-control"
                      v-model="userData.organisation" 
                      id="company"
                    />
                    <label for="company">Company</label>
                  </div>
                </div>
                <!-- input -->
                <div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
                  <div class="form-group floating-label">
                    <textarea
                      type="text"
                      class="form-control"
                      value=""
                      v-model="userData.bio" 
                      id="yourself"
                    ></textarea>
                    <label for="yourself"
                      >Tell others a little about yourself</label
                    >
                  </div>
                </div>
                <!-- input -->
                <div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
                  <p class="things">Three things that you talk more about</p>
f06677bfc   Digvijay Singh   profile screen added
99

298fff252   Digvijay Singh   new design added
100
101
102
103
104
105
106
107
108
109
110
111
                  <ul class="interests">
                    <li><span>Cats</span></li>
                    <li>
                      <input class="" placeholder="Add interest" />
                      <a href="#"
                        ><img src="../assets/images/plus-circle.svg"
                      /></a>
                    </li>
                  </ul>
                </div>
                <div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
                  <p class="things">Choose Background color</p>
f06677bfc   Digvijay Singh   profile screen added
112

298fff252   Digvijay Singh   new design added
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
                  <ul class="colors">
                    <li><a href="#" class="silver"></a></li>
                    <li><a href="#" class="milk-punch active"></a></li>
                    <li><a href="#" class="french-pass"></a></li>
                    <li><a href="#" class="cyan-french-pass"></a></li>
                    <li><a href="#" class="cosmos"></a></li>
                    <li><a href="#" class="cape-Honey"></a></li>
                    <li><a href="#" class="snuff"></a></li>
                    <li><a href="#" class="catskillWhite"></a></li>
                    <li><a href="#" class="white"></a></li>
                  </ul>
                </div>
              </div>
              <a @click="closeDialog" class="next-bt">Next</a>
            </form>
          </div>
          <div class="clearfix"></div>
        </div>
      </div>
      <!-- profile -->
      <div class="container-fluid inner-wrp">
f06677bfc   Digvijay Singh   profile screen added
134
        <nav class="navbar navbar-expand-sm spotLight-nav">
298fff252   Digvijay Singh   new design added
135
136
137
138
139
140
141
142
143
144
145
146
          <a class="navbar-brand" href="#"
            ><img src="../assets/images/logo.png"
          /></a>
          <button
            class="navbar-toggler"
            type="button"
            data-toggle="collapse"
            data-target="#navbarsExample03"
            aria-controls="navbarsExample03"
            aria-expanded="false"
            aria-label="Toggle navigation"
          >
f06677bfc   Digvijay Singh   profile screen added
147
148
149
150
            <span class="navbar-toggler-icon"></span>
            <span class="navbar-toggler-icon"></span>
            <span class="navbar-toggler-icon"></span>
          </button>
298fff252   Digvijay Singh   new design added
151

f06677bfc   Digvijay Singh   profile screen added
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
          <div class="collapse navbar-collapse" id="navbarsExample03">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <a class="nav-link" href="#">About</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Masterclass</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Stories</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Library</a>
              </li>
            </ul>
          </div>
          <div class="user-profile-photo">
            <a href="#"><img src="../assets/images/user.png" /></a>
          </div>
298fff252   Digvijay Singh   new design added
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
        </nav>
        <!-- menu wrapper -->
        <div class="row profile-tab-spc-top">
          <div class="col-sm-8 col-md-12 col-lg-8 col-xl-8">
            <img src="../assets/images/user.png" class="inner-profile-ps" />
            <div class="user-profile">
              <h1>{{userData.name}} <a href="#" class="tags">{{userData.role}}</a></h1>
              <ul class="joined-info">
                <li>
                  <a href="#">Add your work</a>
                  <img src="../assets/images/u-info-icon.png" /> <span></span>
                </li>
                <li><a href="#">34772 Karma</a> <span></span></li>
                <li><a href="#">Joined on {{moment(userData.createdAt).format('MMM YYYY')}}</a></li>
              </ul>
              <p>Tell others a little about yourself</p>
            </div>
          </div>
          <!-- user profile -->
          <div class="col-sm-4 col-md-12 col-lg-4 col-xl-4">
            <div class="list-style-group">
              <p>Awards</p>
              <ul class="list-style">
                <li>
                  <a href="#"><img src="../assets/images/icon-1.png" /></a>
                </li>
              </ul>
            </div>
            <!-- list style -->
          </div>
f06677bfc   Digvijay Singh   profile screen added
201
        </div>
298fff252   Digvijay Singh   new design added
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
        <div class="clearfix"></div>
        <div class="row top-brd profile-tab-spc-top">
          <div class="col-sm-8 col-md-8 col-lg-8 col-xl-8">
            <ul class="profile-tab">
              <li class="active"><a href="#">Case-studies(0)</a></li>
              <li><a href="#">Comments/Replies(0)</a></li>
            </ul>
          </div>
          <div class="col-sm-4 col-md-4 col-lg-4 col-xl-4">
            <ul class="social-connects">
              <li><span>Follow</span></li>
              <li>
                <a href="#" class="active"
                  ><img src="../assets/images/plus.png"
                /></a>
                <span class="connect-social-channel"
                  >Connect your social channels</span
                >
              </li>
            </ul>
          </div>
        </div>
        <!-- tab style -->
        <div class="profile-data-wrp">
          <div class="container-fluid data-wrp">
            <div class="row">
              <div class="col-lg-12">
                <div class="profile-buttons">
                  <a
                    class="profile-sm-bt center-and-spc bt-active"
                    @click="openDialog"
                    >Update Profile</a
                  >
                  <a href="#" class="profile-md-bt center-and-spc"
                    >Explore Case-studies</a
                  >
                  <a href="#" class="profile-lg-bt">Publish Your Case Study</a>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- data wrp -->
f06677bfc   Digvijay Singh   profile screen added
245
246
247
248
249
250
        <!-- body wrapper -->
      </div>
    </main>
  </template>
  
  <script>
f06677bfc   Digvijay Singh   profile screen added
251
252
253
  import Vue from "vue";
  import router from "../router";
  import $ from "jquery";
298fff252   Digvijay Singh   new design added
254
  import axios from 'axios'
f06677bfc   Digvijay Singh   profile screen added
255
256
257
258
259
260
261
  
  export default {
    name: "Profile",
  
    data() {
      return {
        loggedinFlag: false,
298fff252   Digvijay Singh   new design added
262
263
        usertoken: null,
        userData:{},
f06677bfc   Digvijay Singh   profile screen added
264
265
      };
    },
298fff252   Digvijay Singh   new design added
266
267
268
269
270
271
272
273
274
275
    mounted() {
      var userdata = localStorage.getItem("spotlight_usertoken");
      if (userdata) {
        userdata = JSON.parse(userdata);
        this.usertoken = userdata.token;
        this.getProfile();
      }
  
      
    },
f06677bfc   Digvijay Singh   profile screen added
276
    methods: {
298fff252   Digvijay Singh   new design added
277
      goToSignUp() {
f06677bfc   Digvijay Singh   profile screen added
278
279
280
281
282
        this.$router.push("/signup");
      },
      goToReset() {
        this.$router.push("/reset");
      },
298fff252   Digvijay Singh   new design added
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
      getProfile() {
        axios
        .get("/profile", {
          headers: {
            Authorization: "Bearer " + this.usertoken,
          },
        })
        .then((response) => {
          this.userData = response.data.data;
          console.log(response.data.data);
        })
        .catch((error) => console.log(error));
      },
      saveProfile(){
        var obj = {};
        obj = Object.assign(obj, this.userData);
          delete obj.awards;
          delete obj.createdAt;
          delete obj.email;
          delete obj.role;
          delete obj.verified;
          delete obj.updatedAt;
          delete obj.__v;
          delete obj._id;
          axios
          .put("/profile", obj,{
            headers: {
              Authorization: "Bearer " + this.usertoken,
            },
          })
          .then((response) => {
            // this.userData = response.data.data;
            console.log(response.data.data);
          })
          .catch((error) => console.log(error));
  
      },
      openDialog() {
        $(".inner-wrp").addClass("body-blur");
        $(".popup-wrp").show();
      },
      closeDialog() {
        this.saveProfile();
        $(".inner-wrp").removeClass("body-blur");
        $(".popup-wrp").hide();
      },
f06677bfc   Digvijay Singh   profile screen added
329
330
331
    },
  };
  </script>