talk_appAmin/pages/mine/myActivity/index.vue

399 lines
11 KiB
Vue
Raw Normal View History

2024-06-09 20:22:43 +08:00
<template>
<view class="cardss">
<!-- tabs标签 -->
<view class="tabsinfo flex ">
<up-tabs :list="list4" lineWidth="20" lineHeight="2" @click="tabsClick" lineColor="#3477FC" :activeStyle="{
color: '#000000',
fontSize: '28rpx',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#999999',
fontSize: '28rpx',
transform: 'scale(1.05)'
}" itemStyle=" width: 180rpx; padding-bottom:18rpx;">
</up-tabs>
</view>
</view>
<view class="cardz">
<!-- 列表信息 -->
<view class="scrollable-list">
<up-list @scrolltolower="scrolltolower" :showScrollbar="false" :pagingEnabled="true">
<up-list-item v-for="(item, index) in modelValue" :key="index">
<view class="listInfo" @click="toInfo(item)">
<view class="titile-Time">
发布时间 {{ item.startTime }}
</view>
<view class="statsInfo1">
<view v-if="item.auditStatus == 0"
style="font-size: 24rpx;color: #3477FC ;width: 74rpx; height: 25rpx;">已发布</view>
<view v-else-if="item.auditStatus == 2"
style="font-size: 24rpx;color: #43CE8F ;width: 74rpx; height: 25rpx;">审核中</view>
<view v-else-if="item.auditStatus == 3 |item.auditStatus==4"
style="font-size: 24rpx;color: #F87863 ;width: 74rpx; height: 25rpx;">未通过</view>
</view>
<up-line color="#f4f5f6" length="96%" direction="row" margin="24rpx 24rpx 24rpx 0" ></up-line>
<view class="titile">
{{ item.acTitle }}
</view>
<view class="startTime flex alignCenter">
<image :src="tu52" style="width: 25rpx; height: 26rpx; margin-right: 12rpx;"></image>
开始时间{{ item.startTime }}
</view>
<view class="endTime flex alignCenter">
<image :src="tu53" style="width: 25rpx; height: 26rpx; margin-right: 12rpx;"></image>
结束时间{{ item.endTime }}
</view>
<view class="addrs flex alignCenter">
<image :src="tu51" style="width: 25rpx; height: 26rpx; margin-right: 12rpx;"></image>
活动地点{{ item.addres }}
</view>
<view class="statsInfo">
<!-- 动态数据 -->
<view :class="getDictLabelByValue(item.state).cssClass">
<span class="text">{{ getDictLabelByValue(item.state).dictLabel }}</span>
</view>
</view>
</view>
</up-list-item>
</up-list>
</view>
</view>
</template>
<script setup>
import { getmelistInfo } from "@/api/activityInfo/info";
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'
import { ref, getCurrentInstance, reactive, toRefs } from 'vue';
import { getDicts } from "@/api/system/dict/data";
import { onShow, onLoad, onPullDownRefresh } from '@dcloudio/uni-app'
import image from 'uview-plus/libs/config/props/image';
const { proxy } = getCurrentInstance();
const isOfficial = ref(true)
const iconConfig = proxy.iconConfig;
const bjt = iconConfig.bjt;
const tu51 = iconConfig.tu51;
const tu52 = iconConfig.tu52;
const tu53 = iconConfig.tu53;
const list4 = reactive([
{ name: '全部活动', state: 9 },
{ name: '已发布', state: 0 },
{ name: '未通过', state: 3 },
{ name: '审核中', state: 2 }
]);
const total = ref()
const actiInfoList = ref()
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 5,
launchUserId: null,
accendCondition: null,
acName: null,
acTitle: null,
acContent: null,
startTime: null,
endTime: null,
state: null,
addres: null,
longitude: null,
latitude: null,
file: null,
elroll: null,
acQrcode: null,
tab: null,
readCount: null,
transmitCount: null,
likeCount: null,
commentCount: null,
favoriteCount: null,
postTop: null,
type: null,
anonymity: null,
auditor: null,
auditStatus: null,
auditTime: null,
auditAdvice: null,
cut: null,
},
rules: {
auditStatus: [
{ required: true, message: "状态0正常1待脱敏 2待审核 3脱敏未通过 4 审核未通过 5草稿不能为空", trigger: "change" }
],
}
});
// 表单重置
function reset() {
form.value = {
id: null,
launchUserId: null,
accendCondition: null,
acName: null,
acTitle: null,
acContent: null,
startTime: null,
endTime: null,
state: null,
addres: null,
longitude: null,
latitude: null,
file: null,
elroll: null,
acQrcode: null,
tab: null,
readCount: null,
transmitCount: null,
likeCount: null,
commentCount: null,
favoriteCount: null,
postTop: null,
type: null,
anonymity: null,
createTime: null,
auditor: null,
auditStatus: null,
auditTime: null,
auditAdvice: null,
cut: null,
delFlag: null
};
proxy.resetForm("infoRef");
}
const { queryParams, form, rules } = toRefs(data);
const modelValue = ref()
// 在data中添加isLoading标志
const isLoading = ref(false);
const scrolltolower = async () => {
console.log("加载新数据:");
// 检查是否还有更多数据可以加载
if (queryParams.value.pageNum * queryParams.value.pageSize < total.value) {
// 防止在数据加载时重复触发
if (isLoading.value) return;
isLoading.value = true;
queryParams.value.pageNum += 1;
try {
const response = await getmelistInfo(queryParams.value);
// 使用Array.prototype.push.apply将新数据追加到actiInfoList中
Array.prototype.push.apply(modelValue.value, response.rows);
console.log(modelValue.value);
} catch (error) {
console.error("加载更多数据时发生错误:", error);
} finally {
isLoading.value = false;
}
} else {
// 可以在这里处理没有更多数据的情况,例如显示提示信息
console.log("没有更多数据了");
}
};
2024-06-09 23:10:23 +08:00
const toInfo = (item) => {
proxy.$tab.navigateTo(`/pages/mine/myActivity/info?id=${item.id}`);
}
//删除分页信息
2024-06-09 20:22:43 +08:00
const removePage = () => {
queryParams.value.pageNum = 1
queryParams.value.pageSize = 5
2024-06-09 20:22:43 +08:00
}
const activityState = ref()
onLoad((options) => {
getDicts('activity_state').then(e => {
activityState.value = e.data;
2024-06-09 20:22:43 +08:00
})
reset()
getListBytype(options.type)
})
const getListBytype = (type) => {
if(type == 0){
queryParams.value.auditStatus = null;
}else if(type == 1){
queryParams.value.auditStatus = 0;
}else if(type == 2){
queryParams.value.auditStatus = 2;
}else if(type == 3){
queryParams.value.auditStatus = 3;
}
getList()
}
// 下拉刷新
onPullDownRefresh((options) => {
removePage();
console.log("下拉刷新,", queryParams.value);
2024-06-09 20:22:43 +08:00
getList();
})
2024-06-11 13:25:35 +08:00
//按照条件查询
2024-06-09 20:22:43 +08:00
const tabsClick = (index) => {
removePage()
if (index.state == 9) {
queryParams.value.auditStatus = null;
} else {
queryParams.value.auditStatus = index.state
}
getList()
}
const getList = () => {
getmelistInfo(queryParams.value)
.then(res => {
uni.stopPullDownRefresh()
total.value = res.total
modelValue.value = res.rows
})
}
const getDictLabelByValue = (state) => {
const dict = activityState.value.find((dict) => dict.dictValue === state);
return dict ? dict : '未知状态';
};
</script>
<style lang="scss">
2024-06-09 20:22:43 +08:00
.tabsinfo {
background-color: #ffffff;
margin: 0 auto;
justify-content: space-between;
}
.cardss {
width: 100%;
height: 68rpx;
background-color: #FFFFFF;
display: flex;
align-items: flex-end;
}
.scrollable-list {
overflow-x: hidden;
overflow-y: auto;
}
.listInfo {
position: relative;
width: 686rpx;
height: 408rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;
background: #ffffff;
margin: 0 auto;
margin-top: 24rpx;
padding-top: 24rpx;
padding-left: 24rpx;
.titile-Time {
font-weight: 600;
font-size: 30rpx;
color: #000000 !important;
}
.titile {
font-weight: 400;
font-size: 32rpx;
color: #000000 100%;
}
.startTime {
margin-top: 34rpx;
font-weight: 400;
height: 24rpx;
font-size: 24rpx;
color: #000000 100%;
}
.endTime {
margin-top: 12rpx;
font-weight: 400;
height: 24rpx;
font-size: 24rpx;
color: #000000 100%;
}
.addrs {
margin-top: 22rpx;
font-weight: 400;
height: 24rpx;
font-size: 24rpx;
color: #000000 100%;
}
}
.statsInfo1 {
position: absolute;
right: 24rpx;
top: 24rpx;
}
.statsInfo {
position: absolute;
right: 24rpx;
bottom: 24rpx;
}
.state0 {
width: 84rpx;
height: 28rpx;
border-radius: 14rpx 14rpx 14rpx 14rpx;
background: #f1f1f1;
display: flex;
justify-content: center;
align-content: center;
.text {
font-weight: 400;
width: 60rpx;
height: 20rpx;
font-size: 20rpx;
text-align: center;
color: #7E7E7E;
}
}
.state1 {
width: 84rpx;
height: 28rpx;
border-radius: 14rpx 14rpx 14rpx 14rpx;
background: #c0f0ec;
display: flex;
justify-content: center;
align-content: center;
.text {
font-weight: 400;
font-size: 20rpx;
text-align: center;
color: #00CCBE;
}
}
.state2 {
width: 84rpx;
height: 28rpx;
border-radius: 14rpx 14rpx 14rpx 14rpx;
background: #fde2e2;
display: flex;
justify-content: center;
align-content: center;
.text {
font-weight: 400;
width: 60rpx;
height: 20rpx;
font-size: 20rpx;
text-align: center;
color: #FFABAB;
}
}
</style>