martial-arts/pagesA/my-extend/my-extend.vue

161 lines
4.6 KiB
Vue
Raw Permalink Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view>
<status-container titlet="我的推广" returnc="#FFFFFF">
<!-- 我的推广 -->
<view slot="content" style="margin-top: -20rpx;" v-if="loading">
<!-- <view class="extend-list">
<view class="text curr">我的推广</view>
<view class="text" @tap="share()">我的分享</view>
</view> -->
<view class="bacf pad-zy20 boxshow2 posi-sticky" :style="{top:newtop+'px'}">
<view class="disjbac pad-sx20 pad-zy10">
<view class="fon22 col26">推广获取积分</view>
<view class="fon26 bold col-e42417">{{scoreInfo || 0}}</view>
</view>
</view>
<view class="mar-s30 pad-zy20 bacf boxshow2">
<view class=" col26 pad-sx20 pad-zy10 disac borbot" v-for="(item,index) in dataList" :key="index">
<image :src="item.headimgurl" class="flexs radius_100 mar-y20" style="width: 78rpx;height: 78rpx;" mode="aspectFill" lazy-load></image>
<view class="width100">
<view class="disjbac">
<view class="fon24 colb">{{item.nickname}}</view>
<view class="col-e42417 fon24">+{{item.total_score ? item.total_score : 0}}</view>
</view>
<!-- <view class="disjbac" style="margin-top: 6rpx;">
<view class="fon20" style="color: #747474;" v-if="item.created_at">{{item.created_at.split('-').join('.')}}</view>
<view class="fon24">{{item.name}}</view>
</view> -->
</view>
</view>
</view>
<pitera :textStr="`${noMore && total > dataList.length?'上滑加载更多':'到底了'}~~`" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
</view>
</status-container>
</view>
</template>
<script>
import pitera from '@/components/nothing/pitera.vue';
import yzQr from '@/components/yz-qr/yz-qr.vue';
import {base64ToPath} from '@/jsFile/base64-src.js';
export default {
components:{
pitera,
yzQr
},
data() {
return {
newtop:uni.getSystemInfoSync().statusBarHeight + 42,
dataList:[],
page:1,
size:20,
total:0,
noMore:false,
personCode:'',
loading:false,
//二维码相关参数
textstr:`https://chuanwujia.com/share?invite_code=${uni.getStorageSync('invite_code')}`,
scoreInfo:'',
hostapi:'',// 域名
}
},
onLoad() {
this.loading = true;
this.hostapi = getApp().globalData.hostapi;
// this.getCode();
this.getExtend();
},
onReachBottom() {
if(this.total!=this.dataList.length){
this.page++;
this.getExtend();
}
},
onShareAppMessage(res) {
var shareObj = {
     title: ``, // 默认是小程序的名称(可以写slogan等)
     path: `${uni.getStorageSync('page-path-options')}?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
     imageUrl: ``//自定义图片路径可以是本地文件路径、代码包文件路径或者网络图片路径支持PNG及JPG不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
  };
  return shareObj;
},
methods: {
getPath(path){
this.personCode = path;
},
// 获取推广人
getExtend(){
let params = {
action:'order',
page:this.page,
size:this.size
}
this.$requst.get('/api/user/my-share-account',params).then(res=>{
if(res.code==0){
console.log(res,'推广人信息')
this.scoreInfo = res.data.total_share_score;
this.total = res.data.list.total;
if(this.page==1){this.dataList=[];}
this.dataList = [...this.dataList,...res.data.list.list];
if(this.total==this.dataList.length && this.page!=1){
this.noMore = true;
}
}
})
},
// 获取推广码
getCode(){
if(uni.getStorageSync('personCode')){
this.loading = true;
this.personCode = uni.getStorageSync('personCode');
} else {
this.$toolAll.tools.showToast('加载中...');
this.$requst.get('/api/user/personal-qr').then(res=>{
if(res.code==0){
base64ToPath(res.data.qr).then(result=>{
this.personCode = result;
uni.setStorageSync('personCode',this.personCode);
this.loading = true;
uni.hideToast();
})
}
})
}
},
share() {
uni.navigateTo({
url:`/pagesA/my-share/my-share`
})
}
}
}
</script>
<style>
.extend-list {
margin: 30rpx 0;
background-color: #fff;
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: center;
}
.extend-list .text {
line-height: 70rpx;
font-size: 30rpx;
color: #333;
margin: 0 40rpx;
text-align: center;
border-bottom: 3px solid transparent;
}
.extend-list .text.curr {
font-weight: bold;
border-bottom: 3px solid #e42417;
}
</style>