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.getCartList();
this.getCartNum(); this.getCartNum();
wx.removeStorageSync('categoryId');
}, },
onPullDownRefresh: function() { onPullDownRefresh: function() {
wx.showNavigationBarLoading() wx.showNavigationBarLoading()

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<wxs module="filters" src="../../utils/fixed.wxs"></wxs> <wxs module="filters" src="../../utils/fixed.wxs"></wxs>
<view class="container"> <view class="container" wx:if="{{loading == 1}}">
<view class='banner-wrap'> <view class='banner-wrap'>
<view class='current-item' wx:if="{{gallery.length > 0}}"> <view class='current-item' wx:if="{{gallery.length > 0}}">
<view class='in-item'> <view class='in-item'>
@ -167,4 +167,8 @@
<view class="cancel" bindtap="hideDialog">取消</view> <view class="cancel" bindtap="hideDialog">取消</view>
</view> </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>

View File

@ -14,6 +14,29 @@
width: 100%; 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 start */
.banner-wrap { .banner-wrap {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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