2021-08-19 06:40:59 +00:00
< template >
< view >
<!-- 状态栏 -- >
< status -nav :titleVal ="'我的分享人'" :statusTitle ="true" > < / s t a t u s - n a v >
<!-- 输入框 -- >
< 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 > -- >
2021-08-26 09:57:04 +00:00
<!-- 底部客服 -- >
< public -customer :nbottom ="100" > < / p u b l i c - c u s t o m e r >
2021-12-02 09:31:26 +00:00
<!-- 弹框授权 -- >
< empower @buttonH ="buttonH" :vision ="vision" :isWhere ="2" > < / empower >
<!-- 弹框 -- >
< auth -phone v-if ="isShowP" > < / auth -phone >
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 ( 'navHeight' ) ,
page : 1 ,
size : 20 ,
total : '' , //总数
isZanw : true ,
2021-12-02 09:31:26 +00:00
vision : false ,
isShowP : false ,
2021-08-19 06:40:59 +00:00
}
} ,
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
}
} ,
2021-08-22 08:53:12 +00:00
onShow ( ) {
this . $toolAll . tools . isLogin ( )
} ,
2021-12-02 09:31:26 +00:00
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 ) ;
}
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 ( )
}
this . checkShare ( ) //查询一二级分享总人数
this . checkPeople ( ) //查询分享一二级列表人数
} ,
methods : {
2021-12-02 09:31:26 +00:00
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 . haveImg = false ;
this . vision = true ;
}
}
} , error => { } )
}
} ,
} ) ;
} ,
buttonH ( e ) { //授权成功
this . haveImg = e
if ( e ) {
this . vision = false
this . isShowP = true
}
} ,
2021-08-19 06:40:59 +00:00
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 >