xiongzhu 4 лет назад
Родитель
Сommit
38ebf8240c

+ 1 - 0
src/main/jmrh/.env.development

@@ -0,0 +1 @@
+VUE_APP_BASE_URL=http://localhost:8080

+ 1 - 0
src/main/jmrh/.env.production

@@ -0,0 +1 @@
+VUE_APP_BASE_URL=http://jmrh.izouma.com/

+ 1 - 0
src/main/jmrh/.env.test

@@ -0,0 +1 @@
+VUE_APP_BASE_URL=http://test.jmrh.izouma.com/

+ 1 - 3
src/main/jmrh/src/components/interact/official.vue

@@ -75,9 +75,7 @@ export default {
     },
     },
     methods: {
     methods: {
         beforeGetData() {
         beforeGetData() {
-            if (this.search || this.query) {
-                return { search: this.search, query: this.query };
-            }
+            return { search: this.search, query: this.query, sort: 'createdAt,desc' };
         },
         },
         open() {
         open() {
             if (this.$store.state.userInfo) {
             if (this.$store.state.userInfo) {

+ 3 - 10
src/main/jmrh/src/components/interact/problem.vue

@@ -73,11 +73,9 @@ export default {
         }
         }
     },
     },
     methods: {
     methods: {
-        // beforeGetData() {
-        //     if (this.search || this.query) {
-        //         return { search: this.search, query: this.query };
-        //     }
-        // },
+        beforeGetData() {
+            return { search: this.search, query: this.query, sort: 'createdAt,desc' };
+        },
         open() {
         open() {
             if (this.$store.state.userInfo) {
             if (this.$store.state.userInfo) {
                 this.title = '发布问题';
                 this.title = '发布问题';
@@ -93,11 +91,6 @@ export default {
         toColse(show) {
         toColse(show) {
             this.getData();
             this.getData();
             this.outerVisible = show;
             this.outerVisible = show;
-        },
-        beforeGetData() {
-            if (this.search || this.query) {
-                return { search: this.search, query: this.query };
-            }
         }
         }
     }
     }
 };
 };

+ 3 - 5
src/main/jmrh/src/components/interact/topic.vue

@@ -74,11 +74,9 @@ export default {
         }
         }
     },
     },
     methods: {
     methods: {
-        // beforeGetData() {
-        //     if (this.search || this.query) {
-        //         return { search: this.search, query: this.query };
-        //     }
-        // },
+        beforeGetData() {
+            return { search: this.search, query: this.query, sort: 'createdAt,desc' };
+        },
         open() {
         open() {
             if (this.$store.state.userInfo) {
             if (this.$store.state.userInfo) {
                 this.title = '发布话题';
                 this.title = '发布话题';

+ 1 - 3
src/main/jmrh/src/components/news/hot.vue

@@ -51,9 +51,7 @@ export default {
     },
     },
     methods: {
     methods: {
         beforeGetData() {
         beforeGetData() {
-            if (this.query) {
-                return { query: this.query };
-            }
+            return { query: this.query, sort: 'createdAt,desc' };
         }
         }
     }
     }
 };
 };

+ 1 - 3
src/main/jmrh/src/components/news/qusetion.vue

@@ -51,9 +51,7 @@ export default {
     },
     },
     methods: {
     methods: {
         beforeGetData() {
         beforeGetData() {
-            if (this.query) {
-                return { query: this.query };
-            }
+            return { query: this.query, sort: 'createdAt,desc' };
             // console.log(tableData);
             // console.log(tableData);
         }
         }
     }
     }

+ 1 - 3
src/main/jmrh/src/components/news/topic.vue

@@ -52,9 +52,7 @@ export default {
     },
     },
     methods: {
     methods: {
         beforeGetData() {
         beforeGetData() {
-            if (this.query) {
-                return { query: this.query };
-            }
+            return { query: this.query, sort: 'createdAt,desc' };
         }
         }
     }
     }
 };
 };

+ 1 - 13
src/main/jmrh/src/plugins/http.js

@@ -2,19 +2,7 @@ import axios from 'axios';
 import router from '../router';
 import router from '../router';
 import qs from 'qs';
 import qs from 'qs';
 /* eslint-disable */
 /* eslint-disable */
-let baseUrl = 'http://127.0.0.1:8080';
-switch (process.env.NODE_ENV) {
-    case 'development':
-        baseUrl = 'http://localhost:8080';
-        // baseUrl = 'http://127.0.0.1:8080/';
-        break;
-    case 'test':
-        // baseUrl = 'http://localhost:8081';
-        break;
-    case 'production':
-        baseUrl = '../';
-        break;
-}
+let baseUrl = process.env.VUE_APP_BASE_URL;
 const axiosInstance = axios.create({
 const axiosInstance = axios.create({
     baseURL: baseUrl
     baseURL: baseUrl
 });
 });

+ 26 - 16
src/main/jmrh/src/views/home.vue

@@ -443,7 +443,7 @@ export default {
                     this.top = res.content[0];
                     this.top = res.content[0];
                 }
                 }
             });
             });
