|
@@ -17,7 +17,7 @@
|
|
|
|
|
|
|
|
<view class="product-title">推荐产品</view>
|
|
<view class="product-title">推荐产品</view>
|
|
|
|
|
|
|
|
- <view class="recommend-box">
|
|
|
|
|
|
|
+ <!-- <view class="recommend-box">
|
|
|
<view class="product-box" v-for="item in productList" :key="item.id" @click="goDetail(item.id)">
|
|
<view class="product-box" v-for="item in productList" :key="item.id" @click="goDetail(item.id)">
|
|
|
<image :src="item.imgUrl"></image>
|
|
<image :src="item.imgUrl"></image>
|
|
|
<view class="detail-box">
|
|
<view class="detail-box">
|
|
@@ -25,14 +25,32 @@
|
|
|
<view style="color: #999;">¥{{item.price}}</view>
|
|
<view style="color: #999;">¥{{item.price}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
|
|
+ </view> -->
|
|
|
|
|
+
|
|
|
|
|
+ <!-- <section class="PullScroll-Page"> -->
|
|
|
|
|
+ <!-- <s-pull-scroll ref="pullScroll" :back-top="true" :pullDown="pullDown" :pullUp="loadData"> -->
|
|
|
|
|
+ <view class="recommend-box">
|
|
|
|
|
+ <view class="product-box" v-for="item in productList" :key="item.id" @click="goDetail(item.id)">
|
|
|
|
|
+ <image :src="item.picture"></image>
|
|
|
|
|
+ <view class="detail-box">
|
|
|
|
|
+ <view>{{item.desc || '-'}}</view>
|
|
|
|
|
+ <view style="color: #999;">¥{{item.money || '-'}}</view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <!-- </s-pull-scroll> -->
|
|
|
|
|
+ <!-- </section> -->
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
var md5 = require("../../common/md5.js");
|
|
var md5 = require("../../common/md5.js");
|
|
|
|
|
+ import sPullScroll from '@/components/s-pull-scroll';
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ sPullScroll
|
|
|
|
|
+ },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
title: 'Hello',
|
|
title: 'Hello',
|
|
@@ -66,12 +84,13 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
|
|
|
+ //this.refresh();
|
|
|
getApp().globalData.lastId = options.inviteId ? options.inviteId : getApp().globalData.user_id
|
|
getApp().globalData.lastId = options.inviteId ? options.inviteId : getApp().globalData.user_id
|
|
|
this.loginRequest();
|
|
this.loginRequest();
|
|
|
this.getPageProductList();
|
|
this.getPageProductList();
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
onShareAppMessage() {
|
|
onShareAppMessage() {
|
|
|
- console.log(111);
|
|
|
|
|
return {
|
|
return {
|
|
|
title: '分销小助手',
|
|
title: '分销小助手',
|
|
|
path:'/pages/index/index?inviteId=' + getApp().globalData.user_id
|
|
path:'/pages/index/index?inviteId=' + getApp().globalData.user_id
|
|
@@ -102,6 +121,7 @@
|
|
|
getApp().globalData.user_headUrl = res.data.msg.headimg;
|
|
getApp().globalData.user_headUrl = res.data.msg.headimg;
|
|
|
getApp().globalData.session_key = res.data.msg.session_key;
|
|
getApp().globalData.session_key = res.data.msg.session_key;
|
|
|
getApp().globalData.user_phone = res.data.msg.phone;
|
|
getApp().globalData.user_phone = res.data.msg.phone;
|
|
|
|
|
+ getApp().globalData.user_status = res.data.msg.status;
|
|
|
// getApp().globalData.times = res.data.msg.times;
|
|
// getApp().globalData.times = res.data.msg.times;
|
|
|
// getApp().globalData.total_times = res.data.msg.total_times;
|
|
// getApp().globalData.total_times = res.data.msg.total_times;
|
|
|
this.getPageInfo(res.data.msg.id);
|
|
this.getPageInfo(res.data.msg.id);
|
|
@@ -132,7 +152,8 @@
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- getPageProductList(){ //获取首页面产品列表接口
|
|
|
|
|
|
|
+ getPageProductList(pullScroll){ //获取首页面产品列表接口
|
|
|
|
|
+ console.log(pullScroll)
|
|
|
let that = this;
|
|
let that = this;
|
|
|
uni.request({
|
|
uni.request({
|
|
|
url: getApp().globalData.shareUrl, //需要设置为全局
|
|
url: getApp().globalData.shareUrl, //需要设置为全局
|
|
@@ -143,14 +164,32 @@
|
|
|
data: {
|
|
data: {
|
|
|
method: 'getProductsList',
|
|
method: 'getProductsList',
|
|
|
timestamp: getApp().globalData.globalTimestamp, //Date.now()
|
|
timestamp: getApp().globalData.globalTimestamp, //Date.now()
|
|
|
- page: '',
|
|
|
|
|
|
|
+ // page: pullScroll.page,
|
|
|
|
|
+ // pageSize:4,
|
|
|
|
|
+ page:'',
|
|
|
pageSize:'',
|
|
pageSize:'',
|
|
|
sign: md5('getProductsList' + getApp().globalData.globalTimestamp)
|
|
sign: md5('getProductsList' + getApp().globalData.globalTimestamp)
|
|
|
},
|
|
},
|
|
|
success: res => {
|
|
success: res => {
|
|
|
if (res.data.code === 200) {
|
|
if (res.data.code === 200) {
|
|
|
console.log(res.data.msg)
|
|
console.log(res.data.msg)
|
|
|
- //that.productList = res.data.msg;
|
|
|
|
|
|
|
+ that.productList = res.data.msg;
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // if (pullScroll.page == 1) {
|
|
|
|
|
+ // this.productList = res.data.msg;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // const curList = [];
|
|
|
|
|
+ // for (let i = res.data.msg.length; i < res.data.msg.length + 4; i++) {
|
|
|
|
|
+ // curList.push(i);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // this.productList = this.productList.concat(curList);
|
|
|
|
|
+ // if (this.productList.length > 60) {
|
|
|
|
|
+ // // finish(boolean:是否显示finishText,默认显示)
|
|
|
|
|
+ // pullScroll.finish(this.productList.length > 4);
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // pullScroll.success();
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }, 500);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -173,12 +212,36 @@
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ refresh () {
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$refs.pullScroll.refresh();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ pullDown (pullScroll) {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.loadData(pullScroll);
|
|
|
|
|
+ }, 200);
|
|
|
|
|
+ },
|
|
|
|
|
+ loadData (pullScroll) {
|
|
|
|
|
+ this.getPageProductList(pullScroll)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
-<style>
|
|
|
|
|
|
|
+<style lang="scss">
|
|
|
|
|
+ // .PullScroll-Page {
|
|
|
|
|
+ // padding: 40rpx;
|
|
|
|
|
+ // .btn {
|
|
|
|
|
+ // width: 100%;
|
|
|
|
|
+ // height: 80rpx;
|
|
|
|
|
+ // font-size: 28rpx;
|
|
|
|
|
+ // &:not(:first-child) {
|
|
|
|
|
+ // margin-top: 40rpx;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
.content {
|
|
.content {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
@@ -223,6 +286,7 @@
|
|
|
margin-bottom: 1%;
|
|
margin-bottom: 1%;
|
|
|
}
|
|
}
|
|
|
.recommend-box {
|
|
.recommend-box {
|
|
|
|
|
+ width: 95%;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
justify-content: center;
|