浏览代码

Merge branch 'master' of http://git.choozmo.com:3000/choozmo/AI_Anchor_2

deployer 3 年之前
父节点
当前提交
cbdb75ae80

二进制
api/__pycache__/main.cpython-39.pyc


+ 2 - 4
api/main.py

@@ -299,11 +299,9 @@ async def get_role(token: str = Depends(oauth2_scheme)):
 
 
 @app.post('/get_avatar_by_role')
 @app.post('/get_avatar_by_role')
 async def get_role(token: str = Depends(oauth2_scheme)):
 async def get_role(token: str = Depends(oauth2_scheme)):
-     
     user_id = util.user.get_user_id(token)
     user_id = util.user.get_user_id(token)
-    roles = util.user.get_user_role(user_id)
-    
-    return user_id
+    avatar_info = util.user.get_avatar_by_role(user_id)
+    return avatar_info
 
 
 @app.get('/verify_email')
 @app.get('/verify_email')
 async def verify_email(code):
 async def verify_email(code):

+ 9 - 8
api/util/user.py

@@ -91,16 +91,17 @@ def get_user_role(id):
 
 
 def get_avatar_by_role(id):
 def get_avatar_by_role(id):
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
-    state = 'SELECT * FROM ('\
-'SELECT role_id FROM AI_anchor.user_role '\
-'INNER JOIN users on user_role.user_id= users.id '\
-'INNER JOIN role on user_role.role_id = role.id '\
-'WHERE AI_anchor.users.id=36) a'\
-'INNER JOIN role on a.role_id = role.id'\
-'INNER JOIN avatar on role_avatar.id = avatar.id'
+    state = 'select role_avatar.role_id, avatar_id, avatar.name,num from role_avatar'\ 
+            'INNER JOIN'\
+            '(SELECT role_id FROM AI_anchor.user_role'\
+            'INNER JOIN users on user_role.user_id= users.id'\
+            'INNER JOIN role on user_role.role_id = role.id'\
+            'WHERE AI_anchor.users.id=36) a '\
+            'on role_avatar.role_id = a.role_id'\
+            'INNER JOIN avatar on role_avatar.avatar_id = avatar.id;'
     role_list = []
     role_list = []
     for row in db.query(state):
     for row in db.query(state):
-        role_list.append({'id':row['role_id'],'name':row['name']})
+        print(row)
     db.close()
     db.close()
     return role_list
     return role_list
 #def add_role( username,role_id):
 #def add_role( username,role_id):

+ 1 - 3
html/index_eng.html

@@ -223,12 +223,10 @@
   <div class="modal" tabindex="-1"  id="avatarmega" aria-labelledby="history" aria-hidden="true">
   <div class="modal" tabindex="-1"  id="avatarmega" aria-labelledby="history" aria-hidden="true">
     <div class="modal-dialog modal-dialog-centered">
     <div class="modal-dialog modal-dialog-centered">
       <div class="modal-content text-center">
       <div class="modal-content text-center">
-        <div class="modal-header">
-         
-        </div>
         <div class="modal-body">
         <div class="modal-body">
           <img class="modal-img" src="" alt="">
           <img class="modal-img" src="" alt="">
           <h5 class="modal-title mt-2"></h5>
           <h5 class="modal-title mt-2"></h5>
+          <button type="button" class="btn btn-secondary btn-dismiss" data-bs-dismiss="modal" set-lan="html:close">Close</button>
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>

+ 1 - 3
html/make_video.html

@@ -270,12 +270,10 @@
             <div class="modal" tabindex="-1"  id="avatarmega" aria-labelledby="history" aria-hidden="true">
             <div class="modal" tabindex="-1"  id="avatarmega" aria-labelledby="history" aria-hidden="true">
                 <div class="modal-dialog modal-dialog-centered">
                 <div class="modal-dialog modal-dialog-centered">
                     <div class="modal-content text-center">
                     <div class="modal-content text-center">
-                        <div class="modal-header">
-                           
-                        </div>
                         <div class="modal-body">
                         <div class="modal-body">
                             <img class="modal-img" src="" alt="">
                             <img class="modal-img" src="" alt="">
                             <h5 class="modal-title mt-2"></h5>
                             <h5 class="modal-title mt-2"></h5>
+                            <button type="button" class="btn btn-secondary btn-dismiss" data-bs-dismiss="modal" set-lan="html:close">Close</button>
                         </div>
                         </div>
                     </div>
                     </div>
                 </div>
                 </div>

+ 1 - 3
html/make_video_long.html

@@ -260,12 +260,10 @@
         <div class="modal" tabindex="-1"  id="avatarmega" aria-labelledby="history" aria-hidden="true">
         <div class="modal" tabindex="-1"  id="avatarmega" aria-labelledby="history" aria-hidden="true">
             <div class="modal-dialog modal-dialog-centered">
             <div class="modal-dialog modal-dialog-centered">
                 <div class="modal-content text-center">
                 <div class="modal-content text-center">
