初始化导入 hjsq H5 项目代码
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,590 @@
|
||||
<template>
|
||||
<div class="minepostpage">
|
||||
<Header title="创作中心">
|
||||
<template v-slot:right>
|
||||
<!-- v-if="state.active === 2" -->
|
||||
<div
|
||||
v-if="state.active === 2"
|
||||
class="right-btn"
|
||||
:class="{ 'right-btn--done': state.isEdit }"
|
||||
@click="editPost"
|
||||
>
|
||||
{{ !state.isEdit ? '编辑' : '完成' }}
|
||||
</div>
|
||||
</template>
|
||||
</Header>
|
||||
<div class="info">
|
||||
<div class="info-item">
|
||||
<div class="info-item-title">收益余额</div>
|
||||
<div class="info-item-value">{{ (state.userWallet.income * 100) / 100 || 0 }}</div>
|
||||
<div class="btnbox">
|
||||
<div class="btn flex-center-center" @click="$router.push({ path: '/withdraw' })">立即提现</div>
|
||||
<!-- <div class="btn flex-center-center" @click="$router.push('/revenueDetails')">收益明细</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-item-title">累计收益</div>
|
||||
<div class="info-item-value">{{ (state.userWallet.vidIncome * 100) / 100 || 0 }}</div>
|
||||
<div class="btnbox">
|
||||
<!-- <div class="btn flex-center-center" @click="$router.push({ path: '/withdraw', query: { title: '收益提现' } })">
|
||||
立即提现
|
||||
</div> -->
|
||||
<div class="btn flex-center-center" @click="$router.push('/revenueDetails')">业绩明细</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<van-tabs
|
||||
v-model:active="state.active"
|
||||
title-active-color="#FFFFFF"
|
||||
title-inactive-color="rgba(255, 255, 255, 0.55)"
|
||||
animated
|
||||
@change="onChange"
|
||||
>
|
||||
<van-tab :title="item.name" :name="item.id" v-for="(item, index) in state.tabList" :key="index">
|
||||
<div class="content overflow-y-auto" :id="`minepostPage${item.id}`" v-if="state.active === item.id">
|
||||
<PullRefresh v-if="!state.loading" :params="moreParams" @onLoad="onLoad" @onRefresh="onRefresh">
|
||||
<div class="listBox" v-for="(item, index) in state.list" :key="index">
|
||||
<div class="list_status">
|
||||
<p>{{ state.active === 1 ? '发布于' : '上传于' }}{{ fromNowTime(item.createdAt) }}</p>
|
||||
<div
|
||||
v-if="!state.isEdit"
|
||||
class="status_btn"
|
||||
:class="{ status_err: item.status == 2 }"
|
||||
@click.stop="item.status == 2 ? showDialog(item.reason) : ''"
|
||||
>
|
||||
{{ setText(item.status) }}
|
||||
</div>
|
||||
</div>
|
||||
<UserPost class="post" :postInfo="item" :currentIndex="index" :list="state.list" :key="item" />
|
||||
<div v-if="state.isEdit" class="delete-box" @click="handleCheck(item)">
|
||||
<div class="delete-btn">
|
||||
<div v-if="!item.checked" class="unselect"></div>
|
||||
<div v-if="item.checked" class="select"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PullRefresh>
|
||||
<Loading v-else />
|
||||
</div>
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
<van-popup v-model:show="state.isShow">
|
||||
<div class="warp">
|
||||
<div class="content_warp app-popup-surface">
|
||||
<div class="content">
|
||||
<p class="title app-popup-title">未过审原因</p>
|
||||
<div class="mess app-popup-body" v-html="state.reason"></div>
|
||||
<div class="btn_box">
|
||||
<div class="ISee flex-center-center app-popup-primary" @click="state.isShow = false">我知道了</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-popup>
|
||||
<div class="bottom-box" v-if="state.isEdit">
|
||||
<div class="btn flex-center-center" @click="handleCheckAll">
|
||||
{{ isAllChecked ? '取消全选' : '全选' }}
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="btn flex-center-center delete-btn" @click="handleDelete">删除({{ checkedLength }})</div>
|
||||
</div>
|
||||
<div class="add_info" v-if="!state.isEdit" @click="state.showAddBox = true"></div>
|
||||
<van-popup v-model:show="state.showAddBox" round position="bottom">
|
||||
<div class="addPopup">
|
||||
<div class="title">
|
||||
<div class="add_line" />
|
||||
选择发布类型
|
||||
<!-- <SvgIcon name="popup_close" @click="state.showAddBox = false"></SvgIcon> -->
|
||||
</div>
|
||||
<div class="pop_mess">
|
||||
<div @click="$router.push('/pubilshImg'), (state.showAddBox = false)">
|
||||
<img src="@/assets/images/png/add_img.png" alt="" />
|
||||
图片
|
||||
</div>
|
||||
<div @click="$router.push('/publishVideo'), (state.showAddBox = false)">
|
||||
<img src="@/assets/images/png/add_video.png" alt="" />
|
||||
视频
|
||||
</div>
|
||||
<div @click="$router.push('/publishGraphics'), (state.showAddBox = false)">
|
||||
<img src="@/assets/images/png/add_text.png" alt="" />
|
||||
图文
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'minepostpage',
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, nextTick, onActivated, computed } from 'vue';
|
||||
import UserApi from '@/service/user';
|
||||
import { useUserStore } from '@/stores/user';
|
||||
import { fromNowTime } from '@/utils/index';
|
||||
import TabPageScroll from '@/utils/resetTabPageScrollTop';
|
||||
|
||||
const tabPageScroll = new TabPageScroll();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const state = reactive({
|
||||
userInfo: <Types.User.UserInfoType>{},
|
||||
userWallet: <Types.User.WalletInfo>{},
|
||||
loading: true,
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
list: <Array<any>>[],
|
||||
isShow: false,
|
||||
reason: '',
|
||||
tabList: [
|
||||
{ name: '已发布', id: 1 },
|
||||
{ name: '待审核', id: 0 },
|
||||
{ name: '未通过', id: 2 },
|
||||
],
|
||||
active: 1,
|
||||
isEdit: false,
|
||||
showAddBox: false,
|
||||
});
|
||||
|
||||
const moreParams = reactive({
|
||||
loading: true,
|
||||
refreshing: false,
|
||||
finished: false,
|
||||
isNoData: false,
|
||||
error: false,
|
||||
isHigehtMax: true,
|
||||
});
|
||||
|
||||
const isAllChecked = computed(() => {
|
||||
return state.list.length > 0 && state.list.every((v: any) => v.checked);
|
||||
});
|
||||
|
||||
const checkedLength = computed(() => {
|
||||
return state.list.filter((v: any) => v.checked).length;
|
||||
});
|
||||
|
||||
// 获取帖子
|
||||
const getList = async (type: any) => {
|
||||
try {
|
||||
let req = {
|
||||
// uid:state.userInfo.uid,
|
||||
pageNumber: state.pageNumber,
|
||||
pageSize: state.pageSize,
|
||||
status: state.active,
|
||||
};
|
||||
let res: any = await UserApi.minePublish(req);
|
||||
state.loading = false;
|
||||
moreParams.loading = false;
|
||||
moreParams.refreshing = false;
|
||||
console.log(res);
|
||||
let list = res.list || [];
|
||||
if (type === 'refresh') {
|
||||
state.list = list;
|
||||
} else {
|
||||
state.list = state.list.concat(list);
|
||||
}
|
||||
if (state.pageNumber == 1 && state.list.length == 0) {
|
||||
moreParams.isNoData = true;
|
||||
}
|
||||
if (!res.hasNext) {
|
||||
moreParams.finished = true;
|
||||
}
|
||||
} catch (e) {
|
||||
moreParams.loading = false;
|
||||
moreParams.error = true;
|
||||
}
|
||||
};
|
||||
|
||||
onActivated(() => {
|
||||
let datas = localStorage.getItem('operateData') ? JSON.parse(localStorage.getItem('operateData') as string) : '';
|
||||
if (datas) {
|
||||
console.log(datas);
|
||||
state.list.forEach((v: any, index: any) => {
|
||||
if (v.id == datas.id) {
|
||||
state.list.splice(index, 1, datas);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
nextTick(() => {
|
||||
state.userInfo = userStore.userInfo;
|
||||
/**
|
||||
* 获取金币钱包信息
|
||||
*/
|
||||
userStore.updateWallet();
|
||||
state.userWallet = userStore.walletInfo;
|
||||
getList(null);
|
||||
tabPageScroll.add(`#minepostPage${state.active}`);
|
||||
});
|
||||
|
||||
const onLoad = () => {
|
||||
moreParams.loading = true;
|
||||
state.pageNumber++;
|
||||
getList(null);
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
state.pageNumber = 1;
|
||||
moreParams.refreshing = true;
|
||||
moreParams.finished = false;
|
||||
getList('refresh');
|
||||
};
|
||||
|
||||
const showDialog = (data: any) => {
|
||||
state.isShow = true;
|
||||
state.reason = data;
|
||||
};
|
||||
|
||||
const setText = (data: any) => {
|
||||
if (data == 0) {
|
||||
return '待审核';
|
||||
} else if (data == 1) {
|
||||
return '已通过';
|
||||
} else if (data == 2) {
|
||||
return '未通过原因';
|
||||
// return '查看原因';
|
||||
}
|
||||
};
|
||||
|
||||
const onChange = (data: any) => {
|
||||
state.pageNumber = 1;
|
||||
state.list = [];
|
||||
state.isEdit = false;
|
||||
moreParams.loading = true;
|
||||
moreParams.finished = false;
|
||||
moreParams.refreshing = false;
|
||||
moreParams.isNoData = false;
|
||||
moreParams.error = false;
|
||||
getList(null);
|
||||
setTimeout(() => {
|
||||
tabPageScroll.add(`#minepostPage${state.active}`);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
const editPost = () => {
|
||||
console.log('编辑');
|
||||
state.isEdit = !state.isEdit;
|
||||
};
|
||||
|
||||
const handleCheck = (item: any) => {
|
||||
item.checked = !item.checked;
|
||||
|
||||
console.log(item);
|
||||
};
|
||||
|
||||
const handleCheckAll = () => {
|
||||
const allChecked = state.list.every((item) => item.checked);
|
||||
state.list.forEach((v: any) => {
|
||||
v.checked = !allChecked;
|
||||
});
|
||||
};
|
||||
|
||||
const handleDelete = async () => {
|
||||
console.log(state.list);
|
||||
let ids: Array<string> = [];
|
||||
state.list.forEach((v: any) => {
|
||||
if (v.checked) {
|
||||
ids.push(v.id);
|
||||
}
|
||||
});
|
||||
await UserApi.minePublishDelete({
|
||||
ids,
|
||||
});
|
||||
state.list = state.list.filter((i) => !ids.includes(i.id));
|
||||
console.log(state.list);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.minepostpage {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
background: #000;
|
||||
:deep(.header) {
|
||||
.right-btn {
|
||||
color: rgba(152, 152, 152, 1);
|
||||
font-size: 12px;
|
||||
&.right-btn--done {
|
||||
color: #ffc000;
|
||||
}
|
||||
}
|
||||
}
|
||||
.info {
|
||||
height: 125px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
font-size: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 12px 16px;
|
||||
border-radius: 8px;
|
||||
padding: 0 30px;
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 0 10px;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
.info-item-title {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.info-item-value {
|
||||
font-size: 24px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.btnbox {
|
||||
margin: 10px 0 0 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
div {
|
||||
font-size: 12px;
|
||||
background: #ffc000;
|
||||
color: #1f2029;
|
||||
width: 72px;
|
||||
height: 25px;
|
||||
border-radius: 13.5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content {
|
||||
height: calc(100vh - 200px);
|
||||
padding: 0 10px;
|
||||
padding-bottom: 62px;
|
||||
.listBox {
|
||||
position: relative;
|
||||
.list_status {
|
||||
padding: 0 10px;
|
||||
margin-top: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
p {
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
}
|
||||
.status_btn {
|
||||
color: #03fceb;
|
||||
}
|
||||
.status_err {
|
||||
color: #f52c56;
|
||||
}
|
||||
}
|
||||
.delete-box {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.delete-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 20px;
|
||||
.unselect {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 50%;
|
||||
border: 1.5px solid rgba(255, 255, 255, 0.45);
|
||||
box-sizing: border-box;
|
||||
background: transparent;
|
||||
}
|
||||
.select {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 50%;
|
||||
background: #ffc000;
|
||||
position: relative;
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 7px;
|
||||
top: 4px;
|
||||
width: 5px;
|
||||
height: 9px;
|
||||
border: solid #1f2029;
|
||||
border-width: 0 2px 2px 0;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.my-refresh) {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.warp {
|
||||
color: #fff;
|
||||
.content_warp {
|
||||
width: 311px;
|
||||
border-radius: 10px;
|
||||
background: #000;
|
||||
.content {
|
||||
height: auto !important;
|
||||
font-size: 12px;
|
||||
.title {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
padding: 30px 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.mess {
|
||||
width: 100%;
|
||||
font-size: 15px;
|
||||
padding: 0 30px;
|
||||
box-sizing: border-box;
|
||||
line-height: 20px;
|
||||
color: #a2a4ac;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
.btn_box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
margin: 30px 0 0 0;
|
||||
padding-bottom: 20px;
|
||||
box-sizing: border-box;
|
||||
.ISee {
|
||||
width: 205px;
|
||||
height: 44px;
|
||||
background: #ffc000;
|
||||
color: #1f2029;
|
||||
margin: 0 10px 0 0;
|
||||
border-radius: 22px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.ISee:nth-child(2) {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.van-tabs) {
|
||||
.van-tabs__wrap {
|
||||
background: #000;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 9;
|
||||
}
|
||||
.van-tabs__nav {
|
||||
background: #000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
}
|
||||
.van-tab {
|
||||
flex: 1;
|
||||
padding: 0 18px 5px 18px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.van-tabs__line {
|
||||
width: 13px;
|
||||
height: 3px;
|
||||
bottom: 22px;
|
||||
background: #ffc000;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
.bottom-box {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 20;
|
||||
width: 100%;
|
||||
height: calc(62px + env(safe-area-inset-bottom));
|
||||
padding: 0 24px env(safe-area-inset-bottom);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #1a1a1a;
|
||||
box-sizing: border-box;
|
||||
.line {
|
||||
display: none;
|
||||
}
|
||||
.btn {
|
||||
min-width: auto;
|
||||
height: 38px;
|
||||
border-radius: 19px;
|
||||
font-size: 15px;
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
padding: 0 8px;
|
||||
}
|
||||
.delete-btn {
|
||||
min-width: 110px;
|
||||
background: #f52c56;
|
||||
color: #fff;
|
||||
border-radius: 19px;
|
||||
}
|
||||
}
|
||||
.add_info {
|
||||
position: fixed;
|
||||
bottom: 40px;
|
||||
right: 16px;
|
||||
z-index: 30;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background: url('@/assets/images/png/add_post.png') no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.addPopup {
|
||||
width: 100%;
|
||||
padding: 20px 20px 60px 20px;
|
||||
box-sizing: border-box;
|
||||
background: #000;
|
||||
.title {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
svg {
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
}
|
||||
.add_line {
|
||||
margin: 0 auto 16px;
|
||||
width: 36px;
|
||||
height: 5px;
|
||||
background: #4d4d5c;
|
||||
border-radius: 99px;
|
||||
}
|
||||
}
|
||||
.pop_mess {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
color: #a3a2a2;
|
||||
padding: 0 30px;
|
||||
> div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
font-size: 14px;
|
||||
}
|
||||
img {
|
||||
display: block;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user