Commit 854bacf6 authored by Menethil's avatar Menethil
Browse files

添加Renard小程序

parent a50998e6
var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
var app = getApp();
Page({
data: {
checkedGoodsList: [],
checkedAddress: {},
checkedCoupon: [],
goodsTotalPrice: 0.00, //商品总价
freightPrice: 0.00, //快递费
couponPrice: 0.00, //优惠券的价格
grouponPrice: 0.00, //团购优惠价格
orderTotalPrice: 0.00, //订单总价
actualPrice: 0.00, //实际需要支付的总价
cartId: 0,
addressId: 0,
couponId: 0,
grouponLinkId: 0, //参与的团购,如果是发起则为0
grouponRulesId: 0 //团购规则ID
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
//获取checkou信息
getCheckoutInfo: function() {
let that = this;
util.request(api.CartCheckout, {
cartId: that.data.cartId,
addressId: that.data.addressId,
couponId: that.data.couponId,
grouponRulesId: that.data.grouponRulesId
}).then(function(res) {
if (res.errno === 0) {
that.setData({
checkedGoodsList: res.data.checkedGoodsList,
checkedAddress: res.data.checkedAddress,
actualPrice: res.data.actualPrice,
checkedCoupon: res.data.checkedCoupon,
couponPrice: res.data.couponPrice,
grouponPrice: res.data.grouponPrice,
freightPrice: res.data.freightPrice,
goodsTotalPrice: res.data.goodsTotalPrice,
orderTotalPrice: res.data.orderTotalPrice,
addressId: res.data.addressId,
couponId: res.data.couponId,
grouponRulesId: res.data.grouponRulesId,
});
}
wx.hideLoading();
});
},
selectAddress() {
wx.navigateTo({
url: '/pages/ucenter/address/address',
})
},
addAddress() {
wx.navigateTo({
url: '/pages/ucenter/addressAdd/addressAdd',
})
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
wx.showLoading({
title: '加载中...',
});
try {
var cartId = wx.getStorageSync('cartId');
if (cartId) {
this.setData({
'cartId': cartId
});
}
var addressId = wx.getStorageSync('addressId');
if (addressId) {
this.setData({
'addressId': addressId
});
}
var couponId = wx.getStorageSync('couponId');
if (couponId) {
this.setData({
'couponId': couponId
});
}
var grouponRulesId = wx.getStorageSync('grouponRulesId');
if (grouponRulesId) {
this.setData({
'grouponRulesId': grouponRulesId
});
}
var grouponLinkId = wx.getStorageSync('grouponLinkId');
if (grouponLinkId) {
this.setData({
'grouponLinkId': grouponLinkId
});
}
} catch (e) {
// Do something when catch error
console.log(e);
}
this.getCheckoutInfo();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
submitOrder: function() {
if (this.data.addressId <= 0) {
util.showErrorToast('请选择收货地址');
return false;
}
util.request(api.OrderSubmit, {
cartId: this.data.cartId,
addressId: this.data.addressId,
couponId: this.data.couponId,
grouponRulesId: this.data.grouponRulesId,
grouponLinkId: this.data.grouponLinkId
}, 'POST').then(res => {
if (res.errno === 0) {
const orderId = res.data.orderId;
util.request(api.OrderPrepay, {
orderId: orderId
}, 'POST').then(function(res) {
if (res.errno === 0) {
const payParam = res.data;
console.log("支付过程开始");
wx.requestPayment({
'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr,
'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function(res) {
console.log("支付过程成功");
wx.redirectTo({
url: '/pages/payResult/payResult?status=1&orderId=' + orderId
});
},
'fail': function(res) {
console.log("支付过程失败");
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
},
'complete': function(res) {
console.log("支付过程结束")
}
});
} else {
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
});
} else {
util.showErrorToast(res.errmsg);
}
});
}
});
\ No newline at end of file
{
"navigationBarTitleText": "填写订单"
}
\ No newline at end of file
<view class="container">
<view class="address-box">
<view class="address-item" bindtap="selectAddress" wx:if="{{checkedAddress.id > 0}}">
<view class="l">
<text class="name">{{checkedAddress.name}}</text>
<text class="default" wx:if="{{checkedAddress.isDefault}}">默认</text>
</view>
<view class="m">
<text class="mobile">{{checkedAddress.mobile}}</text>
<text class="address">{{checkedAddress.address}}</text>
</view>
<view class="r">
<image src="/static/images/address_right.png"></image>
</view>
</view>
<view class="address-item address-empty" bindtap="addAddress" wx:else>
<view class="m">
还没有收货地址,去添加
</view>
<view class="r">
<image src="/static/images/address_right.png"></image>
</view>
</view>
</view>
<view class="order-box">
<view class="order-item">
<view class="l">
<text class="name">商品合计</text>
</view>
<view class="r">
<text class="txt">¥ {{goodsTotalPrice}}元</text>
</view>
</view>
<view class="order-item">
<view class="l">
<text class="name">运费</text>
</view>
<view class="r">
<text class="txt">¥ {{freightPrice}}元</text>
</view>
</view>
</view>
<view class="goods-items">
<view class="item" wx:for="{{checkedGoodsList}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="m">{{item.specifications}}</view>
<view class="b">¥{{item.price}}</view>
</view>
</view>
</view>
<view class="order-total">
<view class="l">实付:¥{{actualPrice}}</view>
<view class="r" bindtap="submitOrder">去付款</view>
</view>
</view>
\ No newline at end of file
page{
height: 100%;
background: #f4f4f4;
}
.address-box{
width: 100%;
height: 166.55rpx;
background: url('http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/address-bg-bd30f2bfeb.png') 0 0 repeat-x;
background-size: 62.5rpx 10.5rpx;
margin-bottom: 20rpx;
padding-top: 10.5rpx;
}
.address-item{
display: flex;
height: 155.55rpx;
background: #fff;
padding: 41.6rpx 0 41.6rpx 31.25rpx;
}
.address-item.address-empty{
line-height: 75rpx;
text-align: center;
}
.address-box .l{
width: 125rpx;
height: 100%;
}
.address-box .l .name{
margin-left: 6.25rpx;
margin-top: -7.25rpx;
display: block;
width: 125rpx;
height: 43rpx;
line-height: 43rpx;
font-size: 30rpx;
color: #333;
margin-bottom: 5rpx;
}
.address-box .l .default{
margin-left: 6.25rpx;
display: block;
width: 62rpx;
height: 33rpx;
border-radius: 5rpx;
border: 1px solid #b4282d;
font-size: 20.5rpx;
text-align: center;
line-height: 29rpx;
color: #b4282d;
}
.address-box .m{
flex: 1;
height: 72.25rpx;
color: #999;
}
.address-box .mobile{
display: block;
height: 29rpx;
line-height: 29rpx;
margin-bottom: 6.25rpx;
font-size: 30rpx;
color:#333;
}
.address-box .address{
display: block;
height: 37.5rpx;
line-height: 37.5rpx;
font-size: 25rpx;
color:#666;
}
.address-box .r{
width: 77rpx;
height: 77rpx;
display: flex;
justify-content: center;
align-items: center;
}
.address-box .r image{
width: 52.078rpx;
height: 52.078rpx;
}
.coupon-box{
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
}
.coupon-box .coupon-item{
width: 100%;
height: 108.3rpx;
overflow: hidden;
background: #fff;
display: flex;
padding-left: 31.25rpx;
}
.coupon-box .l{
flex: 1;
height: 43rpx;
line-height: 43rpx;
padding-top: 35rpx;
}
.coupon-box .l .name{
float: left;
font-size: 30rpx;
color: #666;
}
.coupon-box .l .txt{
float: right;
font-size: 30rpx;
color: #666;
}
.coupon-box .r{
margin-top: 15.5rpx;
width: 77rpx;
height: 77rpx;
display: flex;
justify-content: center;
align-items: center;
}
.coupon-box .r image{
width: 52.078rpx;
height: 52.078rpx;
}
.order-box{
margin-top: 20rpx;
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
}
.order-box .order-item{
height: 104.3rpx;
overflow: hidden;
background: #fff;
display: flex;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
padding-top: 26rpx;
border-bottom: 1px solid #d9d9d9;
}
.order-box .order-item .l{
float: left;
height: 52rpx;
width: 50%;
line-height: 52rpx;
overflow: hidden;
}
.order-box .order-item .r{
float: right;
text-align: right;
width: 50%;
height: 52rpx;
line-height: 52rpx;
overflow: hidden;
}
.order-box .order-item.no-border{
border-bottom: none;
}
.goods-items{
margin-top: 20rpx;
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
padding-left: 31.25rpx;
margin-bottom: 120rpx;
}
.goods-items .item{
height: 192rpx;
padding-right: 31.25rpx;
display: flex;
align-items: center;
border-bottom: 1px solid rgba(0,0,0,0.15);
}
.goods-items .item.no-border{
border-bottom: none;
}
.goods-items .item:last-child{
border-bottom: none;
}
.goods-items .img{
height: 145.83rpx;
width: 145.83rpx;
background-color: #f4f4f4;
margin-right: 20rpx;
}
.goods-items .img image{
height: 145.83rpx;
width: 145.83rpx;
}
.goods-items .info{
flex: 1;
height: 145.83rpx;
padding-top: 5rpx;
}
.goods-items .t{
height: 33rpx;
line-height: 33rpx;
margin-bottom: 10rpx;
overflow: hidden;
font-size: 30rpx;
color: #333;
}
.goods-items .t .name{
display: block;
float: left;
}
.goods-items .t .number{
display: block;
float: right;
text-align: right;
}
.goods-items .m {
height: 29rpx;
overflow: hidden;
line-height: 29rpx;
margin-bottom: 25rpx;
font-size: 25rpx;
color: #666;
}
.goods-items .b {
height: 41rpx;
overflow: hidden;
line-height: 41rpx;
font-size: 30rpx;
color: #333;
}
.order-total{
position: fixed;
left:0;
bottom: 0;
height: 100rpx;
width: 100%;
display: flex;
}
.order-total .l{
flex: 1;
height: 100rpx;
line-height: 100rpx;
color: #a78845;
background: #fff;
font-size: 33rpx;
padding-left: 31.25rpx;
border-top: 1rpx solid rgba(0,0,0,0.2);
border-bottom: 1rpx solid rgba(0,0,0,0.2);
}
.order-total .r{
width: 233rpx;
height: 100rpx;
background: #a78845;
border: 1px solid #a78845;
line-height: 100rpx;
text-align: center;
color: #fff;
font-size: 30rpx;
}
\ No newline at end of file
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
var app = getApp()
Page({
data: {
topicList: [],
page: 1,
size: 10,
count: 0,
scrollTop: 0,
showPage: false
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.getTopic();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
nextPage: function(event) {
var that = this;
if (this.data.page + 1 > that.data.count / that.data.size) {
return true;
}
that.setData({
page: that.data.page + 1
});
this.getTopic();
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getTopic();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getTopic: function() {
let that = this;
that.setData({
scrollTop: 0,
showPage: false,
topicList: []
});
// 页面渲染完成
wx.showToast({
title: '加载中...',
icon: 'loading',
duration: 2000
});
util.request(api.TopicList, {
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) {
that.setData({
scrollTop: 0,
topicList: res.data.data,
showPage: true,
count: res.data.count
});
}
wx.hideToast();
});
},
prevPage: function(event) {
if (this.data.page <= 1) {
return false;
}
var that = this;
that.setData({
page: that.data.page - 1
});
this.getTopic();
}
})
\ No newline at end of file
{
"navigationBarTitleText": "专题"
}
\ No newline at end of file
<view class="container">
<scroll-view class="topic-list" scroll-y="true" scroll-top="{{scrollTop}}">
<navigator class="item" wx:for="{{topicList}}" wx:key="id" url="../topicDetail/topicDetail?id={{item.id}}">
<image class="img" src="{{item.picUrl}}"></image>
<view class="info">
<text class="title">{{item.title}}</text>
<text class="desc">{{item.subtitle}}</text>
<!-- <text class="price">{{item.price}}元起</text> -->
</view>
</navigator>
<view class="page" wx:if="{{showPage}}">
<view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view>
<view class="next {{ (count / size) < page +1 ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
</view>
</scroll-view>
</view>
\ No newline at end of file
page ,.container{
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
}
.topic-list{
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
}
.topic-list .item{
width: 100%;
height: 625rpx;
overflow: hidden;
background: #fff;
margin-bottom: 20rpx;
}
.topic-list .img{
width: 100%;
height: 415rpx;
}
.topic-list .info{
width: 100%;
height: 210rpx;
overflow: hidden;
}
.topic-list .title{
display: block;
text-align: center;
width: 100%;
height: 33rpx;
line-height: 35rpx;
color: #a78845;
overflow: hidden;
font-size: 35rpx;
margin-top: 30rpx;
}
.topic-list .desc{
display: block;
text-align: center;
position: relative;
width: auto;
height: 24rpx;
line-height: 24rpx;
overflow: hidden;
color: #999;
font-size: 24rpx;
margin-top: 16rpx;
margin-bottom: 30rpx;
}
.topic-list .price{
display: block;
text-align: center;
width: 100%;
height: 27rpx;
line-height: 27rpx;
overflow: hidden;
color: #b4282d;
font-size: 27rpx;
}
.page{
width: 750rpx;
height: 108rpx;
background: #fff;
margin-bottom: 20rpx;
}
.page view{
height: 108rpx;
width: 50%;
float: left;
font-size: 29rpx;
color: #333;
text-align: center;
line-height: 108rpx;
}
.page .prev{
border-right: 1px solid #D9D9D9;
}
.page .disabled{
color: #ccc;
}
\ No newline at end of file
var app = getApp();
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
Page({
data: {
comments: [],
allCommentList: [],
picCommentList: [],
type: 0,
valueId: 0,
showType: 0,
allCount: 0,
hasPicCount: 0,
allPage: 1,
picPage: 1,
size: 20
},
getCommentCount: function () {
let that = this;
util.request(api.CommentCount, { valueId: that.data.valueId, type: that.data.type}).then(function (res) {
if (res.errno === 0) {
that.setData({
allCount: res.data.allCount,
hasPicCount: res.data.hasPicCount
});
}
});
},
getCommentList: function(){
let that = this;
util.request(api.CommentList, {
valueId: that.data.valueId,
type: that.data.type,
size: that.data.size,
page: (that.data.showType == 0 ? that.data.allPage : that.data.picPage),
showType: that.data.showType
}).then(function (res) {
if (res.errno === 0) {
if (that.data.showType == 0) {
that.setData({
allCommentList: that.data.allCommentList.concat(res.data.data),
allPage: res.data.currentPage,
comments: that.data.allCommentList.concat(res.data.data)
});
} else {
that.setData({
picCommentList: that.data.picCommentList.concat(res.data.data),
picPage: res.data.currentPage,
comments: that.data.picCommentList.concat(res.data.data)
});
}
}
});
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
this.setData({
type: options.type,
valueId: options.valueId
});
this.getCommentCount();
this.getCommentList();
},
onReady: function () {
// 页面渲染完成
},
onShow: function () {
// 页面显示
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
// 页面关闭
},
switchTab: function () {
this.setData({
showType: this.data.showType == 1 ? 0 :1
});
this.getCommentList();
},
onReachBottom: function(){
console.log('onPullDownRefresh');
if ( this.data.showType == 0) {
if (this.data.allCount / this.data.size < this.data.allPage) {
return false;
}
this.setData({
'allPage' : this.data.allPage + 1
});
} else {
if (this.data.hasPicCount / this.data.size < this.data.picPage) {
return false;
}
this.setData({
'picPage': this.data.picPage + 1
});
}
this.getCommentList();
}
})
\ No newline at end of file
{
"navigationBarTitleText": "评论"
}
\ No newline at end of file
<view class="comments">
<view class="b">
<view class="item" wx:for="{{comments}}" wx:key="id">
<view class="info">
<view class="user">
<image src="{{item.userInfo.avatarUrl}}"></image>
<text>{{item.userInfo.nickName}}</text>
</view>
<view class="time">{{item.addTime}}</view>
</view>
<view class="comment">{{item.content}}</view>
<view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="id" wx:for-item="pitem" src="{{pitem.picUrl}}"></image>
</view>
<!--<view class="customer-service" wx:if="{{item.commentReplyVO}}">
<text class="u">小选回复:</text>
<text class="c">{{item.commentReplyVO.replyContent}}</text>
</view>-->
</view>
</view>
</view>
\ No newline at end of file
.comments{
width: 100%;
height: auto;
padding-left:30rpx;
background: #fff;
margin: 20rpx 0;
}
.comments .b{
height: auto;
width: 720rpx;
}
.comments .b.no-h{
margin-top: 0;
}
.comments .item{
height: auto;
width: 720rpx;
overflow: hidden;
border-bottom: 1px solid #d9d9d9;
padding-bottom: 25rpx;
}
.comments .info{
height: 127rpx;
width: 100%;
padding: 33rpx 0 27rpx 0;
}
.comments .user{
float: left;
width: auto;
height: 67rpx;
line-height: 67rpx;
font-size: 0;
}
.comments .user image{
float: left;
width: 67rpx;
height: 67rpx;
margin-right: 17rpx;
border-radius: 50%;
}
.comments .user text{
display: inline-block;
width: auto;
height: 66rpx;
overflow: hidden;
font-size: 29rpx;
line-height: 66rpx;
}
.comments .time{
display: block;
float: right;
width: auto;
height: 67rpx;
line-height: 67rpx;
color: #7f7f7f;
font-size: 25rpx;
margin-right: 30rpx;
}
.comments .comment{
width: 720rpx;
padding-right: 30rpx;
line-height: 45.8rpx;
font-size: 29rpx;
margin-bottom: 16rpx;
}
.comments .imgs{
width: 720rpx;
height: 150rpx;
margin-bottom: 25rpx;
}
.comments .imgs .img{
height: 150rpx;
width: 150rpx;
margin-right: 28rpx;
}
.comments .customer-service{
width: 690rpx;
height: auto;
overflow: hidden;
margin-top: 23rpx;
background: rgba(0,0,0,.03);
padding: 21rpx;
}
.comments .customer-service .u{
font-size: 24rpx;
color: #333;
line-height: 37.5rpx;
}
.comments .customer-service .c{
font-size: 24rpx;
color: #999;
line-height: 37.5rpx;
}
\ No newline at end of file
// 上传组件 基于https://github.com/Tencent/weui-wxss/tree/master/src/example/uploader
var app = getApp();
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
Page({
data: {
valueId: 0,
topic: {},
content: '',
stars: [0, 1, 2, 3, 4],
star: 5,
starText: '十分满意',
hasPicture: false,
picUrls: [],
files: []
},
chooseImage: function (e) {
if (this.data.files.length >= 5) {
util.showErrorToast('只能上传五张图片')
return false;
}
var that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function (res) {
that.setData({
files: that.data.files.concat(res.tempFilePaths)
});
that.upload(res);
}
})
},
upload: function (res) {
var that = this;
const uploadTask = wx.uploadFile({
url: api.StorageUpload,
filePath: res.tempFilePaths[0],
name: 'file',
success: function (res) {
var _res = JSON.parse(res.data);
if (_res.errno === 0) {
var url = _res.data.url
that.data.picUrls.push(url)
that.setData({
hasPicture: true,
picUrls: that.data.picUrls
})
}
},
fail: function (e) {
wx.showModal({
title: '错误',
content: '上传失败',
showCancel: false
})
},
})
uploadTask.onProgressUpdate((res) => {
console.log('上传进度', res.progress)
console.log('已经上传的数据长度', res.totalBytesSent)
console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend)
})
},
previewImage: function (e) {
wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.files // 需要预览的图片http链接列表
})
},
selectRater: function (e) {
var star = e.currentTarget.dataset.star + 1;
var starText;
if (star == 1) {
starText = '很差';
}
else if (star == 2) {
starText = '不太满意';
}
else if (star == 3) {
starText = '满意';
}
else if (star == 4) {
starText = '比较满意';
}
else {
starText = '十分满意'
}
this.setData({
star: star,
starText: starText
})
},
onLoad: function (options) {
if (parseInt(options.type) !== 1){
return;
}
var that = this;
that.setData({
valueId: options.valueId
});
this.getTopic();
},
getTopic: function () {
let that = this;
util.request(api.TopicDetail, { id: that.data.valueId }).then(function (res) {
if (res.errno === 0) {
that.setData({
topic: res.data,
});
}
});
},
onClose: function () {
wx.navigateBack();
},
onPost: function () {
let that = this;
if (!this.data.content) {
util.showErrorToast('请填写评论')
return false;
}
util.request(api.CommentPost, {
type: 1,
valueId: that.data.valueId,
content: that.data.content,
star: that.data.star,
hasPicture: that.data.hasPicture,
picUrls: that.data.picUrls
}, 'POST').then(function (res) {
if (res.errno === 0) {
wx.showToast({
title: '评论成功',
complete: function () {
wx.navigateBack();
}
})
}
});
},
bindInputValue(event) {
let value = event.detail.value;
//判断是否超过140个字符
if (value && value.length > 140) {
return false;
}
this.setData({
content: event.detail.value,
})
},
onReady: function () {
},
onShow: function () {
// 页面显示
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
// 页面关闭
}
})
\ No newline at end of file
{
"navigationBarTitleText": "评论"
}
\ No newline at end of file
<view class="container">
<view class="post-comment">
<view class="goods">
<view class="img">
<image src="{{topic.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{topic.title}}</text>
</view>
<view class="attr">{{topic.subtitle}}</view>
</view>
</view>
<view class="rater">
<text class="rater-title">评分</text>
<block wx:for="{{stars}}" wx:key="*this" wx:for-item="item">
<image src="/static/images/icon_collect_checked.png" bindtap="selectRater" data-star="{{item}}" wx:if="{{item < star}}"></image>
<image src="/static/images/icon_collect.png" bindtap="selectRater" data-star="{{item}}" wx:else></image>
</block>
<text class="rater-desc">{{starText}}</text>
</view>
<view class="input-box">
<textarea class="content" focus="true" bindinput="bindInputValue" maxlength="140" placeholder="留言经过筛选后,对所有人可见" />
<text class="count">{{140 - content.length}}</text>
</view>
<view class="weui-uploader">
<view class="weui-uploader__hd">
<view class="weui-uploader__title">图片上传</view>
<view class="weui-uploader__info">{{picUrls.length}}/{{files.length}}</view>
</view>
<view class="weui-uploader__bd">
<view class="weui-uploader__files" id="uploaderFiles">
<block wx:for="{{files}}" wx:key="*this">
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
</view>
<!-- <view class="weui-uploader__file weui-uploader__file_status" bindtap="previewImage" id="{{item}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
<view class="weui-uploader__file-content">50%</view>
</view> -->
</block>
<view class="weui-uploader__input-box">
<view class="weui-uploader__input" bindtap="chooseImage"></view>
</view>
</view>
</view>
</view>
<view class="btns">
<view class="close" bindtap="onClose">取消</view>
<view class="post" bindtap="onPost">发表</view>
</view>
</view>
</view>
\ No newline at end of file
page, .container {
height: 100%;
background: #f4f4f4;
}
.post-comment {
width: 750rpx;
height: auto;
overflow: hidden;
padding: 30rpx;
background: #fff;
}
.post-comment .goods {
display: flex;
align-items: center;
height: 199rpx;
margin-left: 31.25rpx;
}
.post-comment .goods .img {
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
}
.post-comment .goods .img image {
height: 145.83rpx;
width: 145.83rpx;
}
.post-comment .goods .info {
height: 145.83rpx;
flex: 1;
padding-left: 20rpx;
}
.post-comment .goods .name {
margin-top: 30rpx;
display: block;
height: 44rpx;
line-height: 44rpx;
color: #333;
font-size: 30rpx;
}
.post-comment .goods .number {
display: block;
height: 37rpx;
line-height: 37rpx;
color: #666;
font-size: 25rpx;
}
.post-comment .goods .status {
width: 105rpx;
color: #b4282d;
font-size: 25rpx;
}
.post-comment .rater {
display: flex;
flex-direction: row;
height: 55rpx;
}
.post-comment .rater .rater-title {
font-size: 29rpx;
padding-right: 10rpx;
}
.post-comment .rater image {
padding-left: 5rpx;
height: 50rpx;
width: 50rpx;
}
.post-comment .rater .rater-desc {
font-size: 29rpx;
padding-left: 10rpx;
}
.post-comment .input-box {
height: 337.5rpx;
width: 690rpx;
position: relative;
background: #fff;
}
.post-comment .input-box .content {
position: absolute;
top: 0;
left: 0;
display: block;
background: #fff;
font-size: 29rpx;
border: 5px solid #f4f4f4;
height: 300rpx;
width: 650rpx;
padding: 20rpx;
}
.post-comment .input-box .count {
position: absolute;
bottom: 20rpx;
right: 20rpx;
display: block;
height: 30rpx;
width: 50rpx;
font-size: 29rpx;
color: #999;
}
.post-comment .btns {
height: 108rpx;
}
.post-comment .close {
float: left;
height: 108rpx;
line-height: 108rpx;
text-align: left;
color: #666;
padding: 0 30rpx;
}
.post-comment .post {
float: right;
height: 108rpx;
line-height: 108rpx;
text-align: right;
padding: 0 30rpx;
}
.weui-uploader {
margin-top: 50rpx;
}
.weui-uploader__hd {
display: -webkit-box;
display: -webkit-flex;
display: flex;
padding-bottom: 10px;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
}
.weui-uploader__title {
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
}
.weui-uploader__info {
color: #b2b2b2;
}
.weui-uploader__bd {
margin-bottom: -4px;
margin-right: -9px;
overflow: hidden;
}
.weui-uploader__file {
float: left;
margin-right: 9px;
margin-bottom: 9px;
}
.weui-uploader__img {
display: block;
width: 79px;
height: 79px;
}
.weui-uploader__file_status {
position: relative;
}
.weui-uploader__file_status:before {
content: " ";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.weui-uploader__file-content {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #fff;
}
.weui-uploader__input-box {
float: left;
position: relative;
margin-right: 9px;
margin-bottom: 9px;
width: 77px;
height: 77px;
border: 1px solid #d9d9d9;
}
.weui-uploader__input-box:after, .weui-uploader__input-box:before {
content: " ";
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background-color: #d9d9d9;
}
.weui-uploader__input-box:before {
width: 2px;
height: 39.5px;
}
.weui-uploader__input-box:after {
width: 39.5px;
height: 2px;
}
.weui-uploader__input-box:active {
border-color: #999;
}
.weui-uploader__input-box:active:after, .weui-uploader__input-box:active:before {
background-color: #999;
}
.weui-uploader__input {
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
var app = getApp();
var WxParse = require('../../lib/wxParse/wxParse.js');
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
Page({
data: {
id: 0,
topic: {},
topicList: [],
commentCount: 0,
commentList: []
},
onShareAppMessage: function() {
return {
title: 'Renard 的甜品屋',
desc: '唯爱与美食不可辜负',
path: '/pages/topicDetail/topicDetail?id=' + this.data.id
}
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
var that = this;
that.setData({
id: options.id
});
util.request(api.TopicDetail, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({
topic: res.data,
});
WxParse.wxParse('topicDetail', 'html', res.data.content, that);
}
});
util.request(api.TopicRelated, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({
topicList: res.data
});
}
});
},
getCommentList() {
let that = this;
util.request(api.CommentList, {
valueId: that.data.id,
type: 1,
showType: 0,
page: 1,
size: 5
}).then(function(res) {
if (res.errno === 0) {
that.setData({
commentList: res.data.data,
commentCount: res.data.count
});
}
});
},
postComment() {
if (!app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/auth/login/login"
});
} else {
wx.navigateTo({
url: '/pages/topicCommentPost/topicCommentPost?valueId=' + this.data.id + '&type=1',
})
}
},
onReady: function() {
},
onShow: function() {
// 页面显示
this.getCommentList();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
})
\ No newline at end of file
{
"navigationBarTitleText": "专题详情",
"enablePullDownRefresh": false
}
\ No newline at end of file
<scroll-view class="container">
<scroll-view class="content">
<import src="../../lib/wxParse/wxParse.wxml"/>
<template is="wxParse" data="{{wxParseData:topicDetail.nodes}}"/>
</scroll-view>
<view class="topic-goods">
</view>
<!-- <scroll-view class="comments">
<view class="h">
<text class="t">精选留言</text>
<image bindtap="postComment" class="i" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/comment-add-2aca147c3f.png"></image>
</view>
<view class="has-comments" wx:if="{{commentList.length > 0 }}">
<view class="b">
<view class="item" wx:for="{{commentList}}" wx:key="id">
<view class="info">
<view class="user">
<image class="avatar" src="{{item.userInfo.avatarUrl}}"></image>
<text class="nickname">{{item.userInfo.nickName}}</text>
</view>
<view class="time">{{item.addTime}}</view>
</view>
<view class="comment">
{{item.content}}
</view>
</view>
</view>
<view class="load" wx:if="{{commentCount > 5}}">
<navigator url="/pages/topicComment/topicComment?valueId={{topic.id}}&type=1">查看更多</navigator>
</view>
</view>
<view class="no-comments" wx:if="{{commentList.length <= 0}}">
<view class="b">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-comment-560f87660a.png"></image>
<text class="txt">等你来留言</text>
</view>
</view>
</scroll-view> -->
<scroll-view class="rec-box">
<view class="h">
<text class="txt">专题推荐</text>
</view>
<view class="b">
<navigator class="item" wx:for="{{topicList}}" wx:key="id" url="../topicDetail/topicDetail?id={{item.id}}">
<image class="img" src="{{item.picUrl}}"></image>
<text class="title">{{item.title}}</text>
</navigator>
</view>
</scroll-view>
</scroll-view>
\ No newline at end of file
.content{
width: 100%;
height: auto;
font-size: 0;
}
.content image{
display: inline-block;
width: 100%;
}
.comments{
width: 100%;
height: auto;
padding-left:30rpx;
background: #fff;
margin-top: 20rpx;
}
.comments .h{
height: 93rpx;
line-height: 93rpx;
width: 720rpx;
padding-right: 30rpx;
border-bottom: 1px solid #d9d9d9;
}
.comments .h .t{
display: block;
float: left;
width: 50%;
font-size: 29rpx;
color: #333;
}
.comments .h .i{
display: block;
float: right;
margin-top: 30rpx;
width: 33rpx;
height: 33rpx;
}
.comments .b{
height: auto;
width: 720rpx;
}
.comments .item{
height: auto;
width: 720rpx;
overflow: hidden;
border-bottom: 1px solid #d9d9d9;
}
.comments .info{
height: 127rpx;
width: 100%;
padding: 33rpx 0 27rpx 0;
}
.comments .user{
float: left;
width: auto;
height: 67rpx;
line-height: 67rpx;
font-size: 0;
}
.comments .user .avatar{
display: block;
float: left;
width: 67rpx;
height: 67rpx;
margin-right: 17rpx;
border-radius: 50%;
}
.comments .user .nickname{
display: block;
width: auto;
float: left;
height: 66rpx;
overflow: hidden;
font-size: 29rpx;
line-height: 66rpx;
}
.comments .time{
display: block;
float: right;
width: auto;
height: 67rpx;
line-height: 67rpx;
color: #7f7f7f;
font-size: 25rpx;
margin-right: 30rpx;
}
.comments .comment{
width: 720rpx;
padding-right: 30rpx;
line-height: 45.8rpx;
margin-bottom: 30rpx;
font-size: 29rpx;
color: #333;
}
.comments .load{
width: 720rpx;
height: 108rpx;
line-height: 108rpx;
text-align: center;
font-size: 38.5rpx;
}
.no-comments{
height: 297rpx;
}
.no-comments .txt{
height: 43rpx;
line-height: 43rpx;
display: block;
width: 100%;
text-align: center;
font-size: 29rpx;
color: #7f7f7f;
}
.no-comments .icon{
margin: 48rpx auto 18rpx auto;
height: 130rpx;
display: block;
width: 115rpx;
}
.rec-box{
width: 690rpx;
height: auto;
margin: 0 30rpx;
}
.rec-box .h{
position: relative;
width: 690rpx;
height: 110rpx;
/*border-bottom: 1px solid #d0d0d0;*/
margin-bottom: 32rpx;
}
.rec-box .h .txt{
display: inline-block;
position: absolute;
background: #f4f4f4;
top: 59rpx;
left: 200rpx;
width: 290rpx;
height: 45rpx;
line-height: 45rpx;
font-size: 30rpx;
color: #999;
text-align: center;
}
.rec-box .b .item{
width: 690rpx;
height: auto;
padding: 24rpx 24rpx 30rpx 24rpx;
background: #fff;
margin-bottom: 30rpx;
}
.rec-box .b .item .img{
height: 355rpx;
width: 642rpx;
}
.rec-box .b .item .title{
display: block;
margin-top: 30rpx;
height: 30rpx;
width: 642rpx;
font-size: 28rpx;
}
@import "../../lib/wxParse/wxParse.wxss";
Supports Markdown
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