Commit 4cf20802 by wangyalan-git

资讯管理/评论管理

parent 6bb006b0
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="749f7826-d70b-49cf-994d-3acd7b934330" name="Default Changelist" comment="" /> <list default="true" id="749f7826-d70b-49cf-994d-3acd7b934330" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/images/icon/poster1@2x.png" beforeDir="false" afterPath="$PROJECT_DIR$/images/icon/poster1@2x.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/index/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/pages/index/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/index/index.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/pages/index/index.wxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/index/index.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/pages/index/index.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/login/login.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/pages/login/login.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/newDetail/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/pages/newDetail/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/newDetail/index.json" beforeDir="false" afterPath="$PROJECT_DIR$/pages/newDetail/index.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/newDetail/index.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/pages/newDetail/index.wxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/newDetail/index.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/pages/newDetail/index.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/newsList/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/pages/newsList/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/newsList/index.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/pages/newsList/index.wxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pages/newsList/index.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/pages/newsList/index.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/project.config.json" beforeDir="false" afterPath="$PROJECT_DIR$/project.config.json" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" /> <ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" /> <ignored path="$PROJECT_DIR$/temp/" />
<ignored path="$PROJECT_DIR$/tmp/" /> <ignored path="$PROJECT_DIR$/tmp/" />
...@@ -15,7 +29,7 @@ ...@@ -15,7 +29,7 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-99" /> <option name="x" value="-100" />
<option name="y" value="5" /> <option name="y" value="5" />
<option name="width" value="1935" /> <option name="width" value="1935" />
<option name="height" value="1040" /> <option name="height" value="1040" />
...@@ -69,23 +83,19 @@ ...@@ -69,23 +83,19 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1603358883438</updated> <updated>1603358883438</updated>
<workItem from="1603358884856" duration="655000" /> <workItem from="1603358884856" duration="655000" />
<workItem from="1604054385788" duration="4000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="655000" /> <option name="totallyTimeSpent" value="659000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-7" y="-7" width="1550" height="838" extended-state="6" /> <frame x="-7" y="-7" width="1550" height="838" extended-state="6" />
<layout> <layout>
<window_info id="Favorites" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24966975" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24966975" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Docker" show_stripe_button="false" /> <window_info id="Favorites" order="2" side_tool="true" />
<window_info active="true" anchor="bottom" id="Version Control" visible="true" weight="0.6430595" />
<window_info anchor="bottom" id="Terminal" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Messages" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" /> <window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" /> <window_info anchor="bottom" id="Run" order="2" />
...@@ -93,6 +103,11 @@ ...@@ -93,6 +103,11 @@
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info active="true" anchor="bottom" id="Version Control" order="8" visible="true" weight="0.3937677" />
<window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="bottom" id="Messages" order="11" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
......
images/icon/poster1@2x.png

326 KB | W: | H:

images/icon/poster1@2x.png

190 KB | W: | H:

