Commit 20b97ec8 authored by Junling Bu's avatar Junling Bu
Browse files

chore[litemall-wx]: 使用微信开发者工具的格式化代码

parent 822d5075
...@@ -8,55 +8,55 @@ ...@@ -8,55 +8,55 @@
<view class="right" bindtap="closeSearch">取消</view> <view class="right" bindtap="closeSearch">取消</view>
</view> </view>
<view class="no-search" wx:if="{{ !searchStatus}}"> <view class="no-search" wx:if="{{ !searchStatus}}">
<view class="search-keywords search-history" wx:if="{{!keyword && historyKeyword.length}}"> <view class="search-keywords search-history" wx:if="{{!keyword && historyKeyword.length}}">
<view class="h"> <view class="h">
<text class="title">历史记录</text> <text class="title">历史记录</text>
<image class="icon" bindtap="clearHistory" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/del1-93f0a4add4.png"></image> <image class="icon" bindtap="clearHistory" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/del1-93f0a4add4.png"></image>
</view> </view>
<view class="b"> <view class="b">
<view class="item" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{historyKeyword}}" wx:key="keyword" hover-class="navigator-hover">{{item.keyword}}</view> <view class="item" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{historyKeyword}}" wx:key="keyword" hover-class="navigator-hover">{{item.keyword}}</view>
</view>
</view> </view>
</view> <view class="search-keywords search-hot" wx:if="{{!keyword && hotKeyword.length}}">
<view class="search-keywords search-hot" wx:if="{{!keyword && hotKeyword.length}}"> <view class="h">
<view class="h"> <text class="title">热门搜索</text>
<text class="title">热门搜索</text> </view>
<view class="b">
<view class="item {{item.is_hot === 1 ? 'active' : ''}}" hover-class="navigator-hover" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{hotKeyword}}" wx:key="id">{{item.keyword}}</view>
</view>
</view> </view>
<view class="b"> <view class="shelper-list" wx:if="{{keyword}}">
<view class="item {{item.is_hot === 1 ? 'active' : ''}}" hover-class="navigator-hover" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{hotKeyword}}" wx:key="id">{{item.keyword}}</view> <view class="item" hover-class="navigator-hover" wx:for="{{helpKeyword}}" wx:key="id" bindtap="onKeywordTap" data-keyword="{{item}}">{{item}}</view>
</view> </view>
</view> </view>
<view class="shelper-list" wx:if="{{keyword}}">
<view class="item" hover-class="navigator-hover" wx:for="{{helpKeyword}}" wx:key="id" bindtap="onKeywordTap" data-keyword="{{item}}">{{item}}</view>
</view>
</view>
<view class="search-result" wx:if="{{ searchStatus && goodsList.length}}"> <view class="search-result" wx:if="{{ searchStatus && goodsList.length}}">
<view class="sort"> <view class="sort">
<view class="sort-box"> <view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort"> <view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text> <text class="txt">综合</text>
</view> </view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort"> <view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
<text class="txt">价格</text> <text class="txt">价格</text>
</view>
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter">
<text class="txt">分类</text>
</view>
</view> </view>
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter"> <view class="sort-box-category" wx-if="{{categoryFilter}}">
<text class="txt">分类</text> <view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
</view> </view>
</view> </view>
<view class="sort-box-category" wx-if="{{categoryFilter}}"> <view class="cate-item">
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view> <view class="b">
</view> <navigator class="item {{(iindex + 1) % 2 == 0 ? 'item-b' : ''}}" url="/pages/goods/goods?id={{iitem.id}}" wx:for="{{goodsList}}" wx:key="id" wx:for-item="iitem" wx:for-index="iindex">
</view> <image class="img" src="{{iitem.picUrl}}" background-size="cover"></image>
<view class="cate-item"> <text class="name">{{iitem.name}}</text>
<view class="b"> <text class="price">¥{{iitem.retailPrice}}</text>
<navigator class="item {{(iindex + 1) % 2 == 0 ? 'item-b' : ''}}" url="/pages/goods/goods?id={{iitem.id}}" wx:for="{{goodsList}}" wx:key="id" wx:for-item="iitem" wx:for-index="iindex"> </navigator>
<image class="img" src="{{iitem.picUrl}}" background-size="cover"></image> </view>
<text class="name">{{iitem.name}}</text>
<text class="price">¥{{iitem.retailPrice}}</text>
</navigator>
</view> </view>
</view> </view>
</view>
<view class="search-result-empty" wx:if="{{!goodsList.length && searchStatus}}"> <view class="search-result-empty" wx:if="{{!goodsList.length && searchStatus}}">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noSearchResult-7572a94f32.png"></image> <image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noSearchResult-7572a94f32.png"></image>
......
page{ page {
min-height: 100%; min-height: 100%;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
.container{ .container {
min-height: 100%; min-height: 100%;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
.search-header{ .search-header {
position: fixed; position: fixed;
top: 0; top: 0;
width: 750rpx; width: 750rpx;
height: 91rpx; height: 91rpx;
display: flex; display: flex;
background: #fff; background: #fff;
border-bottom: 1px solid rgba(0,0,0,.15); border-bottom: 1px solid rgba(0, 0, 0, 0.15);
padding: 0 31.25rpx; padding: 0 31.25rpx;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
}
.search-header .input-box{
position: relative;
margin-top: 16rpx;
float: left;
width: 0;
flex: 1;
height: 59rpx;
line-height: 59rpx;
padding: 0 20rpx;
background: #f4f4f4;
}
.search-header .icon{
position: absolute;
top: 14rpx;
left: 20rpx;
width: 31rpx;
height: 31rpx;
}
.search-header .del{
position: absolute;
top: 3rpx;
right: 10rpx;
width: 53rpx;
height: 53rpx;
z-index: 10;
} }
.search-header .keywrod{ .search-header .input-box {
position: absolute; position: relative;
top: 0; margin-top: 16rpx;
left: 40rpx; float: left;
width: 506rpx; width: 0;
height: 59rpx; flex: 1;
padding-left: 30rpx; height: 59rpx;
} line-height: 59rpx;
padding: 0 20rpx;
.search-header .right{ background: #f4f4f4;
margin-top: 24rpx;
margin-left: 31rpx;
margin-right: 6rpx;
width: 58rpx;
height: 43rpx;
line-height: 43rpx;
float: right;
}
.no-search{
height: auto;
overflow: hidden;
margin-top: 91rpx;
}
.search-keywords{
background: #fff;
width: 750rpx;
height: auto;
overflow: hidden;
margin-bottom: 20rpx;
}
.search-keywords .h{
padding: 0 31.25rpx;
height: 93rpx;
line-height: 93rpx;
width: 100%;
color: #999;
font-size: 29rpx;
} }
.search-keywords .title{ .search-header .icon {
display: block; position: absolute;
width: 120rpx; top: 14rpx;
float: left; left: 20rpx;
width: 31rpx;
height: 31rpx;
} }
.search-keywords .icon{ .search-header .del {
margin-top: 19rpx; position: absolute;
float: right; top: 3rpx;
display: block; right: 10rpx;
margin-left: 511rpx; width: 53rpx;
height: 55rpx; height: 53rpx;
width: 55rpx; z-index: 10;
} }
.search-keywords .b{ .search-header .keywrod {
width: 750rpx; position: absolute;
height: auto; top: 0;
overflow: hidden; left: 40rpx;
padding-left: 31.25rpx; width: 506rpx;
height: 59rpx;
padding-left: 30rpx;
} }
.search-keywords .item{ .search-header .right {
display: inline-block; margin-top: 24rpx;
width: auto; margin-left: 31rpx;
height: 48rpx; margin-right: 6rpx;
line-height: 48rpx; width: 58rpx;
padding:0 15rpx; height: 43rpx;
border: 1px solid #999; line-height: 43rpx;
margin: 0 31.25rpx 31.25rpx 0; float: right;
font-size: 24rpx;
color: #333;
} }
.search-keywords .item.active{ .no-search {
color: #b4282d; height: auto;
border: 1px solid #b4282d; overflow: hidden;
margin-top: 91rpx;
} }
.shelper-list{ .search-keywords {
width: 750rpx; background: #fff;
height: auto; width: 750rpx;
overflow: hidden; height: auto;
background: #fff; overflow: hidden;
padding: 0 31.25rpx; margin-bottom: 20rpx;
}
.search-keywords .h {
padding: 0 31.25rpx;
height: 93rpx;
line-height: 93rpx;
width: 100%;
color: #999;
font-size: 29rpx;
} }
.shelper-list .item{ .search-keywords .title {
height: 93rpx; display: block;
width: 687.5rpx; width: 120rpx;
line-height: 93rpx; float: left;
font-size: 24rpx; }
color: #333;
border-bottom: 1px solid #f4f4f4; .search-keywords .icon {
margin-top: 19rpx;
float: right;
display: block;
margin-left: 511rpx;
height: 55rpx;
width: 55rpx;
}
.search-keywords .b {
width: 750rpx;
height: auto;
overflow: hidden;
padding-left: 31.25rpx;
}
.search-keywords .item {
display: inline-block;
width: auto;
height: 48rpx;
line-height: 48rpx;
padding: 0 15rpx;
border: 1px solid #999;
margin: 0 31.25rpx 31.25rpx 0;
font-size: 24rpx;
color: #333;
}
.search-keywords .item.active {
color: #b4282d;
border: 1px solid #b4282d;
}
.shelper-list {
width: 750rpx;
height: auto;
overflow: hidden;
background: #fff;
padding: 0 31.25rpx;
} }
.shelper-list .item {
height: 93rpx;
width: 687.5rpx;
line-height: 93rpx;
font-size: 24rpx;
color: #333;
border-bottom: 1px solid #f4f4f4;
}
.sort{ .sort {
position: fixed; position: fixed;
top: 91rpx; top: 91rpx;
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
} }
.sort-box{ .sort-box {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
overflow: hidden; overflow: hidden;
padding: 0 30rpx; padding: 0 30rpx;
display: flex; display: flex;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box .item{ .sort-box .item {
height: 78rpx; height: 78rpx;
line-height: 78rpx; line-height: 78rpx;
text-align: center; text-align: center;
flex:1; flex: 1;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.sort-box .item .txt{ .sort-box .item .txt {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #333; color: #333;
} }
.sort-box .item.active .txt{ .sort-box .item.active .txt {
color: #b4282d; color: #b4282d;
} }
.sort-box .item.by-price{ .sort-box .item.by-price {
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat; background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.asc{ .sort-box .item.by-price.active.asc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.desc{ .sort-box .item.by-price.active.desc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box-category{ .sort-box-category {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding: 40rpx 40rpx 0 0; padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box-category .item{ .sort-box-category .item {
height: 54rpx; height: 54rpx;
line-height: 54rpx; line-height: 54rpx;
text-align: center; text-align: center;
float: left; float: left;
padding: 0 16rpx; padding: 0 16rpx;
margin: 0 0 40rpx 40rpx; margin: 0 0 40rpx 40rpx;
border: 1px solid #666; border: 1px solid #666;
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
} }
.sort-box-category .item.active{ .sort-box-category .item.active {
color: #b4282d; color: #b4282d;
border: 1px solid #b4282d; border: 1px solid #b4282d;
} }
.cate-item{ .cate-item {
margin-top: 175rpx; margin-top: 175rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.cate-item .h{ .cate-item .h {
height: 145rpx; height: 145rpx;
width: 750rpx; width: 750rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.cate-item .h .name{ .cate-item .h .name {
display: block; display: block;
height: 35rpx; height: 35rpx;
margin-bottom: 18rpx; margin-bottom: 18rpx;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.cate-item .h .desc{ .cate-item .h .desc {
display: block; display: block;
height: 24rpx; height: 24rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }
.cate-item .b{ .cate-item .b {
width: 750rpx; width: 750rpx;
padding: 0 6.25rpx; padding: 0 6.25rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.cate-item .list-filter{ .cate-item .list-filter {
height: 80rpx; height: 80rpx;
width: 100%; width: 100%;
background: #fff; background: #fff;
margin-bottom: 6.25rpx; margin-bottom: 6.25rpx;
} }
.cate-item .b .item{ .cate-item .b .item {
float: left; float: left;
background: #fff; background: #fff;
width: 365rpx; width: 365rpx;
...@@ -283,16 +282,16 @@ page{ ...@@ -283,16 +282,16 @@ page{
text-align: center; text-align: center;
} }
.cate-item .b .item-b{ .cate-item .b .item-b {
margin-left: 6.25rpx; margin-left: 6.25rpx;
} }
.cate-item .item .img{ .cate-item .item .img {
width: 302rpx; width: 302rpx;
height: 302rpx; height: 302rpx;
} }
.cate-item .item .name{ .cate-item .item .name {
display: block; display: block;
width: 365.625rpx; width: 365.625rpx;
height: 35rpx; height: 35rpx;
...@@ -304,7 +303,7 @@ page{ ...@@ -304,7 +303,7 @@ page{
color: #333; color: #333;
} }
.cate-item .item .price{ .cate-item .item .price {
display: block; display: block;
width: 365.625rpx; width: 365.625rpx;
height: 30rpx; height: 30rpx;
...@@ -313,24 +312,24 @@ page{ ...@@ -313,24 +312,24 @@ page{
color: #b4282d; color: #b4282d;
} }
.search-result-empty{ .search-result-empty {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding-top: 300rpx; padding-top: 300rpx;
} }
.search-result-empty .icon{ .search-result-empty .icon {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
width: 240rpx; width: 240rpx;
height: 240rpx; height: 240rpx;
} }
.search-result-empty .text{ .search-result-empty .text {
display: block; display: block;
width: 100%; width: 100%;
height: 40rpx; height: 40rpx;
font-size: 28rpx; font-size: 28rpx;
text-align: center; text-align: center;
color: #999; color: #999;
} }
\ No newline at end of file
...@@ -2,82 +2,85 @@ var util = require('../../utils/util.js'); ...@@ -2,82 +2,85 @@ var util = require('../../utils/util.js');
var api = require('../../config/api.js'); var api = require('../../config/api.js');
var app = getApp() var app = getApp()
Page({ Page({
data: { data: {
topicList: [], topicList: [],
page: 1, page: 1,
size: 10, size: 10,
count: 0, count: 0,
scrollTop: 0, scrollTop: 0,
showPage: false showPage: false
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.getTopic(); this.getTopic();
}, },
onReady: function () { onReady: function() {
// 页面渲染完成 // 页面渲染完成
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
nextPage: function (event) { nextPage: function(event) {
var that = this; var that = this;
if (this.data.page > that.data.count / that.data.size) { if (this.data.page > that.data.count / that.data.size) {
return true; return true;
} }
that.setData({
page: that.data.page + 1
});
this.getTopic(); that.setData({
page: that.data.page + 1
}, });
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) { this.getTopic();
if (res.errno === 0) {
that.setData({ },
scrollTop: 0, getTopic: function() {
topicList: res.data.data,
showPage: true, let that = this;
count: res.data.count that.setData({
}); scrollTop: 0,
} showPage: false,
wx.hideToast(); topicList: []
}); });
// 页面渲染完成
}, wx.showToast({
prevPage: function (event) { title: '加载中...',
if (this.data.page <= 1) { icon: 'loading',
return false; duration: 2000
} });
util.request(api.TopicList, {
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) {
var that = this;
that.setData({ that.setData({
page: that.data.page - 1 scrollTop: 0,
topicList: res.data.data,
showPage: true,
count: res.data.count
}); });
this.getTopic(); }
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
<view class="container"> <view class="container">
<scroll-view class="topic-list" scroll-y="true" scroll-top="{{scrollTop}}"> <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}}"> <navigator class="item" wx:for="{{topicList}}" wx:key="id" url="../topicDetail/topicDetail?id={{item.id}}">
<image class="img" src="{{item.picUrl}}"></image> <image class="img" src="{{item.picUrl}}"></image>
<view class="info"> <view class="info">
<text class="title">{{item.title}}</text> <text class="title">{{item.title}}</text>
<text class="desc">{{item.subtitle}}</text> <text class="desc">{{item.subtitle}}</text>
<text class="price">{{item.price}}元起</text> <text class="price">{{item.price}}元起</text>
</view> </view>
</navigator> </navigator>
<view class="page" wx:if="{{showPage}}"> <view class="page" wx:if="{{showPage}}">
<view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view> <view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view>
<view class="next {{ (count / size) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view> <view class="next {{ (count / size) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
\ No newline at end of file
...@@ -17,9 +17,12 @@ Page({ ...@@ -17,9 +17,12 @@ Page({
picPage: 1, picPage: 1,
size: 20 size: 20
}, },
getCommentCount: function () { getCommentCount: function() {
let that = this; let that = this;
util.request(api.CommentCount, { valueId: that.data.valueId, type: that.data.type}).then(function (res) { util.request(api.CommentCount, {
valueId: that.data.valueId,
type: that.data.type
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
...@@ -29,15 +32,15 @@ Page({ ...@@ -29,15 +32,15 @@ Page({
} }
}); });
}, },
getCommentList: function(){ getCommentList: function() {
let that = this; let that = this;
util.request(api.CommentList, { util.request(api.CommentList, {
valueId: that.data.valueId, valueId: that.data.valueId,
type: that.data.type, type: that.data.type,
size: that.data.size, size: that.data.size,
page: (that.data.showType == 0 ? that.data.allPage : that.data.picPage), page: (that.data.showType == 0 ? that.data.allPage : that.data.picPage),
showType: that.data.showType showType: that.data.showType
}).then(function (res) { }).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
if (that.data.showType == 0) { if (that.data.showType == 0) {
...@@ -56,7 +59,7 @@ Page({ ...@@ -56,7 +59,7 @@ Page({
} }
}); });
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.setData({ this.setData({
type: options.type, type: options.type,
...@@ -65,39 +68,39 @@ Page({ ...@@ -65,39 +68,39 @@ Page({
this.getCommentCount(); this.getCommentCount();
this.getCommentList(); this.getCommentList();
}, },
onReady: function () { onReady: function() {
// 页面渲染完成 // 页面渲染完成
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
switchTab: function () { switchTab: function() {
this.setData({ this.setData({
showType: this.data.showType == 1 ? 0 :1 showType: this.data.showType == 1 ? 0 : 1
}); });
this.getCommentList(); this.getCommentList();
}, },
onReachBottom: function(){ onReachBottom: function() {
console.log('onPullDownRefresh'); console.log('onPullDownRefresh');
if ( this.data.showType == 0) { if (this.data.showType == 0) {
if (this.data.allCount / this.data.size < this.data.allPage) { if (this.data.allCount / this.data.size < this.data.allPage) {
return false; return false;
} }
this.setData({ this.setData({
'allPage' : this.data.allPage + 1 'allPage': this.data.allPage + 1
}); });
} else { } else {
if (this.data.hasPicCount / this.data.size < this.data.picPage) { if (this.data.hasPicCount / this.data.size < this.data.picPage) {
......
...@@ -12,10 +12,6 @@ ...@@ -12,10 +12,6 @@
<view class="imgs" wx:if="{{item.picList.length > 0}}"> <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> <image class="img" wx:for="{{item.picList}}" wx:key="id" wx:for-item="pitem" src="{{pitem.picUrl}}"></image>
</view> </view>
<!--<view class="customer-service" wx:if="{{item.commentReplyVO}}">
<text class="u">小选回复:</text>
<text class="c">{{item.commentReplyVO.replyContent}}</text>
</view>-->
</view> </view>
</view> </view>
......
.comments{ .comments {
width: 100%; width: 100%;
height: auto; height: auto;
padding-left:30rpx; padding-left: 30rpx;
background: #fff; background: #fff;
margin: 20rpx 0; margin: 20rpx 0;
} }
.comments .b{ .comments .b {
height: auto; height: auto;
width: 720rpx; width: 720rpx;
} }
.comments .b.no-h{ .comments .b.no-h {
margin-top: 0; margin-top: 0;
} }
.comments .item{ .comments .item {
height: auto; height: auto;
width: 720rpx; width: 720rpx;
overflow: hidden; overflow: hidden;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
padding-bottom: 25rpx; padding-bottom: 25rpx;
} }
.comments .info{ .comments .info {
height: 127rpx; height: 127rpx;
width: 100%; width: 100%;
padding: 33rpx 0 27rpx 0; padding: 33rpx 0 27rpx 0;
} }
.comments .user{ .comments .user {
float: left; float: left;
width: auto; width: auto;
height: 67rpx; height: 67rpx;
line-height: 67rpx; line-height: 67rpx;
font-size: 0; font-size: 0;
} }
.comments .user image{ .comments .user image {
float: left; float: left;
width: 67rpx; width: 67rpx;
height: 67rpx; height: 67rpx;
margin-right: 17rpx; margin-right: 17rpx;
border-radius: 50%; border-radius: 50%;
} }
.comments .user text{ .comments .user text {
display: inline-block; display: inline-block;
width: auto; width: auto;
height: 66rpx; height: 66rpx;
overflow: hidden; overflow: hidden;
font-size: 29rpx; font-size: 29rpx;
line-height: 66rpx; line-height: 66rpx;
} }
.comments .time{ .comments .time {
display: block; display: block;
float: right; float: right;
width: auto; width: auto;
height: 67rpx; height: 67rpx;
line-height: 67rpx; line-height: 67rpx;
color: #7f7f7f; color: #7f7f7f;
font-size: 25rpx; font-size: 25rpx;
margin-right: 30rpx; margin-right: 30rpx;
} }
.comments .comment{ .comments .comment {
width: 720rpx; width: 720rpx;
padding-right: 30rpx; padding-right: 30rpx;
line-height: 45.8rpx; line-height: 45.8rpx;
font-size: 29rpx; font-size: 29rpx;
margin-bottom: 16rpx; margin-bottom: 16rpx;
} }
.comments .imgs{ .comments .imgs {
width: 720rpx; width: 720rpx;
height: 150rpx; height: 150rpx;
margin-bottom: 25rpx; margin-bottom: 25rpx;
} }
.comments .imgs .img{ .comments .imgs .img {
height: 150rpx; height: 150rpx;
width: 150rpx; width: 150rpx;
margin-right: 28rpx; margin-right: 28rpx;
} }
.comments .customer-service{ .comments .customer-service {
width: 690rpx; width: 690rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
margin-top: 23rpx; margin-top: 23rpx;
background: rgba(0,0,0,.03); background: rgba(0, 0, 0, 0.03);
padding: 21rpx; padding: 21rpx;
} }
.comments .customer-service .u {
.comments .customer-service .u{ font-size: 24rpx;
font-size: 24rpx; color: #333;
color: #333; line-height: 37.5rpx;
line-height: 37.5rpx;
} }
.comments .customer-service .c{ .comments .customer-service .c {
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
line-height: 37.5rpx; line-height: 37.5rpx;
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ Page({ ...@@ -14,7 +14,7 @@ Page({
picUrls: [], picUrls: [],
files: [] files: []
}, },
chooseImage: function (e) { chooseImage: function(e) {
if (this.data.files.length >= 5) { if (this.data.files.length >= 5) {
util.showErrorToast('只能上传五张图片') util.showErrorToast('只能上传五张图片')
return false; return false;
...@@ -25,7 +25,7 @@ Page({ ...@@ -25,7 +25,7 @@ Page({
count: 1, count: 1,
sizeType: ['original', 'compressed'], sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: function (res) { success: function(res) {
that.setData({ that.setData({
files: that.data.files.concat(res.tempFilePaths) files: that.data.files.concat(res.tempFilePaths)
}); });
...@@ -33,13 +33,13 @@ Page({ ...@@ -33,13 +33,13 @@ Page({
} }
}) })
}, },
upload: function (res) { upload: function(res) {
var that = this; var that = this;
const uploadTask = wx.uploadFile({ const uploadTask = wx.uploadFile({
url: api.StorageUpload, url: api.StorageUpload,
filePath: res.tempFilePaths[0], filePath: res.tempFilePaths[0],
name: 'file', name: 'file',
success: function (res) { success: function(res) {
var _res = JSON.parse(res.data); var _res = JSON.parse(res.data);
if (_res.errno === 0) { if (_res.errno === 0) {
var url = _res.data.url var url = _res.data.url
...@@ -50,7 +50,7 @@ Page({ ...@@ -50,7 +50,7 @@ Page({
}) })
} }
}, },
fail: function (e) { fail: function(e) {
wx.showModal({ wx.showModal({
title: '错误', title: '错误',
content: '上传失败', content: '上传失败',
...@@ -66,28 +66,24 @@ Page({ ...@@ -66,28 +66,24 @@ Page({
}) })
}, },
previewImage: function (e) { previewImage: function(e) {
wx.previewImage({ wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接 current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.files // 需要预览的图片http链接列表 urls: this.data.files // 需要预览的图片http链接列表
}) })
}, },
selectRater: function (e) { selectRater: function(e) {
var star = e.currentTarget.dataset.star + 1; var star = e.currentTarget.dataset.star + 1;
var starText; var starText;
if (star == 1) { if (star == 1) {
starText = '很差'; starText = '很差';
} } else if (star == 2) {
else if (star == 2) {
starText = '不太满意'; starText = '不太满意';
} } else if (star == 3) {
else if (star == 3) {
starText = '满意'; starText = '满意';
} } else if (star == 4) {
else if (star == 4) {
starText = '比较满意'; starText = '比较满意';
} } else {
else {
starText = '十分满意' starText = '十分满意'
} }
this.setData({ this.setData({
...@@ -96,8 +92,8 @@ Page({ ...@@ -96,8 +92,8 @@ Page({
}) })
}, },
onLoad: function (options) { onLoad: function(options) {
if (parseInt(options.type) !== 1){ if (parseInt(options.type) !== 1) {
return; return;
} }
...@@ -107,9 +103,11 @@ Page({ ...@@ -107,9 +103,11 @@ Page({
}); });
this.getTopic(); this.getTopic();
}, },
getTopic: function () { getTopic: function() {
let that = this; let that = this;
util.request(api.TopicDetail, { id: that.data.valueId }).then(function (res) { util.request(api.TopicDetail, {
id: that.data.valueId
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
...@@ -117,12 +115,12 @@ Page({ ...@@ -117,12 +115,12 @@ Page({
}); });
} }
}); });
}, },
onClose: function () { onClose: function() {
wx.navigateBack(); wx.navigateBack();
}, },
onPost: function () { onPost: function() {
let that = this; let that = this;
if (!this.data.content) { if (!this.data.content) {
...@@ -137,11 +135,11 @@ Page({ ...@@ -137,11 +135,11 @@ Page({
star: that.data.star, star: that.data.star,
hasPicture: that.data.hasPicture, hasPicture: that.data.hasPicture,
picUrls: that.data.picUrls picUrls: that.data.picUrls
}, 'POST').then(function (res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
wx.showToast({ wx.showToast({
title: '评论成功', title: '评论成功',
complete: function () { complete: function() {
wx.navigateBack(); wx.navigateBack();
} }
}) })
...@@ -161,18 +159,18 @@ Page({ ...@@ -161,18 +159,18 @@ Page({
content: event.detail.value, content: event.detail.value,
}) })
}, },
onReady: function () { onReady: function() {
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
} }
......
...@@ -35,10 +35,6 @@ ...@@ -35,10 +35,6 @@
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}"> <view class="weui-uploader__file" bindtap="previewImage" id="{{item}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" /> <image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
</view> </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> </block>
<view class="weui-uploader__input-box"> <view class="weui-uploader__input-box">
<view class="weui-uploader__input" bindtap="chooseImage"></view> <view class="weui-uploader__input" bindtap="chooseImage"></view>
......
...@@ -12,14 +12,16 @@ Page({ ...@@ -12,14 +12,16 @@ Page({
commentList: [], commentList: [],
topicGoods: [] topicGoods: []
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
var that = this; var that = this;
that.setData({ that.setData({
id: options.id id: options.id
}); });
util.request(api.TopicDetail, { id: that.data.id }).then(function (res) { util.request(api.TopicDetail, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
topic: res.data.topic, topic: res.data.topic,
...@@ -30,7 +32,9 @@ Page({ ...@@ -30,7 +32,9 @@ Page({
} }
}); });
util.request(api.TopicRelated, { id: that.data.id }).then(function (res) { util.request(api.TopicRelated, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
topicList: res.data topicList: res.data
...@@ -40,7 +44,13 @@ Page({ ...@@ -40,7 +44,13 @@ Page({
}, },
getCommentList() { getCommentList() {
let that = this; let that = this;
util.request(api.CommentList, { valueId: that.data.id, type: 1, showType: 0, page: 1, size: 5 }).then(function (res) { util.request(api.CommentList, {
valueId: that.data.id,
type: 1,
showType: 0,
page: 1,
size: 5
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
commentList: res.data.data, commentList: res.data.data,
...@@ -51,26 +61,27 @@ Page({ ...@@ -51,26 +61,27 @@ Page({
}, },
postComment() { postComment() {
if (!app.globalData.hasLogin) { if (!app.globalData.hasLogin) {
wx.navigateTo({ url: "/pages/auth/login/login" }); wx.navigateTo({
} url: "/pages/auth/login/login"
else { });
} else {
wx.navigateTo({ wx.navigateTo({
url: '/pages/topicCommentPost/topicCommentPost?valueId=' + this.data.id + '&type=1', url: '/pages/topicCommentPost/topicCommentPost?valueId=' + this.data.id + '&type=1',
}) })
} }
}, },
onReady: function () { onReady: function() {
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
this.getCommentList(); this.getCommentList();
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
} }
......
<scroll-view class="container"> <scroll-view class="container">
<scroll-view class="content"> <scroll-view class="content">
<import src="../../lib/wxParse/wxParse.wxml"/> <import src="../../lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:topicDetail.nodes}}"/> <template is="wxParse" data="{{wxParseData:topicDetail.nodes}}" />
</scroll-view> </scroll-view>
<scroll-view class="sv-goods" wx:if="{{topicGoods.length > 0 }}"> <scroll-view class="sv-goods" wx:if="{{topicGoods.length > 0 }}">
<view class="topic-goods"> <view class="topic-goods">
<view class="h"> <view class="h">
<text class="t">专题商品</text> <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> <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>
<view class="b"> <view class="b">
<view class="item" wx:for="{{topicGoods}}" wx:for-index="index" wx:for-item="item" wx:key="id"> <view class="item" wx:for="{{topicGoods}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.id}}"> <navigator url="/pages/goods/goods?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image> <image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<view class="right"> <view class="right">
<view class="text"> <view class="text">
<text class="name">{{item.name}}</text> <text class="name">{{item.name}}</text>
<text class="desc">{{item.brief}}</text> <text class="desc">{{item.brief}}</text>
<text class="price">¥{{item.retailPrice}}</text> <text class="price">¥{{item.retailPrice}}</text>
</view>
</view>
</navigator>
</view>
</view> </view>
</view> </view>
</navigator>
</view>
</view>
</view>
</scroll-view> </scroll-view>
<scroll-view class="comments"> <scroll-view class="comments">
<view class="h"> <view class="h">
<text class="t">精选留言</text> <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> <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>
<view class="has-comments" wx:if="{{commentList.length > 0 }}"> <view class="has-comments" wx:if="{{commentList.length > 0 }}">
<view class="b"> <view class="b">
<view class="item" wx:for="{{commentList}}" wx:key="id"> <view class="item" wx:for="{{commentList}}" wx:key="id">
<view class="info"> <view class="info">
...@@ -48,12 +48,12 @@ ...@@ -48,12 +48,12 @@
<view class="load" wx:if="{{commentCount > 5}}"> <view class="load" wx:if="{{commentCount > 5}}">
<navigator url="/pages/topicComment/topicComment?valueId={{topic.id}}&type=1">查看更多</navigator> <navigator url="/pages/topicComment/topicComment?valueId={{topic.id}}&type=1">查看更多</navigator>
</view> </view>
</view> </view>
<view class="no-comments" wx:if="{{commentList.length <= 0}}"> <view class="no-comments" wx:if="{{commentList.length <= 0}}">
<view class="b"> <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> <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> <text class="txt">等你来留言</text>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<scroll-view class="rec-box"> <scroll-view class="rec-box">
......
.content{ .content {
width: 100%; width: 100%;
height: auto; height: auto;
font-size: 0; font-size: 0;
} }
.content image{ .content image {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
} }
.comments{ .comments {
width: 100%; width: 100%;
height: auto; height: auto;
padding-left:30rpx; padding-left: 30rpx;
background: #fff; background: #fff;
margin-top: 20rpx; margin-top: 20rpx;
} }
.comments .h{ .comments .h {
height: 93rpx; height: 93rpx;
line-height: 93rpx; line-height: 93rpx;
width: 720rpx; width: 720rpx;
padding-right: 30rpx; padding-right: 30rpx;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.comments .h .t{ .comments .h .t {
display: block; display: block;
float: left; float: left;
width: 50%; width: 50%;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
} }
.comments .h .i{ .comments .h .i {
display: block; display: block;
float: right; float: right;
margin-top: 30rpx; margin-top: 30rpx;
width: 33rpx; width: 33rpx;
height: 33rpx; height: 33rpx;
} }
.comments .b{ .comments .b {
height: auto; height: auto;
width: 720rpx; width: 720rpx;
} }
.comments .item{ .comments .item {
height: auto; height: auto;
width: 720rpx; width: 720rpx;
overflow: hidden; overflow: hidden;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.comments .info{ .comments .info {
height: 127rpx; height: 127rpx;
width: 100%; width: 100%;
padding: 33rpx 0 27rpx 0; padding: 33rpx 0 27rpx 0;
} }
.comments .user{ .comments .user {
float: left; float: left;
width: auto; width: auto;
height: 67rpx; height: 67rpx;
line-height: 67rpx; line-height: 67rpx;
font-size: 0; font-size: 0;
} }
.comments .user .avatar{ .comments .user .avatar {
display: block; display: block;
float: left; float: left;
width: 67rpx; width: 67rpx;
height: 67rpx; height: 67rpx;
margin-right: 17rpx; margin-right: 17rpx;
border-radius: 50%; border-radius: 50%;
} }
.comments .user .nickname{ .comments .user .nickname {
display: block; display: block;
width: auto; width: auto;
float: left; float: left;
height: 66rpx; height: 66rpx;
overflow: hidden; overflow: hidden;
font-size: 29rpx; font-size: 29rpx;
line-height: 66rpx; line-height: 66rpx;
} }
.comments .time{ .comments .time {
display: block; display: block;
float: right; float: right;
width: auto; width: auto;
height: 67rpx; height: 67rpx;
line-height: 67rpx; line-height: 67rpx;
color: #7f7f7f; color: #7f7f7f;
font-size: 25rpx; font-size: 25rpx;
margin-right: 30rpx; margin-right: 30rpx;
} }
.comments .comment{ .comments .comment {
width: 720rpx; width: 720rpx;
padding-right: 30rpx; padding-right: 30rpx;
line-height: 45.8rpx; line-height: 45.8rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
} }
.comments .load{ .comments .load {
width: 720rpx; width: 720rpx;
height: 108rpx; height: 108rpx;
line-height: 108rpx; line-height: 108rpx;
text-align: center; text-align: center;
font-size: 38.5rpx; font-size: 38.5rpx;
} }
.no-comments{ .no-comments {
height: 297rpx; height: 297rpx;
} }
.no-comments .txt{ .no-comments .txt {
height: 43rpx; height: 43rpx;
line-height: 43rpx; line-height: 43rpx;
display: block; display: block;
width: 100%; width: 100%;
text-align: center; text-align: center;
font-size: 29rpx; font-size: 29rpx;
color: #7f7f7f; color: #7f7f7f;
} }
.no-comments .icon{ .no-comments .icon {
margin: 48rpx auto 18rpx auto; margin: 48rpx auto 18rpx auto;
height: 130rpx; height: 130rpx;
display: block; display: block;
width: 115rpx; width: 115rpx;
} }
.sv-goods{ .sv-goods {
width: 100%; width: 100%;
height: auto; height: auto;
padding-left:30rpx; padding-left: 30rpx;
background: #fff; background: #fff;
margin-top: 20rpx; margin-top: 20rpx;
} }
.topic-goods .b .item { .topic-goods .b .item {
border-top: 1px solid #d9d9d9; border-top: 1px solid #d9d9d9;
margin: 0 20rpx; margin: 0 20rpx;
height: 244rpx; height: 244rpx;
width: 710rpx; width: 710rpx;
} }
.topic-goods .b .img { .topic-goods .b .img {
margin-top: 12rpx; margin-top: 12rpx;
margin-right: 12rpx; margin-right: 12rpx;
float: left; float: left;
width: 220rpx; width: 220rpx;
height: 220rpx; height: 220rpx;
} }
.topic-goods .b .right { .topic-goods .b .right {
float: left; float: left;
height: 244rpx; height: 244rpx;
width: 476rpx; width: 476rpx;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
} }
.topic-goods .b .text { .topic-goods .b .text {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
overflow: hidden; overflow: hidden;
height: 244rpx; height: 244rpx;
width: 476rpx; width: 476rpx;
} }
.topic-goods .b .name { .topic-goods .b .name {
float: left; float: left;
width: 330rpx; width: 330rpx;
display: block; display: block;
color: #333; color: #333;
line-height: 50rpx; line-height: 50rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.topic-goods .b .desc { .topic-goods .b .desc {
width: 476rpx; width: 476rpx;
display: block; display: block;
color: #999; color: #999;
line-height: 50rpx; line-height: 50rpx;
font-size: 25rpx; font-size: 25rpx;
} }
.topic-goods .b .price { .topic-goods .b .price {
width: 476rpx; width: 476rpx;
display: flex; display: flex;
color: #b4282d; color: #b4282d;
line-height: 50rpx; line-height: 50rpx;
font-size: 33rpx; font-size: 33rpx;
} }
.rec-box{ .rec-box {
width: 690rpx; width: 690rpx;
height: auto; height: auto;
margin: 0 30rpx; margin: 0 30rpx;
} }
.rec-box .h{ .rec-box .h {
position: relative; position: relative;
width: 690rpx; width: 690rpx;
height: 96rpx; height: 96rpx;
/*border-bottom: 1px solid #d0d0d0;*/ /*border-bottom: 1px solid #d0d0d0;*/
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
.rec-box .h .txt{ .rec-box .h .txt {
display: inline-block; display: inline-block;
position: absolute; position: absolute;
background: #f4f4f4; background: #f4f4f4;
top: 59rpx; top: 59rpx;
left: 200rpx; left: 200rpx;
width: 290rpx; width: 290rpx;
height: 45rpx; height: 45rpx;
line-height: 45rpx; line-height: 45rpx;
font-size: 30rpx; font-size: 30rpx;
color: #999; color: #999;
text-align: center; text-align: center;
} }
.rec-box .b .item{ .rec-box .b .item {
width: 690rpx; width: 690rpx;
height: 397rpx; height: 397rpx;
padding: 24rpx 24rpx 30rpx 24rpx; padding: 24rpx 24rpx 30rpx 24rpx;
background: #fff; background: #fff;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.rec-box .b .item .img{ .rec-box .b .item .img {
height: 278rpx; height: 278rpx;
width: 642rpx; width: 642rpx;
} }
.rec-box .b .item .title{ .rec-box .b .item .title {
display: block; display: block;
margin-top: 30rpx; margin-top: 30rpx;
height: 30rpx; height: 30rpx;
width: 642rpx; width: 642rpx;
font-size: 28rpx; font-size: 28rpx;
} }
@import "../../lib/wxParse/wxParse.wxss"; @import "../../lib/wxParse/wxParse.wxss";
...@@ -6,19 +6,19 @@ Page({ ...@@ -6,19 +6,19 @@ Page({
data: { data: {
addressList: [], addressList: [],
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
}, },
onReady: function () { onReady: function() {
// 页面渲染完成 // 页面渲染完成
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
this.getAddressList(); this.getAddressList();
}, },
getAddressList (){ getAddressList() {
let that = this; let that = this;
util.request(api.AddressList).then(function (res) { util.request(api.AddressList).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
addressList: res.data addressList: res.data
...@@ -26,7 +26,7 @@ Page({ ...@@ -26,7 +26,7 @@ Page({
} }
}); });
}, },
addressAddOrUpdate (event) { addressAddOrUpdate(event) {
console.log(event) console.log(event)
//返回之前,先取出上一页对象,并设置addressId //返回之前,先取出上一页对象,并设置addressId
...@@ -55,13 +55,13 @@ Page({ ...@@ -55,13 +55,13 @@ Page({
}) })
} }
}, },
deleteAddress(event){ deleteAddress(event) {
console.log(event.target) console.log(event.target)
let that = this; let that = this;
wx.showModal({ wx.showModal({
title: '', title: '',
content: '确定要删除地址?', content: '确定要删除地址?',
success: function (res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
let addressId = event.target.dataset.addressId; let addressId = event.target.dataset.addressId;
util.request(api.AddressDelete, { util.request(api.AddressDelete, {
...@@ -80,12 +80,12 @@ Page({ ...@@ -80,12 +80,12 @@ Page({
} }
}) })
return false; return false;
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
} }
}) })
\ No newline at end of file
<view class="container"> <view class="container">
<view class="address-list" wx:if="{{ addressList.length > 0 }}"> <view class="address-list" wx:if="{{ addressList.length > 0 }}">
<view class="item" wx:for="{{addressList}}" wx:key="id" bindtap="addressAddOrUpdate" data-address-id="{{item.id}}"> <view class="item" wx:for="{{addressList}}" wx:key="id" bindtap="addressAddOrUpdate" data-address-id="{{item.id}}">
<view class="l"> <view class="l">
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
<view class="default" wx:if="{{item.isDefault}}">默认</view> <view class="default" wx:if="{{item.isDefault}}">默认</view>
</view> </view>
<view class="c"> <view class="c">
<view class="mobile">{{item.mobile}}</view> <view class="mobile">{{item.mobile}}</view>
<view class="address">{{item.detailedAddress}}</view> <view class="address">{{item.detailedAddress}}</view>
</view> </view>
<view class="r"> <view class="r">
<image catchtap="deleteAddress" data-address-id="{{item.id}}" class="del" src="/static/images/del-address.png"></image> <image catchtap="deleteAddress" data-address-id="{{item.id}}" class="del" src="/static/images/del-address.png"></image>
</view> </view>
</view>
</view> </view>
<view class="empty-view" wx:if="{{ addressList.length <= 0 }}"> </view>
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noAddress-26d570cefa.png"></image> <view class="empty-view" wx:if="{{ addressList.length <= 0 }}">
<text class="text">收货地址在哪里</text> <image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noAddress-26d570cefa.png"></image>
</view> <text class="text">收货地址在哪里</text>
<view class="add-address" bindtap="addressAddOrUpdate" data-address-id="0">新建</view> </view>
</view> <view class="add-address" bindtap="addressAddOrUpdate" data-address-id="0">新建</view>
</view>
\ No newline at end of file
page{ page {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.container{ .container {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
.address-list{ .address-list {
padding-left: 31.25rpx; padding-left: 31.25rpx;
background: #fff url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/address-bg-bd30f2bfeb.png) 0 0 repeat-x; background: #fff 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: auto 10.5rpx; background-size: auto 10.5rpx;
margin-bottom: 90rpx; margin-bottom: 90rpx;
} }
.address-list .item{ .address-list .item {
height: 156.55rpx; height: 156.55rpx;
align-items: center; align-items: center;
display: flex; display: flex;
border-bottom: 1rpx solid #DCD9D9; border-bottom: 1rpx solid #dcd9d9;
} }
.address-list .l{ .address-list .l {
width: 125rpx; width: 125rpx;
height: 80rpx; height: 80rpx;
overflow: hidden; overflow: hidden;
} }
.address-list .name{ .address-list .name {
width: 125rpx; width: 125rpx;
height: 43rpx; height: 43rpx;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
margin-bottom: 5.2rpx; margin-bottom: 5.2rpx;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
} }
.address-list .default{ .address-list .default {
width: 62.5rpx; width: 62.5rpx;
height: 33rpx; height: 33rpx;
line-height: 28rpx; line-height: 28rpx;
text-align: center; text-align: center;
font-size: 20rpx; font-size: 20rpx;
color: #b4282d; color: #b4282d;
border: 1rpx solid #b4282d; border: 1rpx solid #b4282d;
visibility: visible; visibility: visible;
} }
.address-list .c {
.address-list .c{ flex: 1;
flex: 1; height: auto;
height: auto; overflow: hidden;
overflow: hidden;
} }
.address-list .mobile{ .address-list .mobile {
height: 29rpx;
height: 29rpx; font-size: 29rpx;
font-size: 29rpx; line-height: 29rpx;
line-height: 29rpx; overflow: hidden;
overflow: hidden; color: #333;
color: #333; margin-bottom: 6.25rpx;
margin-bottom: 6.25rpx;
} }
.address-list .address{ .address-list .address {
height: 37rpx; height: 37rpx;
font-size: 25rpx; font-size: 25rpx;
line-height: 37rpx; line-height: 37rpx;
overflow: hidden; overflow: hidden;
color: #666; color: #666;
} }
.address-list .r{ .address-list .r {
width: 52rpx; width: 52rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
margin-right: 16.5rpx; margin-right: 16.5rpx;
} }
.address-list .del{ .address-list .del {
display: block; display: block;
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
} }
.add-address{ .add-address {
border: none; border: none;
right: 0; right: 0;
display: flex; display: flex;
...@@ -117,7 +115,7 @@ page{ ...@@ -117,7 +115,7 @@ page{
background-image: linear-gradient(to right, #9a9ba1 0%, #9a9ba1 100%); background-image: linear-gradient(to right, #9a9ba1 0%, #9a9ba1 100%);
} }
.empty-view{ .empty-view {
height: 100%; height: 100%;
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -126,15 +124,15 @@ page{ ...@@ -126,15 +124,15 @@ page{
justify-content: center; justify-content: center;
} }
.empty-view .icon{ .empty-view .icon {
height: 248rpx; height: 248rpx;
width: 258rpx; width: 258rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.empty-view .text{ .empty-view .text {
width: auto; width: auto;
font-size: 28rpx; font-size: 28rpx;
line-height: 35rpx; line-height: 35rpx;
color: #999; color: #999;
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ var app = getApp(); ...@@ -6,7 +6,7 @@ var app = getApp();
Page({ Page({
data: { data: {
address: { address: {
id:0, id: 0,
provinceId: 0, provinceId: 0,
cityId: 0, cityId: 0,
areaId: 0, areaId: 0,
...@@ -20,10 +20,24 @@ Page({ ...@@ -20,10 +20,24 @@ Page({
}, },
addressId: 0, addressId: 0,
openSelectRegion: false, openSelectRegion: false,
selectRegionList: [ selectRegionList: [{
{ id: 0, name: '省份', pid: 1, type: 1 }, id: 0,
{ id: 0, name: '城市', pid: 1, type: 2 }, name: '省份',
{ id: 0, name: '区县', pid: 1, type: 3 } pid: 1,
type: 1
},
{
id: 0,
name: '城市',
pid: 1,
type: 2
},
{
id: 0,
name: '区县',
pid: 1,
type: 3
}
], ],
regionType: 1, regionType: 1,
regionList: [], regionList: [],
...@@ -43,14 +57,14 @@ Page({ ...@@ -43,14 +57,14 @@ Page({
address: address address: address
}); });
}, },
bindinputAddress (event){ bindinputAddress(event) {
let address = this.data.address; let address = this.data.address;
address.address = event.detail.value; address.address = event.detail.value;
this.setData({ this.setData({
address: address address: address
}); });
}, },
bindIsDefault(){ bindIsDefault() {
let address = this.data.address; let address = this.data.address;
address.isDefault = !address.isDefault; address.isDefault = !address.isDefault;
this.setData({ this.setData({
...@@ -59,12 +73,14 @@ Page({ ...@@ -59,12 +73,14 @@ Page({
}, },
getAddressDetail() { getAddressDetail() {
let that = this; let that = this;
util.request(api.AddressDetail, { id: that.data.addressId }).then(function (res) { util.request(api.AddressDetail, {
id: that.data.addressId
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
if(res.data){ if (res.data) {
that.setData({ that.setData({
address: res.data address: res.data
}); });
} }
} }
}); });
...@@ -110,10 +126,24 @@ Page({ ...@@ -110,10 +126,24 @@ Page({
this.getRegionList(address.cityId); this.getRegionList(address.cityId);
} else { } else {
this.setData({ this.setData({
selectRegionList: [ selectRegionList: [{
{ id: 0, name: '省份', pid: 0, type: 1 }, id: 0,
{ id: 0, name: '城市', pid: 0, type: 2 }, name: '省份',
{ id: 0, name: '区县', pid: 0, type: 3 } pid: 0,
type: 1
},
{
id: 0,
name: '城市',
pid: 0,
type: 2
},
{
id: 0,
name: '区县',
pid: 0,
type: 3
}
], ],
regionType: 1 regionType: 1
}) })
...@@ -123,7 +153,7 @@ Page({ ...@@ -123,7 +153,7 @@ Page({
this.setRegionDoneStatus(); this.setRegionDoneStatus();
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
console.log(options) console.log(options)
if (options.id && options.id != 0) { if (options.id && options.id != 0) {
...@@ -133,7 +163,7 @@ Page({ ...@@ -133,7 +163,7 @@ Page({
this.getAddressDetail(); this.getAddressDetail();
} }
}, },
onReady: function () { onReady: function() {
}, },
selectRegionType(event) { selectRegionType(event) {
...@@ -142,14 +172,14 @@ Page({ ...@@ -142,14 +172,14 @@ Page({
let selectRegionList = that.data.selectRegionList; let selectRegionList = that.data.selectRegionList;
//判断是否可点击 //判断是否可点击
if (regionTypeIndex + 1 == this.data.regionType || (regionTypeIndex - 1 >= 0 && selectRegionList[regionTypeIndex-1].id <= 0)) { if (regionTypeIndex + 1 == this.data.regionType || (regionTypeIndex - 1 >= 0 && selectRegionList[regionTypeIndex - 1].id <= 0)) {
return false; return false;
} }
this.setData({ this.setData({
regionType: regionTypeIndex + 1 regionType: regionTypeIndex + 1
}) })
let selectRegionItem = selectRegionList[regionTypeIndex]; let selectRegionItem = selectRegionList[regionTypeIndex];
this.getRegionList(selectRegionItem.pid); this.getRegionList(selectRegionItem.pid);
...@@ -240,7 +270,9 @@ Page({ ...@@ -240,7 +270,9 @@ Page({
getRegionList(regionId) { getRegionList(regionId) {
let that = this; let that = this;
let regionType = that.data.regionType; let regionType = that.data.regionType;
util.request(api.RegionList, { pid: regionId }).then(function (res) { util.request(api.RegionList, {
pid: regionId
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
regionList: res.data.map(item => { regionList: res.data.map(item => {
...@@ -258,10 +290,10 @@ Page({ ...@@ -258,10 +290,10 @@ Page({
} }
}); });
}, },
cancelAddress(){ cancelAddress() {
wx.navigateBack(); wx.navigateBack();
}, },
saveAddress(){ saveAddress() {
console.log(this.data.address) console.log(this.data.address)
let address = this.data.address; let address = this.data.address;
...@@ -293,7 +325,7 @@ Page({ ...@@ -293,7 +325,7 @@ Page({
} }
let that = this; let that = this;
util.request(api.AddressSave, { util.request(api.AddressSave, {
id: address.id, id: address.id,
name: address.name, name: address.name,
mobile: address.mobile, mobile: address.mobile,
...@@ -302,7 +334,7 @@ Page({ ...@@ -302,7 +334,7 @@ Page({
areaId: address.areaId, areaId: address.areaId,
address: address.address, address: address.address,
isDefault: address.isDefault isDefault: address.isDefault
}, 'POST').then(function (res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
//返回之前,先取出上一页对象,并设置addressId //返回之前,先取出上一页对象,并设置addressId
var pages = getCurrentPages(); var pages = getCurrentPages();
...@@ -325,15 +357,15 @@ Page({ ...@@ -325,15 +357,15 @@ Page({
}); });
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
} }
......
<view class="add-address"> <view class="add-address">
<view class="add-form"> <view class="add-form">
<view class="form-item"> <view class="form-item">
<input class="input" bindinput="bindinputName" placeholder="姓名" value="{{address.name}}" auto-focus/> <input class="input" bindinput="bindinputName" placeholder="姓名" value="{{address.name}}" auto-focus/>
</view>
<view class="form-item">
<input class="input" bindinput="bindinputMobile" value="{{address.mobile}}" placeholder="手机号码"/>
</view>
<view class="form-item">
<input class="input" value="{{address.provinceName + address.cityName + address.areaName}}" disabled="true" bindtap="chooseRegion" placeholder="省份、城市、区县"/>
</view>
<view class="form-item">
<input class="input" bindinput="bindinputAddress" value="{{address.address}}" placeholder="详细地址, 如街道、楼盘号等"/>
</view>
<view class="form-default">
<text bindtap="bindIsDefault" class="default-input {{address.isDefault == 1 ? 'selected' : ''}}">设为默认地址</text>
</view>
</view> </view>
<view class="form-item">
<view class="btns"> <input class="input" bindinput="bindinputMobile" value="{{address.mobile}}" placeholder="手机号码" />
<button class="cannel" bindtap="cancelAddress">取消</button> </view>
<button class="save" bindtap="saveAddress">保存</button> <view class="form-item">
<input class="input" value="{{address.provinceName + address.cityName + address.areaName}}" disabled="true" bindtap="chooseRegion" placeholder="省份、城市、区县" />
</view>
<view class="form-item">
<input class="input" bindinput="bindinputAddress" value="{{address.address}}" placeholder="详细地址, 如街道、楼盘号等" />
</view>
<view class="form-default">
<text bindtap="bindIsDefault" class="default-input {{address.isDefault == 1 ? 'selected' : ''}}">设为默认地址</text>
</view> </view>
</view>
<view class="region-select" wx:if="{{openSelectRegion}}"> <view class="btns">
<view class="hd"> <button class="cannel" bindtap="cancelAddress">取消</button>
<view class="region-selected"> <button class="save" bindtap="saveAddress">保存</button>
<view class="item {{item.id == 0 ? 'disabled' : ''}} {{(regionType -1) === index ? 'selected' : ''}}" bindtap="selectRegionType" data-region-type-index="{{index}}" wx:for="{{selectRegionList}}" wx:key="id">{{item.name}}</view> </view>
</view>
<view class="done {{selectRegionDone ? '' : 'disabled'}}" bindtap="doneSelectRegion">确定</view> <view class="region-select" wx:if="{{openSelectRegion}}">
<view class="hd">
<view class="region-selected">
<view class="item {{item.id == 0 ? 'disabled' : ''}} {{(regionType -1) === index ? 'selected' : ''}}" bindtap="selectRegionType" data-region-type-index="{{index}}" wx:for="{{selectRegionList}}" wx:key="id">{{item.name}}</view>
</view> </view>
<view class="bd"> <view class="done {{selectRegionDone ? '' : 'disabled'}}" bindtap="doneSelectRegion">确定</view>
</view>
<view class="bd">
<scroll-view scroll-y class="region-list"> <scroll-view scroll-y class="region-list">
<view class="item {{item.selected ? 'selected' : ''}}" bindtap="selectRegion" data-region-index="{{index}}" wx:for="{{regionList}}" wx:key="id">{{item.name}}</view> <view class="item {{item.selected ? 'selected' : ''}}" bindtap="selectRegion" data-region-index="{{index}}" wx:for="{{regionList}}" wx:key="id">{{item.name}}</view>
</scroll-view> </scroll-view>
</view>
</view> </view>
</view>
</view> </view>
<view class="bg-mask" bindtap="cancelSelectRegion" wx:if="{{openSelectRegion}}"></view> <view class="bg-mask" bindtap="cancelSelectRegion" wx:if="{{openSelectRegion}}"></view>
\ No newline at end of file
page{ page {
height: 100%; height: 100%;
background: #f4f4f4; background: #f4f4f4;
}
.add-address .add-form{
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
} }
.add-address .form-item{ .add-address .add-form {
height: 116rpx; background: #fff;
padding-left: 31.25rpx; width: 100%;
border-bottom: 1px solid #d9d9d9; height: auto;
display: flex; overflow: hidden;
align-items: center;
padding-right: 31.25rpx;
} }
.add-address .input{ .add-address .form-item {
flex: 1; height: 116rpx;
height: 44rpx; padding-left: 31.25rpx;
line-height: 44rpx; border-bottom: 1px solid #d9d9d9;
overflow: hidden; display: flex;
align-items: center;
padding-right: 31.25rpx;
} }
.add-address .form-default{ .add-address .input {
border-bottom: 1px solid #d9d9d9; flex: 1;
height: 96rpx; height: 44rpx;
background: #fafafa; line-height: 44rpx;
padding-top: 28rpx; overflow: hidden;
font-size: 28rpx;
} }
.default-input{ .add-address .form-default {
margin: 0 auto; border-bottom: 1px solid #d9d9d9;
display: block; height: 96rpx;
width: 240rpx; background: #fafafa;
height: 40rpx; padding-top: 28rpx;
padding-left: 50rpx; font-size: 28rpx;
line-height: 40rpx;
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
background-size: 38rpx 486rpx;
font-size: 28rpx;
} }
.default-input.selected{ .default-input {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat; margin: 0 auto;
background-size: 38rpx 486rpx; display: block;
width: 240rpx;
height: 40rpx;
padding-left: 50rpx;
line-height: 40rpx;
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
background-size: 38rpx 486rpx;
font-size: 28rpx;
} }
.add-address .btns{ .default-input.selected {
position: fixed; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
bottom: 0; background-size: 38rpx 486rpx;
left: 0;
overflow: hidden;
display: flex;
height: 100rpx;
width: 100%;
} }
.add-address .cannel,.add-address .save{ .add-address .btns {
flex: 1; position: fixed;
height: 100rpx; bottom: 0;
text-align: center; left: 0;
line-height: 100rpx; overflow: hidden;
font-size: 28rpx; display: flex;
color: #fff; height: 100rpx;
border:none; width: 100%;
border-radius: 0;
} }
.add-address .cannel{ .add-address .cannel, .add-address .save {
background: #333; flex: 1;
height: 100rpx;
text-align: center;
line-height: 100rpx;
font-size: 28rpx;
color: #fff;
border: none;
border-radius: 0;
} }
.add-address .save{ .add-address .cannel {
background: #b4282d; background: #333;
} }
.add-address .save {
background: #b4282d;
}
.region-select{ .region-select {
width: 100%; width: 100%;
height: 600rpx; height: 600rpx;
background: #fff; background: #fff;
position: fixed; position: fixed;
z-index: 10; z-index: 10;
left:0; left: 0;
bottom: 0; bottom: 0;
} }
.region-select .hd{ .region-select .hd {
height: 108rpx; height: 108rpx;
width: 100%; width: 100%;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
padding: 46rpx 30rpx 0 30rpx; padding: 46rpx 30rpx 0 30rpx;
} }
.region-select .region-selected{ .region-select .region-selected {
float: left; float: left;
height: 60rpx; height: 60rpx;
display: flex; display: flex;
} }
.region-select .region-selected .item{ .region-select .region-selected .item {
max-width: 140rpx; max-width: 140rpx;
margin-right: 30rpx; margin-right: 30rpx;
text-align: left; text-align: left;
...@@ -112,19 +112,19 @@ page{ ...@@ -112,19 +112,19 @@ page{
color: #333; color: #333;
font-size: 28rpx; font-size: 28rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.region-select .region-selected .item.disabled{ .region-select .region-selected .item.disabled {
color: #999; color: #999;
} }
.region-select .region-selected .item.selected{ .region-select .region-selected .item.selected {
color: #b4282d; color: #b4282d;
} }
.region-select .done{ .region-select .done {
float: right; float: right;
height: 60rpx; height: 60rpx;
width: 60rpx; width: 60rpx;
...@@ -136,21 +136,21 @@ page{ ...@@ -136,21 +136,21 @@ page{
font-size: 28rpx; font-size: 28rpx;
} }
.region-select .done.disabled{ .region-select .done.disabled {
color: #999; color: #999;
} }
.region-select .bd{ .region-select .bd {
height: 492rpx; height: 492rpx;
width: 100%; width: 100%;
padding: 0 30rpx; padding: 0 30rpx;
} }
.region-select .region-list{ .region-select .region-list {
height: 492rpx; height: 492rpx;
} }
.region-select .region-list .item{ .region-select .region-list .item {
width: 100%; width: 100%;
height: 104rpx; height: 104rpx;
line-height: 104rpx; line-height: 104rpx;
...@@ -159,17 +159,16 @@ page{ ...@@ -159,17 +159,16 @@ page{
font-size: 28rpx; font-size: 28rpx;
} }
.region-select .region-list .item.selected{ .region-select .region-list .item.selected {
color: #b4282d; color: #b4282d;
} }
.bg-mask {
.bg-mask{
height: 100%; height: 100%;
width: 100%; width: 100%;
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
position: fixed; position: fixed;
top:0; top: 0;
left:0; left: 0;
z-index: 8; z-index: 8;
} }
...@@ -16,7 +16,11 @@ Page({ ...@@ -16,7 +16,11 @@ Page({
title: '加载中...', title: '加载中...',
}); });
let that = this; let that = this;
util.request(api.CollectList, { type: that.data.type, page: that.data.page, size: that.data.size }).then(function (res) { util.request(api.CollectList, {
type: that.data.type,
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
collectList: that.data.collectList.concat(res.data.collectList), collectList: that.data.collectList.concat(res.data.collectList),
...@@ -26,7 +30,7 @@ Page({ ...@@ -26,7 +30,7 @@ Page({
wx.hideLoading(); wx.hideLoading();
}); });
}, },
onLoad: function (options) { onLoad: function(options) {
this.getCollectList(); this.getCollectList();
}, },
onReachBottom() { onReachBottom() {
...@@ -43,22 +47,22 @@ Page({ ...@@ -43,22 +47,22 @@ Page({
}); });
return false; return false;
} }
}, },
onReady: function () { onReady: function() {
}, },
onShow: function () { onShow: function() {
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
openGoods(event) { openGoods(event) {
let that = this; let that = this;
let index = event.currentTarget.dataset.index; let index = event.currentTarget.dataset.index;
let goodsId = this.data.collectList[index].valueId; let goodsId = this.data.collectList[index].valueId;
...@@ -71,10 +75,13 @@ Page({ ...@@ -71,10 +75,13 @@ Page({
wx.showModal({ wx.showModal({
title: '', title: '',
content: '确定删除吗?', content: '确定删除吗?',
success: function (res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
util.request(api.CollectAddOrDelete, { type: that.data.type, valueId: goodsId}, 'POST').then(function (res) { util.request(api.CollectAddOrDelete, {
type: that.data.type,
valueId: goodsId
}, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
console.log(res.data); console.log(res.data);
wx.showToast({ wx.showToast({
...@@ -92,24 +99,24 @@ Page({ ...@@ -92,24 +99,24 @@ Page({
} }
}) })
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: '/pages/goods/goods?id=' + goodsId, url: '/pages/goods/goods?id=' + goodsId,
}); });
} }
}, },
//按下事件开始 //按下事件开始
touchStart: function (e) { touchStart: function(e) {
let that = this; let that = this;
that.setData({ that.setData({
touchStart: e.timeStamp touchStart: e.timeStamp
}) })
}, },
//按下事件结束 //按下事件结束
touchEnd: function (e) { touchEnd: function(e) {
let that = this; let that = this;
that.setData({ that.setData({
touchEnd: e.timeStamp touchEnd: e.timeStamp
}) })
}, },
}) })
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</view> </view>
</view> </view>
<view class="collect-list" wx:else> <view class="collect-list" wx:else>
<view class="item" bindtap="openGoods" bindtouchstart="touchStart" bindtouchend="touchEnd" wx:for="{{collectList}}" wx:key="id" data-index="{{index}}"> <view class="item" bindtap="openGoods" bindtouchstart="touchStart" bindtouchend="touchEnd" wx:for="{{collectList}}" wx:key="id" data-index="{{index}}">
<image class="img" src="{{item.picUrl}}"></image> <image class="img" src="{{item.picUrl}}"></image>
<view class="info"> <view class="info">
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
...@@ -16,4 +16,4 @@ ...@@ -16,4 +16,4 @@
</view> </view>
</view> </view>
</view> </view>
\ No newline at end of file
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