diff --git a/新闻小程序/pages/home/home.js b/新闻小程序/pages/home/home.js index d3cb6dc..6750a6b 100644 --- a/新闻小程序/pages/home/home.js +++ b/新闻小程序/pages/home/home.js @@ -7,8 +7,9 @@ Page({ { title: "上海今日全市进行抗原检测 明日全市进行核酸检测" }, { title: "苏州发现奥密克戎新变异株 与全球已知毒株均不同源" }, { title: "美工作组抵华 参与东航事故调查" }, + { title: "上海昨日新增本土确诊425例、无症状8581例" }, ], - list: [], + news_list: [], }, onLoad: function (options) { // 获取轮播图数据 @@ -37,14 +38,14 @@ Page({ wx.showLoading({ title: '加载中...', }) - let len = this.data.list.length + let len = this.data.news_list.length console.log('当前list长度', len) wx.cloud.database().collection('neidi-news') .skip(len) .get() .then(res => { wx.hideLoading() - // console.log('请求成功', res) + console.log('新闻列表请求成功:', res) let datalist = res.data if (datalist.length <= 0) { wx.showToast({ @@ -53,11 +54,12 @@ Page({ }) } this.setData({ - list: this.data.list.concat(res.data) + news_list: this.data.news_list.concat(res.data), + news_image: res.data.news_img, }) }) .catch(res => { - console.log('请求失败', res) + console.log('新闻列表请求失败', res) }) }, /** diff --git a/新闻小程序/pages/home/home.wxml b/新闻小程序/pages/home/home.wxml index 5aca49e..d3017e2 100644 --- a/新闻小程序/pages/home/home.wxml +++ b/新闻小程序/pages/home/home.wxml @@ -1,6 +1,6 @@ - + {{item.title}} @@ -8,6 +8,15 @@ + + + 内地新闻 + 香港新闻 + 台湾新闻 + 国际新闻 + 军事新闻 + + @@ -17,12 +26,25 @@ - - - - + + + + + + + + + + + {{item.news_title}} - {{item.news_title}} - {{item.news_date}}----------{{item.news_author}} + + + + {{item.news_author}} + {{item.news_date}} + + - \ No newline at end of file + + \ No newline at end of file diff --git a/新闻小程序/pages/home/home.wxss b/新闻小程序/pages/home/home.wxss index 29205da..4e3e892 100644 --- a/新闻小程序/pages/home/home.wxss +++ b/新闻小程序/pages/home/home.wxss @@ -30,19 +30,62 @@ swiper image { align-items: center; color: white } +/* 新闻板块导航栏 */ +.types { + width: 100%; + height: auto; + white-space: nowrap; + border-bottom: 1px solid; + border-bottom-color: black; + background-color: rgba(153, 151, 151, 0.151); +} +.type-item { + font-size: 18px; + width: rpx; + display: inline-block; + margin: 10rpx 20rpx; +} + + /* 新闻列表 */ +.news-list { + background-color: rgba(128, 128, 128, 0.137); +} .newsItem { - border: 1px solid black; - margin: 20rpx; - height: 150rpx; - background-color: white; + padding: 30rpx 30rpx 30rpx 30rpx; } + /* 新闻图片 */ +.news_image { + width: 250rpx; + height: 175rpx; +} + /* 新闻标题 */ .news_title { - font-size: larger; + font-size: 20px; + margin-left: 15rpx; } -.news_date { - font-size: small; + /* 发布单位 */ +.publish { + display: flex; + flex-direction: row; + font-size: 14px; color: grey; + margin-top: 10rpx; + border-bottom: 1px solid; + border-bottom-color: rgb(163, 147, 147); +} + /* 发布时间 */ +.create-time { + margin-left: 30rpx; + margin-bottom: 20rpx; +} + /* 标题图文框 */ +.pic-words { + display: flex; + flex-direction: row; +} + /* 标题 */ +.title-words { + width: 500rpx; } -