|
@@ -10,9 +10,9 @@ function getCookie(name) {
|
|
|
|
|
|
function renderView() {
|
|
|
let token = getCookie('jwt_token');
|
|
|
- // if(!token) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
+ if(!token) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
// axios.defaults.withCredentials = false;
|
|
|
axios({
|
|
|
method: 'post',
|
|
@@ -55,14 +55,14 @@ function renderView() {
|
|
|
// 使用者名稱
|
|
|
const userName = `<h2 class="user-name text-white mt-4 fw-bold">Hello,${userInfo.user_info.userName}</h2>`;
|
|
|
// 已使用
|
|
|
- const usedtime=`<h1 class="text-center">${userInfo.user_info.total_sec} <span style="font-size:15px;">秒</span></h1>`;
|
|
|
+ const usedtime=`<h1 class="text-center">${userInfo.user_info.total_sec} <span style="font-size:15px;" set-lan="html:sec">秒</span></h1>`;
|
|
|
// 未使用
|
|
|
- const NotUsedTime=`<h1 class="text-center">${userInfo.user_info.left_sec} <span style="font-size:15px;">秒</span></h1>`;
|
|
|
+ const NotUsedTime=`<h1 class="text-center">${userInfo.user_info.left_sec} <span style="font-size:15px;" set-lan="html:sec">秒</span></h1>`;
|
|
|
// user資訊
|
|
|
const infContent=`
|
|
|
<div class="inf-content">
|
|
|
<p>${userInfo.user_info.userName}</p>
|
|
|
- <p>*************** <a href="./reset_pwd_email.html">更改密碼</a></p>
|
|
|
+ <p>*************** <a href="./reset_pwd_email.html" set-lan="html:resetPsd">更改密碼</a></p>
|
|
|
<p>${userInfo.user_info.email}</p>
|
|
|
</div>`;
|
|
|
// 歷史紀錄
|
|
@@ -116,4 +116,72 @@ $(".historical-record").hide();
|
|
|
$( ".check-history" ).click(function() {
|
|
|
$(".historical-record").toggle();
|
|
|
$(".arrowdown").toggleClass("arrowdoup");
|
|
|
- });
|
|
|
+ });
|
|
|
+
|
|
|
+ var loaded_data = ''
|
|
|
+function openNav() {
|
|
|
+ document.getElementById("mySidenav").style.width = "250px";
|
|
|
+ document.querySelector('.loader').style.display = "block";
|
|
|
+ let token = getCookie('jwt_token');
|
|
|
+ axios({
|
|
|
+ method: 'post',
|
|
|
+ url: 'https://www.choozmo.com:8887/history_input',
|
|
|
+ headers: {
|
|
|
+ 'accept': 'application/json',
|
|
|
+ 'Authorization': `Bearer ${token}`
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res.data);
|
|
|
+ loaded_data = res.data;
|
|
|
+ for (var obj of loaded_data) {
|
|
|
+ var historyList = document.querySelector('.historyList');
|
|
|
+ var list = document.createElement('li');
|
|
|
+ list.id = obj.id;
|
|
|
+ // div-imgfr
|
|
|
+ var divImgfr = document.createElement('div');
|
|
|
+ divImgfr.classList.add('item_imgfr');
|
|
|
+ var img = document.createElement('img');
|
|
|
+ img.setAttribute('src', obj['image_urls'][0]);
|
|
|
+ divImgfr.appendChild(img);
|
|
|
+ // div-content
|
|
|
+ var contentBox = document.createElement('div');
|
|
|
+ contentBox.classList.add('content-box');
|
|
|
+ var boxTitle = document.createElement('p');
|
|
|
+ boxTitle.classList.add('box-title');
|
|
|
+ boxTitle.textContent = obj.name;
|
|
|
+ boxTitle.id = obj.id;
|
|
|
+ boxTitle.setAttribute('onclick', `direct(${obj.id})`);
|
|
|
+
|
|
|
+ var boxLink = document.createElement('span');
|
|
|
+ boxLink.classList.add('box-link');
|
|
|
+ boxLink.setAttribute("data-url", obj.link);
|
|
|
+ boxLink.setAttribute('onclick', 'view()');
|
|
|
+ boxLink.innerHTML = '<i class="fas fa-play-circle me-1"></i>觀看影片';
|
|
|
+ contentBox.appendChild(boxTitle);
|
|
|
+ contentBox.appendChild(boxLink);
|
|
|
+ list.classList.add("historyList-item");
|
|
|
+ list.setAttribute('onclick', `direct(${obj.id})`);
|
|
|
+ list.appendChild(divImgfr);
|
|
|
+ list.appendChild(contentBox);
|
|
|
+ historyList.appendChild(list);
|
|
|
+ }
|
|
|
+ document.querySelector('.loader').style.display = "none";
|
|
|
+
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function direct(id) {
|
|
|
+ location.href = `make_video.html?id=${id}`;
|
|
|
+}
|
|
|
+
|
|
|
+function view() {
|
|
|
+ event.stopPropagation();
|
|
|
+ console.log(event.target);
|
|
|
+ if (event.target.nodeName === 'I') {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ window.open(`http://${event.target.dataset.url}`, '_blank');
|
|
|
+ }
|
|
|
+ }
|