-                    <div class="modal-header">
-                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"><img src="static/img/close.svg" alt=""></button>
-                    </div>
                     <div class="modal-body">
                     <div class="modal-body">
                     <img class="modal-img" src="" alt="">
                     <img class="modal-img" src="" alt="">
                     <h5 class="modal-title mt-2"></h5>
                     <h5 class="modal-title mt-2"></h5>
+                    <button type="button" class="btn btn-secondary btn-dismiss" data-bs-dismiss="modal" set-lan="html:close">Close</button>
                     </div>
                     </div>
                 </div>
                 </div>
                 </div>
                 </div>

+ 1 - 3
html/make_video_slide.html

@@ -242,12 +242,10 @@
             <div class="modal" tabindex="-1"  id="avatarmega" aria-labelledby="history" aria-hidden="true">
             <div class="modal" tabindex="-1"  id="avatarmega" aria-labelledby="history" aria-hidden="true">
                 <div class="modal-dialog modal-dialog-centered">
                 <div class="modal-dialog modal-dialog-centered">
                     <div class="modal-content text-center">
                     <div class="modal-content text-center">
-                        <div class="modal-header">
-                            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"><img src="static/img/close.svg" alt=""></button>
-                        </div>
                         <div class="modal-body">
                         <div class="modal-body">
                             <img class="modal-img" src="" alt="">
                             <img class="modal-img" src="" alt="">
                             <h5 class="modal-title mt-2"></h5>
                             <h5 class="modal-title mt-2"></h5>
+                            <button type="button" class="btn btn-secondary btn-dismiss" data-bs-dismiss="modal" set-lan="html:close">Close</button>
                         </div>
                         </div>
                     </div>
                     </div>
                 </div>
                 </div>

+ 13 - 16
html/script_profiles.js

@@ -60,20 +60,7 @@ function renderView() {
               }
               }
             });
             });
           }
           }
-        // const str = `<img src="static/img/undraw_male_avatar_323b.svg" alt="">
-        //     <p class="card-profile-txt">User Profile</p>
-        //     <p class="card-profile-cnt">${userInfo.user_info.userName}</p>
-        //     <p class="card-profile-cnt">${userInfo.user_info.email}</p>
-        //     <div class="d-flex justify-content-around">
-        //         <div>
-        //             <p set-lan="html:used">已使用</p>
-        //             <p><strong>${userInfo.user_info.total_sec}</strong><span set-lan="html:sec">秒</span></p>
-        //         </div>
-        //         <div>
-        //             <p set-lan="html:left">未使用</p>
-        //             <p><strong>${userInfo.user_info.left_sec}</strong><span set-lan="html:sec">秒</span></p>
-        //         </div>
-        //     </div>`;
+        
         const str = `<img src="static/img/undraw_male_avatar_323b.svg" alt="">
         const str = `<img src="static/img/undraw_male_avatar_323b.svg" alt="">
         <p class="card-profile-txt">User Profile</p>
         <p class="card-profile-txt">User Profile</p>
         <p class="card-profile-cnt">${userInfo.user_info.userName}</p>
         <p class="card-profile-cnt">${userInfo.user_info.userName}</p>
@@ -117,11 +104,21 @@ function renderView() {
         }
         }
         // 歷史紀錄
         // 歷史紀錄
         // const historicalrecord 
         // const historicalrecord 