images/icon/poster1@2x.png
images/icon/poster1@2x.png
images/icon/poster1@2x.png
images/icon/poster1@2x.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -18,6 +18,8 @@ Page({ ...@@ -18,6 +18,8 @@ Page({
news: [], news: [],
taglist: [], taglist: [],
sts: 0, sts: 0,
preZone: [],
newGoods: []
}, },
//事件处理函数 //事件处理函数
bindViewTap: function () { bindViewTap: function () {
...@@ -26,7 +28,7 @@ Page({ ...@@ -26,7 +28,7 @@ Page({
}) })
}, },
onLoad: function (options) { onLoad: function (options) {
this.getAllData();
}, },
toNews(e) { toNews(e) {
...@@ -135,8 +137,8 @@ Page({ ...@@ -135,8 +137,8 @@ Page({
url: '/pages/recent-news/recent-news', url: '/pages/recent-news/recent-news',
}) })
}, },
onShow: function () { onShow: function () {
this.getAllData();
let token = wx.getStorageSync('token') let token = wx.getStorageSync('token')
let shareCode = wx.getStorageSync('shareCode') let shareCode = wx.getStorageSync('shareCode')
console.log('页面参数路径', shareCode, token) console.log('页面参数路径', shareCode, token)
...@@ -173,7 +175,9 @@ Page({ ...@@ -173,7 +175,9 @@ Page({
this.getVideoShow() this.getVideoShow()
// this.getIndexImgs() // this.getIndexImgs()
this.getNoticeList(); this.getNoticeList();
this.getTag(); // this.getTag();
this.getTagProd(1)
this.getTagProd(3)
this.getHeadNews() this.getHeadNews()
this.getHotNews() this.getHotNews()
...@@ -191,7 +195,6 @@ Page({ ...@@ -191,7 +195,6 @@ Page({
userId: app.globalData.userInfo.userId, userId: app.globalData.userInfo.userId,
}, },
callBack: (res) => { callBack: (res) => {
console.log('头条', res.result.list)
this.setData({ this.setData({
headNews: res.result.list, headNews: res.result.list,
}); });
...@@ -296,7 +299,7 @@ Page({ ...@@ -296,7 +299,7 @@ Page({
http.request(params); http.request(params);
}, },
getTagProd(id, index) { getTagProd(id) {
var param = { var param = {
url: "/prod/prodListByTagId", url: "/prod/prodListByTagId",
method: "GET", method: "GET",
...@@ -305,16 +308,38 @@ Page({ ...@@ -305,16 +308,38 @@ Page({
size: 6 size: 6
}, },
callBack: (res) => { callBack: (res) => {
var taglist = this.data.taglist; if(id == 3){
taglist[index].prods = res.records this.setData({
newGoods: res.records
this.setData({ })
taglist: taglist, }else{
}); this.setData({
preZone: res.records
})
}
} }
}; };
http.request(param); http.request(param);
}, },
// getTagProd(id, index) {
// var param = {
// url: "/prod/prodListByTagId",
// method: "GET",
// data: {
// tagId: id,
// size: 6
// },
// callBack: (res) => {
// var taglist = this.data.taglist;
// taglist[index].prods = res.records
// this.setData({
// taglist: taglist,
// });
// }
// };
// http.request(param);
// },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
......
...@@ -34,78 +34,46 @@ ...@@ -34,78 +34,46 @@
</view> </view>
<!-- end swiper --> <!-- end swiper -->
</view> </view>
<!-- 商品 --> <!-- 首发新品 -->
<view wx:for="{{taglist}}" wx:key="id" style="margin-top: 20rpx;"> <view class='more-prod'>
<!-- 首发新品 --> <view class='title'>
<view class='more-prod' wx:if="{{item.style==0}}"> <view style="display:flex;align-items: center;">
<view class='title'> <image src="/images/icon/products@2x.png" class="title-icon" mode="widthFix"></image>
<view style="display:flex;align-items: center;"> <text>{{'首发新品'}}</text>
<image src="/images/icon/products@2x.png" class="title-icon" mode="widthFix"></image>
<text>{{item.title}}</text>
</view>
</view> </view>
<view class='prod-show'>
<block wx:for="{{item.prods}}" wx:for-item="prod" wx:key="prodId">
<view class='show-item' bindtap='toProdPage' data-prodid="{{prod.prodId}}">
<view class='more-prod-pic'>
<image src='{{prod.pic}}' class='more-pic'></image>
</view>
<view class='prod-text-right'>
<view class='text-ellipsis'>{{prod.prodName}}</view>
<!-- <view class='prod-info'>{{prod.brief}}</view> -->
<view class='prod-after'>已售:{{667}}人 | 预售:{{222}}人</view>
<view class='b-cart'>
<view class='price'>
<text class='symbol'>¥</text>
<text class='big-num'>{{wxs.parsePrice(prod.price)[0]}}</text>
<text class='small-num'>.{{wxs.parsePrice(prod.price)[1]}}</text>
</view>
<view class='go-to-buy'>立即购买</view>
</view>
</view>
</view>
</block>
</view>
</view>
<!-- 预热专区 -->
<view class='up-to-date' wx:if="{{item.style==2}}">
<view class='title'>
<view style="display:flex;align-items: center;">
<image src="/images/icon/hot@2x.png" class="title-icon" mode="widthFix"></image>
<text>{{item.title}}</text>
</view>
</view> </view>
<view class='item-cont'> <view class='prod-show'>
<block wx:for="{{item.prods}}" wx:for-item="prod" wx:key="prodId"> <block wx:for="{{newGoods}}" wx:for-item="prod" wx:key="prodId">
<view class='prod-item' bindtap='toProdPage' data-prodid="{{prod.prodId}}"> <view class='show-item' bindtap='toProdPage' data-prodid="{{prod.prodId}}">
<view> <view class='more-prod-pic'>
<view class='imagecont'> <image src='{{prod.pic}}' class='more-pic'></image>
<image src='{{prod.pic}}' class='prodimg'></image> </view>
</view> <view class='prod-text-right'>
<view class='prod-text'>{{prod.prodName}}</view> <view class='text-ellipsis'>{{prod.prodName}}</view>
<view class='prod-info'>{{prod.brief}}</view>
<!-- <view class='prod-after'>已售:{{667}}人 | 预售:{{222}}人</view> -->
<view class='b-cart'>
<view class='price'> <view class='price'>
<text class='symbol'>¥</text> <text class='symbol'>¥</text>
<text class='big-num'>{{wxs.parsePrice(prod.price)[0]}}</text> <text class='big-num'>{{wxs.parsePrice(prod.price)[0]}}</text>
<text class='small-num'>.{{wxs.parsePrice(prod.price)[1]}}</text> <text class='small-num'>.{{wxs.parsePrice(prod.price)[1]}}</text>
</view> </view>
<view class='go-to-buy'>立即购买</view>
</view> </view>
</view> </view>
</block> </view>
</block>
</view>
</view> </view>
</view> </view>
<!-- 资讯 -->
<!-- 全供头条 --> <!-- 全供头条 -->
<view class='more-prod' style="margin-top: 20rpx;"> <view class='more-prod' wx:if="{{headNews && headNews.length}}">
<view class='title' bindtap="goMore" data-type="1"> <view class='title' bindtap="goMore" data-type="1">
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<image src="/images/icon/Headlines@2x.png" class="title-icon" mode="widthFix"></image> <image src="/images/icon/Headlines@2x.png" class="title-icon" mode="widthFix"></image>
<text>{{'全供头条'}}</text> <text>{{'全供头条'}}</text>
</view> </view>
<view class="title-more" > <view class="title-more">
查看更多 查看更多
</view> </view>
</view> </view>
...@@ -123,7 +91,8 @@ ...@@ -123,7 +91,8 @@
<view class="b-right"> <view class="b-right">
<image src='../../images/icon/comment@2x.png' class='basket-img'></image> <image src='../../images/icon/comment@2x.png' class='basket-img'></image>
<text style="margin-right: 20rpx;">{{prod.commentNumber}}</text> <text style="margin-right: 20rpx;">{{prod.commentNumber}}</text>
<image src='../../images/icon/Fabulous@2x.png' class='basket-img'></image> <image src="../../images/icon/{{prod.praise? 'Fabul@2x.png':'Fabulous@2x.png'}}" class='basket-img'>
</image>
<text>{{prod.praiseNumber}}</text> <text>{{prod.praiseNumber}}</text>
</view> </view>
</view> </view>
...@@ -132,8 +101,36 @@ ...@@ -132,8 +101,36 @@
</block> </block>
</view> </view>
</view> </view>
<!-- 预热专区 -->
<view class='up-to-date' style="margin-top: 20rpx;" >
<view class='title'>
<view style="display:flex;align-items: center;">
<image src="/images/icon/hot@2x.png" class="title-icon" mode="widthFix"></image>
<text>{{'预热专区'}}</text>
</view>
</view>
<view class='item-cont'>
<block wx:for="{{preZone}}" wx:for-item="prod" wx:key="prodId">
<view class='prod-item' bindtap='toProdPage' data-prodid="{{prod.prodId}}">
<view>
<view class='imagecont'>
<image src='{{prod.pic}}' class='prodimg'></image>
</view>
<view class='prod-text'>{{prod.prodName}}</view>
<view class='price'>
<text class='symbol'>¥</text>
<text class='big-num'>{{wxs.parsePrice(prod.price)[0]}}</text>
<text class='small-num'>.{{wxs.parsePrice(prod.price)[1]}}</text>
</view>
</view>
</view>
</block>
</view>
</view>
<!-- 热议专区 --> <!-- 热议专区 -->
<view class='more-prod' style="margin-top: 20rpx;"> <view class='more-prod' wx:if="{{hotNews && hotNews.length}}">
<view class='title' bindtap="goMore" data-type="2"> <view class='title' bindtap="goMore" data-type="2">
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<image src="/images/icon/discussion@2x.png" class="title-icon" mode="widthFix"></image> <image src="/images/icon/discussion@2x.png" class="title-icon" mode="widthFix"></image>
...@@ -144,7 +141,7 @@ ...@@ -144,7 +141,7 @@
</view> </view>
</view> </view>
<view class='prod-show'> <view class='prod-show'>
<block wx:for="{{headNews}}" wx:for-item="prod" wx:key="prodId"> <block wx:for="{{hotNews}}" wx:for-item="prod" wx:key="prodId">
<view class='show-item' bindtap='toNews' data-id="{{prod.id}}"> <view class='show-item' bindtap='toNews' data-id="{{prod.id}}">
<view class='more-prod-pic'> <view class='more-prod-pic'>
<image src='{{prod.pic}}' class='more-pic'></image> <image src='{{prod.pic}}' class='more-pic'></image>
...@@ -157,7 +154,8 @@ ...@@ -157,7 +154,8 @@
<view class="b-right"> <view class="b-right">
<image src='../../images/icon/comment@2x.png' class='basket-img'></image> <image src='../../images/icon/comment@2x.png' class='basket-img'></image>
<text style="margin-right: 20rpx;">{{prod.commentNumber}}</text> <text style="margin-right: 20rpx;">{{prod.commentNumber}}</text>
<image src='../../images/icon/Fabulous@2x.png' class='basket-img'></image> <image src="../../images/icon/{{prod.praise? 'Fabul@2x.png':'Fabulous@2x.png'}}" class='basket-img'>
</image>
<text>{{prod.praiseNumber}}</text> <text>{{prod.praiseNumber}}</text>
</view> </view>
</view> </view>
......
...@@ -202,10 +202,8 @@ swiper.pic-swiper .banner { ...@@ -202,10 +202,8 @@ swiper.pic-swiper .banner {
.title { .title {
position: relative; position: relative;
height: 64rpx;
line-height: 64rpx;
font-size: 32rpx; font-size: 32rpx;
padding: 10rpx 30rpx; padding: 20rpx 30rpx 0;
color: #333; color: #333;
background: #fff; background: #fff;
display: flex; display: flex;
...@@ -216,6 +214,7 @@ swiper.pic-swiper .banner { ...@@ -216,6 +214,7 @@ swiper.pic-swiper .banner {
} }
.title .title-icon{ .title .title-icon{
width: 40rpx; width: 40rpx;
height: 40rpx;
margin-right: 5rpx; margin-right: 5rpx;
} }
.title .title-more{ .title .title-more{
...@@ -270,7 +269,7 @@ line-height:44rpx; ...@@ -270,7 +269,7 @@ line-height:44rpx;
margin: auto; margin: auto;
height: auto; height: auto;
width: calc(100% - 40rpx); width: calc(100% - 40rpx);
padding:0 20rpx; padding:20rpx 20rpx 0;
display: flex; display: flex;
flex-wrap:wrap; flex-wrap:wrap;
/* justify-content: space-between; */ /* justify-content: space-between; */
...@@ -432,6 +431,7 @@ line-height:44rpx; ...@@ -432,6 +431,7 @@ line-height:44rpx;
.more-prod { .more-prod {
background: #fff; background: #fff;
padding-bottom: 20rpx; padding-bottom: 20rpx;
margin-top: 20rpx;
} }
......
...@@ -38,11 +38,12 @@ button { ...@@ -38,11 +38,12 @@ button {
} }
.login-btn{ .login-btn {
background-color: #fff; color: #fff;
color: #eb2444; background-color: #eb2444;
} }
.no-login{
.no-login {
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
text-align: center; text-align: center;
......
// pages/news-detail/news-detail.js // pages/news-detail/news-detail.js
var http = require("../../utils/http.js"); var http = require("../../utils/http.js");
var config = require("../../utils/config.js"); var config = require("../../utils/config.js");
var app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
id: '',
news: { news: {
title: '', title: '',
content: '', content: '',
id: null id: null,
} },
pageNum: 1,
list: [],
total: 0,
flag: false,
content: ''
}, },
getDetail() {
var that = this
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// var ths = this;
//加载公告详情
var params = { var params = {
// `/shop/notice/info/${options.id}` url: '/consult/getOneById',
url: '/shop/notice/info/' + options.id,
method: "GET", method: "GET",
// data: { data: {
// id: id, consultId: that.data.id,
// }, userId: app.globalData.userInfo.userId
// callBack: function(news){ },
callBack: res => { callBack: res => {
res.content = res.content.replace(/width=/gi, 'sss='); let consult = res.result.consult
res.content = res.content.replace(/height=/gi, 'sss='); consult.content = consult.content.replace(/width=/gi, 'sss=');
res.content = res.content.replace(/ \/\>/gi, ' style="max-width:100% !important;display:block;" \/\>'); consult.content = consult.content.replace(/height=/gi, 'sss=');
this.setData({ consult.content = consult.content.replace(/ \/\>/gi, ' style="max-width:100% !important;display:block;" \/\>');
news: res that.setData({
news: consult,
flag: res.result.flag
}); });
} }
}; };
http.request(params); http.request(params);
}, },
getList() {
var that = this
var params = {
url: '/consultComment/getListPage',
method: "GET",
data: {
consultId: this.data.id,
pageNum: this.data.pageNum,
pageSize: 5,
status: 0
},
callBack: res => {
let list = res.result.list
if (that.data.pageNum > 1) {
list = that.data.list.concat(list)
}
that.setData({
list: list,
total: res.result.total
})
console.log('list', that.data.list)
}
};
http.request(params);
},
toLike() {
var that = this, user = app.globalData.userInfo
if (user && user.userId) {
var params = {
url: '/p/consultPraise/praisr',
method: "POST",
data: {
consultId: that.data.id,
userId: app.globalData.userInfo.userId
},
callBack: res => {
wx.showToast({
title: '点赞成功',
})
that.getDetail()
}
};
http.request(params);
} else {
wx.navigateTo({
url: '/pages/login/login',
})
}
},
cancleLike() {
var that = this, user = app.globalData.userInfo
if (user && user.userId) {
var params = {
url: '/p/consultPraise/canclePraisr',
method: "POST",
data: {
consultId: that.data.id,
userId: app.globalData.userInfo.userId
},
callBack: res => {
wx.showToast({
title: '取消点赞',
})
that.getDetail()
}
};
http.request(params);
} else {
wx.navigateTo({
url: '/pages/login/login',
})
}
},
toComment() {
var that = this, user = app.globalData.userInfo
if (user && user.userId) {
var params = {
url: '/consultComment/insertCommentConsult',
method: "POST",
data: {
consultId: that.data.id,
status: 0,
content: that.data.content,
userId: app.globalData.userInfo.userId
},
callBack: res => {
wx.showToast({
title: '评论成功',
})
that.setData({
content: '',
pageNum: 1,
total: 0,
list: []
}, function () {
that.getList()
})
}
};
http.request(params);
} else {
wx.navigateTo({
url: '/pages/login/login',
})
}
},
inputContent(e) {
this.setData({
content: e.detail.value
})
},
focusConent(e){
let user = app.globalData.userInfo
if (!user || !user.userId) {
wx.navigateTo({
url: '/pages/login/login',
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
id: options.id
})
this.getDetail()
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
...@@ -54,7 +186,13 @@ Page({ ...@@ -54,7 +186,13 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.setData({
list: [],
pageNum: 1,
total: 0
}, function () {
this.getList()
})
}, },
/** /**
...@@ -82,7 +220,10 @@ Page({ ...@@ -82,7 +220,10 @@ Page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
if (this.data.total > this.data.list.length) {
this.data.pageNum++
this.getList()
}
}, },
/** /**
......
{ {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
"navigationBarTitleText": "最新公告", "navigationBarTitleText": "资讯详情",
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#fafafa" "navigationBarBackgroundColor": "#fafafa"
} }
\ No newline at end of file
<!--pages/news-detail/news-detail.wxml--> <!--pages/news-detail/news-detail.wxml-->
<view class='container'> <view class='container'>
<!-- <block wx:for='{{news}}' wx:key=''> --> <!-- <block wx:for='{{news}}' wx:key=''> -->
<view class='news-detail'> <view class='news-detail'>
<view class='news-detail-title'>{{news.title}}</view> <view class='news-detail-title'>{{news.title}}</view>
<view class="time">{{news.createTime}}</view>
<!-- <view class='news-detail-text'>{{news.content}}</view> --> <!-- <view class='news-detail-text'>{{news.content}}</view> -->
<image wx:if="{{news.pic}}" class="img" src="{{news.pic}}" mode="widthFix"></image>
<rich-text nodes="{{news.content}}"></rich-text> <rich-text nodes="{{news.content}}"></rich-text>
</view> </view>
<!-- </block> --> <!-- </block> -->
<!-- 评论 -->
<block wx:if="{{list.length}}">
<view class="comment-title">全部评论</view>
<view class="comments" wx:for="{{list}}" wx:key="index">
<image src="{{item.pic}}" mode="widthFix"></image>
<view class="info-right">
<view>{{item.nickName}}</view>
<view>{{item.createTime}}</view>
<view>{{item.content}}</view>
</view>
</view>
</block>
</view> </view>
<view class="bottom">
<input class="input" placeholder='请发表你的评论' maxlength='100' value="{{content}}"
bindinput="inputContent" bindconfirm="toComment" bindfocus="focusConent"></input>
<image class="like-img" wx:if="{{!flag}}" src="/images/icon/Fabulous@2x.png" bindtap="toLike" mode="widthFix"></image>
<image class="like-img" wx:else src="/images/icon/Fabul@2x.png" mode="widthFix" bindtap="cancleLike"></image>
</view>
\ No newline at end of file
/* pages/news-detail/news-detail.wxss */ /* pages/news-detail/news-detail.wxss */
.container {
padding-bottom: 120rpx;
}
.news-detail { .news-detail {
padding: 20rpx; padding: 20rpx;
...@@ -8,7 +11,11 @@ ...@@ -8,7 +11,11 @@
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
line-height: 50rpx; line-height: 50rpx;
padding: 20rpx; padding: 20rpx 20rpx 0;
}
.img {
width: 100%;
} }
.news-detail .news-detail-text { .news-detail .news-detail-text {
...@@ -18,3 +25,71 @@ ...@@ -18,3 +25,71 @@
text-justify: inter-ideograph; text-justify: inter-ideograph;
margin-top: 20rpx; margin-top: 20rpx;
} }
.comment-title {
text-align: center;
font-size: 30rpx;
color: #020202;
}
.comments {
width: 100%;
display: flex;
align-items: flex-start;
padding: 20rpx 30rpx;
}
.info-right {
color: #999;
font-size: 24rpx;
}
.comments image {
width: 50rpx;
margin-right: 20rpx;
}
.info-right view:first-child {
color: #333;
font-size: 30rpx;
}
.info-right view:last-child {
font-size: 26rpx;
color: #333;
}
.time {
color: #999;
font-size: 24rpx;
padding: 10rpx 20rpx;
}
.bottom {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 98rpx;
display: flex;
align-items: center;
border-top: 1rpx solid #f2f2f2;
background: #fff;
padding: 0 30rpx;
}
.bottom .input {
font-size: 26rpx;
border: 1rpx solid #ccc;
border-radius: 40rpx;
padding-left: 20rpx;
flex: 1;
height: 60rpx;
line-height: 60rpx;
}
.bottom .like-img {
width: 50rpx;
height: 50rpx;
margin-left: 20rpx;
}
\ No newline at end of file
...@@ -68,17 +68,7 @@ Page({ ...@@ -68,17 +68,7 @@ Page({
onShow: function () { onShow: function () {
this.setData({ this.setData({
type: this.options.type, type: this.options.type,
list: [ list: [],
{
"brief": "",
"createTime": "2020-09-09",
"id": 0,
"pic": "https://zhqg.jsonpro.cn/zhqgImages/product/20201022/c8c82ad4e9824d6996d183450e0ee0cf.jpg",
"price": 0,
"prodId": 0,
"title": "标题表题",
"userId": ""
}],
pageNum: 1, pageNum: 1,
total: 0 total: 0
}) })
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<view class="b-right"> <view class="b-right">
<image src='../../images/icon/comment@2x.png' class='basket-img'></image> <image src='../../images/icon/comment@2x.png' class='basket-img'></image>
<text style="margin-right: 20rpx;">{{prod.commentNumber}}</text> <text style="margin-right: 20rpx;">{{prod.commentNumber}}</text>
<image src='../../images/icon/Fabulous@2x.png' class='basket-img'></image> <image src="../../images/icon/{{prod.praise? 'Fabul@2x.png':'Fabulous@2x.png'}}" class='basket-img'></image>
<text>{{prod.praiseNumber}}</text> <text>{{prod.praiseNumber}}</text>
</view> </view>
</view> </view>
......
...@@ -107,4 +107,9 @@ page { ...@@ -107,4 +107,9 @@ page {
color:#333; color:#333;
display: flex; display: flex;
align-items: center; align-items: center;
}
.offList{
color: #999;
font-size: 26rpx;
padding-top: 30rpx;
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"ignore": [] "ignore": []
}, },
"setting": { "setting": {
"urlCheck": true, "urlCheck": false,
"es6": true, "es6": true,
"enhance": false, "enhance": false,
"postcss": true, "postcss": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment