Sfoglia il codice sorgente

信息中心V1.3.9

kaick 1 anno fa
parent
commit
5e42376a45

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

@@ -241,22 +241,6 @@ public class ArticleController extends BaseController {
         return ERROR_PATH;
     }
 
-    /**
-     * 文章推荐和文章
-     */
-    @GetMapping("/info/articlerecommendation.html")
-    public String toArticleRecommendation(final Model model) {
-        List<BaseLink> typeList = articleService.getArticleTypes();
-        List<BaseLink> data = articleService.getArticleLabels().getData();
-        List<ImageLink> Ads = articleService.getLastestInfoAds().getData();
-        model.addAttribute("ads", Ads);
-        model.addAttribute("labels", data);
-        model.addAttribute("articleType", typeList);
-        model.addAttribute("typeId", 0);
-        model.addAttribute("labelId", 0);
-        return ARTICLE_RECOMMENDATION;
-    }
-
     /**
      * 获取文章热门标签
      */

+ 1 - 1
src/main/resources/mapper/ArticleMapper.xml

@@ -58,7 +58,7 @@
 		from cm_related cr
 		left join info a on a.id=cr.relatedId
 		left join info_praise c on a.id = c.infoId
-1		where cr.type=2
+		where cr.type=2
 		and a.enabledStatus = 1
 		and a.auditStatus = 2
 		and NOW() >= a.pubdate

+ 11 - 1
src/main/resources/static/js/article/recommendation.js

@@ -22,6 +22,7 @@ var recommendation = new Vue({
             selectDataRoutes: 1 // 最新 最早
         },
         listData: [],
+        articlerecommendationData: [],
         listRecord: 0,
         productRecord: 0,
         productList: [],
@@ -64,9 +65,18 @@ var recommendation = new Vue({
     },
     methods: {
         initData() {
-            if (this.state===2) {
+            if (this.state === 2) {
                 this.getNewList()
             }
+            this.getArticlerecommendation(this.state,1)
+        },
+        getArticlerecommendation: function (id, pageNum) {
+            var _self = this;
+            $.getJSON("/info/articlerecommendation/" + id + "/" + pageNum, {}, function (r) {
+                if (r.code === 0 && r.data) {
+                    _self.articlerecommendationData = r.data;
+                }
+            });
         },
         getNewList(num) {
             if (isPC) {

+ 16 - 15
src/main/resources/templates/article/recommendation.html

@@ -17,29 +17,30 @@
           <div>精选推荐</div>
         </div>
         <div class="select-content">
-          <div class="select-content-item" th:each="select: ${pageData.results}">
+          <div class="select-content-item" v-for="item in articlerecommendationData.results">
             <div class="img-left">
-              <img style="width: 100%;height: 100%;" th:src="${select.image}" />
+              <img style="width: 100%;height: 100%;" :src="item.image" />
             </div>
             <div class="item-content">
               <div>
-                <div class="item-1" th:text="${select.title}"></div>
-                <div class="item-2" th:text="${select.title}"></div>
-                <div class="item-3" th:text="${select.title}"></div>
+                <div class="item-1" v-html="item.title"></div>
+                <div class="item-2" v-html="item.title"></div>
+                <div class="item-3"  v-html="item.title"></div>
               </div>
-              <div class="item-4" th:text="${select.title}"></div>
+              <div class="item-4"  v-html="item.title"></div>
             </div>
           </div>
         </div>
       </div>
-      <div v-if="isPC" class="pageWrap clear" th:if="${pageData.totalRecord} > 0">
-        <a class="prev" th:href="'/info/articlerecommendation-1-' + ${pageData.pageNum - 1} + '.html?isSelected'" th:if="${pageData.hasPreviousPage}"></a>
-        <template th:each="selectInfo: ${pageData.totalPage}">
-          <a th:href="'/info/articlerecommendation-1-' + ${selectInfo} + '.html?isSelected'" th:text="${selectInfo}"></a>
+
+      <div class="pageWrap clear" v-if="isPC && articlerecommendationData.totalRecord > 0">
+        <a class="prev" :href="'/info/articlerecommendation-1-' + (articlerecommendationData.pageNum - 1) + '.html?isSelected'" v-if="articlerecommendationData.hasPreviousPage"></a>
+        <template  v-for="item in articlerecommendationData.totalPage">
+          <a :href="'/info/articlerecommendation-1-' + item + '.html?isSelected'" v-text="item"></a>
 <!--          <span th:else>···</span>-->
         </template>
-        <a class="next" th:if="${pageData.hasNextPage}" th:href="'/info/articlerecommendation-1-' + ${pageData.pageNum + 1} + '.html?isSelected'"></a>
-        <span>共<b th:text="${pageData.totalPage}"></b>页</span>
+        <a class="next" v-if="articlerecommendationData.hasNextPage" :href="'/info/articlerecommendation-1-' + (articlerecommendationData.pageNum + 1) + '.html?isSelected'"></a>
+        <span>共<b v-text="articlerecommendationData.totalPage"></b>页</span>
         <span>跳至</span>
         <input v-model="pageInput"/>
         <span>页</span>&nbsp;
@@ -65,12 +66,12 @@
         </li>
       </ul>
       <ul v-else>
-        <li th:each="file: ${pageData}">
-          <a class="info-item" th:href="${file.ossUrl}">
+        <li v-for="item in listData">
+          <a class="info-item" :href="item.ossUrl">
             <div>
               <img src="/img/article/PC--pdf.png" style="width: 100%;height: 100%;object-fit: contain;"/>
             </div>
-            <div th:text="${file.fileName}"></div>
+            <div v-html="item.fileName"></div>
           </a>
         </li>
       </ul>