Przeglądaj źródła

show coffee or not

huaisianhuang 3 lat temu
rodzic
commit
de4387fe0a

+ 13 - 5
step_question/apis/static/index-line.html

@@ -123,15 +123,23 @@
       </fieldset>
     </form>
         
-    <div class="text-center">
-
+    <div class="text-center coffee_b">
       <img class="img-fluid mb-3" src="images/banner-bottom.jpg" alt="幸福空間 - 裝修市場問卷調查">
-
-
     </div>
 
   </div>
-
+  <script>
+    function showcoffee() {
+      axios.get('http://q.ptt.cx/coffee').then(res => {
+        if(res.data.coffee == 1) {
+          $('.coffee_b').css('display', 'block');
+        } else {
+          $('.coffee_b').css('display', 'none');
+        }
+      });
+      }
+      showcoffee();
+  </script>
   <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
   <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
   <script src="./script.js"></script>

+ 2 - 1
step_question/apis/static/script.js

@@ -105,13 +105,14 @@ $("input[name=submit]").click(function(){
 				console.error(error)
 			}
 		}); */
+		showThankyou();
 	}
 });
 
 // 依據管道導頁
 function showThankyou() {
 	axios.get('http://q.ptt.cx/coffee').then(res => {
-		if(res.data.coffee == 1) {
+		if(res.data.coffee === "1") {
 			document.location = '/a1/index_complete_line.html';
 		} else {
 			document.location = '/a1/index_complete_line_after.html';