ming hai 1 ano
pai
achega
f424ef874d
Modificáronse 5 ficheiros con 83 adicións e 69 borrados
  1. 67 33
      assets/js/commonVue.js
  2. 3 3
      news/index.html
  3. 10 30
      news/read.html
  4. 2 2
      product/index.html
  5. 1 1
      solution/index.html

+ 67 - 33
assets/js/commonVue.js

@@ -24,8 +24,11 @@ var app = new Vue({
     columnList: [],
     currentPath: '',
     articalArray: [], //详情数组
+    articalArrayRelated: [], //相关新闻
     columnTypes: [], //栏目类型
 
+    
+
     // 公共弹框
     centerDialogVisible: false,
     dialogDataArray:[],
@@ -72,11 +75,17 @@ var app = new Vue({
     // 新闻
     news: [],
     goPage: 1,
-    one_page_size: 9,
-    currentPageNum: 1,
     totalPageNum: 1,
-    totalPageSzie: 4,
+    totalPageSzie: 1,
     loading: true,
+    categoryid:0,
+    requestParams:{
+      categoryid: this.id,
+      pageNum: 1,
+      pageSize: 9,
+      title: ''
+
+    },
 
 
     //解决方案旧
@@ -86,7 +95,7 @@ var app = new Vue({
     previousInfo: {},
     nextInfo: {},
     relativeArr: [],
-    ariticle_id: 0,
+    // ariticle_id: 0,
   },
 
   computed: {
@@ -105,8 +114,10 @@ var app = new Vue({
 
   },
   created: function () {
-    this.ariticle_id = this.getQuery('id')
-    this.title = this.getQuery('title') ? this.getQuery('title') : ''
+    this.requestParams.categoryid = this.getQuery('id') ? this.getQuery('id') : ''
+
+    // this.ariticle_id = this.getQuery('id')
+    this.requestParams.title = this.getQuery('title') ? this.getQuery('title') : ''
 
   },
   mounted: function () {
@@ -144,6 +155,8 @@ var app = new Vue({
           }
           if (res.data[i].categoryName == '产品服务' && window.location.pathname == '/product/read.html') {
             _this.currentPath = '/product/index.html' //产品详情时栏目高亮
+            
+           
           }
           if (res.data[i].categoryName == '解决方案') {
             _this.dialogDataArray=(res.data[i].children)
@@ -152,6 +165,14 @@ var app = new Vue({
 
           if (res.data[i].categoryName == '新闻动态' && window.location.pathname == '/news/read.html') {
             _this.currentPath = '/news/index.html' //新闻详情时栏目高亮
+
+            //获取相关新闻数据
+            setTimeout(()=>{
+              _this.requestParams.title=''
+              _this.getArticalData( _this.requestParams,1)
+            },1)
+
+
             //新闻详情旧
             jQuery.ajax({
               type: 'POST',
@@ -180,7 +201,9 @@ var app = new Vue({
           }
           if (res.data[i].categoryName == '关于永天' && window.location.pathname.indexOf('about') > -1) {
             _this.columnTypes = res.data[i].children
-            _this.getArticalData(_this.getQuery('id'))
+            _this.requestParams.categoryid=_this.getQuery('id') 
+            console.log(_this.requestParams)
+            _this.getArticalData(_this.requestParams)
 
             //关于永天旧
             $.ajax({
@@ -198,8 +221,8 @@ var app = new Vue({
           if (res.data[i].children.length > 0) {
             if (res.data[i].categoryName == '解决方案' && window.location.pathname.indexOf('solution') > -1) {
               _this.columnTypes = res.data[i].children
-              _this.id = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
-              _this.getArticalData(_this.id)
+              _this.requestParams.categoryid = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
+              _this.getArticalData(_this.requestParams)
 
               //解决方案旧
               $.ajax({
@@ -216,13 +239,15 @@ var app = new Vue({
             }
             if (res.data[i].categoryName == '新闻动态' && window.location.pathname.indexOf('news') > -1) {
               _this.columnTypes = res.data[i].children
-              _this.id = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
-              _this.getArticalData(_this.id)
+              _this.requestParams.categoryid = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
+              _this.getArticalData(_this.requestParams)
+
+
             }
             if (res.data[i].categoryName == '产品服务' && window.location.pathname.indexOf('product') > -1) {
               _this.columnTypes = res.data[i].children
-              _this.id = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
-              _this.getArticalData(_this.id)
+              _this.requestParams.categoryid = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
+              _this.getArticalData(_this.requestParams)
             }
           }
         }
@@ -230,26 +255,35 @@ var app = new Vue({
     },
 
     //获取内容
-    getArticalData(param) {
+    getArticalData(requestParams,type) {
       $.ajax({
         type: 'GET',
         dataType: 'json',
         url: window.FQDN2 + 'siteArticle/siteArticleList',
-        data: {
-          categoryid: param,
-          pageNum: _this.currentPageNum,
-          pageSize: _this.one_page_size,
-          title: _this.title
-        }
+        data: requestParams
       }).done(function (res) {
-        var aa = res.data.records;
+       
+  
+        var aa
+        var bb
+
+        if(type==1){
+         bb=res.data.records
+        }else{
+          aa= res.data.records;
+          aa.sort(_this.compare("lmtitle"))
+          _this.articalArray = aa;
+        }
 
-        aa.sort(_this.compare("lmtitle"))
+        if(bb){
+          _this.articalArrayRelated =bb.filter(obj => obj.id !=  _this.articalArray[0].id);
+          console.log(_this.articalArrayRelated)
+        }
         _this.loading = false;
-        _this.articalArray = aa;
         _this.totalPageSzie = res.data.total
         _this.totalPageNum = Math.ceil(res.data.total / res.data.size);
-        console.log(aa)
+
+        
 
       }).fail(function (err) {});
 
@@ -257,31 +291,31 @@ var app = new Vue({
 
     //类型点击
     facilityClick(e, item) {
-      this.id = item.id
-      this.getArticalData(item.id)
-      this.currentPageNum = 1
-      // console.log(item.id)
+      this.requestParams.categoryid = item.id
+      this.requestParams.pageNum = 1
+      this.getArticalData(this.requestParams)
+      
     },
 
 
     //  分页
     oneInnerBox: function (param) {
-      window.location = "./read.html?id=" + param.categoryid + '&title=' + param.title;
+      window.location = "./read.html?id=" + param.categoryid + "&title=" + param.title+ "&isTwo=1";
       // window.location = "./read.html?id=154"
 
     },
     enterPage: function (res) {
       if (this.goPage >= 1 && this.goPage <= this.totalPageNum) {
-        this.currentPageNum = this.goPage
-        this.getArticalData(this.id)
+        this.requestParams.pageNum = this.goPage
+        this.getArticalData(this.requestParams)
       } else {
         this.goPage = 1
         alert('输入页数有误!')
       }
     },
     currentChange: function (res) {
-      this.currentPageNum = res
-      this.getArticalData(this.id)
+      this.requestParams.pageNum = res
+      this.getArticalData(this.requestParams)
     },
 
 

+ 3 - 3
news/index.html

@@ -118,7 +118,7 @@
             <div class="container">
                 <div class="row newTypeBox">
                     <div class="col-lg-6 col-md-6 titleOne" v-for="(item,i) in columnTypes"
-                        :class="item.id == id ? 'active' : ''" @click="facilityClick(i, item)">{{item.categoryName}}
+                        :class="item.id == requestParams.categoryid ? 'active' : ''" @click="facilityClick(i, item)">{{item.categoryName}}
                     </div>
                 </div>
             </div>
@@ -153,8 +153,8 @@
                             <div class="page-des align-items-start cannot_selected">共<span> {{
                                     totalPageNum}}</span>页,共<span> {{totalPageSzie}}</span>条信息</div>
 
-                            <el-pagination prev-text="上一页" next-text='下一页' :page-size="one_page_size"
-                                :current-page="currentPageNum" background layout="prev, pager, next"
+                            <el-pagination prev-text="上一页" next-text='下一页' :page-size="requestParams.pageSize"
+                                :current-page="requestParams.pageNum" background layout="prev, pager, next"
                                 :total="totalPageSzie" @current-change="currentChange">
                             </el-pagination>
                             <div class="page-des2 align-items-end cannot_selected pc">前往第

+ 10 - 30
news/read.html

@@ -151,12 +151,12 @@
                         </div>
 
                         <!--  -->
-                        <div v-if="!loading" class="read-page d-flex justify-content-between">
-                            <a :class="[!hasPrevious ? 'disable' : '']" :href="[hasPrevious ? './read.html?id='+previousInfo.id : 'javascript: void();']" class="previous">上一篇{{previousInfo.title}}</a>
+                        <div v-if="!loading" class="read-page d-flex justify-content-center">
+                            <!-- <a :class="[!hasPrevious ? 'disable' : '']" :href="[hasPrevious ? './read.html?id='+previousInfo.id : 'javascript: void();']" class="previous">上一篇{{previousInfo.title}}</a> -->
                             <a href="./index.html">返回新闻列表</a>
-                            <a :class="[!hasNext ? 'disable' : '']" :href="[hasNext ? './read.html?id='+nextInfo.id : 'javascript: void();']" class="next">下一篇{{nextInfo.title}}</a>
-                            <a :class="[!hasPrevious ? 'disable' : '']" :href="[hasPrevious ? './read.html?id='+previousInfo.id : 'javascript: void();']" class="min-previous">上一篇</a>
-                            <a :class="[!hasNext ? 'disable' : '']" :href="[hasNext ? './read.html?id='+nextInfo.id : 'javascript: void();']" class="min-next">下一篇</a>
+                            <!-- <a :class="[!hasNext ? 'disable' : '']" :href="[hasNext ? './read.html?id='+nextInfo.id : 'javascript: void();']" class="next">下一篇{{nextInfo.title}}</a> -->
+                            <!-- <a :class="[!hasPrevious ? 'disable' : '']" :href="[hasPrevious ? './read.html?id='+previousInfo.id : 'javascript: void();']" class="min-previous">上一篇</a> -->
+                            <!-- <a :class="[!hasNext ? 'disable' : '']" :href="[hasNext ? './read.html?id='+nextInfo.id : 'javascript: void();']" class="min-next">下一篇</a> -->
                         </div>
 
                         <!-- 相关新闻 start -->
@@ -164,35 +164,15 @@
                             <div class="title-tag2 pt-60">相关新闻</div>
                             <div class="relNewBox container ">
 
-                                <a class="justify-content-between d-flex relNewsList" :href="'./read.html?id='+item.id" v-for="item in relativeArr" :key="item.id">
+                                <a class="ustify-content-between d-flex relNewsList" :href="'./read.html?id='+item.id+'&title='+item.title" v-for="item in articalArrayRelated" :key="item.id">
                                     <div><img width="18" height="18" src="../assets/img/news/arrowT.svg"> {{item.title}} </div>
-                                    <div> {{item.time}}</div>
+                                    <div> {{timeFormatSeconds(item.modifydate?item.modifydate:'')}}</div>
                                 </a>
 
 
-                                <!-- <a class="justify-content-between d-flex relNewsList" href="">
-                                    <div><img width="18" height="18" src="../assets/img/news/arrowT.svg"> 大数据时代要定“明规则” 保护好用户隐私 </div>
-                                    <div>2022-02-12</div>
-                                </a>
-                                <a class="justify-content-between d-flex relNewsList" href="">
-                                    <div><img width="18" height="18"
-                                            src="../assets/img/news/arrowT.svg">IDC关于覆盖100多个城市的智慧城市支出预测 </div>
-                                    <div>2022-02-12</div>
-                                </a>
-                                <a class="justify-content-between d-flex relNewsList" href="">
-                                    <div><img width="18" height="18"
-                                            src="../assets/img/news/arrowT.svg">中国智慧城市建设:全国加速进行时 </div>
-                                    <div>2022-02-12</div>
-                                </a>
-                                <a class="justify-content-between d-flex relNewsList" href="">
-                                    <div><img width="18" height="18" src="../assets/img/news/arrowT.svg">德勤中国智能制造深度报告
-                                    </div>
-                                    <div>2022-02-12</div>
-                                </a>
-                                <a class="justify-content-between d-flex relNewsList" href="">
-                                    <div><img width="18" height="18" src="../assets/img/news/arrowT.svg">复合年增长率为13.6%
-                                        2022年中国将成最大物联网市场</div>
-                                    <div>2022-02-12</div>
+                                <!-- <a class="justify-content-between d-flex relNewsList" :href="'./read.html?id='+item.id" v-for="item in relativeArr" :key="item.id">
+                                    <div><img width="18" height="18" src="../assets/img/news/arrowT.svg"> {{item.title}} </div>
+                                    <div> {{item.time}}</div>
                                 </a> -->
                             </div>
                         </div>

+ 2 - 2
product/index.html

@@ -157,7 +157,7 @@
 
 
                           
-                                <a v-for="(item,i) in columnTypes" :class="item.id == id ? 'active' : ''"
+                                <a v-for="(item,i) in columnTypes" :class="item.id == requestParams.categoryid ? 'active' : ''"
                                 @click="facilityClick(i, item)">{{item.categoryName}}</a>
 
                                
@@ -223,7 +223,7 @@
                                         <div class="page-des align-items-start cannot_selected">共<span> {{
                                                 totalPageNum}}</span>页,共<span> {{totalPageSzie}}</span>条信息</div>
 
-                                        <el-pagination prev-text="上一页" next-text='下一页' :page-size="one_page_size" :current-page="currentPageNum" background layout="prev, pager, next" :total="totalPageSzie" @current-change="currentChange">
+                                        <el-pagination prev-text="上一页" next-text='下一页' :page-size="requestParams.pageSize" :current-page="requestParams.pageNum" background layout="prev, pager, next" :total="totalPageSzie" @current-change="currentChange">
                                         </el-pagination>
 
                                         <div class="page-des2 align-items-end cannot_selected pc">前往第

+ 1 - 1
solution/index.html

@@ -121,7 +121,7 @@
         <!--====== SOLUTION TYPE START ======-->
         <section style="background:#F4F8FD" class="solutionType">
             <div class="container" style="text-align:center">
-                <div class=" solutionTypeOne" v-for="(item,i) in columnTypes" :class="item.id == id ? 'active' : ''"
+                <div class=" solutionTypeOne" v-for="(item,i) in columnTypes" :class="item.id == requestParams.categoryid ? 'active' : ''"
                     @click="facilityClick(i, item)">
                     <div style="width:40px;height:40px;;overflow:hidden;margin:0 auto">
                         <img :src="item.imagePath" alt="">