Jelajahi Sumber

ui optimization

huaisianhuang 4 tahun lalu
induk
melakukan
2adc40e3bb
3 mengubah file dengan 451 tambahan dan 81 penghapusan
  1. 45 17
      api/static/index2.html
  2. 89 9
      api/static/script_msg.js
  3. 317 55
      api/static/style.css

+ 45 - 17
api/static/index2.html

@@ -30,18 +30,17 @@
       z-index: 1;
       top: 0;
       left: 0;
-      background: linear-gradient(to bottom, #1C7CE0, #150051);
+      background: linear-gradient(90deg, #0162c8, #51cde0);
       overflow-x: hidden;
       transition: 0.5s;
       padding-top: 20px;
     }
     
     .sidenav a {
-      padding: 8px 8px 8px 32px;
+      padding: 8px 8px 8px 8px;
       text-decoration: none;
       font-size: 25px;
-      color: #818181;
-      display: block;
+      color: #ffffff;
       transition: 0.3s;
     }
     
@@ -64,33 +63,66 @@
     </style>
 </head>
 <body>
-  <div class="container-fluid">
-    <div id="mySidenav" class="sidenav">
+  <div class="container-fluid px-0">
+    <nav class="navbar sticky-top d-block d-md-none">
+      <div class="container-fluid">
+        <a class="navbar-brand" href="#">AI ANCHOR GO</a>
+        <button class="navbar-toggler pt-0" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
+          <span class="menu-line"></span>
+          <img src="static/img/close.svg" alt="" width="16" height="16" class="menu-close">
+        </button>
+        <div class="collapse navbar-collapse" id="navbarNav">
+          <ul class="navbar-nav">
+            <li class="nav-item" data-bs-toggle="modal" data-bs-target="#howto">
+              <i class="fas fa-book-open me-2"></i>使用說明
+            </li>
+            <li class="nav-item" data-bs-toggle="modal" data-bs-target="#history" onclick="openNav()">
+              <i class="fas fa-history me-2"></i>歷史紀錄
+            </li>
+          </ul>
+        </div>
+      </div>
+    </nav>
+    <div id="mySidenav" class="sidenav d-none d-md-block">
       <!-- <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a> -->
       <h2 class="go_title">AI ANCHOR GO</h2>
       <ul class="nav-list">
         <li class="nav-list-item pb-1 mb-3" data-bs-toggle="modal" data-bs-target="#howto"><i class="fas fa-book-open me-2"></i>使用說明</li>
         <li class="nav-list-item pb-1" data-bs-toggle="modal" data-bs-target="#history" onclick="openNav()"><i class="fas fa-history me-2"></i>歷史紀錄</li>
       </ul>
+      <ul class="step">
+        <li data-section="#sec-title" class="step-li sec-title"><i class="fas fa-heading"></i><a>標題</a></li>
+        <li data-section="#sec-avatar" class="step-li sec-avatar"><i class="fas fa-user-alt"></i><a>人物</a></li>
+        <li data-section="#sec-subtitle" class="step-li sec-subtitle"><i class="fas fa-align-left"></i><a>台詞</a></li>
+        <li data-section="#imgSrc" class="step-li imgSrc"><i class="fas fa-images"></i><a>影像</a></li>
+      </ul>
       <p class="right-text text-white d-inline-block">Choozmo All Rights Reserved</p>
     </div>
     <!-- <span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776; 過去紀錄</span> -->
     <div class="content ms-auto">
       <form id="msform">
+        <div class="step__box d-block d-md-none">
+          <ul class="step">
+              <li data-section="#sec-title" class="step-li sec-title"><i class="fas fa-heading"></i><a>標題</a></li>
+              <li data-section="#sec-avatar" class="step-li sec-avatar"><i class="fas fa-user-alt"></i><a>人物</a></li>
+              <li data-section="#sec-subtitle" class="step-li sec-subtitle"><i class="fas fa-align-left"></i><a>台詞</a></li>
+              <li data-section="#imgSrc" class="step-li imgSrc"><i class="fas fa-images"></i><a>影像</a></li>
+            </ul>
+        </div>
         <div class="linker__box">
           <p>預覽影片</p>
           <i class="fas fa-link"></i>
           <a id='linker' style="display: none;" class="ms-2">影片連結</a>
         </div>
         <!-- fieldsets -->
-        <fieldset>
+        <fieldset id="sec-title">
           <h3 class="fs-subtitle">標題<img class="ms-1" src="static/img/question.png" alt="" data-bs-toggle="tooltip" data-bs-placement="right" title="將作為影片的內嵌標題"></h3>
           <input id=title type="text" name='t1' class='title_new' value="" placeholder="標題" /> <br/>
         </fieldset>
-        <fieldset>
+        <fieldset id="sec-avatar">
           <h3  class="fs-subtitle">選擇人物<img class="ms-1" src="static/img/question.png" alt="" data-bs-toggle="tooltip" data-bs-placement="right" title="將作為影片的講者"></h3>
           <select id="avatar" class='avatar'>
-            <option value="6">Angus</option>
+            <option value="請選擇人物" selected="selected" disabled>請選擇人物</option>
             <option value="7">Peggy</option>
             <option value="8">Stacy</option>
             <option value="10">Nina黑</option>
@@ -100,12 +132,6 @@
             <option value="12">Angela</option>
           </select>
           <div class="owl-carousel owl-theme">
-            <div class="card item" data-avatar="Angus" data-img="angus">
-              <div class="imgfr"><img src="static/img/angus.webp" class="card-img-top" alt="..."></div>
-              <div class="card-body">
-                <h5 class="card-title">Angus</h5>
-              </div>
-            </div>
             <div class="card item" data-avatar="Peggy" data-img="peggy">
               <div class="imgfr"><img src="static/img/peggy.webp" class="card-img-top" alt="..."></div>
               <div class="card-body">
@@ -150,7 +176,7 @@
             </div>
           </div>
         </fieldset>
-        <fieldset>
+        <fieldset id="sec-subtitle">
           <h3 class="fs-subtitle">台詞</h3>
           <div class="subtitle-inputs">
           
@@ -215,7 +241,9 @@
           <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">
-          <img class="modal-img" src="" alt="">
+          <div class="modal-imgfr">
+            <img class="modal-img" src="" alt="">
+          </div>
           <h5 class="modal-title mt-2"></h5>
         </div>
       </div>

+ 89 - 9
api/static/script_msg.js

@@ -15,7 +15,6 @@ var avatarSelector = document.getElementById("avatar");
 var card = document.getElementsByClassName('card');
 card = [... card];
 avatarSelector.addEventListener('change', avatarChange);
-avatarChange();
 
 function addCardListener() {
   for(let i = 0;i < card.length; i++){
@@ -27,7 +26,6 @@ addCardListener();
 
 function avatarChange() {
   var value = avatarSelector.options[avatarSelector.selectedIndex].text;
-  $('.owl-carousel').trigger('to.owl.carousel', avatarSelector.selectedIndex);
   console.log(value);
   for(let i = 0;i < card.length; i++) {
     card[i].classList.remove('active');
@@ -82,7 +80,7 @@ $(".next").click(function () {
   button.setAttribute('disabled', '');
   setTimeout(function () {
     button.removeAttribute('disabled')
-  }, 4000);
+  }, 8000);
   avatar = $('.avatar').val();
   name_title = $('.title_new').val();
   txtARR = [];
@@ -113,8 +111,7 @@ $(".next").click(function () {
     data: objstr,
     success: function(suc_data) {
       Swal.fire({
-        title: "資料已送出",
-        icon: 'success',
+        icon: 'warning',
         text: `${suc_data.msg}`,
         confirmButtonColor: '#3085d6',
       });  
@@ -206,6 +203,8 @@ function view() {
   }
 }
 
+var subtitleInputs = document.querySelector(".subtitle-inputs");
+var imgInputs = document.querySelector(".img-inputs");
 
 function load_data() {
   var title = document.getElementById("title");
@@ -262,8 +261,6 @@ function load_data() {
 }
 
 
-var subtitleInputs = document.querySelector(".subtitle-inputs");
-var imgInputs = document.querySelector(".img-inputs");
 let length = 5;
 function initial() {
     for(let i = 0;i < length; i++) {
@@ -332,7 +329,7 @@ $('.owl-carousel').owlCarousel({
   touchDrag: true,
   smartSpeed: 1000,
   autoplay: true,
-  autoplayTimeout: 8000,
+  autoplayTimeout: 6000,
   autoplayHoverPause: false,
   responsive:{
       0:{
@@ -345,4 +342,87 @@ $('.owl-carousel').owlCarousel({
           items:4
       }
   }
-})
+});
+
+function avatarFocus() {
+  document.querySelector('.avatar').addEventListener('focus', () => {
+      console.log('avatar focus');
+      $('.sec-avatar').siblings().removeClass('active');
+      $('.sec-avatar').addClass('active');
+  })
+  
+}
+
+avatarFocus();
+
+function inputtitleChange() {
+  $('.title_new').on('focus', function(){
+      $('.sec-title').siblings().removeClass('active');
+      $('.sec-title').addClass('active');
+  }) 
+}
+
+inputtitleChange();
+
+function inputtxtChange() {
+  $('.txtsrc').on('focus', function(){
+      $('.sec-subtitle').siblings().removeClass('active');
+      $('.sec-subtitle').addClass('active');
+  }) 
+}
+
+inputtxtChange();
+
+function inputimgChange() {
+  $('.imgsrc').on('focus', function(){
+      $('.imgSrc').siblings().removeClass('active');
+      $('.imgSrc').addClass('active');
+  }) 
+}
+
+inputimgChange();
+
+var steps = $('.step-li');
+  steps.on("click", function () {
+      console.log('ss');
+      var section = $(this).data("section");
+      $("html,body").animate(
+          {
+              scrollTop: $(section).offset().top - 150
+          },
+          400
+      );
+      $(this).siblings().removeClass('active');
+      $(this).addClass('active');
+      $(section).siblings().removeClass('aniScale');
+      $(section).removeClass("aniScale");
+      $(section).addClass("aniScale");
+
+  });
+
+function buttonRipple() {
+  button.addEventListener('click', function(e){
+      e.preventDefault();
+      let ripples = document.createElement('span');
+      ripples.classList.add('ripples');
+      button.appendChild(ripples);
+      setTimeout(() => {
+          ripples.remove();
+      }, 1000);
+  })
+}
+
+buttonRipple();
+
+let open = false;
+$('.navbar-toggler').click(function () {
+  open = !open;
+  if(open) {
+      $('.menu-close').css('display', 'inline-block');
+      $('.menu-line').css('display', 'none');
+  } else {
+      $('.menu-close').css('display', 'none');
+      $('.menu-line').css('display', 'inline-block');
+  }
+  
+});

+ 317 - 55
api/static/style.css

@@ -54,55 +54,10 @@ body {
 	z-index: 3;
 } */
 
-.img_banner {
-	background-image: url('images/banner_top1.jpg');
-	background-repeat: no-repeat;
-	background-size: contain;
-	background-position: center;
-	width: 100%;
-	height: 65px;
-}
-
-/*form styles*/
-.img_logo {
-	display: inline-block;
-	margin: 0 auto;
-	margin-bottom: 10px;
-}
 
-.title__block {
-	display: flex;
-	justify-content: center;
-	align-items: center;
-	margin: 0px auto;
-}
 
-.sub-logo {
-	display: inline-block;
-	font-weight: 700;
-	font-size: 1.4rem;
-	color: white;
-}
-
-.slogan {
-	display: block;
-	font-weight: 700;
-	font-size: 1.2rem;
-	color: white;
-}
+/*form styles*/
 
-.notice_card {
-	box-sizing: border-box;
-	width: 80%;
-	margin: 0 10%;
-	margin-bottom: 1.5rem;
-	background: white;
-	border: 0 none;
-	border-radius: 3px;
-	box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
-	padding: 10px 20px;
-	line-height: 1.5rem;
-}
 #myProgress {
 	width: 100%;
 	background-color: #ddd;
@@ -253,7 +208,7 @@ body {
 	background: white;
 	border: 0 none;
 	border-radius: 3px;
-	box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
+	box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.2);
 	padding: 20px 30px;
 	box-sizing: border-box;
 	width: 80%;
@@ -278,22 +233,34 @@ body {
 }
 /*buttons*/
 #msform .action-button {
-	width: 100px;
-	background: #1C7CE0;
+	background: linear-gradient(90deg, #0162c8, #55e7fc);
 	font-weight: bold;
 	color: white;
 	border: 0 none;
-	border-radius: 1px;
+	border-radius: 40px;
 	cursor: pointer;
-	padding: 10px 5px;
+	padding: 10px 50px;
 	margin: 10px auto;
 	display: block;
+	overflow: hidden;
+	position: relative;
 }
 #msform .action-button:hover, #msform .action-button:focus {
 	box-shadow: 0 0 0 2px white, 0 0 0 3px #1C7CE0;
 }
 #msform .next[disabled] {
-	background-color: grey;
+	background: grey;
+}
+
+.ripples {
+	position: absolute;
+	background: #fff;
+	left: 50%;
+	top: 50%;
+	transform: translate(-50%, -50%);
+	pointer-events: none;
+	border-radius: 50%;
+	animation: aniRipple 1s linear infinite;
 }
 /*headings*/
 .fs-title {
@@ -601,7 +568,7 @@ footer {
 
 #avatarmega .modal-header {
 	position: absolute;
-	top: -1.5rem;
+	top: -2.5rem;
 	right: 1rem;
 }
 
@@ -671,7 +638,7 @@ footer {
 }
 
 #msform input[type="text"].imgsrc {
-	width: calc(100% - 8rem);
+	width: calc(100% - 7rem);
 	margin-right: 5px;
 }
 
@@ -696,12 +663,66 @@ footer {
 	background-color: #3b86d6;
 }
 
+.listimg__fr {
+	width: 50px;
+	height: 50px;
+	border-radius: 50%;
+	overflow: hidden;
+	margin: auto .5rem;
+}
+
+.listimg__fr img {
+	width: 100%;
+	height: 100%;
+}
+
+.historyList-item {
+	border: none;
+	box-shadow: 1px 1px 4px 1px rgb(207, 207, 207);
+	padding: .5rem;
+	color: black;
+	text-decoration: none;
+	cursor: pointer;
+}
+
+.historyList-item:hover {
+	color: black;
+}
+
+.vertical-align {
+	vertical-align: middle;
+}
+
+.loading {
+	width:100%;
+    height:100%;
+    opacity:0.8;
+    background-color:white;
+    z-index:10000;
+    display:none;
+    position:fixed;
+    top:0;
+    left:0;
+    background-color: rgba(#e1e1e1, 0.8);
+    background-image: url("img/Spinner-1s-181px.gif");
+    background-repeat: no-repeat;
+    background-position: 50% 50%;
+}
+
+.edit-btn {
+	color: black;
+}
+
+.owl-theme .owl-nav {
+	display: none;
+}
+
 .add, .addimg {
 	cursor: pointer;
 	display: inline-block;
 	width: 2rem;
 	height: 2rem;
-	background-color: #67abf3;
+	background: linear-gradient(90deg, #0162c8, #55e7fc);
 	font-size: 1.2rem;
 	color: white;
 	border-radius: 50%;
@@ -711,3 +732,244 @@ footer {
 	background-color: #398ee9;
 }
 
+.step-li {
+	cursor: pointer;
+	padding: .5rem 0;
+}
+
+.step {
+	padding-left: 3.5rem;
+	margin-top: 3rem;
+}
+
+.step .step-li a{
+	display: inline-block;
+	font-size: 1.2rem;
+	color: white;
+	position: relative;
+	padding-left: 10px;
+}
+
+.step a:hover::after  {
+	width: 300%;
+}
+
+.step a::after {
+	position: absolute;
+	content: " ";
+	bottom: 0;
+	left: 0;
+	width: 0%;
+	height: 100%;
+	background: transparent;
+	border-bottom: 1px solid white;
+	transition: all .4s;
+}
+
+.step-li.active a::after {
+	width: 300%;
+}
+
+.step .step-li a:hover{
+	color: white;
+}
+
+.step i {
+	color: white;
+	display: inline-block;
+	padding: .6rem;
+	border: 1px solid white;
+	border-radius: 50%;
+	
+}
+
+.step-li.active i {
+	color: black;
+	background-color: white;
+}
+
+.aniScale {
+	animation: aniScale 1.2s 1;
+}
+
+@media (max-width: 768px) { 
+	#msform {
+		margin-top: 150px;
+	}
+	.content {
+		width: 100%;
+	}
+	.navbar {
+		background: linear-gradient(90deg, #0162c8, #55e7fc);
+		position: fixed !important;
+        top: 0;
+        right: 0;
+        left: 0;
+        z-index: 1030;
+	}
+	.navbar-brand {
+		color: white;
+	}
+	.navbar-nav {
+		padding: .5rem 0;
+	}
+	.navbar-nav .nav-item {
+		color: white;
+		padding: .5rem 1rem;
+		cursor: pointer;
+	}
+	.navbar-nav .nav-item .nav-link {
+		color: white;
+	}
+	#msform fieldset {
+		width: 95%;
+		margin: 2rem 2.5%;
+		padding: 10px 15px;
+	}
+	#msform input[type="text"].imgsrc {
+		width: calc(100% - 6rem);
+	}
+	.upload-btn {
+		width: 5rem;
+		padding: .3rem .3rem;
+	}
+	.menu-line {
+		display: inline-block;
+		width: 2rem;
+		height: 2px;
+		background-color: white;
+		position: relative;
+		box-shadow: 1px 1px 5px 1px rgb(192, 192, 192);
+		margin-bottom: 5px;
+
+	}
+	.menu-line::before {
+			position: absolute;
+			content: '';
+			left: 0;
+			top: -10px;
+			width: 2rem;
+			height: 2px;
+			background-color: white;
+			box-shadow: 1px 1px 5px 1px rgb(192, 192, 192);
+	}
+	.menu-line::after {
+			position: absolute;
+			content: '';
+			left: 0;
+			top: 10px;
+			width: 2rem;
+			height: 2px;
+			background-color: white;
+			box-shadow: 1px 1px 5px 1px rgb(192, 192, 192);
+	}
+	.menu-close {
+		display: none;
+	}
+	.navbar-brand:hover {
+		color: white;
+	}
+	.navbar-toggler:focus {
+		box-shadow: none;
+	}
+	.historyList-item {
+		width: 97%;
+	}
+	.item_imgfr {
+		width: 17%;
+	}
+	.linker__box {
+		width: 95%;
+		margin: 0 2.5%;
+	}
+	.step__box {
+		width: 100%;
+		position: fixed;
+		z-index: 20;
+		background: linear-gradient(180deg, white 90%, transparent);
+		top: 56px;
+	}
+	.step {
+		padding-left: 0;
+		overflow: hidden;
+		margin: 0rem auto;
+	}
+	.step-li {
+		list-style-type: none;
+		color: black;
+		text-transform: uppercase;
+		width: 25%;
+		float: left;
+		position: relative;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+	}
+	.step-li:after {
+		content: '';
+		width: 100%;
+		height: 2px;
+		background: #2fb9ce;
+		position: absolute;
+		left: -50%;
+		top: 30%;
+		z-index: -1; /*put it behind the numbers*/
+	}
+	.step-li:first-child:after {
+		/*connector not needed before the first step*/
+		content: none; 
+	}
+	.step .step-li a {
+		font-size: 12px;
+		padding-left: 0;
+		color: black;
+	}
+	.step .step-li a:hover {
+		color: black;
+	}
+	
+	.step-li i {
+		color: #2fb9ce;
+		font-size: 1.1rem;
+		border: 1px solid #2fb9ce;
+		margin-bottom: 5px;
+		background: white;
+	}
+	.step-li.active i {
+		background: #2fb9ce;
+		color: white;
+	}
+	#avatarmega .modal-imgfr {
+		width: 100%;
+	}
+	#avatarmega .modal-imgfr img {
+		width: 100%;
+	}
+}
+
+ 
+
+@keyframes aniRipple {
+	0% {
+		width: 0px;
+		height: 0px;
+		opacity: .5;
+	}
+	100% {
+		width: 180px;
+		height: 180px;
+		opacity: 0;
+	}
+}
+
+@keyframes aniScale {
+	0% {
+		transform: scale(1);
+	}
+	50% {
+		transform: scale(1.05);
+	}
+	100% {
+		transform: scale(1);
+	}
+}