Commit ebe04cc1d7f6187aea96a97aa4aa7148988f186c

Authored by Neeraj Sharma
1 parent 51e4f3e163

solve issue upload image dyanmic

src/pages/Students/students.vue
... ... @@ -1830,10 +1830,6 @@ export default {
1830 1830 mobile: "",
1831 1831 state: "",
1832 1832 gender: "",
1833   - fatherName: "",
1834   - fatherCellNo: "",
1835   - motherName: "",
1836   - motherCellNo: "",
1837 1833 select: "",
1838 1834 selectSection: "",
1839 1835 bloodGroup: "",
... ... @@ -2068,10 +2064,6 @@ export default {
2068 2064 mobile: this.addStudents.mobile,
2069 2065 state: this.addStudents.state,
2070 2066 gender: this.addStudents.gender,
2071   - fatherName: this.addStudents.fatherName,
2072   - fatherCellNo: this.addStudents.fatherCellNo,
2073   - motherName: this.addStudents.motherName,
2074   - motherCellNo: this.addStudents.motherCellNo,
2075 2067 establishmentYear: this.addStudents.establishmentYear,
2076 2068 classId: this.addStudents.select,
2077 2069 sectionId: this.addStudents.selectSection,
... ... @@ -2079,9 +2071,14 @@ export default {
2079 2071 allergies: this.addStudents.allergies,
2080 2072 medicalNotes: this.addStudents.medicalNotes,
2081 2073 height: this.addStudents.height,
2082   - weight: this.addStudents.weight,
2083   - upload: this.imageUrl
  2074 + weight: this.addStudents.weight
2084 2075 };
  2076 + if (this.imageUrl) {
  2077 + var str = this.imageUrl;
  2078 + const [baseUrl, imageUrl] = str.split(/,/);
  2079 + console.log("imageUrlimageUrlimageUrlimageUrl", imageUrl);
  2080 + addStudent.upload = imageUrl;
  2081 + }
2085 2082 this.loading = true;
2086 2083 http()
2087 2084 .post("/createStudent", addStudent)
... ... @@ -2123,10 +2120,6 @@ export default {
2123 2120 mobile: this.editedItem.mobile,
2124 2121 state: this.editedItem.state,
2125 2122 gender: this.editedItem.gender,
2126   - fatherName: this.editedItem.fatherName,
2127   - fatherCellNo: this.editedItem.fatherCellNo,
2128   - motherName: this.editedItem.motherName,
2129   - motherCellNo: this.editedItem.motherCellNo,
2130 2123 establishmentYear: this.editedItem.establishmentYear,
2131 2124 classId: this.editedItem.select,
2132 2125 sectionId: this.editedItem.selectSection,
... ... @@ -2137,7 +2130,10 @@ export default {
2137 2130 weight: this.editedItem.weight
2138 2131 };
2139 2132 if (this.imageUrl) {
2140   - editStudent.upload = this.imageUrl;
  2133 + var str = this.imageUrl;
  2134 + const [baseUrl, imageUrl] = str.split(/,/);
  2135 + console.log("imageUrlimageUrlimageUrlimageUrl", imageUrl);
  2136 + editStudent.upload = imageUrl;
2141 2137 }
2142 2138 http()
2143 2139 .put("/updateStudent", editStudent)
... ...
src/pages/Subjects/subjects.vue
... ... @@ -271,16 +271,16 @@
271 271 <label class="right">Class:</label>
272 272 </v-flex>
273 273 <v-flex xs6 class="ml-3">
274   - <v-autocomplete
  274 + <v-select
275 275 v-model="addSubject.classId"
276   - placeholder="fill your class Name"
  276 + label="Select your class"
277 277 type="text"
278 278 :items="classList"
279 279 item-text="classNum"
280 280 item-value="_id"
281 281 :rules="nameRules"
282 282 required
283   - ></v-autocomplete>
  283 + ></v-select>
284 284 </v-flex>
285 285 </v-layout>
286 286 <v-layout>
... ...
src/pages/Teachers/teachers.vue
... ... @@ -1327,18 +1327,6 @@ export default {
1327 1327 // },
1328 1328 submit() {
1329 1329 if (this.$refs.form.validate()) {
1330   - // let images = new FormData();
1331   - // images.append("upload",this.imageUrl);
1332   - // console.log(images);
1333   - // var form_data = new FormData();
1334   - // for (var key in addTeacher) {
1335   - // if (key === 'upload') {
1336   - // form_data.append(key, this.imageFile);
1337   - // } else {
1338   - // form_data.append(key, addTeacher[key])
1339   - // }
1340   - // }
1341   - // console.log("images",images)
1342 1330 let addTeacher = {
1343 1331 name: this.addTeachers.name,
1344 1332 email: this.addTeachers.email,
... ... @@ -1351,11 +1339,13 @@ export default {
1351 1339 presentAddress: this.addTeachers.presentAddress,
1352 1340 mobileNo: this.addTeachers.mobileNo,
1353 1341 state: this.addTeachers.state,
1354   - joinDate: this.addTeachers.joinDate,
1355   - upload: this.imageUrl
1356   - // upload:this.imageFile
  1342 + joinDate: this.addTeachers.joinDate
1357 1343 };
1358   - // console.log("addTeacher============>", addTeacher);
  1344 + if (this.imageUrl) {
  1345 + var str = this.imageUrl;
  1346 + const [baseUrl, imageUrl] = str.split(/,/);
  1347 + addTeacher.upload = imageUrl;
  1348 + }
1359 1349 this.loading = true;
1360 1350 http()
1361 1351 .post("/createTeacher", addTeacher)
... ... @@ -1401,7 +1391,9 @@ export default {
1401 1391 joinDate: this.editedItem.joinDate
1402 1392 };
1403 1393 if (this.imageUrl) {
1404   - editTeacher.upload = this.imageUrl;
  1394 + var str = this.imageUrl;
  1395 + const [baseUrl, imageUrl] = str.split(/,/);
  1396 + editTeacher.upload = imageUrl;
1405 1397 }
1406 1398 http()
1407 1399 .put("/updateTeacher", editTeacher)
... ...