dl_uniapp/pages/mine/member/member-index.vue
2025-05-09 16:15:58 +08:00

483 lines
11 KiB
Vue

<template>
<view class="auth-choose-box">
<navigation-bar-vue title="通告主详情" style="width: 100%;" background-color="#ffffff"
title-color="#000000"></navigation-bar-vue>
<view class="choose-detail">
<view class="people-info-box">
<view class="image-box">
<image :src="imageUrl+member.avatar" mode="scaleToFill"></image>
</view>
<view class="people-name-box">
<view class="name-box">
<view class="name-dom">{{ member.nickName||'' }}</view>
<view class="fans-dom">{{ member.tfansNum||'0' }}关注</view>
</view>
<view v-if="null != member.identityName" class="renzheng-dom">
<image src="@/static/mine/auth/renzhen.png" mode="aspectFit"></image>
认证{{(member.identityName||'')=='转发PR'?'ZFPR':member.identityName}}
</view>
<view v-else class="renzheng-dom">
未认证
</view>
</view>
<view class="opt-box">
<view class="guanzhu" v-if="!isLove" @click="forkUser('1')">关注</view>
<view class="guanzhu" v-if="isLove" @click="forkUser('0')">取消关注</view>
</view>
</view>
<!-- <view class="bozhu-type-box">-->
<!-- <view class="item-dom">好物</view>-->
<!-- <view class="item-dom">颜值</view>-->
<!-- </view>-->
<view class="pingjia-box">
<view class="pingjia-content">
<view class="top-title">
<image src="@/static/mine/auth/pingjia.png" mode="aspectFit"></image>
合作博主评价:
</view>
<view class="item-box">
<view v-for="item in member.evaluates" class="item-dom">
{{item.evaluate}}(<text>{{ item.num }}</text>)
</view>
</view>
</view>
</view>
<view class="dl-title">
<image src="@/static/mine/auth/dian.png" mode="aspectFit"></image>
<text>进行中的通告(<text>{{total}}</text>)</text>
</view>
<view class="data-list-box">
<scroll-view style="height: 100%;" scroll-y="true" @scrolltolower="onReachBottomCus" refresher-enabled
@refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<notice-item @goDetail="goDetail" v-if="dataList.length>0" :dataList="dataList"></notice-item>
<view style="text-align: center" v-if="dataList.length==0">
<image class="" src="@/static/images/nothing.png"></image>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import {
toast
} from '@/utils/common.js'
import {
getJSONData
} from '@/utils/auth.js';
import {
queryListByUserId
} from '@/api/business/notice.js'
import {
announcerDetail,
dealMemberRights
} from '@/api/business/member.js'
import noticeItem from '@/pages/components/notice-item.vue'
import navigationBarVue from '@/components/navigation/navigationBar.vue';
import config from '@/config'
import {
postForkUser
} from '@/api/business/base.js'
import {
getNoticeDetail
} from '@/api/business/notice';
import {
getUserType
} from '@/utils/common.js'
import constant from '@/utils/constant';
export default {
components: {
navigationBarVue,
noticeItem
},
data() {
return {
imageUrl: '',
member: {},
dataList: [],
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
status: '审核通过',
},
userId: null,
total: 0,
//下来刷新状态
isTriggered: false,
//当前用户是否关注该博主
isLove: false,
noticeId: null,
}
},
onLoad(option) {
console.log(option, 'option')
this.userId = option.userId
this.queryParams.userId = option.userId
this.noticeId = option.noticeId
this.initMember()
this.initNotice()
this.getDetail()
},
methods: {
/**
* 查看通告详情
* @param {Object} item
*/
goDetail(item) {
let userInfo = getJSONData(constant.userInfo)
if (!userInfo) {
store.dispatch('LogOut').then(res => {
uni.reLaunch({
url: '/pages/login'
})
})
} else {
let userType = getUserType()
let param = {
userId: userInfo.userId,
userType: userType,
noticeId: item.id,
rightsCode: 'unlock_notice',
deplete: 1
}
dealMemberRights(param).then(res => {
if (res.code == 200) {
this.$tab.navigateTo(`/pages/notice/detail?id=${item.id}`)
}
}).catch((e) => {
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
}
},
/**扣除解锁通告权益*/
dealMemberRights() {
dealMemberRights()
},
/**
* 关注、取消关注
* @param {Object} isLove
*/
forkUser(isLove) {
postForkUser({
userId: this.userId,
isLove: isLove
}).then(res => {
if (res.code == 200) {
uni.showToast({
icon: 'success',
duration: 2000,
title: '操作成功'
});
this.isLove = isLove == '1'
}
}).catch((e) => {
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
},
/**
* 查通告详情
*/
getDetail() {
getNoticeDetail({
noticeId: this.noticeId
}).then(res => {
if (res.code == 200) {
this.isLove = res.data.isLove
}
}).catch((e) => {
this.isTriggered = false
uni.showToast({
icon: 'error',
duration: 2000,
title: e
});
})
},
/**出初始化通告主详情*/
initMember() {
announcerDetail(this.userId).then(res => {
if (res.code == 200) {
this.member = res.data
}
})
},
/**初始化通告列表*/
initNotice() {
queryListByUserId(this.queryParams).then(res => {
this.isTriggered = false
if (res.code == 200) {
if (this.queryParams.pageNum == 1) {
this.dataList = res.data.records
} else {
this.dataList = this.dataList.concat(res.data.records)
}
this.total = res.data.total
}
})
},
/**
* 上滑加载数据
*/
onReachBottomCus() {
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
if (this.queryParams.pageNum * this.queryParams.pageSize >= this.total) {
toast("没有更多数据了")
return
}
//页码+1,调用获取数据的方法获取第二页数据
this.queryParams.pageNum++
this.initNotice()
},
/**
* 下拉刷新数据
*/
onRefresherrefresh() {
this.isTriggered = true
this.queryParams.pageNum = 1
this.total = 0
this.initNotice()
},
}
}
</script>
<style lang="scss">
.auth-choose-box {
padding-top: calc(90rpx + var(--status-bar-height));
border-top: 1rpx solid #F4F4F4;
background-color: white;
width: 100%;
color: #363636;
font-size: 30rpx;
height: 100%;
display: flex;
flex-direction: column;
align-items: self-start;
justify-content: center;
position: relative;
.choose-detail {
height: calc(100vh - 150rpx);
overflow-y: scroll;
border-top: 1rpx solid #F4F4F4;
width: 100%;
background-color: #F2F2F2;
border-radius: 20rpx;
display: flex;
flex-direction: column;
align-items: self-start;
justify-content: start;
position: relative;
.people-info-box {
width: 100%;
padding: 30rpx;
background-color: white;
display: flex;
align-items: center;
justify-content: center;
.image-box {
display: flex;
align-items: center;
justify-content: center;
image {
border-radius: 50%;
width: 100rpx;
height: 100rpx;
}
}
.people-name-box {
flex: 1;
display: flex;
flex-direction: column;
align-items: self-start;
justify-content: center;
padding: 0 15rpx;
.name-box {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
justify-content: center;
.name-dom {
font-size: 34rpx;
font-weight: bold;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-right: 20rpx;
}
.fans-dom {
font-size: 22rpx;
padding: 5rpx 15rpx;
border: 1rpx solid #FC1F3E;
color: #FC1F3E;
border-radius: 25rpx 25rpx 25rpx 0;
}
}
.renzheng-dom {
padding: 8rpx 0;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
image {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
}
}
.opt-box {
width: 230rpx;
font-size: 25rpx;
display: flex;
align-items: center;
justify-content: flex-end;
.lahei {
display: flex;
align-items: center;
justify-content: center;
border-radius: 20rpx;
color: white;
background-color: #929292;
padding: 5rpx 20rpx;
}
.guanzhu {
display: flex;
align-items: center;
justify-content: center;
margin-left: 20rpx;
background-color: #FC1F3E;
color: white;
border-radius: 20rpx;
padding: 5rpx 20rpx;
}
}
}
.bozhu-type-box {
width: 100%;
background-color: white;
border-bottom: 1rpx solid #F4F4F4;
.item-dom {
display: flex;
align-items: center;
justify-content: center;
float: left;
padding: 4rpx 25rpx;
background-color: #F4F4F4;
color: #363636;
margin: 0 0 30rpx 30rpx;
border-radius: 30rpx;
}
}
.pingjia-box {
width: 100%;
background-color: white;
padding: 30rpx;
.pingjia-content {
width: 100%;
background-color: #FAFAFA;
border-radius: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.top-title {
width: 100%;
padding: 30rpx 30rpx 20rpx 30rpx;
display: flex;
align-items: center;
justify-content: start;
image {
width: 50rpx;
height: 50rpx;
margin-right: 10rpx;
font-weight: bold;
}
}
.item-box {
width: 100%;
.item-dom {
float: left;
padding: 5rpx 25rpx;
color: #363636;
border-radius: 30rpx;
border: 1rpx solid #E5E5E5;
margin: 0 0 15rpx 30rpx;
}
}
}
}
.dl-title {
padding: 20rpx 30rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: start;
margin-bottom: 20rpx;
image {
width: 30rpx;
height: 30rpx;
}
text {
margin-left: 10rpx;
font-weight: bold;
font-size: 32rpx;
}
}
.data-list-box {
padding: 5rpx 30rpx 20rpx 30rpx;
display: flex;
flex-direction: column;
align-items: self-start;
justify-content: start;
width: 100%;
height: calc(100vh - var(--status-bar-height) - var(--window-bottom) - 400rpx);
}
}
}
</style>