ming il y a 3 ans
Parent
commit
94196172c5

BIN
static/img/angus.webp


BIN
static/img/girl2.png


BIN
static/img/ninablack.webp


BIN
static/img/ninawhite.webp


BIN
static/img/peggy.webp


BIN
static/img/stacy.webp


+ 58 - 14
static/index2.html

@@ -15,6 +15,7 @@
     <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet"> 
   <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
   <link rel="stylesheet" href="static/style.css">
+  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.min.css">
   <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
   <style>
     body {
@@ -93,6 +94,43 @@
             <option value="9">Nina黑</option>
             <option value="10">Nina灰</option>
           </select>
+          <div class="d-flex">
+            <div class="card" style="width:25%;">
+              <div class="imgfr"><img src="static/angus.webp" class="card-img-top" alt="..."></div>
+              <div class="zoomin"><img src="static/imgangus.webp" class="card-img-top" alt="..."></div>
+              <div class="card-body">
+                <h5 class="card-title">Angus</h5>
+              </div>
+            </div>
+            <div class="card" style="width:25%;">
+              <div class="imgfr"><img src="static/imgpeggy.webp" class="card-img-top" alt="..."></div>
+              <div class="zoomin"><img src="static/imgpeggy.webp" class="card-img-top" alt="..."></div>
+              <div class="card-body">
+                <h5 class="card-title">Peggy</h5>
+              </div>
+            </div>
+            <div class="card" style="width:25%;">
+              <div class="imgfr"><img src="static/imgstacy.webp" class="card-img-top" alt="..."></div>
+              <div class="zoomin"><img src="static/imgstacy.webp" class="card-img-top" alt="..."></div>
+              <div class="card-body">
+                <h5 class="card-title">Stacy</h5>
+              </div>
+            </div>
+            <div class="card" style="width:25%;">
+              <div class="imgfr"><img src="static/imgninablack.webp" class="card-img-top" alt="..."></div>
+              <div class="zoomin"><img src="static/imgninablack.webp" class="card-img-top" alt="..."></div>
+              <div class="card-body">
+                <h5 class="card-title">Nina黑</h5>
+              </div>
+            </div>
+            <div class="card" style="width:25%;">
+              <div class="imgfr"><img src="static/imgninawhite.webp" class="card-img-top" alt="..."></div>
+              <div class="zoomin"><img src="static/imgninawhite.webp" class="card-img-top" alt="..."></div>
+              <div class="card-body">
+                <h5 class="card-title">Nina灰</h5>
+              </div>
+            </div>
+          </div>
         </fieldset>
         <fieldset>
           <h3 class="fs-subtitle">台詞</h3>
@@ -108,17 +146,17 @@
           <input type="text" name='t10' class='txtsrc10' value="" placeholder="10" /><br/>
         </fieldset>
         <fieldset>
-          <h3 class="fs-subtitle">影像連結</h3><img class="ms-1" src="static/img/question.png" alt="" data-bs-toggle="tooltip" data-bs-placement="right" title="僅接受png, jpg格式">
-          <input type="text" name='m1' class='imgsrc1' value="" placeholder="1" /><br/>
-          <input type="text" name='m2' class='imgsrc2' value="" placeholder="2" /><br/>
-          <input type="text" name='m3' class='imgsrc3' value="" placeholder="3" /><br/>
-          <input type="text" name='m4' class='imgsrc4' value="" placeholder="4" /><br/>
-          <input type="text" name='m5' class='imgsrc5' value="" placeholder="5" /><br/>
-          <input type="text" name='m6' class='imgsrc6' value="" placeholder="6" /><br/>
-          <input type="text" name='m7' class='imgsrc7' value="" placeholder="7" /><br/>
-          <input type="text" name='m8' class='imgsrc8' value="" placeholder="8" /><br/>
-          <input type="text" name='m9' class='imgsrc9' value="" placeholder="9" /><br/>
-          <input type="text" name='m10' class='imgsrc10' value="" placeholder="10" /><br/>
+          <h3 class="fs-subtitle">影像連結</h3><img class="ms-1" src="static/img/question.png" alt="" data-bs-toggle="tooltip" data-bs-placement="right" title="僅接受png, jpg, mp4格式">
+          <input type="text" name='m1' class='imgsrc imgsrc1' value="" placeholder="1" /><br/>
+          <input type="text" name='m2' class='imgsrc imgsrc2' value="" placeholder="2" /><br/>
+          <input type="text" name='m3' class='imgsrc imgsrc3' value="" placeholder="3" /><br/>
+          <input type="text" name='m4' class='imgsrc imgsrc4' value="" placeholder="4" /><br/>
+          <input type="text" name='m5' class='imgsrc imgsrc5' value="" placeholder="5" /><br/>
+          <input type="text" name='m6' class='imgsrc imgsrc6' value="" placeholder="6" /><br/>
+          <input type="text" name='m7' class='imgsrc imgsrc7' value="" placeholder="7" /><br/>
+          <input type="text" name='m8' class='imgsrc imgsrc8' value="" placeholder="8" /><br/>
+          <input type="text" name='m9' class='imgsrc imgsrc9' value="" placeholder="9" /><br/>
+          <input type="text" name='m10' class='imgsrc imgsrc10' value="" placeholder="10" /><br/>
           <input id="checker" type="button" name="next" class="next action-button" value="送出" />
           
           <h3 class="fs-subtitle">處理進度</h3>
@@ -132,12 +170,16 @@
     <div class="modal fade" tabindex="-1" id="howto" aria-labelledby="howto" aria-hidden="true">
       <div class="modal-dialog">
         <div class="modal-content">
-          <div type="button" data-bs-dismiss="modal" aria-label="Close" class="modal-closer"><img src="images/Icon ionic-md-close-circle@2x.png" alt=""></div>
+          <div class="modal-header">
+            <h5 class="modal-title" id="staticBackdropLabel">使用說明</h5>
+            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
+          </div>
           <div class="modal-body">
-              <h5 class="modal-title">使用說明</h5>
               <div class="modal-terms">
                   <ol class="ps-0">
-                      <li>蒐集、處理及利用您個人資料。</li>
+                      <li>1. 一句台詞請對應提供一個影像連結做為搭配</li>
+                      <li>2. 影像連結檔案格式支援:<stong class="strong">.png, jpg, .mp4</stong></li>
+                      <li>3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看</li>
                   </ol>
               </div>
           </div>
@@ -167,6 +209,7 @@
   <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
   <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
   <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script> 
+  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.all.min.js"></script>
   <script src="static/script_msg.js"></script>
 
   <body>
@@ -175,3 +218,4 @@
 
 </body>
 </html>
+

+ 56 - 5
static/script_msg.js

@@ -6,9 +6,25 @@ var client_id = Date.now()
 var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
 var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
   return new bootstrap.Tooltip(tooltipTriggerEl)
-})
+});
+
+
+(function(){
+  $('.imgfr').hover(function(){
+    $(this).next().css('display', 'block');
+  }, function(){
+    $(this).next().css('display', 'none');
+  })
+}());
+
+
+const button = document.querySelector('.next');
 
 $(".next").click(function(){
+  button.setAttribute('disabled', '');
+  setTimeout(function(){
+    button.removeAttribute('disabled')
+  }, 4000);
   avatar = $('.avatar').val();
   name_title = $('.title_new').val();
   txtARR=[];
@@ -28,7 +44,7 @@ $(".next").click(function(){
 	dataOBJ = {"name":name_title,"text_content":txtARR,"image_urls":imgARR,"avatar":avatar,"client_id":client_id}
 	objstr = JSON.stringify(dataOBJ);
 	console.log(dataOBJ)
-  alert('資料送出,請稍候')
+  //alert('資料已送出! 請耐心等候')
   $.ajax({
 	url: 'http://www.choozmo.com:8888/make_anchor_video_v2',
 	//url: 'http://www.choozmo.com:8888/qqreq',
@@ -37,11 +53,14 @@ $(".next").click(function(){
 	type: 'post',
 	data: objstr,
 	success: function(suc_data) {
-    alert(suc_data.msg)
+    Swal.fire({
+      title: `${suc_data.msg}`,
+      confirmButtonColor: '#3085d6',
+    }); 
 	  },
 	//data:JSON.stringify({n1:"12",n2:"22"}),
 	error: function (error) {
-	  alert(error)
+	  console.error(error)
 	}
 });
 
@@ -104,9 +123,41 @@ var myModal = new bootstrap.Modal(document.getElementById('history'), {
     }
             var ws = new WebSocket(`ws://www.choozmo.com:8888/progress/${client_id}`);
             ws.onmessage = function(event) {
-              var elem = document.getElementById("myBar");
               console.log(event.data)
+              var elem = document.getElementById("myBar");
               elem.style.width = event.data + "%";
               elem.innerHTML = event.data  + "%";
             };
 
+
+            var err = [];
+            function listenToimg() {
+            }
+            
+            validate();
+            function validate(){
+              let imgsrc = document.querySelectorAll('.imgsrc');
+              imgsrc = [...imgsrc];
+              for(let i = 0; i < 10; i++){
+                imgsrc[i].addEventListener('blur', function(){
+                  let srcArray = $(this).val().split('.');
+                  console.log(srcArray);
+                  if(srcArray.includes('png') || srcArray.includes('jpg')){
+                    $(this).removeClass('error');
+                    $(this).next().remove('p');
+                    err.pop();
+                  }else if(srcArray.length <= 1){
+                    $(this).removeClass('error');
+                    $(this).next().remove('p');
+                    err.pop();
+                  }else {
+                    $(this).addClass('error');
+                    if( this.nextSibling.nodeName !== 'P') {
+                      $(this).after('<p class="error-text">未支援該格式</p>');
+                    }
+                    err.push('svg');
+                    console.log(err);
+                  }
+                });
+              }
+            }