Commit 6bb006b0 by wangyalan-git

首页资讯

parent 93c50a4a
......@@ -22,6 +22,8 @@
"pages/footprint/footprint",
"pages/recent-news/recent-news",
"pages/news-detail/news-detail",
"pages/newsList/index",
"pages/newDetail/index",
"pages/invite/invite",
"pages/orderFlow/orderFlow",
"pages/distribution/index",
......
......@@ -37,7 +37,7 @@ Page({
url: "/balanceRecord/getBalanceRecordList",
method: "GET",
data: {
userId: app.globalData.userInfo.userId,
userId : app.globalData.userInfo.userId,
// userId: '3d79cbae35cd42ee8906839004335c18',
pageNum: this.data.pageNum,
pageSize: 10
......
......@@ -27,7 +27,13 @@ Page({
},
onLoad: function (options) {
this.getAllData();
},
toNews(e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/newDetail/index?id=' + id,
})
},
getVideoShow() {
var params = {
......@@ -70,7 +76,7 @@ Page({
console.log("绑定成功", res)
},
errCallBack: (res) => {
console.log("res",res)
console.log("res", res)
}
};
......@@ -132,18 +138,18 @@ Page({
onShow: function () {
let token = wx.getStorageSync('token')
let shareCode = wx.getStorageSync('shareCode')
console.log('页面参数路径', shareCode,token)
// 登录返回
shareCode && token && this.boundParentByShareCode(shareCode);
let shareCode = wx.getStorageSync('shareCode')
console.log('页面参数路径', shareCode, token)
// 登录返回
shareCode && token && this.boundParentByShareCode(shareCode);
// 如果是点击转发跳转进来,分析参数page
if (this.options.shareCode) {
app.globalData.shareCode = this.options.shareCode
wx.setStorageSync('shareCode', this.options.shareCode)
token && this.boundParentByShareCode(this.options.shareCode); // 绑定内容获取
}
console.log('邀请码',shareCode)
console.log('邀请码', shareCode)
// 扫码页面渲染完成
if (this.options.scene) {
let scene = decodeURIComponent(this.options.scene);
......@@ -153,7 +159,12 @@ Page({
}
},
goMore(e) {
let type = e.currentTarget.dataset.type
wx.navigateTo({
url: '/pages/newsList/index?type=' + type,
})
},
getAllData() {
let user = app.globalData.userInfo
if (user && user.id) {
......@@ -163,8 +174,52 @@ Page({
// this.getIndexImgs()
this.getNoticeList();
this.getTag();
this.getHeadNews()
this.getHotNews()
},
getHeadNews() {
var params = {
url: "/consult/getPageList",
method: "GET",
data: {
type: 1,
status: 0,
commentStatus: 0,
pageNum: 1,
pageSize: 3,
userId: app.globalData.userInfo.userId,
},
callBack: (res) => {
console.log('头条', res.result.list)
this.setData({
headNews: res.result.list,
});
}
};
http.request(params);
},
getHotNews() {
var params = {
url: "/consult/getPageList",
method: "GET",
data: {
type: 2,
status: 0,
commentStatus: 0,
pageNum: 1,
pageSize: 3,
userId: app.globalData.userInfo.userId,
},
callBack: (res) => {
console.log('头条', res.result.list)
this.setData({
hotNews: res.result.list,
});
}
};
http.request(params);
},
//加载轮播图
getIndexImgs() {
//加载轮播图
......
......@@ -21,60 +21,61 @@
<image src='/images/icon/playBtn.png' class='playbtn' bindtap="videoPlay" data-video="{{item.video}}">
</image>
</view>
<image src='{{item.imgUrl}}' data-prodid='{{item.relation}}' bindtap='toProdPage' class='banner' mode="aspectFill"></image>
<image src='{{item.imgUrl}}' data-prodid='{{item.relation}}' bindtap='toProdPage' class='banner'
mode="aspectFill"></image>
</view>
</swiper-item>
</block>
</swiper>
<view wx:else class="my-video">
<video class='box-w block' id="video" src="{{video}}" show-center-play-btn="{{false}}"
autoplay='false' object-fit="fill" bindpause="quiteVideo" bindended="quiteVideo"
controls="true" auto-pause-if-navigate="true"></video>
<video class='box-w block' id="video" src="{{video}}" show-center-play-btn="{{false}}" autoplay='false'
object-fit="fill" bindpause="quiteVideo" bindended="quiteVideo" controls="true"
auto-pause-if-navigate="true"></video>
</view>
<!-- end swiper -->
</view>
<!-- 商品 -->
<view wx:for="{{taglist}}" wx:key="id" style="margin-top: 20rpx;">
<!-- 首发新品 -->
<view class='more-prod' wx:if="{{item.style==0}}">
<view class='title'>
<view style="display:flex;align-items: center;">
<image src="/images/icon/products@2x.png" class="title-icon" mode="widthFix"></image>
<text>{{item.title}}</text>
</view>
<view class='cat-item'>
<view class='item' bindtap='toClassifyPage' data-sts="1">
<image src='../../images/icon/newProd.png'></image>
<text>新品推荐</text>
</view>
<view class='item' bindtap='toClassifyPage' data-sts="1">
<image src='../../images/icon/timePrice.png'></image>
<text>限时特惠</text>
</view>
<view class='item' bindtap='toClassifyPage' data-sts="3">
<image src='../../images/icon/neweveryday.png'></image>
<text>每日疯抢</text>
</view>
<view class='item' bindtap='toCategory'>
<image src='../../images/icon/newprods.png'></image>
<text>全部分类</text>
<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='message-play' bindtap='onNewsPage'>
<image src='../../images/icon/horn.png' class='hornpng'></image>
<swiper vertical='true' autoplay='true' duration='1000' class='swiper-cont'>
<block wx:for='{{news}}' wx:key='index'>
<swiper-item class="items">{{item.title}}</swiper-item>
</block>
</swiper>
<text class='arrow'></text>
</view> -->
</view>
<block wx:for="{{taglist}}" wx:key="id">
<!-- 每日上新 -->
<!-- 预热专区 -->
<view class='up-to-date' wx:if="{{item.style==2}}">
<view class='title'>
<text>{{item.title}}</text>
<view class='more-prod-cont' bindtap='toClassifyPage' data-sts="0" data-id="{{item.id}}"
data-title="{{item.title}}">
<text class='more'>查看更多</text>
<!-- <text class='arrow'></text> -->
<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 class='item-cont'>
<block wx:for="{{item.prods}}" wx:for-item="prod" wx:key="prodId">
......@@ -95,70 +96,75 @@
</view>
</view>
<!-- 商城热卖 -->
<view class='hot-sale' wx:if="{{item.style==1}}">
<view class='title'>
<text>{{item.title}}</text>
<view class='more-prod-cont' bindtap='toClassifyPage' data-sts="0" data-id="{{item.id}}"
data-title="{{item.title}}">
<text class='more'>更多</text>
<text class='arrow'></text>
</view>
</view>
<!-- 资讯 -->
<!-- 全供头条 -->
<view class='more-prod' style="margin-top: 20rpx;">
<view class='title' bindtap="goMore" data-type="1">
<view style="display: flex;align-items: center;">
<image src="/images/icon/Headlines@2x.png" class="title-icon" mode="widthFix"></image>
<text>{{'全供头条'}}</text>
</view>
<view class='hotsale-item-cont'>
<block wx:for="{{item.prods}}" wx:for-item="prod" wx:key="prodId">
<view class='prod-items' bindtap='toProdPage' data-prodid="{{prod.prodId}}">
<view class='hot-imagecont'>
<image src='{{prod.pic}}' class='hotsaleimg'></image>
</view>
<view class='hot-text'>
<view class='hotprod-text'>{{prod.prodName}}</view>
<view class='prod-info'>{{prod.brief}}</view>
<view class='prod-text-info'>
<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='singal-price'>
<text>¥</text>
<text>{{prod.oriPrice}}</text>
</view> -->
<image src='../../images/tabbar/basket-sel.png' class='basket-img'></image>
<view class="title-more" >
查看更多
</view>
</view>
<view class='prod-show'>
<block wx:for="{{headNews}}" wx:for-item="prod" wx:key="prodId">
<view class='show-item' bindtap='toNews' data-id="{{prod.id}}">
<view class='more-prod-pic'>
<image src='{{prod.pic}}' class='more-pic'></image>
</view>
<view class='prod-text-right'>
<view class='prod-text more'>{{prod.title}}</view>
<!-- <view class='prod-info'>{{prod.brief}}</view> -->
<view class='b-cart'>
<view class='time'>{{prod.createTime}}</view>
<view class="b-right">
<image src='../../images/icon/comment@2x.png' class='basket-img'></image>
<text style="margin-right: 20rpx;">{{prod.commentNumber}}</text>
<image src='../../images/icon/Fabulous@2x.png' class='basket-img'></image>
<text>{{prod.praiseNumber}}</text>
</view>
</view>
</view>
</block>
</view>
</block>
</view>
</view>
<!-- 热议专区 -->
<view class='more-prod' style="margin-top: 20rpx;">
<view class='title' bindtap="goMore" data-type="2">
<view style="display: flex;align-items: center;">
<image src="/images/icon/discussion@2x.png" class="title-icon" mode="widthFix"></image>
<text>{{'热议专区'}}</text>
</view>
<view class="title-more">
查看更多
</view>
</view>
<!-- 更多宝贝 -->
<view class='more-prod' wx:if="{{item.style==0}}">
<view class='title'>{{item.title}}</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='prod-text more'>{{prod.prodName}}</view>
<view class='prod-info'>{{prod.brief}}</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> -->
<image src='../../images/tabbar/basket-sel.png' class='basket-img'></image>
<view class='prod-show'>
<block wx:for="{{headNews}}" wx:for-item="prod" wx:key="prodId">
<view class='show-item' bindtap='toNews' data-id="{{prod.id}}">
<view class='more-prod-pic'>
<image src='{{prod.pic}}' class='more-pic'></image>
</view>
<view class='prod-text-right'>
<view class='prod-text more'>{{prod.title}}</view>
<!-- <view class='prod-info'>{{prod.brief}}</view> -->
<view class='b-cart'>
<view class='time'>{{prod.createTime}}</view>
<view class="b-right">
<image src='../../images/icon/comment@2x.png' class='basket-img'></image>
<text style="margin-right: 20rpx;">{{prod.commentNumber}}</text>
<image src='../../images/icon/Fabulous@2x.png' class='basket-img'></image>
<text>{{prod.praiseNumber}}</text>
</view>
</view>
</view>
</block>
</view>
</view>
</block>
</view>
</block>
</view>
</view>
<wxs module="wxs" src="../../wxs/number.wxs" />
\ No newline at end of file
/**index.wxss**/
.container{
padding-bottom: 20rpx;
}
page {
background: #f7f7f7;
background: #f4f4f4;
height: auto;
}
......@@ -17,17 +19,17 @@ swiper.pic-swiper {
margin-top: 75rpx;
padding: 10rpx 0;
background: #fff;
height: 422rpx;
height: 350rpx;
}
.my-video{
padding: 10rpx 0;
margin-top: 75rpx;
width: 100%;
height: 422rpx;
height: 350rpx;
}
.my-video .block{
width: 100%;
height: 422rpx;
height: 350rpx;
}
swiper-item {
font-size: 26rpx;
......@@ -74,7 +76,7 @@ swiper.pic-swiper .banner {
position: absolute;
width: 690rpx;
margin: 0 10rpx;
height: 402rpx;
height: 330rpx;
border-radius: 8rpx;
display: inline-block;
box-shadow: 0 4px 10px 0 rgba(83, 83, 83, 0.288);
......@@ -102,7 +104,7 @@ swiper.pic-swiper .banner {
width: 92%;
margin: auto;
left: 4%;
background: #f7f7f7;
background: #f4f4f4;
}
.bg-sear .section .placeholder {
......@@ -203,14 +205,22 @@ swiper.pic-swiper .banner {
height: 64rpx;
line-height: 64rpx;
font-size: 32rpx;
padding:40rpx 0 10rpx 30rpx;
color:#333;
padding: 10rpx 30rpx;
color: #333;
background: #fff;
display: flex;
align-items: center;
font-weight: bold;
justify-content: space-between;
color: black;
}
.up-to-date .title{
color: #fff;
background: none;
.title .title-icon{
width: 40rpx;
margin-right: 5rpx;
}
.title .title-more{
font-size: 24rpx;
color: #999;
}
.title .more-prod-cont {
......@@ -218,7 +228,10 @@ swiper.pic-swiper .banner {
display: inline-block;
text-align: right;
}
.up-to-date{
background: #fff;
padding-bottom: 20rpx;
}
.up-to-date .title .more-prod-cont .more {
position:absolute;
right:30rpx;
......@@ -251,13 +264,7 @@ line-height:44rpx;
border-right: 2rpx solid #666;
}
.up-to-date {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAABxCAYAAACkwXoWAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+IEmuOgAAAZBJREFUeJzt1DEBwCAAwLAxYfhEGXJABkcTBb065trnAwj6XwcAvGKAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGRdKykDj9OUNYkAAAAASUVORK5CYII=");
background-position: top;
background-size: 100% 332rpx;
background-repeat: no-repeat;
background-color: #fff;
}
.up-to-date .item-cont {
margin: auto;
......@@ -287,7 +294,7 @@ line-height:44rpx;
background: #fff;
display: inline-block;
margin-bottom:20rpx;
box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2);
/* box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2); */
margin-right: 15rpx;
}
......@@ -307,17 +314,17 @@ line-height:44rpx;
}
.up-to-date .item-cont .prod-item .prod-text {
font-size: 28rpx;
font-size: 26rpx;
overflow: hidden;
margin: 10rpx 0;
height: 75rpx;
display: -webkit-box;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
color: #000;
padding: 0 10rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.up-to-date .item-cont .prod-item .price {
margin-left: 0;
}
.up-to-date .item-cont .prod-item .prod-price {
......@@ -377,7 +384,6 @@ line-height:44rpx;
margin-top: 20rpx;
padding: 0 10rpx;
}
.prod-items .hot-text .prod-info, .more-prod .prod-text-right .prod-info {
font-size: 22rpx;
color: #999;
......@@ -385,7 +391,10 @@ line-height:44rpx;
overflow: hidden;
text-overflow: ellipsis;
}
.more-prod .prod-text-right .prod-after{
color: #333;
font-size: 22rpx;
}
.prod-items .hot-text .prod-text-info {
position: relative;
height: 70rpx;
......@@ -422,12 +431,13 @@ line-height:44rpx;
.more-prod {
background: #fff;
padding-bottom: 20rpx;
}
.more-prod .prod-show .show-item .more-prod-pic {
width: 250rpx;
height: 250rpx;
width: 170rpx;
height: 170rpx;
}
.more-prod .prod-show .show-item {
......@@ -435,39 +445,50 @@ line-height:44rpx;
display: flex;
padding: 20rpx;
justify-content: start;
border-top: 2rpx solid #f4f4f4;
/* border-top: 2rpx solid #f4f4f4; */
align-items: flex-start;
}
.show-item + .show-item{
border-top: 1rpx solid #f2f2f2;
}
.more-prod .prod-show .show-item .more-prod-pic .more-pic {
max-width: 100%;
max-height: 100%;
border-radius: 10rpx;
}
.more-prod .prod-show .show-item .prod-text-right {
margin-left: 30rpx;
width: 72%;
height: 170rpx;
padding-bottom: 10rpx;
display: flex;
flex-direction: column;
justify-content: center;
justify-content: space-between;
}
.more-prod .prod-show .show-item .prod-text-right .text-ellipsis{
font-size: 28rpx;
overflow: hidden;
color: #020202;
white-space: nowrap;
text-overflow: ellipsis;
}
.more-prod .prod-show .show-item .prod-text-right .go-to-buy {
font-size: 26rpx;
background: #fff2f5;
color: #eb2444;
background: #CE1A0C;
color: #fff;
width: 160rpx;
border-radius: 50rpx;
text-align: center;
padding: 12rpx 20rpx;
position: absolute;
right: 20rpx;
bottom: 20rpx;
padding: 12rpx 0rpx;
}
.more-prod .prod-show .show-item .prod-text-right .prod-text.more {
margin: 0;
font-size: 28rpx;
overflow: hidden;
color: #020202;
margin-bottom: 20rpx;
display: -webkit-box;
word-break: break-all;
......@@ -483,14 +504,29 @@ line-height:44rpx;
.b-cart {
margin-top: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.b-cart .price{
margin-left: 0;
}
.b-cart .time{
color: #999;
font-size: 24rpx;
}
.b-cart .basket-img {
width: 50rpx;
height: 50rpx;
position: absolute;
right: 46rpx;
width: 36rpx;
height: 36rpx;
/* position: absolute;
right: 46rpx; */
/* border: 2rpx solid #eb2444;
border-radius: 50%; */
padding: 8rpx;
/* padding: 8rpx; */
}
.b-cart .b-right{
font-size: 24rpx;
color:#333;
display: flex;
align-items: center;
}
\ No newline at end of file
// pages/news-detail/news-detail.js
var http = require("../../utils/http.js");
var config = require("../../utils/config.js");
Page({
/**
* 页面的初始数据
*/
data: {
news: {
title: '',
content: '',
id: null
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// var ths = this;
//加载公告详情
var params = {
// `/shop/notice/info/${options.id}`
url: '/shop/notice/info/' + options.id,
method: "GET",
// data: {
// id: id,
// },
// callBack: function(news){
callBack: res => {
res.content = res.content.replace(/width=/gi, 'sss=');
res.content = res.content.replace(/height=/gi, 'sss=');
res.content = res.content.replace(/ \/\>/gi, ' style="max-width:100% !important;display:block;" \/\>');
this.setData({
news: res
});
}
};
http.request(params);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"backgroundTextStyle": "light",
"navigationBarTitleText": "最新公告",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#fafafa"
}
\ No newline at end of file
<!--pages/news-detail/news-detail.wxml-->
<view class='container'>
<!-- <block wx:for='{{news}}' wx:key=''> -->
<view class='news-detail'>
<view class='news-detail-title'>{{news.title}}</view>
<!-- <view class='news-detail-text'>{{news.content}}</view> -->
<rich-text nodes="{{news.content}}"></rich-text>
</view>
<!-- </block> -->
</view>
/* pages/news-detail/news-detail.wxss */
.news-detail {
padding: 20rpx;
}
.news-detail .news-detail-title {
font-size: 32rpx;
font-weight: bold;
line-height: 50rpx;
padding: 20rpx;
}
.news-detail .news-detail-text {
font-size: 28rpx;
line-height: 46rpx;
text-align: justify;
text-justify: inter-ideograph;
margin-top: 20rpx;
}
var http = require("../../utils/http.js")
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
type: 1,
pageNum: 1,
list: [],
total: 0,
},
getList() {
var that = this
var params = {
url: "/consult/getPageList",
method: "GET",
data: {
type: that.data.type,
status: 0,
commentStatus: 0,
userId: app.globalData.userInfo.userId,
pageNum: this.data.pageNum,
pageSize: 10
},
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);
},
toNews(e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/newDetail/index?id=' + id,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// this.getList(0);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
type: this.options.type,
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,
total: 0
})
this.getList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (this.data.total > this.data.list.length) {
this.data.pageNum++
this.getList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "资讯"
}
\ No newline at end of file
<view class="page">
<!-- 列表展示 -->
<view class="list-box">
<!-- 列表展示 -->
<view class="prod-show" wx:for="{{list}}" wx:for-item="prod" wx:key="index">
<view class='show-item' bindtap='toNews' data-id="{{prod.id}}">
<view class='more-prod-pic'>
<image src='{{prod.pic}}' class='more-pic'></image>
</view>
<view class='prod-text-right'>
<view class='prod-text more'>{{prod.title}}</view>
<!-- <view class='prod-info'>{{prod.brief}}</view> -->
<view class='b-cart'>
<view class='time'>{{prod.createTime}}</view>
<view class="b-right">
<image src='../../images/icon/comment@2x.png' class='basket-img'></image>
<text style="margin-right: 20rpx;">{{prod.commentNumber}}</text>
<image src='../../images/icon/Fabulous@2x.png' class='basket-img'></image>
<text>{{prod.praiseNumber}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 暂无内容 -->
<view class="offList" wx:if="{{list.length == 0}}">—— 暂无资讯 ——</view>
</view>
</view>
\ No newline at end of file
page {
background: #f4f4f4;
}
.list-box {
/* margin-top: 90rpx; */
display: flex;
align-items: center;
flex-direction: column;
min-height: 80vh;
}
.prod-show{
width: 100%;
}
.prod-show .show-item .more-prod-pic {
width: 170rpx;
height: 170rpx;
}
.prod-show .show-item {
position: relative;
display: flex;
padding: 20rpx;
justify-content: start;
/* border-top: 2rpx solid #f4f4f4; */
align-items: flex-start;
background: #fff;
}
.show-item + .show-item{
border-top: 1rpx solid #f2f2f2;
}
.prod-show .show-item .more-prod-pic .more-pic {
max-width: 100%;
max-height: 100%;
border-radius: 10rpx;
}
.prod-show .show-item .prod-text-right {
margin-left: 30rpx;
width: 72%;
height: 170rpx;
padding-bottom: 10rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.prod-show .show-item .prod-text-right .text-ellipsis{
font-size: 28rpx;
overflow: hidden;
color: #020202;
white-space: nowrap;
text-overflow: ellipsis;
}
.prod-show .show-item .prod-text-right .go-to-buy {
font-size: 26rpx;
background: #CE1A0C;
color: #fff;
width: 160rpx;
border-radius: 50rpx;
text-align: center;
padding: 12rpx 0rpx;
}
.prod-show .show-item .prod-text-right .prod-text.more {
margin: 0;
font-size: 28rpx;
overflow: hidden;
color: #020202;
margin-bottom: 20rpx;
display: -webkit-box;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.prod-show .show-item .prod-text-right .more.prod-price {
font-size: 28rpx;
font-family: arial;
}
.b-cart {
margin-top: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.b-cart .price{
margin-left: 0;
}
.b-cart .time{
color: #999;
font-size: 24rpx;
}
.b-cart .basket-img {
width: 36rpx;
height: 36rpx;
/* position: absolute;
right: 46rpx; */
/* border: 2rpx solid #eb2444;
border-radius: 50%; */
/* padding: 8rpx; */
}
.b-cart .b-right{
font-size: 24rpx;
color:#333;
display: flex;
align-items: center;
}
\ No newline at end of file
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