1、修复一个群友Solver提出的关于体验性改善的问题

2、详情页增加加载动画效果
3、去除一些console.log
This commit is contained in:
shengliang 2020-03-07 20:21:04 +08:00
parent a685888a5b
commit 65f37e00b6
11 changed files with 64 additions and 25 deletions

View File

@ -29,6 +29,7 @@ Page({
// 页面显示
this.getCartList();
this.getCartNum();
wx.removeStorageSync('categoryId');
},
onPullDownRefresh: function() {
wx.showNavigationBarLoading()

View File

@ -88,27 +88,41 @@ Page({
},
onShow: function() {
this.getChannelShowInfo();
let id = this.data.nowId;
let nowId = wx.getStorageSync('categoryId');
this.setData({
list: [],
allPage: 1,
allCount: 0,
size: 8,
loading: 1
})
if (nowId == 0 || nowId == undefined) {
if(id == 0 && nowId === 0){
return false
}
else if (nowId == 0 && nowId === '') {
this.setData({
list: [],
allPage: 1,
allCount: 0,
size: 8,
loading: 1
})
this.getCurrentList(0);
this.setData({
nowId: 0,
currentCategory: {}
})
} else {
wx.setStorageSync('categoryId', 0)
} else if(id != nowId) {
this.setData({
list: [],
allPage: 1,
allCount: 0,
size: 8,
loading: 1
})
this.getCurrentList(nowId);
this.getCurrentCategory(nowId);
this.setData({
nowId: nowId
})
wx.setStorageSync('categoryId', nowId)
}
this.getCatalog();
},
switchCate: function(e) {
@ -129,11 +143,12 @@ Page({
this.setData({
currentCategory: {}
})
wx.removeStorageSync('categoryId');
} else {
wx.setStorageSync('categoryId', id)
this.getCurrentList(id);
this.getCurrentCategory(id);
}
wx.setStorageSync('categoryId', id)
this.setData({
nowId: id
})

View File

@ -115,9 +115,6 @@ Page({
},
getGoodsInfo: function() {
let that = this;
wx.showLoading({
title: '加载中...',
});
util.request(api.GoodsDetail, {
id: that.data.id
}).then(function(res) {
@ -147,10 +144,10 @@ Page({
productList: res.data.productList,
checkedSpecPrice: res.data.info.retail_price,
galleryImages: galleryImages,
loading:1
});
wx.setStorageSync('goodsImage', res.data.info.https_pic_url);
}
wx.hideLoading();
});
},
clickSkuValue: function(event) {
@ -328,6 +325,8 @@ Page({
},
onShow: function() {
let userInfo = wx.getStorageSync('userInfo');
let info = wx.getSystemInfoSync();
let sysHeight = info.windowHeight - 100;
let userId = userInfo.id;
if (userId > 0) {
this.setData({
@ -335,9 +334,9 @@ Page({
});
}
this.setData({
priceChecked: false
priceChecked: false,
sysHeight: sysHeight
})
this.getGoodsInfo();
this.getCartCount();
},

View File

@ -1,5 +1,5 @@
<wxs module="filters" src="../../utils/fixed.wxs"></wxs>
<view class="container">
<view class="container" wx:if="{{loading == 1}}">
<view class='banner-wrap'>
<view class='current-item' wx:if="{{gallery.length > 0}}">
<view class='in-item'>
@ -167,4 +167,8 @@
<view class="cancel" bindtap="hideDialog">取消</view>
</view>
</view>
</view>
<view class="loading" style="height:{{sysHeight}}px" wx:else>
<image class="img" src="http://lucky-icon.meiweiyuxian.com/hio/loading2.gif"></image>
<view class="text">海风吹啊吹</view>
</view>

View File

@ -14,6 +14,29 @@
width: 100%;
}
.loading {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.loading .img {
width: 90rpx;
height: 90rpx;
}
.loading .text {
margin-top: 20rpx;
width: 100%;
font-size: 24rpx;
color: #999;
text-align: center;
}
/* banner start */
.banner-wrap {

View File

@ -87,11 +87,11 @@ Page({
});
};
let info = wx.getSystemInfoSync();
let system = info.system;
let sysHeight = info.windowHeight - 100;
this.setData({
sysHeight: sysHeight
})
});
wx.removeStorageSync('categoryId');
},
getCartNum: function() {
util.request(api.CartGoodsCount).then(function(res) {

View File

@ -99,5 +99,5 @@
</view>
<view class="loading" style="height:{{sysHeight}}px" wx:else>
<image class="img" src="http://lucky-icon.meiweiyuxian.com/hio/loading2.gif"></image>
<view class="text">努力加载中</view>
<view class="text">海风吹啊吹</view>
</view>

View File

@ -141,7 +141,7 @@ Page({
actualPrice: actualPrice,
offlinePay:0
}, 'POST').then(res => {
console.log(res);
// console.log(res);
if (res.errno === 0) {
wx.removeStorageSync('orderId');
wx.setStorageSync('addressId', 0);
@ -162,7 +162,6 @@ Page({
},
offlineOrder: function (e) {
let formId = e.detail.formId;
console.log(e)
let offlinePay = e.currentTarget.dataset.off;
if (this.data.addressId <= 0) {
util.showErrorToast('请选择收货地址');
@ -180,7 +179,6 @@ Page({
actualPrice: actualPrice,
offlinePay:offlinePay
}, 'POST').then(res => {
console.log(res);
if (res.errno === 0) {
wx.removeStorageSync('orderId');
wx.setStorageSync('addressId', 0);

View File

@ -60,7 +60,6 @@ Page({
id: id
}).then(function(res) {
if (res.errno === 0) {
// console.log(res.data);
that.setData({
goods: res.data,
});

View File

@ -76,6 +76,7 @@ Page({
userInfo: userInfo,
});
this.getOrderInfo();
wx.removeStorageSync('categoryId');
},
onPullDownRefresh: function() {

View File

@ -38,7 +38,6 @@ Page({
that.getOrderList();
that.getOrderInfo();
}).catch(res => {
console.log(res);
util.showErrorToast(res.errmsg);
});
},