上传文件至 '新闻小程序/pages/news-detail'
This commit is contained in:
parent
195db89cf2
commit
22be3e05ab
|
@ -1,28 +1,34 @@
|
||||||
// pages/news-detail/news-detail.js
|
// pages/news-detail/news-detail.js
|
||||||
let newsType = ''
|
let newsType = ''
|
||||||
let newsid = '' //4.27
|
let newsid = ''
|
||||||
let collect = false //4.27
|
let collect = false
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
// console.log('从主页传递来的id:', options.id)
|
console.log('从主页传递来的id:', options.id)
|
||||||
// console.log('从主页传递来的currentIndex:', options.currentIndex)
|
console.log('从主页传递来的currentIndex:', options.currentIndex)
|
||||||
newsid = options.id //4.27
|
newsid = options.id
|
||||||
newsType = options.currentIndex
|
// newsType = options.currentIndex
|
||||||
let currentIndex = options.currentIndex
|
let currentIndex = options.currentIndex
|
||||||
if (currentIndex == 0) {
|
if (currentIndex == 0) {
|
||||||
newsType = 'nd-news'
|
newsType = 'lqxy'
|
||||||
} else if (currentIndex == 1) {
|
} else if (currentIndex == 1) {
|
||||||
newsType = 'xg-news'
|
newsType = 'qcxy'
|
||||||
} else if (currentIndex == 2) {
|
} else if (currentIndex == 2) {
|
||||||
newsType = 'tw-news'
|
newsType = 'hyxy'
|
||||||
} else if (currentIndex == 3) {
|
} else if (currentIndex == 3) {
|
||||||
newsType = 'gj-news'
|
newsType = 'hkxy'
|
||||||
} else if (currentIndex == 4) {
|
} else if (currentIndex == 4) {
|
||||||
newsType = 'junshi-news'
|
newsType = 'gdxy'
|
||||||
} else if (currentIndex == 5) {
|
} 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'
|
newsType = 'lunbotu-news'
|
||||||
}
|
}
|
||||||
// 查询新闻详情数据,按不同板块
|
// 查询新闻详情数据,按不同板块
|
||||||
|
@ -30,15 +36,15 @@ Page({
|
||||||
.get()
|
.get()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('新闻详情页请求成功', res)
|
console.log('新闻详情页请求成功', res)
|
||||||
collect = res.data.collect //4.27
|
collect = res.data.collect
|
||||||
this.setData({
|
this.setData({
|
||||||
detail: res.data,
|
detail: res.data,
|
||||||
news_image: res.data.news_img,
|
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() {
|
collect() {
|
||||||
this.setData({
|
this.setData({
|
||||||
collect_img: collect ? "../../images/collect-no.png" : "../../images/collect-yes.png"
|
collect_img: collect ? "../../images/collect-no.png" : "../../images/collect-yes.png"
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
<view class="detail_start">
|
<view class="detail_start">
|
||||||
<view class="news_title">{{detail.news_title}}</view>
|
<view class="news_title">{{detail.news_title}}</view>
|
||||||
<view class="publisher-info">
|
<view class="publisher-info">
|
||||||
<view class="news_author">{{detail.news_author}}</view>
|
<view wx:if="{{detail.news_date != 'None'}}">
|
||||||
<view class="news_date">发布于{{detail.news_date}}</view>
|
<view class="news_date">发布于{{detail.news_date}}</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="news_author">{{detail.news_author}}</view>
|
||||||
|
<view class="news_date">发布于{{detail.news_date}}</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -16,7 +19,7 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 收藏按钮 4.27-->
|
<!-- 收藏按钮 -->
|
||||||
<button class="collect" bindtap="collect">
|
<button class="collect" bindtap="collect">
|
||||||
点击收藏<image class="collect_img" src="{{collect_img}}"></image>
|
点击收藏<image class="collect_img" src="{{collect_img}}"></image>
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in New Issue