Commit 822d5075 authored by Junling Bu's avatar Junling Bu
Browse files

chore[renard-wx]: 清理代码,删除不必要的组件。

parent 5a981060
...@@ -5,37 +5,6 @@ ...@@ -5,37 +5,6 @@
</scroll-view> </scroll-view>
<view class="topic-goods"> <view class="topic-goods">
</view> </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"> <scroll-view class="rec-box">
<view class="h"> <view class="h">
<text class="txt">专题推荐</text> <text class="txt">专题推荐</text>
......
var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
var app = getApp();
Page({
data: {
footprintList: [],
page: 1,
size: 10,
totalPages: 1
},
getFootprintList() {
wx.showLoading({
title: '加载中...',
});
let that = this;
util.request(api.FootprintList, { page: that.data.page, size: that.data.size }).then(function (res) {
if (res.errno === 0) {
let f1 = that.data.footprintList;
let f2 = res.data.footprintList;
for (let i = 0; i < f2.length; i++) {
let last = f1.length - 1;
if (last >= 0 && f1[last][0].addTime === f2[i].addTime) {
f1[last].push(f2[i]);
}
else{
let tmp = [];
tmp.push(f2[i])
f1.push(tmp);
}
}
that.setData({
footprintList: f1,
totalPages: res.data.totalPages
});
}
wx.hideLoading();
});
},
deleteItem (event){
let that = this;
let index = event.currentTarget.dataset.index;
let iindex = event.currentTarget.dataset.iindex;
let goodsId = this.data.footprintList[index][iindex].id;
var touchTime = that.data.touchEnd - that.data.touchStart;
console.log(touchTime);
//如果按下时间大于350为长按
if (touchTime > 350) {
wx.showModal({
title: '',
content: '要删除所选足迹?',
success: function (res) {
if (res.confirm) {
util.request(api.FootprintDelete, { footprintId: goodsId }, 'POST').then(function (res) {
if (res.errno === 0) {
wx.showToast({
title: '删除成功',
icon: 'success',
duration: 2000
});
that.data.footprintList[index].splice(iindex, 1)
if (that.data.footprintList[index].length == 0){
that.data.footprintList.splice(index, 1)
}
that.setData({
footprintList: that.data.footprintList
});
}
});
}
}
});
} else {
wx.navigateTo({
url: '/pages/goods/goods?id=' + goodsId,
});
}
},
onLoad: function (options) {
this.getFootprintList();
},
onReachBottom() {
if (this.data.totalPages > this.data.page) {
this.setData({
page: this.data.page + 1
});
this.getFootprintList();
} else {
wx.showToast({
title: '没有更多用户足迹了',
icon: 'none',
duration: 2000
});
return false;
}
},
onReady: function () {
},
onShow: function () {
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
// 页面关闭
},
//按下事件开始
touchStart: function (e) {
let that = this;
that.setData({
touchStart: e.timeStamp
})
console.log(e.timeStamp + '- touchStart')
},
//按下事件结束
touchEnd: function (e) {
let that = this;
that.setData({
touchEnd: e.timeStamp
})
console.log(e.timeStamp + '- touchEnd')
},
})
\ No newline at end of file
{
"navigationBarTitleText": "我的足迹"
}
\ No newline at end of file
<view class="container">
<view class="no-footprint" wx:if="{{footprintList.length <= 0}}">
<view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>没有浏览足迹</text>
</view>
</view>
<view class="footprint" wx:if="{{footprintList.length > 0}}">
<view class="day-item" wx:for="{{footprintList}}" wx:key="*this" wx:for-index="index">
<view class="day-hd" wx:if="{{item.length > 0}}">{{item[0].addTime}}</view>
<view class="day-list" wx:if="{{item.length > 0}}">
<view class="item" data-index="{{index}}" data-iindex="{{iindex}}" bindtouchstart="touchStart" bindtouchend="touchEnd" bindtap="deleteItem" wx:for="{{item}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="id">
<image class="img" src="{{iitem.picUrl}}"></image>
<view class="info">
<view class="name">{{iitem.name}}</view>
<view class="subtitle">{{iitem.brief}}</view>
<view class="price">¥{{iitem.retailPrice}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
page{
background: #f4f4f4;
min-height: 100%;
}
.container{
background: #f4f4f4;
min-height: 100%;
width: 100%;
height: auto;
overflow: hidden;
}
.no-footprint{
width: 100%;
height: auto;
margin: 0 auto;
}
.no-footprint .c{
width: 100%;
height: auto;
margin-top: 200rpx;
}
.no-footprint .c image{
margin: 0 auto;
display: block;
text-align: center;
width: 258rpx;
height: 258rpx;
}
.no-footprint .c text{
margin: 0 auto;
display: block;
width: 258rpx;
height: 29rpx;
line-height: 29rpx;
text-align: center;
font-size: 29rpx;
color: #999;
}
.footprint{
height: auto;
overflow: hidden;
width: 100%;
border-top: 1px solid #e1e1e1;
}
.day-item{
height: auto;
overflow: hidden;
width: 100%;
margin-bottom: 20rpx;
}
.day-hd{
height: 94rpx;
width: 100%;
line-height: 94rpx;
background: #fff;
padding-left: 30rpx;
color: #333;
font-size: 28rpx;
}
.day-list{
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
padding-left: 30rpx;
border-top: 1px solid #e1e1e1;
}
.item{
height: 212rpx;
width: 720rpx;
background: #fff;
padding: 30rpx 30rpx 30rpx 0;
border-bottom: 1px solid #e1e1e1;
}
.item:last-child{
border-bottom: 1px solid #fff;
}
.item .img{
float: left;
width: 150rpx;
height: 150rpx;
}
.item .info{
float: right;
width: 540rpx;
height: 150rpx;
display: flex;
flex-direction: column;
justify-content: center;
padding-left: 20rpx;
}
.item .info .name{
font-size: 28rpx;
color: #333;
line-height: 40rpx;
}
.item .info .subtitle{
margin-top: 8rpx;
font-size: 24rpx;
color: #888;
line-height: 40rpx;
}
.item .info .price{
margin-top: 8rpx;
font-size: 28rpx;
color: #333;
line-height: 40rpx;
}
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