Guest User

Untitled

a guest
Jun 11th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2. <div>
  3.    <!--   <p>{{loading}} - {{form}}</p> -->
  4.     <div id="f">
  5.         <b-form @submit="onSubmit" >
  6.               <div class="d-flex justify-content-start">
  7.             <p style="margin-left: 20px; font-weight:normal;">Реєстрація</p>
  8.               </div>
  9.             <b-form-group
  10.                     description="введіть ім'я користувача"
  11.                     class="child"
  12.                     id="input-group-1"
  13.                     label-for="input-1"
  14.             >
  15.                 <b-form-input
  16.  
  17.                         id="input-1"
  18.                         v-model="form.email"
  19.                         type="email"
  20.                         required
  21.                         placeholder="емейл..."
  22.                 ></b-form-input>
  23.             </b-form-group>
  24.  
  25.             <b-form-group class="child" description="введіть ім'я користувача" label-for="input-2">
  26.                 <b-form-input
  27.  
  28.                         id="input-11"
  29.                         v-model="form.name"
  30.                         required
  31.                         placeholder="ім'я.."
  32.                         minlength="6"
  33.                 ></b-form-input>
  34.             </b-form-group>
  35.  
  36.             <b-form-group class="child">
  37.                 <b-form-input
  38.                         description="введіть пароль"
  39.                         id="input-2"
  40.                         v-model="form.password"
  41.                         type="password"
  42.                         required
  43.                         placeholder="пароль..."
  44.                         minlength="6"
  45.                 ></b-form-input>
  46.             </b-form-group>
  47.  
  48.             <b-form-group class="child" id="">
  49.                 <b-form-checkbox
  50.                         v-on:change="show_password_"
  51.                 >
  52.                     <p style="margin-left: 20px; font-weight:normal;">      Показати пароль</p>
  53.                 </b-form-checkbox>
  54.  
  55.             </b-form-group>
  56.  
  57.  
  58.             <b-button  v-on:click="loading=true" type="submit" variant="primary" style="margin-left: 10px; margin-top: -25px;">Реєстрація</b-button>
  59.         </b-form>
  60.  
  61.     </div>
  62.   <p>{{loading}}</p>
  63.     <div  v-if="loading">
  64.  
  65.        <load_spinner></load_spinner>
  66.     </div>
  67.  
  68. </div>
  69. </template>
  70. <style>
  71.  
  72. </style>
  73. <script>
  74.     /* eslint-disable */
  75.  
  76.     /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
  77.      import current_host from "../get_api_host.js"
  78. import "./style.css"
  79. import load_spinner from "../load_spinner.vue"
  80.     import $ from "jquery"
  81.  import Swal from 'sweetalert2/dist/sweetalert2.js'
  82.  import 'sweetalert2/dist/sweetalert2.css'
  83. import axios from "axios"
  84.     import Load_spiner from "../proposals/load_spiner";
  85.     export default {
  86.         name: "register",
  87.         components: {Swal,Load_spiner,load_spinner},
  88.      //   contents: {Swal},
  89.         data() {
  90.             return {
  91.                 loading: false,
  92.                 form: {
  93.                     email: '',
  94.                     name: '',
  95.                     password: '',
  96.                   //  role: 'Адміністратор',
  97.                 },
  98.                 show_password: false,
  99.                 show: true
  100.             }
  101.         },
  102.              check_email(){
  103.                  var self = this;
  104.                  var res = null
  105.             $.get({
  106.  
  107.                 async: false,
  108.                 url: "https://emailverification.whoisxmlapi.com/api/v1?apiKey=at_KnzbXz2J5IJSzVqualuiMb20MGLQG&emailAddress="+self.form.email,
  109.                 success:function(e){
  110.                   //  alert(JSON.stringify(e))
  111.                     //alert(1)
  112.                     res =  JSON.stringify(e)
  113.                 },
  114.                 error:function (e) {
  115.                    // alert(2)
  116.                     // alert(JSON.stringify(e))
  117.                    res = JSON.stringify(e)
  118.                 }
  119.             })
  120.                  return res;
  121.         },
  122.             show_password_(e) {
  123.  
  124.                 var x = document.getElementById("input-2");
  125.                 //alert(x.type)
  126.                 if (x.type === "password") {
  127.                     x.type = "text";
  128.                 } else {
  129.                     x.type = "password";
  130.                 }
  131.  
  132.                 var y = document.getElementById("input-3");
  133.                 //  alert(y.type)
  134.                 if (y.type === "password") {
  135.                     y.type = "text";
  136.                 } else {
  137.                     y.type = "password";
  138.                 }
  139.             },
  140.             onSubmit(evt) {
  141.             //    this.loading = !this.loading;
  142.                  alert(this.loading)
  143.             //    alert(this.form.name + " " + this.form.email + " " + this.form.password);
  144.              evt.preventDefault();
  145.        this.check_email();
  146. //sleep(1)
  147.         // this.loading =false;
  148.             //    alert(this.form.name + " " + this.form.email + " " + this.form.password);
  149.  
  150.  
  151.  
  152.                 //this.email = this.form.email.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  153.     //  this.password = this.form.password.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  154.     //          this.name = this.form.name.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  155.  
  156.       //          var vm = this;
  157.  
  158.  
  159.         //        if ( this.check_email()) {
  160.                    //  this.loading = false
  161.                  /*   $.post({
  162.                         async: false,
  163.                         url: current_host + "/register/",
  164.                         data: vm.form,
  165.                         dataType: "json",
  166.  
  167.                         success: function (data) {
  168.                             //  alert(JSON.stringify(data))
  169.                             // alert(JSON.stringify(data));
  170.                             localStorage.setItem("id", data.id);
  171.                             localStorage.setItem("name", data.name);
  172.                             localStorage.setItem("token", data.token);
  173.                             localStorage.setItem("role", "Звичайний");
  174.                             localStorage.setItem("is_blocked_by_admin", data.is_blocked_by_admin);
  175.                             window.location.href = "/";
  176.                         },
  177.                         error: function (e) {
  178.                             //    alert(2)
  179.                             //  alert(JSON.stringify(e))
  180.                             Swal.fire({
  181.                                 icon: 'info',
  182.                                 title: 'Oops...',
  183.                                 text: e.responseJSON.response,
  184.                             });
  185.                             //  alert("error");
  186.                             // alert(JSON.stringify(e));
  187.  
  188.                         }
  189.                     });*/
  190.                 }
  191.             //},
  192.         }
  193.     }
  194.  
  195. </script>
Add Comment
Please, Sign In to add comment