180 lines
5.4 KiB
Vue
180 lines
5.4 KiB
Vue
<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}}({{dataList[indexye].length}})</view> -->
|
|
<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> -->
|
|
<!-- 底部客服 -->
|
|
<public-customer :nbottom="100"></public-customer>
|
|
<!-- 弹框授权 -->
|
|
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
|
<!-- 弹框 -->
|
|
<auth-phone v-if="isShowP"></auth-phone>
|
|
</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('navHeight'),
|
|
page:1,
|
|
size:20,
|
|
total:'',//总数
|
|
isZanw:true,
|
|
vision:false,
|
|
isShowP:false,
|
|
}
|
|
},
|
|
onPageScroll(e) {
|
|
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
|
},
|
|
onReachBottom() {//触底事件
|
|
if(this.total!=this.dataList.length){
|
|
this.page++
|
|
this.checkPeople()
|
|
} else {
|
|
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多分享人','none',1000)
|
|
this.isZanw = false
|
|
}
|
|
},
|
|
onShow() {
|
|
this.$toolAll.tools.isLogin()
|
|
},
|
|
onLoad(options) {
|
|
if(uni.getStorageSync('is_active')!=1){this.vision = true;}
|
|
if(options.invite_code!='' && options.invite_code!=undefined){
|
|
this.loginEv(options.invite_code);
|
|
} else if(options.source_code!='' && options.source_code!=undefined){
|
|
this.loginEv('',options.source_code,options.channel);
|
|
}
|
|
if(uni.getStorageSync('navHeight')==''){
|
|
const query = wx.createSelectorQuery()
|
|
query.select('.navHeight').boundingClientRect((rect) => {
|
|
uni.setStorageSync('navHeight',rect.height)
|
|
this.navH = rect.height
|
|
}).exec()
|
|
}
|
|
this.checkShare()//查询一二级分享总人数
|
|
this.checkPeople()//查询分享一二级列表人数
|
|
},
|
|
methods: {
|
|
loginEv(invite_code='',source='',channel=''){
|
|
uni.login({
|
|
provider: 'weixin',
|
|
success: (res)=> {
|
|
if (res.code) {
|
|
var params = {
|
|
code:res.code,
|
|
invite_code:invite_code,//用户邀请码
|
|
source_code:source,
|
|
channel:channel
|
|
}
|
|
this.$requst.post('user/login',params).then(res => {
|
|
if(res.data.token!=''){
|
|
if(res.data.is_active==0) {
|
|
this.vision = true;
|
|
}
|
|
}
|
|
},error => {})
|
|
}
|
|
},
|
|
});
|
|
},
|
|
buttonH(e){//授权成功
|
|
if(e) {
|
|
this.vision = false
|
|
this.isShowP = true
|
|
}
|
|
},
|
|
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
|
|
}
|
|
},error=>{})
|
|
},
|
|
checkPeople(){//查询分享一二级列表人数
|
|
this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{
|
|
console.log('查询分享一二级列表人数列表:',res);
|
|
if(res.code==0){
|
|
if(res.data.list.length!=0){
|
|
res.data.list.forEach(item=>{
|
|
let obj = {
|
|
src:item.account.headimgurl,
|
|
name:item.account.nickname,
|
|
time:item.created_at,
|
|
action:item.invite_source,
|
|
num:item.score
|
|
}
|
|
this.dataList[this.flag].push(obj)
|
|
})
|
|
this.total = res.data.total
|
|
}
|
|
}
|
|
},error=>{})
|
|
},
|
|
backTop(){//回到顶部事件
|
|
uni.pageScrollTo({
|
|
scrollTop: 0,
|
|
duration: 300
|
|
});
|
|
},
|
|
chooseye(index){
|
|
this.flag = index
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
</style>
|