hookehuyr

新闻中心列表页接口联调

...@@ -11,9 +11,12 @@ ...@@ -11,9 +11,12 @@
11 "build_tar": "npm run build && npm run tar", 11 "build_tar": "npm run build && npm run tar",
12 "scp-dev": "scp dist.tar.gz ipadbiz-inner:/opt/space-dev/f", 12 "scp-dev": "scp dist.tar.gz ipadbiz-inner:/opt/space-dev/f",
13 "dec-dev": "ssh ipadbiz-inner 'cd /opt/space-dev/f && tar -xzvf dist.tar.gz && rm -rf dist.tar.gz'", 13 "dec-dev": "ssh ipadbiz-inner 'cd /opt/space-dev/f && tar -xzvf dist.tar.gz && rm -rf dist.tar.gz'",
14 + "scp-oa": "scp dist.tar.gz ipadbiz-inner:/opt/hager/f",
15 + "dec-oa": "ssh ipadbiz-inner 'cd /opt/hager/f && tar -xzvf dist.tar.gz && rm -rf dist.tar.gz'",
14 "remove_tar": "rm -rf dist.tar.gz", 16 "remove_tar": "rm -rf dist.tar.gz",
15 "remove_dist": "rm -rf hager", 17 "remove_dist": "rm -rf hager",
16 - "dev_upload": "npm run build_tar && npm run scp-dev && npm run dec-dev && npm run remove_tar && npm run remove_dist" 18 + "dev_upload": "npm run build_tar && npm run scp-dev && npm run dec-dev && npm run remove_tar && npm run remove_dist",
19 + "oa_upload": "npm run build_tar && npm run scp-oa && npm run dec-oa && npm run remove_tar && npm run remove_dist"
17 }, 20 },
18 "dependencies": { 21 "dependencies": {
19 "@babel/polyfill": "^7.12.1", 22 "@babel/polyfill": "^7.12.1",
......
1 /* 1 /*
2 * @Date: 2024-09-26 13:36:06 2 * @Date: 2024-09-26 13:36:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-23 10:13:25 4 + * @LastEditTime: 2024-10-23 11:00:04
5 * @FilePath: /hager/src/api/hager.js 5 * @FilePath: /hager/src/api/hager.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -9,6 +9,8 @@ import { fn, fetch } from '@/api/fn'; ...@@ -9,6 +9,8 @@ import { fn, fetch } from '@/api/fn';
9 9
10 const Api = { 10 const Api = {
11 HONOR: '/srv/?a=cate&type=honor', 11 HONOR: '/srv/?a=cate&type=honor',
12 + NEWS: '/srv/?a=cate&type=news',
12 }; 13 };
13 14
14 export const honorAPI = (params) => fn(fetch.get(Api.HONOR, params)); 15 export const honorAPI = (params) => fn(fetch.get(Api.HONOR, params));
16 +export const newsAPI = (params) => fn(fetch.get(Api.NEWS, params));
......
...@@ -625,8 +625,8 @@ export default { ...@@ -625,8 +625,8 @@ export default {
625 display: flex; 625 display: flex;
626 align-items: center; 626 align-items: center;
627 border-radius: 1rem; 627 border-radius: 1rem;
628 - border: 1px solid #f5f5f5; 628 + border: 1px solid #E3F1F7;
629 - background-color: #e3f1f7; 629 + background-color: #E3F1F7;
630 padding: 0.5rem 1rem; 630 padding: 0.5rem 1rem;
631 overflow: hidden; 631 overflow: hidden;
632 width: 100%; 632 width: 100%;
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 12:05:44 2 * @Date: 2024-10-18 12:05:44
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-22 15:02:54 4 + * @LastEditTime: 2024-10-23 11:57:18
5 * @FilePath: /hager/src/views/news/index.vue 5 * @FilePath: /hager/src/views/news/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -22,29 +22,32 @@ ...@@ -22,29 +22,32 @@
22 <hager-box style="margin: 1rem 0;"> 22 <hager-box style="margin: 1rem 0;">
23 <div v-if="!is_xs" class="hager-news-list"> 23 <div v-if="!is_xs" class="hager-news-list">
24 <div class="card" v-for="(item, index) in news_list" :key="index"> 24 <div class="card" v-for="(item, index) in news_list" :key="index">
25 - <img :src="item.src" alt="学校图片" class="card-image"> 25 + <img :src="item.cover" alt="学校图片" class="card-image">
26 <div class="news-item"> 26 <div class="news-item">
27 - <div :class="news-item-title">{{ item.title }}</div> 27 + <el-tooltip class="item" effect="dark" :content="item.post_title" placement="bottom">
28 - <p class="news-item-sub" v-clamp="2">{{ item.sub }}</p> 28 + <div class="news-item-title">{{ item.post_title }}</div>
29 - <p class="news-item-content" v-clamp="3">{{ item.content }}</p> 29 + </el-tooltip>
30 + <!-- <div class="news-item-title">{{ item.post_title }}</div> -->
31 + <p class="news-item-sub" v-clamp="2">{{ item.post_title_en }}</p>
32 + <p class="news-item-content" v-clamp="3">{{ item.post_excerpt }}</p>
30 <div @click="goToNew(item)" class="news-item-more" style="margin-top: 3rem;">MORE</div> 33 <div @click="goToNew(item)" class="news-item-more" style="margin-top: 3rem;">MORE</div>
31 </div> 34 </div>
32 </div> 35 </div>
33 </div> 36 </div>
34 <div v-else class="hager-news-list xs"> 37 <div v-else class="hager-news-list xs">
35 <div class="card" v-for="(item, index) in news_list" :key="index"> 38 <div class="card" v-for="(item, index) in news_list" :key="index">
36 - <img :src="item.src" alt="学校图片" class="card-image"> 39 + <img :src="item.cover" alt="学校图片" class="card-image">
37 <div class="news-item"> 40 <div class="news-item">
38 - <div class="news-item-title xs">{{ item.title }}</div> 41 + <div class="news-item-title xs">{{ item.post_title }}</div>
39 - <p class="news-item-sub">{{ item.sub }}</p> 42 + <p class="news-item-sub">{{ item.post_title_en }}</p>
40 - <p class="news-item-content">{{ item.content }}</p> 43 + <p class="news-item-content">{{ item.post_excerpt }}</p>
41 <div @click="goToNew(item)" class="news-item-more" style="margin-top: 3rem;">MORE</div> 44 <div @click="goToNew(item)" class="news-item-more" style="margin-top: 3rem;">MORE</div>
42 </div> 45 </div>
43 </div> 46 </div>
44 </div> 47 </div>
45 </hager-box> 48 </hager-box>
46 <hager-box> 49 <hager-box>
47 - <hager-load-more></hager-load-more> 50 + <hager-load-more v-if="page <= max_page" @click.native="getMore"></hager-load-more>
48 </hager-box> 51 </hager-box>
49 </div> 52 </div>
50 </template> 53 </template>
...@@ -53,34 +56,25 @@ ...@@ -53,34 +56,25 @@
53 import mixin from 'common/mixin'; 56 import mixin from 'common/mixin';
54 import hagerBox from '@/components/common/hagerBox'; 57 import hagerBox from '@/components/common/hagerBox';
55 import hagerLoadMore from '@/components/hagerLoadMore.vue'; 58 import hagerLoadMore from '@/components/hagerLoadMore.vue';
59 +import { newsAPI } from "@/api/hager.js";
56 60
57 export default { 61 export default {
58 components: { hagerBox, hagerLoadMore }, 62 components: { hagerBox, hagerLoadMore },
59 mixins: [mixin.init], 63 mixins: [mixin.init],
60 data () { 64 data () {
61 return { 65 return {
62 - news_list: [{ 66 + news_list: [],
63 - id: '1', 67 + max_page: 0,
64 - src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg', 68 + page: 1,
65 - title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀', 69 + limit: 10,
66 - content: '11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整',
67 - sub: 'o Ehe gy aha oid asto Ehe gy aha oid asto Ehe gy aha oid ast o Ehe gy aha oid asto Ehe gy aha oid asto Ehe gy aha oid astgy aha oid asto Ehe gy aha oid asto Ehe gy aha oid ast'
68 - }, {
69 - id: '2',
70 - src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
71 - title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀',
72 - content: '11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整',
73 - sub: 'o Ehe gy aha oid asto Ehe gy aha oid asto Ehe gy aha oid ast'
74 - }, {
75 - id: '3',
76 - src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
77 - title: '获奖+1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀国际标1!海格电气荣获2023酒店文旅优秀',
78 - content: '11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整11月28-29日,2023汤点文旅住宿节在苏州国际会议酒店隆重开幕,作为酒店整',
79 - sub: 'o Ehe gy aha oid asto Ehe gy aha oid asto Ehe gy aha oid ast'
80 - }]
81 } 70 }
82 }, 71 },
83 - mounted () { 72 + async mounted () {
73 + const { code, data } = await newsAPI({ page: this.page, limit: this.limit });
74 + if (code) {
75 + this.news_list = data.list;
76 + this.max_page = data.max_page;
77 + }
84 }, 78 },
85 methods: { 79 methods: {
86 goToNew (v) { 80 goToNew (v) {
...@@ -90,6 +84,13 @@ export default { ...@@ -90,6 +84,13 @@ export default {
90 id: v.id 84 id: v.id
91 } 85 }
92 }); 86 });
87 + },
88 + async getMore () {
89 + this.page += 1;
90 + const { code, data } = await newsAPI({ page: this.page, limit: this.limit });
91 + if (code) {
92 + this.news_list = this.news_list.concat(data.list);
93 + }
93 } 94 }
94 } 95 }
95 } 96 }
......