Jelajahi Sumber

静态化测试

zhijiezhao 2 tahun lalu
induk
melakukan
226bc87855

+ 6 - 0
src/main/java/com/caimei/www/controller/unlimited/ArticleController.java

@@ -39,6 +39,8 @@ public class ArticleController extends BaseController {
     @GetMapping("/info/center-{id}-{pageNum}.html")
     public String toArticleList(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum, final Model model) {
         List<BaseLink> typeList = articleService.getArticleTypes();
+        List<BaseLink> data = articleService.getArticleLabels().getData();
+        model.addAttribute("labels",data);
         model.addAttribute("articleType", typeList);
         model.addAttribute("typeId", id);
         model.addAttribute("labelId", 0);
@@ -53,6 +55,8 @@ public class ArticleController extends BaseController {
     @GetMapping("/info/label-{id}-{pageNum}.html")
     public String toArticleLabel(@PathVariable("id") Integer id, @PathVariable("pageNum") Integer pageNum, final Model model) {
         List<BaseLink> typeList = articleService.getArticleTypes();
+        List<BaseLink> data = articleService.getArticleLabels().getData();
+        model.addAttribute("labels",data);
         model.addAttribute("articleType", typeList);
         model.addAttribute("typeId", 0);
         model.addAttribute("labelId", id);
@@ -67,6 +71,8 @@ public class ArticleController extends BaseController {
     @GetMapping("/info/search-{pageNum}.html")
     public String toArticleSearch(@PathVariable("pageNum") Integer pageNum, final Model model) {
         List<BaseLink> typeList = articleService.getArticleTypes();
+        List<BaseLink> data = articleService.getArticleLabels().getData();
+        model.addAttribute("labels",data);
         model.addAttribute("articleType", typeList);
         model.addAttribute("typeId", 0);
         model.addAttribute("labelId", 0);

+ 4 - 1
src/main/resources/templates/article/components/article-sidebar.html

@@ -1,3 +1,4 @@
+<html xmlns:th="http://www.w3.org/1999/xhtml">
 <div class="other" id="articleSide" v-cloak>
     <div id="mHotWord">
         <div class="tags clearfix">
@@ -5,7 +6,9 @@
                 热搜词
             </p>
             <div class="tag">
-                <a v-for="label in labelList"  :href="'/info/label-' + label.id + '-1.html'" :style="'opacity:'+label.sort" v-text="label.name"></a>
+                <th:block th:each="label : ${labels}"  th:object="${label}">
+<!--                    <a v-for="label in labelList"  :href="'/info/label-' + label.id + '-1.html'" :style="'opacity:'+label.sort" v-text="label.name"></a>-->
+                </th:block>
             </div>
         </div>
         <a href="javascript:void(0);" class="close"></a>