Browse Source

fixed #49

ali 3 năm trước cách đây
mục cha
commit
87d9dba2ac

+ 37 - 0
src/api/models/Auth.js

@@ -9,6 +9,7 @@ export default class AuthAPI extends APIRepository {
       login: '/uma/users/login',
       sendOtp: '/uma/users/send_otp',
       signUp: '/uma/users/sign_up',
+      verify: '/uma/users/verify',
       setPass: '/uma/users/set_password',
 
       loginAdmin: '/auth/login',
@@ -61,6 +62,42 @@ export default class AuthAPI extends APIRepository {
     })
   }
 
+  sendOtpVerify (data) {
+    return this.sendRequest({
+      apiMethod: 'post',
+      api: this.api,
+      request: this.APIAdresses.sendOtp,
+      data: this.getNormalizedSendData({
+        input: '', // String
+        action: 'VERIFY' // String
+      }, data),
+      resolveCallback: (response) => {
+        return response.data.message // String (ok)
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
+
+  verify (data) {
+    return this.sendRequest({
+      apiMethod: 'put',
+      api: this.api,
+      request: this.APIAdresses.sendOtp,
+      data: this.getNormalizedSendData({
+        input: '', // String
+        otp: '' // String
+      }, data),
+      resolveCallback: (response) => {
+        return response.data
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
+
   sendOtpForgotPassword (data) {
     return this.sendRequest({
       apiMethod: 'post',

+ 3 - 2
src/assets/Enums/academicDegree.js

@@ -1,10 +1,11 @@
 const academicDegree = [
   { label: 'زیر دبپلم', value: 'UNDER_DIPLOMA' },
-  { label: 'دبپلم', value: 'DIPLOMA' },
+  { label: 'دیپلم', value: 'DIPLOMA' },
   { label: 'فوق دیپلم', value: 'ASSOCIATE' },
   { label: 'کارشناسی', value: 'BACHELOR' },
   { label: 'کارشناسی ارشد', value: 'MASTER' },
-  { label: 'دکتری', value: 'DOCTORAL' }
+  { label: 'دکتری', value: 'DOCTORAL' },
+  { label: 'تحصیلات حوزوی', value: 'SEMINARY' }
 ]
 
 export default academicDegree

+ 2 - 2
src/assets/Enums/educationalStatus.js

@@ -1,7 +1,7 @@
 const educationalStatus = [
   { label: 'در حال تحصیل', value: 'STUDYING' },
-  { label: 'فارغ التحصیل', value: 'GRADUATED' },
-  { label: 'اخراج شده', value: 'DROPPED_OUT' }
+  { label: 'فارغ التحصیل', value: 'GRADUATED' }
+  // { label: 'اخراج شده', value: 'DROPPED_OUT' }
 ]
 
 export default educationalStatus

+ 28 - 27
src/components/Widgets/Other/Shop/ShopCompleteInfo/ShopCompleteInfo.vue

@@ -143,15 +143,16 @@ export default {
     entityParamKey: 'id',
     showRouteName: 'UserPanel.ShopPaymentFromWallet',
     inputs: [
-      { type: 'separator', name: 'space', label: 'اطلاعات ضروری', col: 'col-md-12' },
-      { type: 'input', name: 'email', label: 'ایمیل', responseKey: 'email', placeholder: ' ', col: 'col-md-3' },
-      { type: 'input', name: 'mobile_number', label: 'تلفن همراه', responseKey: 'mobile_number', placeholder: ' ', col: 'col-md-3' },
-      { type: 'input', name: 'national_code', label: 'کدملی/کد اتباع غیر ایرانی', responseKey: 'national_code', placeholder: ' ', col: 'col-md-3' },
-      { type: 'separator', name: 'space', label: 'اطلاعات پروفایل', col: 'col-md-12' },
-      { type: 'file', name: 'picture', label: 'عکس پروفایل', responseKey: 'picture', placeholder: ' ', col: 'col-md-3' },
-      { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
-      { type: 'input', name: 'firstname', label: 'نام', responseKey: 'firstname', placeholder: ' ', col: 'col-md-3' },
-      { type: 'input', name: 'lastname', label: 'نام خانوادگی', responseKey: 'lastname', placeholder: ' ', col: 'col-md-3' },
+      { type: 'separator', name: 'space', label: 'اطلاعات ضروری', col: 'col-12' },
+      { type: 'input', name: 'email', label: 'ایمیل', responseKey: 'email', placeholder: ' ', disable: true, col: ' col-md-3 col-12' },
+      { type: 'input', name: 'mobile_number', label: 'تلفن همراه', responseKey: 'mobile_number', placeholder: ' ', disable: true, col: ' col-md-3 col-12' },
+      { type: 'optionGroupRadio', name: 'is_valid_national_code', label: 'اتباع خارجی', options: [{ label: 'نیستم', value: true }, { label: 'هستم', value: false }], value: true, col: 'col-md-3 col-12' },
+      { type: 'input', name: 'national_code', label: 'کدملی/کد اتباع غیر ایرانی', responseKey: 'national_code', placeholder: ' ', col: ' col-md-3 col-12' },
+      { type: 'separator', name: 'space', label: 'اطلاعات پروفایل', col: 'col-12' },
+      { type: 'file', name: 'picture', label: 'عکس پروفایل', responseKey: 'picture', placeholder: ' ', col: ' col-md-3 col-12' },
+      { type: 'separator', name: 'space', size: '0', col: 'col-12' },
+      { type: 'input', name: 'firstname', label: 'نام', responseKey: 'firstname', placeholder: ' ', col: ' col-md-3 col-12' },
+      { type: 'input', name: 'lastname', label: 'نام خانوادگی', responseKey: 'lastname', placeholder: ' ', col: ' col-md-3 col-12' },
       {
         type: 'select',
         name: 'gender',
@@ -160,9 +161,9 @@ export default {
         options: Enums.genders,
         value: null,
         label: 'جنسیت',
-        col: 'col-md-3'
+        col: ' col-md-3 col-12'
       },
-      { type: 'date', name: 'birthdate', label: 'تولد', responseKey: 'birthdate', placeholder: ' ', col: 'col-md-3' },
+      { type: 'date', name: 'birthdate', label: 'تولد', responseKey: 'birthdate', placeholder: ' ', col: ' col-md-3 col-12' },
       {
         type: 'select',
         name: 'marital_status',
@@ -171,11 +172,11 @@ export default {
         options: Enums.maritalStatuses,
         value: null,
         label: 'وضعیت تاهل',
-        col: 'col-md-3'
+        col: ' col-md-3 col-12'
       },
-      { type: 'input', name: 'on_call_mobile_number', label: 'تلفن همراه جهت تماس', responseKey: 'mobile_number', placeholder: ' ', col: 'col-md-3' },
-      { type: 'input', name: 'on_social_network_mobile_number', label: 'تلفن همراه جهت شبکه های اجتماعی', responseKey: 'on_social_network_mobile_number', placeholder: ' ', col: 'col-md-3' },
-      { type: 'input', name: 'phone_number', label: 'تلفن منزل', responseKey: 'phone_number', placeholder: ' ', col: 'col-md-3' },
+      { type: 'input', name: 'on_call_mobile_number', label: 'تلفن همراه جهت تماس', responseKey: 'on_call_mobile_number', placeholder: ' ', col: ' col-md-3 col-12' },
+      { type: 'input', name: 'on_social_network_mobile_number', label: 'تلفن همراه جهت شبکه های اجتماعی', responseKey: 'on_social_network_mobile_number', placeholder: ' ', col: ' col-md-3 col-12' },
+      { type: 'input', name: 'phone_number', label: 'تلفن منزل', responseKey: 'phone_number', placeholder: 'با کد شهر وارد شود', col: ' col-md-3 col-12' },
       {
         type: 'select',
         name: 'last_academic_degree',
@@ -184,10 +185,10 @@ export default {
         options: Enums.academicDegree,
         value: null,
         label: 'آخرین مقطع تحصیلی',
-        col: 'col-md-3'
+        col: ' col-md-3 col-12'
       },
-      { type: 'input', name: 'last_academic_degree_field', label: 'رشته تحصیلی', responseKey: 'last_academic_degree_field', placeholder: ' ', col: 'col-md-3' },
-      { type: 'input', name: 'last_academy_name', label: 'نام دانشگاه یا حوزه تحصیلی', responseKey: 'last_academy_name', placeholder: ' ', col: 'col-md-3' },
+      { type: 'input', name: 'last_academic_degree_field', label: 'رشته تحصیلی', responseKey: 'last_academic_degree_field', placeholder: ' ', col: ' col-md-3 col-12' },
+      { type: 'input', name: 'last_academy_name', label: 'نام دانشگاه یا حوزه تحصیلی', responseKey: 'last_academy_name', placeholder: ' ', col: ' col-md-3 col-12' },
       {
         type: 'select',
         name: 'educational_status',
@@ -196,16 +197,16 @@ export default {
         options: Enums.educationalStatus,
         value: null,
         label: 'وضعیت تحصیلی',
-        col: 'col-md-3'
+        col: ' col-md-3 col-12'
       },
-      { type: 'input', name: 'birth_country', label: 'کشور محل تولد', responseKey: 'birth_country', placeholder: ' ', col: 'col-md-4' },
-      { type: 'input', name: 'birth_province', label: 'استان محل تولد', responseKey: 'birth_province', placeholder: ' ', col: 'col-md-4' },
-      { type: 'input', name: 'birth_city', label: 'شهر محل تولد', responseKey: 'birth_city', placeholder: ' ', col: 'col-md-4' },
-      { type: 'input', name: 'living_country', label: 'کشور محل زندگی فعلی', responseKey: 'living_country', placeholder: ' ', col: 'col-md-4' },
-      { type: 'input', name: 'living_abroad_province', label: 'استان محل زندگی فعلی', responseKey: 'living_province', placeholder: ' ', col: 'col-md-4' },
-      { type: 'input', name: 'living_abroad_city', label: 'شهر محل زندگی فعلی', responseKey: 'living_city', placeholder: ' ', col: 'col-md-4' },
-      { type: 'input', name: 'living_postal_code', label: 'کد پستی محل زندگی', responseKey: 'living_postal_code', placeholder: ' ', col: 'col-md-3' },
-      { type: 'input', name: 'living_address', label: 'آدرس پستی محل زندگی', responseKey: 'living_address', placeholder: ' ', col: 'col-md-9' },
+      { type: 'input', name: 'birth_country', label: 'کشور محل تولد', responseKey: 'birth_country', placeholder: ' ', col: 'col-md-4 col-12' },
+      { type: 'input', name: 'birth_province', label: 'استان محل تولد', responseKey: 'birth_province', placeholder: ' ', col: 'col-md-4 col-12' },
+      { type: 'input', name: 'birth_city', label: 'شهر محل تولد', responseKey: 'birth_city', placeholder: ' ', col: 'col-md-4 col-12' },
+      { type: 'input', name: 'living_country', label: 'کشور محل زندگی فعلی', responseKey: 'living_country', placeholder: ' ', col: 'col-md-4 col-12' },
+      { type: 'input', name: 'living_abroad_province', label: 'استان محل زندگی فعلی', responseKey: 'living_province', placeholder: ' ', col: 'col-md-4 col-12' },
+      { type: 'input', name: 'living_abroad_city', label: 'شهر محل زندگی فعلی', responseKey: 'living_city', placeholder: ' ', col: 'col-md-4 col-12' },
+      { type: 'input', name: 'living_postal_code', label: 'کد پستی محل زندگی', responseKey: 'living_postal_code', placeholder: ' ', col: ' col-md-3 col-12' },
+      { type: 'input', name: 'living_address', label: 'آدرس پستی محل زندگی', responseKey: 'living_address', placeholder: ' ', col: 'col-md-9 col-12' },
       { type: 'hidden', name: 'id', responseKey: 'id' }
     ]
   }),

+ 8 - 6
src/components/other/VerifyEmail.vue

@@ -66,7 +66,7 @@
 </template>
 
 <script>
-import API_ADDRESS from 'src/api/Addresses.js'
+import { APIGateway } from 'src/api/APIGateway.js'
 
 export default {
   name: 'VerifyEmail',
@@ -145,13 +145,15 @@ export default {
     },
     sendOtp () {
       if (!this.textInput) {
+        this.$q.notify({
+          type: 'negative',
+          message: 'ایمیل خود را وارد کنید.'
+        })
         return
       }
       this.emailAddress = this.textInput
       this.loading = true
-      this.$axios.post(API_ADDRESS.auth.sendOtp, {
-        input: this.emailAddress
-      })
+      APIGateway.auth.sendOtpVerify({ input: this.emailAddress })
         .then(() => {
           this.loading = false
           this.message = 'کد تایید به ایمیل ' + this.emailAddress + ' ارسال شد.'
@@ -161,7 +163,7 @@ export default {
         })
         .catch(() => {
           this.loading = false
-          this.updateEmailAddressNumber()
+          this.updateEmailAddress()
         })
     },
     updateEmailAddress () {
@@ -173,7 +175,7 @@ export default {
       this.message = ''
       this.otpValue = this.textInput
       this.textInput = ''
-      this.$axios.put(API_ADDRESS.user.verify, {
+      APIGateway.auth.verify({
         input: this.emailAddress,
         otp: this.otpValue
       })

+ 4 - 4
src/pages/User/Profile/profile.vue

@@ -56,9 +56,9 @@ export default {
         { type: 'separator', name: 'space', placeholder: ' ', label: 'اطلاعات ضروری', className: 'custom-separator', col: 'col-12' },
         { type: WarningComp, label: 'بعد از تایید اطلاعات ضروری، امکان تغییر این اطلاعات وجود ندارد', col: 'col-12' },
         { type: VerifyEmailComp, name: 'email', placeholder: ' ', label: 'ایمیل', responseKey: 'email', col: 'col-md-6 col-12' },
-        { type: NationalCodeComp, name: 'national_code', value: '', placeholder: ' ', label: 'کدملی/کد اتباع غیر ایرانی', responseKey: 'national_code', col: 'col-md-6 col-12' },
-        // { type: 'input', name: 'mobile_number', placeholder: ' ', label: 'تلفن همراه', responseKey: 'mobile_number', col: 'col-md-6 col-12' },
         { type: VerifyMobileNumberComp, name: 'mobile_number', placeholder: ' ', label: 'تلفن همراه', responseKey: 'mobile_number', col: 'col-md-6 col-12' },
+        { type: 'optionGroupRadio', name: 'is_valid_national_code', label: 'اتباع خارجی', options: [{ label: 'نیستم', value: true }, { label: 'هستم', value: false }], value: true, col: 'col-md-6 col-12' },
+        { type: NationalCodeComp, name: 'national_code', value: '', placeholder: ' ', label: 'کدملی/کد اتباع غیر ایرانی', responseKey: 'national_code', col: 'col-md-6 col-12' },
         { type: 'separator', name: 'space', label: 'اطلاعات پروفایل', className: 'custom-separator', col: 'col-12' },
         { type: 'file', name: 'picture', placeholder: ' ', label: 'عکس پروفایل', responseKey: 'picture', col: 'col-md-6 col-12' },
         { type: 'separator', name: 'space', size: '0', col: 'col-12' },
@@ -85,9 +85,9 @@ export default {
           placeholder: ' ',
           col: 'col-md-6 col-12'
         },
-        { type: 'input', name: 'mobile_number', placeholder: ' ', label: 'تلفن همراه جهت تماس', responseKey: 'mobile_number', col: 'col-md-6 col-12' },
+        { type: 'input', name: 'on_call_mobile_number', placeholder: ' ', label: 'تلفن همراه جهت تماس', responseKey: 'on_call_mobile_number', col: 'col-md-6 col-12' },
         { type: 'input', name: 'on_social_network_mobile_number', placeholder: ' ', label: 'تلفن همراه جهت شبکه های اجتماعی', responseKey: 'on_social_network_mobile_number', col: 'col-md-6 col-12' },
-        { type: 'input', name: 'phone_number', placeholder: ' ', label: 'تلفن منزل', responseKey: 'phone_number', col: 'col-md-6 col-12' },
+        { type: 'input', name: 'phone_number', placeholder: 'با کد شهر وارد شود', label: 'تلفن منزل', responseKey: 'phone_number', col: 'col-md-6 col-12' },
         {
           type: 'select',
           name: 'last_academic_degree',