Commit a37709dd65f6038eb4779d3a48c09634175ce0e9
1 parent
150a59e7
Exists in
develop
and in
1 other branch
feat: 首页列表联调
Showing
6 changed files
with
93 additions
and
25 deletions
Show diff stats
common/config.js
components/news-list/news-list.vue
... | ... | @@ -3,13 +3,12 @@ |
3 | 3 | <view class="flex-box" @click="newsDetails"> |
4 | 4 | <view class="leftCss"> |
5 | 5 | <view class="topCss overflow-two-lines"> |
6 | - 壳液牌发布最新版《液化天燃 | |
7 | - 气(LNS)前景》 | |
6 | + {{newItem.title}} | |
8 | 7 | </view> |
9 | 8 | <view class="bomCss overflow-one-lines"> |
10 | - <view class="overflow-one-lines"> 行业动态 </view> | |
9 | + <view class="overflow-one-lines"> {{ newItem.plate_name }} </view> | |
11 | 10 | <view class="">|</view> |
12 | - <view class="overflow-one-lines"> 中国燃气控股有限公司 </view> | |
11 | + <view class="overflow-one-lines"> {{newItem.organizeName}} </view> | |
13 | 12 | </view> |
14 | 13 | </view> |
15 | 14 | <view class="rightCss"> |
... | ... | @@ -23,7 +22,9 @@ |
23 | 22 | export default { |
24 | 23 | name: "news-list", |
25 | 24 | props: { |
26 | - | |
25 | + newItem:{ | |
26 | + type:Object | |
27 | + } | |
27 | 28 | }, |
28 | 29 | data() { |
29 | 30 | return { |
... | ... | @@ -34,7 +35,7 @@ |
34 | 35 | newsDetails(){ |
35 | 36 | console.log("跳转"); |
36 | 37 | uni.navigateTo({ |
37 | - url:'/pages/market/newsDetails' | |
38 | + url:'/pages/market/newsDetails?detailsContent=' + JSON.stringify(this.newItem) | |
38 | 39 | }) |
39 | 40 | } |
40 | 41 | } | ... | ... |
pages/market/index.vue
... | ... | @@ -4,14 +4,22 @@ |
4 | 4 | <u-search placeholder="搜索感兴趣的内容" v-model="keyword" :show-action="false" margin="30rpx 34rpx 15rpx 34rpx" |
5 | 5 | borderColor="rgb(230, 230, 230)" height="74rpx" bgColor="#F5F6FA" @search="search"></u-search> |
6 | 6 | <u-tabs :list="tabList" :activeStyle="{'color': '#cf000d','font-weight':'bold'}" lineWidth="30rpx" |
7 | - lineHeight="4rpx" lineColor="#cf000d" :current="current"></u-tabs> | |
7 | + lineHeight="4rpx" lineColor="#cf000d" @click="tabChange"></u-tabs> | |
8 | 8 | </u-sticky> |
9 | - <newsList v-for="i in 10" :key="i"></newsList> | |
9 | + <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" v-if="NewsList.length <= 0"></u-empty> | |
10 | + <newsList v-for="(item,index) in NewsList" :key="index" :newItem="item" v-else></newsList> | |
10 | 11 | </view> |
11 | 12 | </template> |
12 | 13 | |
13 | 14 | <script> |
14 | 15 | import newsList from '@/components/news-list/news-list.vue' |
16 | + import { | |
17 | + getInfoMarketInformationlist | |
18 | + } from '@/api/infoMarketInformation.js' | |
19 | + import { | |
20 | + listSimpleDictDatas | |
21 | + } from '@/api/dict.js' | |
22 | + import keyboard from '../../uni_modules/uview-ui/libs/config/props/keyboard' | |
15 | 23 | export default { |
16 | 24 | components: { |
17 | 25 | newsList |
... | ... | @@ -25,30 +33,79 @@ |
25 | 33 | current: 0, |
26 | 34 | tabList: [{ |
27 | 35 | name: "全部", |
28 | - }, { | |
29 | - name: "行业动态", | |
36 | + key: -1 | |
30 | 37 | }, { |
31 | 38 | name: "宏观经济", |
32 | - }, { | |
33 | - name: "用户资讯", | |
39 | + key: 0 | |
34 | 40 | }, { |
35 | 41 | name: "产业政策", |
42 | + key: 1 | |
43 | + }, { | |
44 | + name: "行业动态", | |
45 | + key: 2 | |
36 | 46 | }, { |
37 | 47 | name: "友商动态", |
48 | + key: 3 | |
49 | + }, { | |
50 | + name: "用户资讯", | |
51 | + key: 4 | |
38 | 52 | }, { |
39 | 53 | name: "国际能源", |
40 | - }] | |
54 | + key: 5 | |
55 | + }], | |
56 | + NewsList: [], | |
57 | + queryParameter: { | |
58 | + keyword: "", | |
59 | + plate_name: "" | |
60 | + } | |
41 | 61 | } |
42 | 62 | }, |
43 | 63 | computed: { |
44 | 64 | |
45 | 65 | }, |
46 | 66 | onLoad() { |
47 | - | |
67 | + this.initData() | |
48 | 68 | }, |
49 | 69 | methods: { |
70 | + initData() { | |
71 | + // this.updateList() | |
72 | + getInfoMarketInformationlist().then(res => { | |
73 | + console.log(res); | |
74 | + if (res.code === 200) { | |
75 | + this.NewsList = res.rows | |
76 | + console.log(this.NewsList); | |
77 | + } | |
78 | + }) | |
79 | + }, | |
50 | 80 | search() { |
51 | 81 | console.log("搜索"); |
82 | + if (this.keyword) { | |
83 | + this.updateList({ | |
84 | + keyword: this.keyword | |
85 | + }) | |
86 | + } | |
87 | + }, | |
88 | + updateList() { | |
89 | + let Params | |
90 | + if (this.keyword && this.current !== -1) { | |
91 | + Params = {keyword: this.keyword,plateName: this.current} | |
92 | + } else if (this.keyword) { | |
93 | + Params = {keyword: this.keyword,} | |
94 | + } else if (this.current !== -1) { | |
95 | + Params = {plateName: this.current} | |
96 | + } | |
97 | + getInfoMarketInformationlist(Params).then(res => { | |
98 | + console.log(res); | |
99 | + if (res.code === 200) { | |
100 | + this.NewsList = res.rows | |
101 | + console.log(this.NewsList); | |
102 | + } | |
103 | + }) | |
104 | + }, | |
105 | + tabChange(e) { | |
106 | + console.log(e); | |
107 | + this.current = e.key | |
108 | + this.updateList() | |
52 | 109 | } |
53 | 110 | } |
54 | 111 | } |
... | ... | @@ -56,4 +113,4 @@ |
56 | 113 | |
57 | 114 | <style lang="scss" scoped> |
58 | 115 | |
59 | 116 | -</style> |
117 | +</style> | |
60 | 118 | \ No newline at end of file | ... | ... |
pages/market/newsDetails.vue
... | ... | @@ -3,13 +3,13 @@ |
3 | 3 | <u-navbar class="navBarCss" title="资讯详情" :titleStyle="{'fontSize':'36rpx','color':'#333333','fontWeight':'700'}" leftClick="leftClick" |
4 | 4 | :autoBack="true" safeAreaInsetTop placeholder /> |
5 | 5 | <view class="titleCss"> |
6 | - 壳液牌发布最新版《液化天燃气(LNS) | |
7 | - 前景》 | |
6 | + {{ detailsContent.title }} | |
8 | 7 | </view> |
9 | 8 | <view class="releaseTimeCss"> |
10 | - 发布时间: 2023年09月21日 13:52:24 | |
9 | + {{ detailsContent.publishTime}} | |
11 | 10 | </view> |
12 | - <rich-text nodes="text内容"></rich-text> | |
11 | + <rich-text :nodes="detailsContent.details"> | |
12 | + </rich-text> | |
13 | 13 | |
14 | 14 | </view> |
15 | 15 | </template> |
... | ... | @@ -22,14 +22,18 @@ |
22 | 22 | }, |
23 | 23 | data() { |
24 | 24 | return { |
25 | - | |
25 | + detailsContent:{} | |
26 | 26 | } |
27 | 27 | }, |
28 | 28 | computed: { |
29 | 29 | |
30 | 30 | }, |
31 | - onLoad() { | |
32 | - | |
31 | + onLoad(data) { | |
32 | + console.log(data); | |
33 | + let resData = JSON.parse(data.detailsContent) | |
34 | + if(data){ | |
35 | + this.detailsContent = resData; | |
36 | + } | |
33 | 37 | }, |
34 | 38 | methods: { |
35 | 39 | leftClick() { | ... | ... |
utils/request/responseInterceptors.js
... | ... | @@ -75,9 +75,10 @@ module.exports = vm => { |
75 | 75 | // hard coding:忽略这个提示,直接登出 |
76 | 76 | console.log(msg) |
77 | 77 | } else { |
78 | - uni.$u.toast(msg) | |
78 | + // uni.$u.toast(msg) | |
79 | 79 | } |
80 | - return Promise.reject(res) | |
80 | + return res.data | |
81 | + // return Promise.reject(res) | |
81 | 82 | } else { |
82 | 83 | return res.data |
83 | 84 | } | ... | ... |