فهرست منبع

eng_msg and fix eng switch

huaisianhuang 3 سال پیش
والد
کامیت
f39a862176
5فایلهای تغییر یافته به همراه94 افزوده شده و 32 حذف شده
  1. 1 1
      html/make_video.html
  2. 12 4
      html/register.js
  3. 18 4
      html/script_profiles.js
  4. 62 22
      html/static/script_util.js
  5. 1 1
      html/user_profile2.html

+ 1 - 1
html/make_video.html

@@ -299,8 +299,8 @@
     <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.all.min.js"></script>
     <script src="static/owl.carousel.min.js"></script>
     <script src="static/loading-overlay.js"></script>
-    <script src="static/script_util.js"></script>
     <script type="text/javascript" src="static/lan.js"></script>
+    <script src="static/script_util.js"></script>
     <script src="static/common.js"></script>
 </body>
 

+ 12 - 4
html/register.js

@@ -71,13 +71,17 @@ function register() {
             console.log(res.data.msg);
             if(res.data.msg == 'ok') {
                 let title = "註冊成功";
+                let text;
                     if (lang == 'en') { 
-                        title = "Register Successfully!"
+                        title = "Register Successfully!";
+                        text = res.data.msg.eng;
+                    } else {
+                        text = res.data.msg.zh;
                     }
                 Swal.fire({
                     title: title,
                     icon: 'success',
-                    text: res.data.msg,
+                    text: text,
                     confirmButtonColor: '#3085d6',
                 });
                 window.setTimeout(() => {
@@ -85,13 +89,17 @@ function register() {
                 }, 2000);
             } else {
                 let title = "註冊失敗";
+                let text;
                     if (lang == 'en') { 
-                        title = "Register failed!"
+                        title = "Register failed!";
+                        text = res.data.msg.eng;
+                    } else {
+                        text = res.data.msg.zh;
                     }
                 Swal.fire({
                     title: title,
                     icon: 'error',
-                    text: res.data.msg,
+                    text: text,
                     confirmButtonColor: '#3085d6',
                 });
             }

+ 18 - 4
html/script_profiles.js

@@ -89,18 +89,32 @@ function renderView() {
             </div>
         </div>`;
         // 使用者名稱
-        const userName = `<h2 class="user-name text-white mt-4 fw-bold">Hi ${userInfo.user_info.userName}</h2>`;
+        let userName = `<h2 class="user-name text-white mt-4 fw-bold">Hi ${userInfo.user_info.userName}</h2>`;
         // 已使用
-        const usedtime=`<h1 class="text-center">${userInfo.user_info.total_sec}&ensp;<span style="font-size:15px;" set-lan="html:sec">秒</span></h1>`;
+        let usedtime=`<h1 class="text-center">${userInfo.user_info.total_sec}&ensp;<span style="font-size:15px;" set-lan="html:sec">秒</span></h1>`;
+        if(lang == 'en') {
+          usedtime=`<h1 class="text-center">${userInfo.user_info.total_sec}&ensp;<span style="font-size:15px;" set-lan="html:sec">Sec</span></h1>`;
+        }
         // 未使用
-        const NotUsedTime=`<h1  class="text-center">${userInfo.user_info.left_sec}&ensp;<span style="font-size:15px;" set-lan="html:sec">秒</span></h1>`;
+        let NotUsedTime=`<h1  class="text-center">${userInfo.user_info.left_sec}&ensp;<span style="font-size:15px;" set-lan="html:sec">秒</span></h1>`;
+        if(lang == 'en') {
+          NotUsedTime=`<h1  class="text-center">${userInfo.user_info.left_sec}&ensp;<span style="font-size:15px;" set-lan="html:sec">Sec</span></h1>`;
+        }
         // user資訊
-        const infContent=`
+        let infContent=`
         <div class="inf-content">
             <p>${userInfo.user_info.userName}</p>
             <p>***************&nbsp;<a href="./reset_pwd_email.html" set-lan="html:resetPsd">更改密碼</a></p>
             <p>${userInfo.user_info.email}</p>
         </div>`;
+        if(lang == 'en') {
+          infContent=`
+            <div class="inf-content">
+                <p>${userInfo.user_info.userName}</p>
+                <p>***************&nbsp;<a href="./reset_pwd_email.html" set-lan="html:resetPsd">Reset Password</a></p>
+                <p>${userInfo.user_info.email}</p>
+            </div>`;
+        }
         // 歷史紀錄
         // const historicalrecord 
         var  historicalrecord=''

+ 62 - 22
html/static/script_util.js

@@ -124,7 +124,7 @@ $(".next").click(function () {
   button.setAttribute('disabled', '');
   setTimeout(function () {
     button.removeAttribute('disabled')
-  }, 4000);
+  }, 6000);
   avatar = $('.avatar').val();
   name_title = $('.title_new').val();
   txtARR = [];
@@ -142,7 +142,7 @@ $(".next").click(function () {
       imgARR.push($(`.imgsrc${i}`).val())
     }
   }
-  multiLang = 0
+  multiLang = 0;
   if ($('#multiLang').prop("checked")) {multiLang = 1;}
   dataOBJ = { "name": name_title, "text_content": txtARR, "image_urls": imgARR, "avatar": avatar,"multiLang":multiLang, "client_id": client_id }
   objstr = JSON.stringify(dataOBJ);
@@ -156,20 +156,32 @@ $(".next").click(function () {
   xhr.onreadystatechange = function () {
     if (xhr.readyState === 4) {
       responseOBJ = JSON.parse(xhr.responseText)
-      if (responseOBJ.msg=='ok')
-      {
+      if (responseOBJ.msg=='ok') {
+        let title = "資料已送出";
+        let text = '資料已傳送,請耐心等候';
+        if (lang == 'en') { // 英文版訊息
+          title = "Submitted Successfully!";
+          text = 'We are working on your video. You will get notfication in line group when your video is done.';
+        }
         Swal.fire({
-          title: "資料已送出",
+          title: title,
           icon: 'success',
-          text: '資料已傳送,請耐心等候',
+          text: text,
           confirmButtonColor: '#3085d6',
         });
-      }
-      else{
+      } else{
+        let title = '發生錯誤';
+        let text;
+        if(lang == 'en') {
+          title = 'Error';
+          text = responseOBJ.msg.eng;
+        } else {
+          text = responseOBJ.msg.zh;
+        }
         Swal.fire({
-          title: "發生錯誤",
+          title: title,
           icon: 'error',
-          text: responseOBJ.msg,
+          text: text,
           confirmButtonColor: '#3085d6',
         });
       }
@@ -217,20 +229,32 @@ $("#sendBTN").click(function () {
   xhr.onreadystatechange = function () {
     if (xhr.readyState === 4) {
       responseOBJ = JSON.parse(xhr.responseText)
-      if (responseOBJ.msg=='ok')
-      {
+      if (responseOBJ.msg=='ok'){
+        let title = "資料已送出";
+        let text = '資料已傳送,請耐心等候';
+        if (lang == 'en') { // 英文版訊息
+          title = "Submitted Successfully!";
+          text = 'We are working on your video. You will get notfication in line group when your video is done.';
+        }
         Swal.fire({
-          title: "資料已送出",
+          title: title,
           icon: 'success',
-          text: '資料已傳送,請耐心等候',
+          text: text,
           confirmButtonColor: '#3085d6',
         });
-      }
-      else{
+      } else {
+        let title = '發生錯誤';
+        let text;
+        if(lang == 'en') {
+          title = 'Error';
+          text = responseOBJ.msg.eng;
+        } else {
+          text = responseOBJ.msg.zh;
+        }
         Swal.fire({
-          title: "發生錯誤",
+          title: title,
           icon: 'error',
-          text: responseOBJ.msg,
+          text: text,
           confirmButtonColor: '#3085d6',
         });
       }
@@ -262,10 +286,16 @@ $("#send_slide").click(function () {
   xhr.setRequestHeader("Content-Type", "application/json");
   xhr.onreadystatechange = function () {
     if (xhr.readyState === 4) {
+      let title = "資料已送出";
+        let text = '資料已傳送,請耐心等候';
+        if (lang == 'en') { // 英文版訊息
+          title = "Submitted Successfully!";
+          text = 'We are working on your video. You will get notfication in line group when your video is done.';
+        }
       Swal.fire({
-        title: "資料已送出",
+        title: title,
         icon: 'success',
-        text: '資料已傳送,請耐心等候',
+        text: text,
         confirmButtonColor: '#3085d6',
       });
     }
@@ -447,6 +477,9 @@ function load_data(tid, loaded_data, draft = false) {
     imguploadlabel.setAttribute('for', `img${i + 1}`);
     imguploadlabel.classList.add('upload-btn');
     imguploadlabel.textContent = '上傳檔案';
+    if(lang == 'en') {
+      imguploadlabel.textContent = 'Upload';
+    }
     imguploadlabel.setAttribute('set-lan', `html:upload_file`);
     imgInputs.appendChild(imguploadlabel);
   }
@@ -582,6 +615,9 @@ function renderimgBlock(i) {
   imguploadlabel.setAttribute('for', `img${i}`);
   imguploadlabel.classList.add('upload-btn');
   imguploadlabel.textContent = '上傳檔案';
+  if(lang == 'en') {
+    imguploadlabel.textContent = 'Upload';
+  }
   imguploadlabel.setAttribute('set-lan', `html:upload_file`);
   imgInputs.appendChild(imguploadlabel);
   $('input[type=file]').on('change', prepareUpload);
@@ -654,15 +690,19 @@ $('.draft-btn').click(() => {
   }).then(res => {
     console.log(res.data);
     $('.draft-btn').text('存為草稿');
+    let title = "儲存完成";
+    if(lang == 'en') {
+      title = 'Saved!'
+      $('.draft-btn').text('Save as Draft');
+    }
     Swal.fire({
-      title: "儲存完成",
+      title: title,
       icon: 'success',
       confirmButtonColor: '#3085d6',
     }); 
   }).catch(err => {
     console.log(err);
   });
-
 });
 
 function getDraftData() {

+ 1 - 1
html/user_profile2.html

@@ -303,8 +303,8 @@
     <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.all.min.js"></script>
     <script src="static/owl.carousel.min.js"></script>
     <script src="static/loading-overlay.js"></script>
-    <script src="./script_profiles.js"></script>
     <script type="text/javascript" src="static/lan.js"></script>
+    <script src="./script_profiles.js"></script>
     <script src="static/common.js"></script>
 </body>