Browse Source

fb share, slide intro text

huai-sian 3 years ago
parent
commit
1f8fde5615
6 changed files with 54 additions and 18 deletions
  1. 5 4
      html/invite.js
  2. 24 1
      html/login.js
  3. 4 4
      html/make_video_slide.html
  4. 6 3
      html/script_profile.js
  5. 2 0
      html/static/lan.js
  6. 13 6
      html/user_profile2.html

+ 5 - 4
html/invite.js

@@ -54,12 +54,13 @@ function validatePassword(psd) {
 }
 
 function getpathId() {
-  id = window.location.search.split('?').pop();
-  if(id.split('=')[0] === 'code') {
-    return id.split('=')[1];
-  }
+    const urlParams = new URLSearchParams(window.location.search);
+    const id = urlParams.get('code');
+    return id;
 }
 
+console.log(getpathId());
+
 function register() {
     let url = 'https://www.choozmo.com:8887/register';
     let userName = $('#register [name = "username"]').val();

+ 24 - 1
html/login.js

@@ -56,7 +56,7 @@ function login(){
     }).then(res => {
         console.log(res.data);
         document.cookie = 'jwt_token='+res.data.access_token;
-        if(res.data.access_token!=null) {
+        if(res.data.access_token!=null && res.data.veri == 'ok') {
             var title = "登入成功";
             if (lang == 'en') { // 英文版訊息
                 title = "Login Successfully!"
@@ -71,6 +71,19 @@ function login(){
                 window.location.href = 'user_profile2.html';
             }, 2000);
             btnLoginPage.style.display = 'none';
+        } else if (res.data.access_token!=null && res.data.veri != 'ok') {
+            var title = "請前往信箱完成驗證";
+
+            if (lang == 'en') { // 英文版訊息
+                title = "Please check your email box to get validated!"
+            }
+
+            Swal.fire({
+                title: title,
+                icon: 'error',
+                text: responseOBJ.detail,
+                confirmButtonColor: '#3085d6',
+            });
         } else {
             var title = "登入失敗";
 
@@ -88,6 +101,16 @@ function login(){
         
     }).catch(err => {
         console.log(err);
+        var title = "錯誤處理中,請稍後再試";
+
+            if (lang == 'en') { // 英文版訊息
+                title = "Oops! Errors occurred. Please try it later!"
+            }
+        Swal.fire({
+            title: title,
+            icon: 'error',
+            confirmButtonColor: '#3085d6',
+        });
     })
 }
 /*     var xhr = new XMLHttpRequest();

+ 4 - 4
html/make_video_slide.html

@@ -344,16 +344,16 @@
                 <div class="modal-dialog">
                     <div class="modal-content">
                         <div class="modal-header">
-                            <h5 class="modal-title" id="staticBackdropLabel">使用說明</h5>
+                            <h5 class="modal-title" id="staticBackdropLabel" set-lan="html:usage_intro">使用說明</h5>
                             <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                         </div>
                         <div class="modal-body">
                             <div class="modal-terms">
                                 <ol class="ps-0">
-                                    <li>1. 一句台詞請對應提供一個影像連結做為搭配</li>
-                                    <li>2. 影像連結檔案格式支援:<stong class="strong">.png, jpg, .mp4</stong>
+                                    <li set-lan="html:slide_howto_use">1. 投影片將作為背景圖,備註中的文字則為虛擬主播的講稿內容。</li>
+                                    <li><lang set-lan="html:sup_img_profile">2. 影像連結檔案格式支援:</lang><stong class="strong">.png, jpg, .mp4</stong>
                                     </li>
-                                    <li>3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看</li>
+                                    <li set-lan="html:submit_to_wait">3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看</li>
                                 </ol>
                             </div>
                         </div>

+ 6 - 3
html/script_profile.js

@@ -3,6 +3,8 @@ const btnUserProfile = document.querySelector('.btn-userProfile');
 const btnLogout = document.querySelector('.btn-logout');
 
 let lan = localStorage.getItem('lan');
+let defaultLength = 5;
+let historyData;
 
 function getCookie(name) {
     const value = `; ${document.cookie}`;
@@ -41,6 +43,7 @@ function checkLan() {
 
 checkLan();
 
+
 function renderView() {
     let token = getCookie('jwt_token');
     if(!token) {
@@ -83,8 +86,7 @@ function renderView() {
               }
             });
           }
-        $('.fb-share-button').attr('data-href', `https://video.choozmo.com?code=${userInfo.user_info.invite_code}`);
-        console.log($('.fb-share-button').attr('data-href'));
+        $('.share-fb').attr('href', `https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fvideo.choozmo.com/invite.html?code=${userInfo.user_info.invite_code}`);
         $('.share-twitter').attr('href',
         `https://twitter.com/intent/tweet?text=I%20just%20created%20a%20video%20in%205%20minutes.%20Check%20it%20out%20%F0%9F%91%89%20https%3A%2F%2Fvideo.choozmo.com/invite.html?code=${userInfo.user_info.invite_code}&related=ai_cmm`)
         
@@ -134,8 +136,9 @@ function renderView() {
         }
         // 歷史紀錄
         // const historicalrecord 
+        historyData = {...userInfo};
         var  historicalrecord='';
-        var length = userInfo.video_info.length > 5 ? 5 : userInfo.video_info.length;
+        var length = userInfo.video_info.length > defaultLength ? defaultLength : userInfo.video_info.length;
         for (var i = 0; i < length; i++) {
           let formatted = userInfo.video_info[i].time_stamp;
           if (lan == 'zh') {

+ 2 - 0
html/static/lan.js

@@ -71,6 +71,7 @@ var zh = {
     "img_link": "影像連結",
     "processing_progress": "處理進度",
     "usage_intro": "使用說明",
+    "slide_howto_use": "1. 投影片將作為背景圖,備註中的文字則為虛擬主播的講稿內容。",
     "one_line_to_one_img": "1. 一句台詞請對應提供一個影像連結做為搭配",
     "sup_img_profile": "2. 影像連結檔案格式支援:",
     "submit_to_wait": "3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看",
@@ -157,6 +158,7 @@ var en = {
     "img_link": "Image Link",
     "processing_progress": "Processing Progress",
     "usage_intro": "Usage Introduction",
+    "slide_howto_use": "1. Each slide would appear as main image and the the content speaker notes will be the content what the avatar says.",
     "one_line_to_one_img": "1. Please Provide an Image Link Corresponding to a Line as a Collocation",
     "sup_img_profile": "2. Supported File Format:",
     "submit_to_wait": "3. After Clicking Submit, You Will Need To Wait For A Period Of Time For The Production Of The Video. Please Wait Patiently. You Can Check It At The Notification URL When The Production Is Completed.",

+ 13 - 6
html/user_profile2.html

@@ -317,7 +317,7 @@
                                                     <div class="d-flex">
                                                         <p style="color:#183790; font-size: 20px;"
                                                             class="d-inline fw-bold" set-lan="html:share">Share:</p>
-                                                        <div style="color:#183790">
+                                                        <!-- <div style="color:#183790">
                                                             <div class="fb-share-button mx-2 ms-3"
                                                                 data-href="https://video.choozmo.com/"
                                                                 data-layout="button" data-size="large"><a
@@ -326,7 +326,14 @@
                                                                     class="fb-xfbml-parse-ignore"></a></div>
                                                             <span class="facebook"
                                                                 style="position: relative; bottom:2px;">Facebook</span>
-                                                        </div>
+                                                        </div> -->
+                                                        <a class="mx-2 mx-lg-4 share-fb text-center"
+                                                            href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fvideo.choozmo.com">
+                                                            <img width="28" class="me-2"
+                                                                src="./static/img/userprofile/Icon awesome-facebook-square.png"
+                                                                alt="">
+                                                            Facebook
+                                                        </a>
                                                         <a class="mx-2 mx-lg-4 text-center share-twitter"
                                                             href="https://twitter.com/intent/tweet?text=I%20just%20created%20a%20video%20in%205%20minutes.%20Check%20it%20out%20%F0%9F%91%89%20https%3A%2F%2Fvideo.choozmo.com/&related=ai_cmm"
                                                             target="_blank">
@@ -366,16 +373,16 @@
             <div class="modal-dialog">
                 <div class="modal-content">
                     <div class="modal-header">
-                        <h5 class="modal-title" id="staticBackdropLabel">使用說明</h5>
+                        <h5 class="modal-title" id="staticBackdropLabel" set-lan="html:usage_intro">使用說明</h5>
                         <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                     </div>
                     <div class="modal-body">
                         <div class="modal-terms">
                             <ol class="ps-0">
-                                <li>1. 一句台詞請對應提供一個影像連結做為搭配</li>
-                                <li>2. 影像連結檔案格式支援:<stong class="strong">.png, jpg, .mp4</stong>
+                                <li set-lan="html:one_line_to_one_img">1. 一句台詞請對應提供一個影像連結做為搭配</li>
+                                <li><lang set-lan="html:sup_img_profile">2. 影像連結檔案格式支援:</lang><stong class="strong">.png, jpg, .mp4</stong>
                                 </li>
-                                <li>3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看</li>
+                                <li set-lan="html:submit_to_wait">3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看</li>
                             </ol>
                         </div>
                     </div>