hengmei-two/pagesB/mysharer/mysharer.vue

148 lines
4.3 KiB
Vue
Raw Normal View History

2021-08-19 06:40:59 +00:00
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'我的分享人'" :statusTitle="true"></status-nav>
<view class="bacf posiszy navHeight" :style="{paddingTop: statusHNH+'px'}">
<view class="disja pad-sx30">
<view @tap="chooseye(indexye)" :style="{color:flag==indexye?publicColor:''}" v-for="(itemye,indexye) in cateList" :key="indexye">{{itemye.title}}({{itemye.num}})</view>
</view>
</view>
<view :style="{paddingTop: navH+'px'}">
<view v-if="dataList[flag].length!=0">
<view class="disjbac bbot pad-sx40 mar-zy50" v-for="(iteml,indexl) in dataList[flag]" :key="indexl">
<view class="disac">
<!-- 头像 -->
<image class="radius20" :src="iteml.src" style="width: 100rpx;height: 100rpx;" mode="aspectFill"></image>
<view class="mar-z25">
<!-- 昵称 -->
<view class="fon32 bold">{{iteml.name}}</view>
<!-- 时间 -->
<view class="fon24 col80 mar-s10">{{iteml.time}}</view>
</view>
</view>
<view class="tright">
<!-- 方式 -->
<view class="fon24 col80">{{iteml.action}}</view>
<!-- 收益 -->
<view class="fon28 bold mar-s10" style="color: #EB5929;">+{{iteml.num}}</view>
</view>
</view>
</view>
<view v-else class="disjcac fc" style="margin-top: 40%;">
<image src="/static/public/nothing.png" style="width: 474rpx;height: 273rpx;" mode="aspectFill"></image>
<view class="fon24 col3">您还没有分享人快去分享吧</view>
</view>
</view>
<!-- 返回顶部 -->
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
2021-08-26 09:57:04 +00:00
<!-- 底部客服 -->
<public-customer :nbottom="100"></public-customer>
2021-08-19 06:40:59 +00:00
</view>
</template>
<script>
export default {
data() {
return {
statusHNH:uni.getStorageSync('statusHNH'),
flag:0,
publicColor:uni.getStorageSync('publicColor'),//主题颜色
cateList:[
{title:'一级',num:0,grade:'first'},
{title:'二级',num:0,grade:'second'},
],
showTop:false,//是否显示返回顶部
dataList:[
[],
[],
],
navH:uni.getStorageSync('electric_nav_height') + 53,
2021-08-19 06:40:59 +00:00
page:1,
size:20,
total:'',//总数
isZanw:true,
}
},
onPageScroll(e) {
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
},
onReachBottom() {//触底事件
if(this.total!=this.dataList[this.flag].length){
2021-08-19 06:40:59 +00:00
this.page++
this.checkPeople()
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多分享人','none',1000)
this.isZanw = false
}
},
2022-03-04 08:48:40 +00:00
onShow() {
// 禁用小程序分享
this.$toolAll.tools.disableShareEv();
2022-03-04 08:48:40 +00:00
this.$toolAll.tools.isLogin()
},
2021-12-02 09:31:26 +00:00
onLoad(options) {
2021-08-19 06:40:59 +00:00
if(uni.getStorageSync('navHeight')==''){
const query = wx.createSelectorQuery()
query.select('.navHeight').boundingClientRect((rect) => {
uni.setStorageSync('navHeight',rect.height)
this.navH = rect.height
}).exec()
}
2022-03-21 01:44:07 +00:00
if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){
2022-03-04 08:48:40 +00:00
this.checkShare()//查询一二级分享总人数
this.checkPeople()//查询分享一二级列表人数
}
2021-08-19 06:40:59 +00:00
},
methods: {
checkShare(){//查询一二级分享总人数
this.$requst.post('user/share-count').then(res=>{
// console.log('查询用户的分享统计记录:',res);
if(res.code==0){
this.cateList[0].num = res.data.user_count.first
this.cateList[1].num = res.data.user_count.second
}
})
2021-08-19 06:40:59 +00:00
},
checkPeople(){//查询分享一二级列表人数
this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{
2022-01-18 02:43:26 +00:00
if(this.flag){
if(this.page==1) this.dataList[1] = [];
2022-01-18 02:43:26 +00:00
} else {
if(this.page==1) this.dataList[0] = [];
2022-01-18 02:43:26 +00:00
}
2021-08-19 06:40:59 +00:00
if(res.code==0){
if(res.data.list.length!=0){
res.data.list.forEach(item=>{
let obj = {
src:item.headimgurl,
name:item.nickname,
2021-08-19 06:40:59 +00:00
time:item.created_at,
action:item.invite_source,
num:item.score
}
this.dataList[this.flag].push(obj)
})
this.total = res.data.total
}
}
})
2021-08-19 06:40:59 +00:00
},
backTop(){//回到顶部事件
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
},
chooseye(index){
this.page = 1;
2022-01-18 02:43:26 +00:00
this.flag = index;
this.checkPeople();
2021-08-19 06:40:59 +00:00
}
}
}
</script>
<style>
</style>