From 22be3e05ab0f9f53078bfb733d58beab0096754a Mon Sep 17 00:00:00 2001
From: link_1999 <1402246900@qq.com>
Date: Sun, 29 May 2022 14:33:55 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?=
=?UTF-8?q?=20'=E6=96=B0=E9=97=BB=E5=B0=8F=E7=A8=8B=E5=BA=8F/pages/news-de?=
=?UTF-8?q?tail'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
新闻小程序/pages/news-detail/news-detail.js | 34 +++++++++++--------
新闻小程序/pages/news-detail/news-detail.wxml | 9 +++--
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/新闻小程序/pages/news-detail/news-detail.js b/新闻小程序/pages/news-detail/news-detail.js
index fb55b22..f474817 100644
--- a/新闻小程序/pages/news-detail/news-detail.js
+++ b/新闻小程序/pages/news-detail/news-detail.js
@@ -1,28 +1,34 @@
// pages/news-detail/news-detail.js
let newsType = ''
-let newsid = '' //4.27
-let collect = false //4.27
+let newsid = ''
+let collect = false
Page({
data: {
},
onLoad: function (options) {
- // console.log('从主页传递来的id:', options.id)
- // console.log('从主页传递来的currentIndex:', options.currentIndex)
- newsid = options.id //4.27
- newsType = options.currentIndex
+ console.log('从主页传递来的id:', options.id)
+ console.log('从主页传递来的currentIndex:', options.currentIndex)
+ newsid = options.id
+ // newsType = options.currentIndex
let currentIndex = options.currentIndex
if (currentIndex == 0) {
- newsType = 'nd-news'
+ newsType = 'lqxy'
} else if (currentIndex == 1) {
- newsType = 'xg-news'
+ newsType = 'qcxy'
} else if (currentIndex == 2) {
- newsType = 'tw-news'
+ newsType = 'hyxy'
} else if (currentIndex == 3) {
- newsType = 'gj-news'
+ newsType = 'hkxy'
} else if (currentIndex == 4) {
- newsType = 'junshi-news'
+ newsType = 'gdxy'
} else if (currentIndex == 5) {
+ newsType = 'zhxy'
+ } else if (currentIndex == 6) {
+ newsType = 'ysxy'
+ } else if (currentIndex == 7) {
+ newsType = 'rwxy'
+ } else if (currentIndex == 9) {
newsType = 'lunbotu-news'
}
// 查询新闻详情数据,按不同板块
@@ -30,15 +36,15 @@ Page({
.get()
.then(res => {
console.log('新闻详情页请求成功', res)
- collect = res.data.collect //4.27
+ collect = res.data.collect
this.setData({
detail: res.data,
news_image: res.data.news_img,
- collect_img: collect ? "../../images/collect-yes.png" : "../../images/collect-no.png" //4.27
+ collect_img: collect ? "../../images/collect-yes.png" : "../../images/collect-no.png"
})
})
},
- // 收藏按钮 4.27
+ // 收藏按钮
collect() {
this.setData({
collect_img: collect ? "../../images/collect-no.png" : "../../images/collect-yes.png"
diff --git a/新闻小程序/pages/news-detail/news-detail.wxml b/新闻小程序/pages/news-detail/news-detail.wxml
index 465b106..ad0a09e 100644
--- a/新闻小程序/pages/news-detail/news-detail.wxml
+++ b/新闻小程序/pages/news-detail/news-detail.wxml
@@ -2,8 +2,11 @@
{{detail.news_title}}
- {{detail.news_author}}
- 发布于{{detail.news_date}}
+
+ 发布于{{detail.news_date}}
+
+
@@ -16,7 +19,7 @@
-
+