-        var  historicalrecord=''
+        var  historicalrecord='';
         for (var i = 0; i < userInfo.video_info.length; i++) {
         for (var i = 0; i < userInfo.video_info.length; i++) {
+          let formatted = userInfo.video_info[i].time_stamp;
+          if (lan == 'zh') {
+            const timeStamp = userInfo.video_info[i].time_stamp;
+            const year = timeStamp.split(',')[0].split('/')[2];
+            const arr = timeStamp.split(',')[0].split('/');
+            arr.pop();
+            arr.unshift(year);
+            const fomatDate = [arr.join('/')];
+            formatted = fomatDate.concat(timeStamp.split(',')[1]).join('');
+          }
             historicalrecord+='\
             historicalrecord+='\
             <tr>\
             <tr>\
-            <td class="px-0">'+userInfo.video_info[i].time_stamp+'</td>\
+            <td class="px-0">'+formatted+'</td>\
             <td class="px-0">'+userInfo.video_info[i].title+'</td>\
             <td class="px-0">'+userInfo.video_info[i].title+'</td>\
             <td class="px-0 w-25">'+userInfo.video_info[i].duration+'</td>\
             <td class="px-0 w-25">'+userInfo.video_info[i].duration+'</td>\
           </tr>`\
           </tr>`\

+ 4 - 2
html/static/lan.js

@@ -126,7 +126,8 @@ var zh = {
     "no_draft": "目前沒有草稿喔",
     "no_draft": "目前沒有草稿喔",
     "trial_title": "想要免費獲得更多時間額度?",
     "trial_title": "想要免費獲得更多時間額度?",
     "trial_txt": "透過社群分享專屬連結,邀請好友註冊 AI Spokesgirl,凡是好友透過連結註冊成功,您可以免費獲得2分鐘製作額度。",
     "trial_txt": "透過社群分享專屬連結,邀請好友註冊 AI Spokesgirl,凡是好友透過連結註冊成功,您可以免費獲得2分鐘製作額度。",
-    "share": "分享:"
+    "share": "分享:",
+    "close": "關閉"
 };
 };
 
 
 var en = {
 var en = {
@@ -209,7 +210,8 @@ var en = {
     "no_draft": "No drafts yet.",
     "no_draft": "No drafts yet.",
     "trial_title": "Want to get more minutes?",
     "trial_title": "Want to get more minutes?",
     "trial_txt": "Invite your friends to AI Spokesgirl and for each eligible one that signs up from your referral, we'll give you 2 more minutes free!",
     "trial_txt": "Invite your friends to AI Spokesgirl and for each eligible one that signs up from your referral, we'll give you 2 more minutes free!",
-    "share": "Share:"
+    "share": "Share:",
+    "close": "Close"
 };
 };
 
 
 function switchLanContent(val){
 function switchLanContent(val){

+ 13 - 4
html/static/scss/style.css

@@ -662,6 +662,19 @@ footer {
   border-bottom: none;
   border-bottom: none;
 }
 }
 
 
+.btn-dismiss {
+  background: -webkit-gradient(linear, left top, right top, from(#0162c8), to(#55e7fc));
+  background: linear-gradient(90deg, #0162c8, #55e7fc);
+  font-weight: bold;
+  color: white;
+  border: 0 none;
+  border-radius: 20px;
+  cursor: pointer;
+  padding: 10px 35px;
+  margin: 10px auto;
+  display: block;
+}
+
 #avatarmega .modal-content {
 #avatarmega .modal-content {
   background-color: transparent;
   background-color: transparent;
   border: none;
   border: none;
@@ -671,10 +684,6 @@ footer {
   color: white;
   color: white;
 }
 }
 
 
-#avatarmega .btn-close {
-  background: none;
-}
-
 #avatarmega .modal-header {
 #avatarmega .modal-header {
   position: absolute;
   position: absolute;
   top: -0.5rem;
   top: -0.5rem;

文件差异内容过多而无法显示
+ 0 - 0
html/static/scss/style.css.map


+ 12 - 4
html/static/scss/style.scss

@@ -622,6 +622,18 @@ footer {
 	border-bottom: none;
 	border-bottom: none;
 }
 }
 
 
+.btn-dismiss {
+	background: linear-gradient(90deg, #0162c8, #55e7fc);
+	font-weight: bold;
+	color: white;
+	border: 0 none;
+	border-radius: 20px;
+	cursor: pointer;
+	padding: 10px 35px;
+	margin: 10px auto;
+	display: block;
+}
+
 #avatarmega .modal-content {
 #avatarmega .modal-content {
 	background-color: transparent;
 	background-color: transparent;
 	border: none;
 	border: none;
@@ -631,10 +643,6 @@ footer {
 	color: white;
 	color: white;
 }
 }
 
 
-#avatarmega .btn-close {
-	background: none;
-}
-
 #avatarmega .modal-header {
 #avatarmega .modal-header {
 	position: absolute;
 	position: absolute;
 	top: -0.5rem;
 	top: -0.5rem;

+ 3 - 0
html/user_profile2.html

@@ -52,6 +52,9 @@
                                     <li><button class="nav-link lan-switch" aria-current="page" set-lan="html:zh" onclick="changeLan(this)" value="zh">中文</button></li>
                                     <li><button class="nav-link lan-switch" aria-current="page" set-lan="html:zh" onclick="changeLan(this)" value="zh">中文</button></li>
                                 </ul>
                                 </ul>
                             </li>
                             </li>
+                            <li class="nav-item">
+                                <a class="nav-link btn-userProfile text-white" aria-current="page" href="user_profile2.html" set-lan="html:user_profile">會員資料</a>
+                            </li>
                             <li class="nav-item">
                             <li class="nav-item">
                                 <a class="nav-link active btn-login text-white" aria-current="page" href="login.html" set-lan="html:login">登入</a>
                                 <a class="nav-link active btn-login text-white" aria-current="page" href="login.html" set-lan="html:login">登入</a>
                             </li>
                             </li>

部分文件因为文件数量过多而无法显示