-        this.$http.get('/article/all', { query: { mainType: '首页轮播' } }).then(res => {
+        this.$http.get('/article/all', { query: { mainType: '首页轮播' }, sort: 'createdAt,desc' }).then(res => {
             this.banners = res.content;
             this.banners = res.content;
         });
         });
 
 
@@ -452,21 +452,29 @@ export default {
         });
         });
         this.getNews();
         this.getNews();
         // 产品发布
         // 产品发布
-        this.$http.get('/resourceSupplyAndDemand/all', { size: 5, query: { type: 'PRODUCT_SUPPLY' } }).then(res => {
-            this.productList = res.content;
-        });
+        this.$http
+            .get('/resourceSupplyAndDemand/all', { size: 5, query: { type: 'PRODUCT_SUPPLY' }, sort: 'createdAt,desc' })
+            .then(res => {
+                this.productList = res.content;
+            });
         // 技术发布
         // 技术发布
-        this.$http.get('/resourceSupplyAndDemand/all', { size: 5, query: { type: 'TECH_SUPPLY' } }).then(res => {
-            this.artProductList = res.content;
-        });
+        this.$http
+            .get('/resourceSupplyAndDemand/all', { size: 5, query: { type: 'TECH_SUPPLY' }, sort: 'createdAt,desc' })
+            .then(res => {
+                this.artProductList = res.content;
+            });
         // 产品需求
         // 产品需求
-        this.$http.get('/resourceSupplyAndDemand/all', { size: 8, query: { type: 'PRODUCT_DEMAND' } }).then(res => {
-            this.productNeedList = res.content;
-        });
+        this.$http
+            .get('/resourceSupplyAndDemand/all', { size: 8, query: { type: 'PRODUCT_DEMAND' }, sort: 'createdAt,desc' })
+            .then(res => {
+                this.productNeedList = res.content;
+            });
         // 技术需求
         // 技术需求
-        this.$http.get('/resourceSupplyAndDemand/all', { size: 8, query: { type: 'TECH_DEMAND' } }).then(res => {
-            this.list = res.content;
-        });
+        this.$http
+            .get('/resourceSupplyAndDemand/all', { size: 8, query: { type: 'TECH_DEMAND' }, sort: 'createdAt,desc' })
+            .then(res => {
+                this.list = res.content;
+            });
         // 产品发布条数
         // 产品发布条数
         this.$http
         this.$http
             .get('/resourceSupplyAndDemand/getDataCount', {
             .get('/resourceSupplyAndDemand/getDataCount', {
@@ -494,9 +502,11 @@ export default {
             this.bannerIndex = e;
             this.bannerIndex = e;
         },
         },
         getNews() {
         getNews() {
-            this.$http.get('/article/all', { query: { mainType: this.tab }, size: 7 }).then(res => {
-                this.news = res.content;
-            });
+            this.$http
+                .get('/article/all', { query: { mainType: this.tab }, size: 7, sort: 'createdAt,desc' })
+                .then(res => {
+                    this.news = res.content;
+                });
         },
         },
         goTab1() {
         goTab1() {
             this.$router.push({
             this.$router.push({

+ 4 - 3
src/main/jmrh/src/views/news.vue

@@ -94,15 +94,15 @@ export default {
         };
         };
     },
     },
     created() {
     created() {
-        this.$http.get('/article/all', { query: { mainType: '首页轮播' } }).then(res => {
+        this.$http.get('/article/all', { query: { mainType: '首页轮播' }, sort: 'createdAt,desc' }).then(res => {
             this.banners = res.content;
             this.banners = res.content;
         });
         });
 
 
-        this.$http.get('/article/all', { query: { mainType: '行业动态' } }).then(res => {
+        this.$http.get('/article/all', { query: { mainType: '行业动态' }, sort: 'createdAt,desc' }).then(res => {
             this.news = res.content;
             this.news = res.content;
         });
         });
 
 
-        this.$http.get('/article/all', { query: { mainType: '通知通告' } }).then(res => {
+        this.$http.get('/article/all', { query: { mainType: '通知通告' }, sort: 'createdAt,desc' }).then(res => {
             this.inform = res.content;
             this.inform = res.content;
         });
         });
 
 
@@ -115,6 +115,7 @@ export default {
         getData() {
         getData() {
             this.$http
             this.$http
                 .get('/article/all', {
                 .get('/article/all', {
+                    sort: 'createdAt,desc',
                     query: { mainType: '热点推荐' },
                     query: { mainType: '热点推荐' },
                     size: this.size,
                     size: this.size,
                     page: this.page - 1
                     page: this.page - 1

+ 1 - 0
src/main/jmrh/src/views/policy.vue

@@ -94,6 +94,7 @@ export default {
             this.$http
             this.$http
                 .get('/article/all', {
                 .get('/article/all', {
                     size: 10000,
                     size: 10000,
+                    sort: 'createdAt,desc',
                     query: { mainType: '政策法规', subType: (this.tabList[this.current] || {}).name }
                     query: { mainType: '政策法规', subType: (this.tabList[this.current] || {}).name }
                 })
                 })
                 .then(res => {
                 .then(res => {