chore[renard-wx]: 清理代码,删除不必要的组件。
This commit is contained in:
@@ -7,21 +7,16 @@
|
||||
"pages/ucenter/index/index",
|
||||
"pages/ucenter/address/address",
|
||||
"pages/ucenter/addressAdd/addressAdd",
|
||||
"pages/ucenter/footprint/footprint",
|
||||
"pages/ucenter/order/order",
|
||||
"pages/ucenter/orderDetail/orderDetail",
|
||||
"pages/ucenter/coupon/coupon",
|
||||
"pages/ucenter/collect/collect",
|
||||
"pages/auth/login/login",
|
||||
"pages/auth/register/register",
|
||||
"pages/auth/reset/reset",
|
||||
"pages/payResult/payResult",
|
||||
"pages/comment/comment",
|
||||
"pages/commentPost/commentPost",
|
||||
"pages/topic/topic",
|
||||
"pages/topicComment/topicComment",
|
||||
"pages/topicDetail/topicDetail",
|
||||
"pages/topicCommentPost/topicCommentPost",
|
||||
"pages/brand/brand",
|
||||
"pages/brandDetail/brandDetail",
|
||||
"pages/search/search",
|
||||
|
||||
@@ -5,10 +5,6 @@ var user = require('../../../utils/user.js');
|
||||
var app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
username: '',
|
||||
password: '',
|
||||
code: '',
|
||||
loginErrorCount: 0
|
||||
},
|
||||
onLoad: function (options) {
|
||||
// 页面初始化 options为页面跳转所带来的参数
|
||||
@@ -50,91 +46,5 @@ Page({
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
accountLogin: function () {
|
||||
var that = this;
|
||||
|
||||
if (this.data.password.length < 1 || this.data.username.length < 1) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '请输入用户名和密码',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
wx.request({
|
||||
url: api.AuthLoginByAccount,
|
||||
data: {
|
||||
username: that.data.username,
|
||||
password: that.data.password
|
||||
},
|
||||
method: 'POST',
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.data.errno == 0){
|
||||
that.setData({
|
||||
loginErrorCount: 0
|
||||
});
|
||||
app.globalData.hasLogin = true;
|
||||
wx.setStorageSync('userInfo', res.data.data.userInfo);
|
||||
wx.setStorage({
|
||||
key:"token",
|
||||
data: res.data.data.token,
|
||||
success: function(){
|
||||
wx.switchTab({
|
||||
url: '/pages/ucenter/index/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
that.setData({
|
||||
loginErrorCount: that.data.loginErrorCount + 1
|
||||
});
|
||||
app.globalData.hasLogin = false;
|
||||
util.showErrorToast('账户登录失败');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
bindUsernameInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
username: e.detail.value
|
||||
});
|
||||
},
|
||||
bindPasswordInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
password: e.detail.value
|
||||
});
|
||||
},
|
||||
bindCodeInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
code: e.detail.value
|
||||
});
|
||||
},
|
||||
clearInput: function (e) {
|
||||
switch (e.currentTarget.id) {
|
||||
case 'clear-username':
|
||||
this.setData({
|
||||
username: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-password':
|
||||
this.setData({
|
||||
password: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-code':
|
||||
this.setData({
|
||||
code: ''
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,31 +1,6 @@
|
||||
<view class="container">
|
||||
<view class="form-box">
|
||||
|
||||
<!-- <view class="form-item">
|
||||
<input class="username" value="{{username}}" bindinput="bindUsernameInput" placeholder="账号"/>
|
||||
<image wx:if="{{ username.length > 0 }}" id="clear-username" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<input class="password" value="{{password}}" password bindinput="bindPasswordInput" placeholder="密码"/>
|
||||
<image class="clear" id="clear-password" wx:if="{{ password.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<view class="form-item-code" wx-if="{{loginErrorCount >= 3}}">
|
||||
<view class="form-item code-item">
|
||||
<input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码"/>
|
||||
<image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
<image class="code-img" src="https://dl.reg.163.com/cp?pd=yanxuan_web&pkid=SkeBZeG&random=1489903563234"></image>
|
||||
</view>
|
||||
|
||||
<button type="default" class="login-btn" bindtap="accountLogin">账号登录</button>
|
||||
|
||||
<view class="form-item-text">
|
||||
<navigator url="/pages/auth/register/register" class="register">注册账号</navigator>
|
||||
<navigator url="/pages/auth/reset/reset" class="reset">忘记密码</navigator>
|
||||
</view> -->
|
||||
|
||||
<button type="primary" open-type="getUserInfo" class="login-btn" bindgetuserinfo="wxLogin">微信直接登录</button>
|
||||
|
||||
</view>
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
var api = require('../../../config/api.js');
|
||||
var check = require('../../../utils/check.js');
|
||||
|
||||
var app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
username: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
mobile: '',
|
||||
code: ''
|
||||
},
|
||||
onLoad: function (options) {
|
||||
// 页面初始化 options为页面跳转所带来的参数
|
||||
// 页面渲染完成
|
||||
|
||||
},
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
onShow: function () {
|
||||
// 页面显示
|
||||
|
||||
},
|
||||
onHide: function () {
|
||||
// 页面隐藏
|
||||
|
||||
},
|
||||
onUnload: function () {
|
||||
// 页面关闭
|
||||
|
||||
},
|
||||
sendCode: function () {
|
||||
wx.showModal({
|
||||
title: '注意',
|
||||
content: '由于目前不支持手机短信发送,因此验证码任意值都可以',
|
||||
showCancel: false
|
||||
});
|
||||
},
|
||||
startRegister: function () {
|
||||
var that = this;
|
||||
|
||||
if (this.data.password.length < 3 || this.data.username.length < 3) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '用户名和密码不得少于3位',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.data.password != this.data.confirmPassword) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '确认密码不一致',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.data.mobile.length == 0 || this.data.code.length == 0) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '手机号和验证码不能为空',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!check.isValidPhone(this.data.mobile)) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '手机号输入不正确',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
wx.request({
|
||||
url: api.AuthRegister,
|
||||
data: {
|
||||
username: that.data.username,
|
||||
password: that.data.password,
|
||||
mobile: that.data.mobile,
|
||||
code: that.data.code
|
||||
},
|
||||
method: 'POST',
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.data.errno == 0) {
|
||||
app.globalData.hasLogin = true;
|
||||
wx.setStorageSync('userInfo', res.data.data.userInfo);
|
||||
wx.setStorage({
|
||||
key: "token",
|
||||
data: res.data.data.token,
|
||||
success: function () {
|
||||
wx.switchTab({
|
||||
url: '/pages/ucenter/index/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: res.data.errmsg,
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
bindUsernameInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
username: e.detail.value
|
||||
});
|
||||
},
|
||||
bindPasswordInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
password: e.detail.value
|
||||
});
|
||||
},
|
||||
bindConfirmPasswordInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
confirmPassword: e.detail.value
|
||||
});
|
||||
},
|
||||
bindMobileInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
mobile: e.detail.value
|
||||
});
|
||||
},
|
||||
bindCodeInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
code: e.detail.value
|
||||
});
|
||||
},
|
||||
clearInput: function (e) {
|
||||
switch (e.currentTarget.id) {
|
||||
case 'clear-username':
|
||||
this.setData({
|
||||
username: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-password':
|
||||
this.setData({
|
||||
password: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-confirm-password':
|
||||
this.setData({
|
||||
confirmPassword: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-mobile':
|
||||
this.setData({
|
||||
mobile: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-code':
|
||||
this.setData({
|
||||
code: ''
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "注册"
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<view class="container">
|
||||
<view class="form-box">
|
||||
|
||||
<view class="form-item">
|
||||
<input class="username" value="{{username}}" bindinput="bindUsernameInput" placeholder="用户名" auto-focus/>
|
||||
<image wx:if="{{ username.length > 0 }}" id="clear-username" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<input class="password" value="{{password}}" password bindinput="bindPasswordInput" placeholder="密码"/>
|
||||
<image class="clear" id="clear-password" wx:if="{{ password.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<input class="password" value="{{confirmPassword}}" password bindinput="bindConfirmPasswordInput" placeholder="确认密码"/>
|
||||
<image class="clear" id="clear-confirm-password" wx:if="{{ confirmPassword.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<input class="mobile" value="{{mobile}}" bindinput="bindMobileInput" placeholder="手机号" />
|
||||
<image wx:if="{{ mobile.length > 0 }}" id="clear-mobile" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<view class="form-item-code" >
|
||||
<view class="form-item code-item">
|
||||
<input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码"/>
|
||||
<image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
<view class="code-btn" bindtap="sendCode">获取验证码</view>
|
||||
</view>
|
||||
|
||||
<button type="default" class="register-btn" bindtap="startRegister">注册</button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -1,69 +0,0 @@
|
||||
.form-box{
|
||||
width: 100%;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
padding: 0 40rpx;
|
||||
margin-top: 96rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.form-item{
|
||||
position: relative;
|
||||
background: #fff;
|
||||
height: 96rpx;
|
||||
border-bottom: 1px solid #a78845;
|
||||
}
|
||||
|
||||
.form-item .username, .form-item .password, .form-item .mobile, .form-item .code{
|
||||
position: absolute;
|
||||
top: 26rpx;
|
||||
left: 0;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 44rpx;
|
||||
background: #fff;
|
||||
color: #a78845;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.form-item-code{
|
||||
margin-top:32rpx;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-item-code .form-item{
|
||||
float: left;
|
||||
width: 350rpx;
|
||||
}
|
||||
|
||||
.form-item-code .code-btn{
|
||||
float: right;
|
||||
padding: 20rpx 40rpx;
|
||||
border: 1px solid #d9d9d9;
|
||||
color: #a78845;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.form-item .clear{
|
||||
position: absolute;
|
||||
top: 26rpx;
|
||||
right: 18rpx;
|
||||
z-index: 2;
|
||||
display: block;
|
||||
background: #fff;
|
||||
height: 44rpx;
|
||||
width: 44rpx;
|
||||
}
|
||||
|
||||
.register-btn{
|
||||
margin: 60rpx 0 40rpx 0;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
color: #a78845;
|
||||
font-size: 30rpx;
|
||||
width: 100%;
|
||||
background: #b4282d;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
var api = require('../../../config/api.js');
|
||||
var check = require('../../../utils/check.js');
|
||||
|
||||
var app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
mobile: '',
|
||||
code: '',
|
||||
password: '',
|
||||
confirmPassword: ''
|
||||
},
|
||||
onLoad: function (options) {
|
||||
// 页面初始化 options为页面跳转所带来的参数
|
||||
// 页面渲染完成
|
||||
|
||||
},
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
onShow: function () {
|
||||
// 页面显示
|
||||
|
||||
},
|
||||
onHide: function () {
|
||||
// 页面隐藏
|
||||
|
||||
},
|
||||
onUnload: function () {
|
||||
// 页面关闭
|
||||
|
||||
},
|
||||
sendCode: function () {
|
||||
wx.showModal({
|
||||
title: '注意',
|
||||
content: '由于目前不支持手机短信发送,因此验证码任意值都可以',
|
||||
showCancel: false
|
||||
});
|
||||
},
|
||||
startReset: function(){
|
||||
var that = this;
|
||||
|
||||
if (this.data.mobile.length == 0 || this.data.code.length == 0) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '手机号和验证码不能为空',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!check.isValidPhone(this.data.mobile)) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '手机号输入不正确',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.data.password.length < 3) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '用户名和密码不得少于3位',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.data.password != this.data.confirmPassword) {
|
||||
wx.showModal({
|
||||
title: '错误信息',
|
||||
content: '确认密码不一致',
|
||||
showCancel: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
wx.request({
|
||||
url: api.AuthReset,
|
||||
data: {
|
||||
mobile: that.data.mobile,
|
||||
code: that.data.code,
|
||||
password: that.data.password
|
||||
},
|
||||
method: 'POST',
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.data.errno == 0) {
|
||||
wx.navigateBack();
|
||||
}
|
||||
else{
|
||||
wx.showModal({
|
||||
title: '密码重置失败',
|
||||
content: res.data.errmsg,
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
bindPasswordInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
password: e.detail.value
|
||||
});
|
||||
},
|
||||
bindConfirmPasswordInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
confirmPassword: e.detail.value
|
||||
});
|
||||
},
|
||||
bindMobileInput: function (e) {
|
||||
|
||||
this.setData({
|
||||
mobile: e.detail.value
|
||||
});
|
||||
},
|
||||
bindCodeInput: function(e){
|
||||
|
||||
this.setData({
|
||||
code: e.detail.value
|
||||
});
|
||||
},
|
||||
clearInput: function(e){
|
||||
switch (e.currentTarget.id){
|
||||
case 'clear-password':
|
||||
this.setData({
|
||||
password: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-confirm-password':
|
||||
this.setData({
|
||||
confirmPassword: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-mobile':
|
||||
this.setData({
|
||||
mobile: ''
|
||||
});
|
||||
break;
|
||||
case 'clear-code':
|
||||
this.setData({
|
||||
code: ''
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "密码重置"
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<view class="container">
|
||||
<view class="form-box">
|
||||
|
||||
<view class="form-item">
|
||||
<input class="mobile" value="{{mobile}}" bindinput="bindMobileInput" placeholder="手机号" />
|
||||
<image wx:if="{{ mobile.length > 0 }}" id="clear-mobile" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<view class="form-item-code">
|
||||
<view class="form-item code-item">
|
||||
<input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码" />
|
||||
<image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
<view class="code-btn" bindtap="sendCode">获取验证码</view>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<input class="password" value="{{password}}" password bindinput="bindPasswordInput" placeholder="密码" />
|
||||
<image class="clear" id="clear-password" wx:if="{{ password.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<input class="password" value="{{confirmPassword}}" password bindinput="bindConfirmPasswordInput" placeholder="确认密码" />
|
||||
<image class="clear" id="clear-confirm-password" wx:if="{{ confirmPassword.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
|
||||
</view>
|
||||
|
||||
<button type="default" class="reset-btn" bindtap="startReset">密码重置</button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -1,68 +0,0 @@
|
||||
.form-box{
|
||||
width: 100%;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
padding: 0 40rpx;
|
||||
margin-top: 96rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.form-item{
|
||||
position: relative;
|
||||
background: #fff;
|
||||
height: 96rpx;
|
||||
border-bottom: 1px solid #d9d9d9;
|
||||
}
|
||||
|
||||
.form-item .mobile, .form-item .password, .form-item .code{
|
||||
position: absolute;
|
||||
top: 26rpx;
|
||||
left: 0;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 44rpx;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.form-item-code{
|
||||
margin-top:32rpx;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-item-code .form-item{
|
||||
float: left;
|
||||
width: 350rpx;
|
||||
}
|
||||
|
||||
.form-item-code .code-btn{
|
||||
float: right;
|
||||
padding: 20rpx 40rpx;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.form-item .clear{
|
||||
position: absolute;
|
||||
top: 26rpx;
|
||||
right: 18rpx;
|
||||
z-index: 2;
|
||||
display: block;
|
||||
background: #fff;
|
||||
height: 44rpx;
|
||||
width: 44rpx;
|
||||
}
|
||||
|
||||
.reset-btn{
|
||||
margin: 60rpx 0 40rpx 0;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
width: 100%;
|
||||
background: #b4282d;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
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();
|
||||
}
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "评论"
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<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>
|
||||
@@ -1,108 +0,0 @@
|
||||
.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;
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
// 上传组件 基于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 () {
|
||||
// 页面关闭
|
||||
|
||||
}
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "评论"
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
<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>
|
||||
@@ -1,246 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -7,9 +7,7 @@ Page({
|
||||
data: {
|
||||
id: 0,
|
||||
topic: {},
|
||||
topicList: [],
|
||||
commentCount: 0,
|
||||
commentList: []
|
||||
topicList: []
|
||||
},
|
||||
|
||||
onShareAppMessage: function() {
|
||||
@@ -50,35 +48,6 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
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() {
|
||||
|
||||
},
|
||||
|
||||
@@ -5,37 +5,6 @@
|
||||
</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>
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
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')
|
||||
},
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的足迹"
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<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>
|
||||
@@ -1,125 +0,0 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user