talk_appAmin/pages/mine/myActivity/draft.vue

345 lines
8.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode 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 class="cardss">
<!-- 顶部导航栏 -->
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" @leftClick="leftClick">
<template #center>
<div class="navbarcenter"><span class="text1">草稿箱</span></div>
</template>
</up-navbar>
</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.createTime }}
</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>
开始时间<span v-if="item.startTime == null">未填写</span> <span v-else>{{ item.startTime}}</span>
</view>
<view class="endTime flex alignCenter">
<image :src="tu53" style="width: 25rpx; height: 26rpx; margin-right: 12rpx;"></image>
结束时间:<span v-if="item.endTime == null">未填写</span> <span v-else>{{ item.endTime}}</span>
</view>
<view class="addrs flex alignCenter">
<image :src="tu51" style="width: 25rpx; height: 26rpx; margin-right: 12rpx;"></image>
活动地点: <span v-if="item.addres == null">未填写</span> <span v-else>{{ item.addres }}</span>
</view>
</view>
</up-list-item>
</up-list>
</view>
</view>
</template>
<script setup>
import { draftlist } 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 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 draftlist(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("没有更多数据了");
}
};
const toInfo = (item) => {
proxy.$tab.navigateTo(`/pages/activity/publish?id=${item.id}`);
}
//删除分页信息
const removePage = () => {
queryParams.value.pageNum = 1
queryParams.value.pageSize = 5
}
const activityState = ref()
onLoad((options) => {
reset()
getList()
})
// 下拉刷新
onPullDownRefresh((options) => {
removePage();
console.log("下拉刷新,", queryParams.value);
getList();
})
const getList = () => {
queryParams.value.auditStatus = 5
draftlist(queryParams.value)
.then(res => {
console.log(res);
uni.stopPullDownRefresh()
total.value = res.total
modelValue.value = res.rows
})
}
const leftClick = () => {
proxy.$tab.navigateBack(1);
};
</script>
<style lang="scss">
page {
background-color: #F4F5F6;
}
.navbarcenter {
.text1 {
font-weight: 600;
font-size: 36rpx;
color: #000000 !important;
}
}
.scrollable-list {
overflow-x: hidden;
overflow-y: auto;
}
.listInfo {
position: relative;
width: 686rpx;
height: 350rpx;
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>