Commit 2c70b34a authored by ziyu's avatar ziyu

improvement: 优化

parent e83026d8
This diff is collapsed.
...@@ -53,5 +53,5 @@ module.exports = { ...@@ -53,5 +53,5 @@ module.exports = {
}, },
checkCornCode(params) { checkCornCode(params) {
return http.post('/api/user/addCoins', params); return http.post('/api/user/addCoins', params);
}, }
}; };
...@@ -46,13 +46,13 @@ ...@@ -46,13 +46,13 @@
const lastIndex = this.list.length - this.activityDisplayItems; const lastIndex = this.list.length - this.activityDisplayItems;
if (e.$wx.detail.current === lastIndex) { if (e.$wx.detail.current === lastIndex) {
this.isAuto = false; this.isAuto = false;
//当最后一个出来的时候等一秒再消失 // 当最后一个出来的时候等一秒再消失
setTimeout(()=>{ setTimeout(() => {
this.isActiveDone = 'anima'; this.isActiveDone = 'anima';
setTimeout(() => { setTimeout(() => {
this.isActiveDone = 'anima hide'; this.isActiveDone = 'anima hide';
}, 2000); }, 2000);
},2000) }, 2000);
} }
} }
} }
......
...@@ -54,17 +54,17 @@ ...@@ -54,17 +54,17 @@
watch: { watch: {
goodsList(val) { goodsList(val) {
/* let list = val || []; /* let list = val || [];
this.list = list;*/ this.list = list; */
} }
}, },
created() { created() {
//获取推荐的商品列表 // 获取推荐的商品列表
this.list = [{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'}, this.list = [{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'}, {value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},
{value: 13, text: '白色条纹马克杯,马克吐温同款13', imgsrc: '/static/images/peo1.jpg', price: '¥39.08', people: 2200, sku: '100004549235'}, {value: 13, text: '白色条纹马克杯,马克吐温同款13', imgsrc: '/static/images/peo1.jpg', price: '¥39.08', people: 2200, sku: '100004549235'},
{value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'}, {value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'},
{value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'},{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'}, {value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'}, {value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'}, {value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'}
]; ];
}, },
methods: { methods: {
...@@ -116,9 +116,8 @@ ...@@ -116,9 +116,8 @@
that.lastPage += 1; that.lastPage += 1;
if (that.lastPage + that.topPage >= totalPage) { if (that.lastPage + that.topPage >= totalPage) {
that.circular = true; that.circular = true;
return;
} }
// that.list = [...that.list, ...nextlist]; that.list = [...that.list, ...nextlist];
}, 1000), 500); }, 1000), 500);
} }
} }
...@@ -200,22 +199,22 @@ ...@@ -200,22 +199,22 @@
if (list.length <= 4) { if (list.length <= 4) {
this.circular = false; this.circular = false;
} }
console.log(current.itemid,this.currentIndex,this.current,111) console.log(current.itemid, this.currentIndex, this.current, 111);
if (current.itemid >= list.length - 1) { if (current.itemid >= list.length - 1) {
this.current = this.currentIndex - 1; this.current = this.currentIndex - 1;
} }
setTimeout(function() { setTimeout(function() {
let newlist = that.list.filter((item, index) => index !== +current.itemid); let newlist = that.list.filter((item, index) => index !== +current.itemid);
// 正常情况下,current.itemid都会比current大一个,当相等或小于的时候就有问题,要重新设置current,最小不能超过0 // 正常情况下,current.itemid都会比current大一个,当相等或小于的时候就有问题,要重新设置current,最小不能超过0
if(newlist.length <= that.swiperItem) { if (newlist.length <= that.swiperItem) {
that.swiperItem = newlist.length; that.swiperItem = newlist.length;
} }
that.list = newlist; that.list = newlist;
if (current.itemid - that.current !==1 ) { if (current.itemid - that.current !== 1) {
that.current = Math.max(that.current - 1, 0); that.current = Math.max(that.current - 1, 0);
} }
//删除完成之后 // 删除完成之后
console.log(current.itemid,that.currentIndex,that.current,222) console.log(current.itemid, that.currentIndex, that.current, 222);
}, 500); }, 500);
} }
} }
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
created() { created() {
let statusHeight = this.$app.$options.globalData.statusBarHeight || ''; let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.popupStyle = 'top:' + (statusHeight + 56) + 'px'); statusHeight && (this.popupStyle = 'top:' + (statusHeight + 56) + 'px');
}, }
}); });
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
authmodal: { authmodal: {
type: Boolean, type: Boolean,
default: false default: false
}, }
}, },
computed: { computed: {
...mapState(['safeAreaStyle']), ...mapState(['safeAreaStyle']),
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
showCornModal() { showCornModal() {
this.$emit('showCorn'); this.$emit('showCorn');
} }
}, }
}); });
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -218,18 +218,18 @@ ...@@ -218,18 +218,18 @@
showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗 showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗
awardsInfo: {}, awardsInfo: {},
isReceive: false, // 是否显示领取克币动画 isReceive: false, // 是否显示领取克币动画
cornModal:false, cornModal: false,
cornCode: '', //克币充值码 cornCode: '', // 克币充值码
cornText:'', cornText: '',
cornTextShow: false, cornTextShow: false
}, },
computed: { computed: {
...mapState([ 'isConnected', 'userInfo', 'safeAreaStyle' ]) ...mapState([ 'isConnected', 'userInfo', 'safeAreaStyle' ])
}, },
watch: { watch: {
cornCode(val,oldval) { cornCode(val, oldval) {
if (val!==oldval && this.cornTextShow) { if (val !== oldval && this.cornTextShow) {
this.cornTextShow = false; this.cornTextShow = false;
} }
} }
...@@ -410,25 +410,24 @@ ...@@ -410,25 +410,24 @@
this.cornModal = false; this.cornModal = false;
}, },
checkCode() { checkCode() {
if(this.cornCode == '') { if (this.cornCode === '') {
this.cornText = '请输入克币充值码'; this.cornText = '请输入克币充值码';
this.cornTextShow = true; this.cornTextShow = true;
return; return;
} }
const msg = ['充值码无效,请重新输入','该充值码已被使用,请重新输入']; const msg = ['充值码无效,请重新输入', '该充值码已被使用,请重新输入'];
checkCornCode({code:this.cornCode}).then(data=>{ checkCornCode({code: this.cornCode}).then(data => {
if(data.code === 0){ if (data.code === 0) {
//充值成功 // 充值成功
this.cornModal = false; this.cornModal = false;
this.mainInfo.account.quantity = data.accountCoins; this.mainInfo.account.quantity = data.accountCoins;
this.isReceive = true; this.isReceive = true;
} else { } else {
const msgindex = data.code+2; const msgindex = data.code + 2;
this.cornText = msg[msgindex]; this.cornText = msg[msgindex];
this.cornTextShow = true; this.cornTextShow = true;
} }
}); });
}, },
resetAddGold() { resetAddGold() {
this.isReceive = false; this.isReceive = false;
......
...@@ -319,7 +319,7 @@ ...@@ -319,7 +319,7 @@
await register(store.state.userInfo); await register(store.state.userInfo);
wx.setStorageSync('isRegister', true); wx.setStorageSync('isRegister', true);
} }
if(!this.batchId) { if (!this.batchId) {
Notify({message: '数据加载中,请稍后重试!'}); Notify({message: '数据加载中,请稍后重试!'});
return; return;
} }
......
Markdown is supported
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