huaisian 2 年之前
父節點
當前提交
1231c84c92
共有 2 個文件被更改,包括 23 次插入16 次删除
  1. 20 13
      js/index-designer.js
  2. 3 3
      json/designers-143.json

+ 20 - 13
js/index-designer.js

@@ -299,6 +299,10 @@ function renderCard(content, i = 0){
     let cardData = '';
     let data = content[i];
     for(let j = 0;j < data.length; j ++) {
+        let tagStr = '';
+        for(let k = 0;k < data[i]['tags'].length; k ++) {
+            tagStr += `<a href="${data[i]['tags'][k]['link']}" class="card__tag" target="_blank">${data[i]['tags'][k]['name']}</a>`
+        }
         cardData += `<div class="col-md-4">
                         <a href="" target="_blank">
                         <div class="card">
@@ -306,9 +310,7 @@ function renderCard(content, i = 0){
                             <div class="card-body">
                             <h5 class="card-title card__title mt-0">${data[i]['title']}</h5>
                             <p class="card-text mb-0">
-                                <a href="" class="card__tag" target="_blank">混搭風</a>
-                                <a href="" class="card__tag" target="_blank">混搭風</a>
-                                <a href="" class="card__tag" target="_blank">混搭風</a>
+                                ${tagStr}
                             </p>
                             </div>
                         </div>
@@ -453,7 +455,6 @@ function loadMore(designer) {
         let last = document.querySelector('#pills-intro .work__row>div:last-child');
         let pageNum = Math.ceil(totalPages.intro / 9) - 1;
         if ($(this).scrollTop() > last.offsetTop) {
-            console.log('over');
             if(n >= pageNum) {
                 n = pageNum;
                 return;
@@ -462,6 +463,10 @@ function loadMore(designer) {
                 let append = '';
                 let d = designer['Content'][0].Carddata.slice(9*n, (9*n)+9);
                 for(let j = 0;j < d.length; j ++) {
+                    let tagStr = ''
+                    for(let k = 0;k < d[j]['tags'].length; k ++) {
+                        tagStr += `<a href="${d[j]['tags'][k]['link']}" class="card__tag" target="_blank">${d[j]['tags'][k]['name']}</a>`
+                    }
                     append += `<div class="col-lg-6 col-xl-4">
                                     <a href="" target="_blank">
                                     <div class="card">
@@ -472,9 +477,7 @@ function loadMore(designer) {
                                         <div class="card-body">
                                         <h5 class="card-title card__title mt-0">${d[j]['title']}</h5>
                                         <p class="card-text mb-0">
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
+                                            ${tagStr}
                                         </p>
                                         </div>
                                     </div>
@@ -502,6 +505,10 @@ function loadMore(designer) {
                 let append = '';
                 let d = designer['Content'][1].Carddata.slice(9*n_video, (9*n_video)+9);
                 for(let j = 0;j < d.length; j ++) {
+                    let tagStr = ''
+                    for(let k = 0;k < d[j]['tags'].length; k ++) {
+                        tagStr += `<a href="${d[j]['tags'][k]['link']}" class="card__tag" target="_blank">${d[j]['tags'][k]['name']}</a>`
+                    }
                     append += `<div class="col-lg-6 col-xl-4">
                                     <a href="" target="_blank">
                                     <div class="card">
@@ -513,9 +520,7 @@ function loadMore(designer) {
                                         <div class="card-body">
                                         <h5 class="card-title card__title mt-0">${d[j]['title']}</h5>
                                         <p class="card-text mb-0">
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
+                                            ${tagStr}
                                         </p>
                                         </div>
                                     </div>
@@ -539,6 +544,10 @@ function loadMore(designer) {
                 let append = '';
                 let d = designer['Content'][2].Carddata.slice(9*n_columns, (9*n_columns)+9);
                 for(let j = 0;j < d.length; j ++) {
+                    let tagStr = ''
+                    for(let k = 0;k < d[j]['tags'].length; k ++) {
+                        tagStr += `<a href="${d[j]['tags'][k]['link']}" class="card__tag" target="_blank">${d[j]['tags'][k]['name']}</a>`
+                    }
                     append += `<div class="col-lg-6 col-xl-4">
                                     <a href="" target="_blank">
                                     <div class="card">
@@ -549,9 +558,7 @@ function loadMore(designer) {
                                         <div class="card-body">
                                         <h5 class="card-title card__title mt-0">${d[j]['title']}</h5>
                                         <p class="card-text mb-0">
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
-                                            <a href="" class="card__tag" target="_blank">混搭風</a>
+                                            ${tagStr}
                                         </p>
                                         </div>
                                     </div>

+ 3 - 3
json/designers-143.json

@@ -71,15 +71,15 @@
               "tags": [
                 {
                   "name": "混搭風",
-                  "link": ""
+                  "link": "https://hhh.com.tw/"
                 },
                 { 
                   "name": "混搭風",
-                  "link": ""
+                  "link": "https://hhh.com.tw/"
                 },
                 {
                   "name": "混搭風",
-                  "link": ""
+                  "link": "https://hhh.com.tw/"
                 }
               ],
               "views": 999,