Advertisement
tomilia

Untitled

Jul 27th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.78 KB | None | 0 0
  1. {% load staticfiles %}
  2. <link rel="stylesheet" href="{% static 'css/modal.css' %}">
  3. <div id="id02" class="modal" >
  4.  
  5. <div class="phone-sign">
  6. <form class="modal-content animate" id="reg">
  7. <div class="imgcontainer">
  8. <button onclick="document.getElementById('id02').style.display='none';" class="close" type="reset" value="reset" title="Close Modal">&times;</span>
  9. </div>
  10. <div class="front-step">
  11. <div class="container">
  12.  
  13. <div class="panel panel-primary">
  14. <div class="panel-body">
  15.  
  16.  
  17. <div class="form-group">
  18. <label class="control-label" for="signupPasswordagain">電話號碼註冊</label>
  19. <div class="row align-items-center h-40" >
  20. <div class="col-md-3">
  21. <select class="custom-select" name="ccode" id="exampleSelect1">
  22. <option value=852>+852</option>
  23. <option value=853>+853</option>
  24. <option value=86>+86</option>
  25. </select>
  26. </div>
  27. <div class="col-md-8" style="margin-left:-20px;">
  28. <input id="signupPasswordagain" name="tel" type="text" maxlength="25" class="form-control" placeholder="輸入你的電話號碼" style="background:#fff;">
  29. </div>
  30. </div>
  31. </div>
  32. <div class="form-group" style="margin-top:30px;">
  33. <label class="control-label" for="signupPasswordagain">驗證碼</label>
  34. <div class="row align-items-center h-40" >
  35.  
  36. <div class="col-md-3">
  37. <input id="vericode" type="text" maxlength="3" name="verify" class="form-control" style="background:#fff;">
  38. </div>
  39. <div class="col-md-3">
  40. <button class="btn btn-success">發送驗證碼</label>
  41. </div>
  42. </div>
  43.  
  44. </div>
  45. </div>
  46. </div>
  47. <div class="form-group">
  48. <button id="signupNextStep" type="button" class="btn btn-info btn-block process" style="margin-top:30px;" onclick="">下一步</button>
  49. <script>
  50. $('#vericode').on('input',function() {
  51. if($('#vericode').val().length==3)
  52. {
  53. $('.process').prop('disabled', false);
  54. }
  55. else {
  56. $('.process').prop('disabled', true);
  57. }
  58. });
  59.  
  60. $('.process').prop('disabled', true);
  61.  
  62. </script>
  63. </div>
  64. <hr/>
  65. {% include 'blog/social-sign.html' %}
  66. </div>
  67.  
  68. </div>
  69. <div class="back-step" style="display:none;">
  70. <div class="container">
  71.  
  72. <div class="panel panel-primary">
  73. <div class="panel-body">
  74.  
  75. <div class="container">
  76.  
  77. <!--checkpoint-->
  78. <div class="form-group">
  79. <div class="form-group">
  80. <h2 style="text-align:center;">請輸入密碼 </h2>
  81. </div>
  82. <div class="form-group">
  83. <label class="control-label" for="signupPassword">密碼</label>
  84. <input id="signupPassword" type="password" name="pw" maxlength="25" class="form-control" placeholder="at least 6 characters" length="40">
  85. </div>
  86.  
  87.  
  88. <div class="form-group">
  89. <label class="control-label" for="signupPasswordagain">確認密碼</label>
  90. <input id="signupPasswordagain" type="password" name='confirmpw' maxlength="25" class="form-control">
  91. </div>
  92. <div class="form-group">
  93. <button id="signupSubmit" type="button" class="btn btn-danger btn-block process" style="margin-top:30px;" onclick="me()">登記</button>
  94. <script>
  95.  
  96.  
  97. </script>
  98. </div>
  99. </div>
  100. </div>
  101.  
  102. </div>
  103. </div>
  104.  
  105. <script>
  106.  
  107. function me(){
  108. console.log($('#reg').serialize());
  109. }
  110. //success verification
  111. $('#signupNextStep').click(function(){
  112. $('.front-step').css('display','none');
  113. $('.back-step').css('display','block');
  114. });
  115. </script>
  116.  
  117. </div>
  118. </div>
  119.  
  120.  
  121. </form>
  122. </div>
  123.  
  124.  
  125.  
  126.  
  127. <div class="email-sign" style="display:none;">
  128. <form class="modal-content animate" @submit="checkSForm" id="emailreg">
  129. {%csrf_token%}
  130. <div class="imgcontainer">
  131. <span onclick="document.getElementById('id02').style.display='none'" class="close" title="Close Modal">&times;</span>
  132. </div>
  133. <div class="container">
  134. <div class="row">
  135. <div class="panel panel-primary">
  136. <div class="panel-body">
  137. <div class="container">
  138. <div class="form-group">
  139.  
  140. <span v-html="messagc"></span>
  141.  
  142. </div>
  143. {%for non_field_error in sform.non_field.errors%}
  144. <p class="help is-danger">{{non_field_error}}</p>
  145. {% endfor %}
  146. {% for field in sform %}
  147. <div class="form-group">
  148. <label for="{{field.id_for_label}}" class="label">{{field.label}}</label>
  149. <div @keyup.enter="Login" class="fieldx">{{field}}</div>
  150. <style>.fieldx input {width: 100%;}</style>
  151. {% if field.help_text%}
  152. <p class="help">{{field.help_text}}</p>
  153. {% endif %}
  154. {% for error in field.errors %}
  155. <p class="is-danger">{{error}}</p>
  156. {% endfor %}
  157. </div>
  158. {%endfor%}
  159.  
  160.  
  161. <hr/>
  162. <p></p>
  163. <div class="custom-control custom-checkbox mr-sm-2">
  164. <input type="checkbox" class="custom-control-input" id="customControlAutosizing" required>
  165. <label class="custom-control-label" for="customControlAutosizing"><p class="form-group">By creating an account, you agree to our <a href="#">Terms of Use</a> and our <a href="#">Privacy Policy</a>.</p></label>
  166. </div>
  167. <div class="form-group">
  168. <button id="signupSubmit" type="submit" class="btn btn-success btn-block">立即注冊!</button>
  169. </div>
  170.  
  171. </div>
  172.  
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </form>
  178. </div>
  179. </div>
  180.  
  181.  
  182. <!--
  183. Below we include the Login Button social plugin. This button uses
  184. the JavaScript SDK to present a graphical Login button that triggers
  185. the FB.login() function when clicked.
  186. -->
  187.  
  188.  
  189. <script >
  190.  
  191.  
  192. var app2 = new Vue({
  193.  
  194. el: '#emailreg',
  195. data: {
  196. messagc: '',
  197. username:null,
  198. password:null
  199.  
  200. },
  201. methods:{
  202. checkSForm:function(e) {
  203. let self=this;
  204. this.errors = [];
  205. if(e) e.preventDefault();
  206.  
  207. $.ajax({
  208. url: '/signup/', //this is the submit URL
  209. type: 'POST', //or POST
  210. data: $('#emailreg').serialize(),
  211. success: function(data){
  212. alert(data);
  213. location.reload();
  214. },
  215. error: function(data){
  216. alert(JSON.stringify(data));
  217. }
  218. });
  219. }
  220. },
  221. delimiters: ['${', '}']
  222. });
  223.  
  224. </script>
  225.  
  226. <script>
  227. function changemail(){
  228. $('.phone-sign').css('display','none');
  229. $('.email-sign').css('display','block');
  230. }
  231. // Get the modal
  232. var modalx = document.getElementById('id01');
  233. var modaly =document.getElementById('id02');
  234. // When the user clicks anywhere outside of the modal, close it
  235. window.onclick = function(event) {
  236. if (event.target == modalx ) {
  237.  
  238. modalx.style.display = "none";
  239. }
  240. else if (event.target == modaly){
  241. modaly.style.display = "none";
  242. }
  243. }
  244. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement