兼兼街公众号代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

216 lines
4.9 KiB

<template>
<view>
<view class="home-pages">
<view style="position: absolute;top: 0; left: 0; height: 188rpx; width: 100%; z-index: 100; background-color: #FFFFFF; box-shadow: 0px 15px 10px -15px #E8E8E8;">
<view style="margin: 28rpx 24rpx; display: flex;">
<image :showLoading="true" :src="userInfo?userInfo.headImage : ''" style="width: 148rpx;height: 148rpx;border-radius: 50%;"></image>
<view style="padding: 28rpx;">
<view style="font-size: 32rpx;font-weight: 600">{{userInfo?userInfo.nickName : '点击登录'}}</view>
<view style="font-size: 30rpx;margin-top: 20rpx;">我的余额{{userInfo.price}}</view>
</view>
</view>
</view>
<view class="home-content">
<user-card v-for="(item,i) in informationList" :key="i" :item="item"></user-card>
</view>
</view>
</view>
</template>
<script>
import userCard from '@/components/user-card/index-price.vue'
export default{
components:{
userCard
},
data(){
return{
userInfo:{
price:0.00
},
current:1,
activiteList:[],
informationList:[],
params:{
pageNo:1,
pageSize:10,
total: null,
isLock: true
},
}
},
onShow() {
this.getmyInfo()
},
onLoad() {
this.getinformation()
// if(this.current == 0){
// this.getActivity();
// }else{
// this.getinformation()
// }
},
onPullDownRefresh() {
this.activiteList = [];
this.params.pageNo = 1;
this.params.total = null;
this.params.isLock = true;
this.getinformation()
},
onReachBottom() {
if(this.params.isLock){
this.params.isLock = false;
if(this.params.total !== null && this.params.pageNo * this.params.pageSize >= this.params.total){
this.$Toast('没有更多数据!');
setTimeout(()=>{
this.params.isLock = true;
},3000)
return
}
this.params.pageNo+=1;
this.$Toast('数据加载成功!');
this.getinformation()
}
},
onPullDownRefresh() {
this.params.pageNo = 1;
this.getinformation()
// if(this.current == 0){
// this.getActivity();
// }else{
// this.getinformation()
// }
},
// 隐藏微信h5的标题栏
onReady() {
this.$com.displayNav()
},
methods:{
getmyInfo(){
this.$api('myInfo')
.then(res=>{
if(res.code == 200){
this.role = res.result.role;
this.userInfo = res.result;
this.$store.commit('set_userInfo',res.result)
}else{
this.userInfo = null
}
})
},
// tabClick(e){
// this.current = e.index;
// this.params.pageNo = 1;
// if(this.current == 0){
// this.getActivity(2);
// }else{
// this.getinformation(2)
// }
// },
// getActivity(type){
// uni.showLoading()
// this.$api('activity',this.params)
// .then(res=>{
// uni.hideLoading()
// if(res.code == 200){
// if(this.params.total== null) {
// this.params.total = res.result.total
// }
// if(this.params.pageNo>1){
// uni.hideLoading();
// }
// this.pages = this.pages.concat(res.result.pages);
// this.params.isLock = true;
// }else {
// if(this.params.pageNo>1){
// uni.hideLoading();
// }
// this.params.isLock = true;
// }
// })
// },
getinformation(type){
uni.showLoading()
this.$api('getPriceList',this.params)
.then(res=>{
uni.hideLoading();
if(res.code == 200){
if(this.params.total== null) {
this.params.total = res.result.total
}
if(this.params.pageNo>1){
uni.hideLoading();
}
this.informationList = this.informationList.concat(res.result.records);
this.params.isLock = true;
}else {
if(this.params.pageNo>1){
uni.hideLoading();
}
this.params.isLock = true;
}
})
// uni.showLoading()
// this.$api('getFans',this.params)
// .then(res=>{
// uni.hideLoading()
// if(res.code == 200){
// this.pages = res.result.pages;
// if(type == 2){
// this.informationList = [...this.informationList,...res.result.records];
// }else{
// this.informationList = res.result.records;
// uni.stopPullDownRefresh();
// }
// }
// })
},
seeDetail(item){//查看详情
uni.navigateTo({
url:`/pages/home/course-detial?id=${item.id}`
})
},
newDetail(item){//知识查看详情
uni.navigateTo({
url:`/pages/home/new-detail?id=${item.id}`
})
},
lower(){
if(this.params.pageNo >= this.pages) return;
this.params.pageNo ++;
if(this.current == 0){
this.getActivity(2);
}else{
this.getinformation(2)
}
},
}
}
</script>
<style lang="scss" scoped>
.home-content {
margin-top: 20rpx;
}
.home-pages {
padding: 188rpx 29rpx 0;
background-color: #F7F7F7;
.scroll-Y {
height: calc(100vh - 200rpx);
padding-top: 20rpx;
}
}
</style>