talk_appAmin/pages/common/activityList/index.vue

219 lines
5.7 KiB
Vue
Raw Normal View History

2024-06-02 11:10:25 +08:00
<template>
<!-- 列表信息 -->
<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)">
<span class="titile">
2024-06-05 16:57:58 +08:00
{{ item.acTitle }}
2024-06-02 11:10:25 +08:00
</span>
<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">
2024-06-09 15:37:59 +08:00
<image :src="tu51" style="width: 25rpx; height: 26rpx; margin-right: 12rpx;"></image>
2024-06-05 16:57:58 +08:00
活动地点{{ item.addres }}
2024-06-02 11:10:25 +08:00
</view>
2024-06-09 23:10:23 +08:00
<view class="statsInfo1" v-if="getDictLabelByValue2(item.attendState) != null">
2024-06-09 20:22:43 +08:00
<!-- 动态数据 -->
2024-06-09 23:10:23 +08:00
<view class="state1" >
<span class="text">{{ getDictLabelByValue2(item.attendState) }}</span></view>
2024-06-09 20:22:43 +08:00
</view>
<view class="statsInfo2">
2024-06-02 11:10:25 +08:00
<!-- 动态数据 -->
2024-06-05 16:57:58 +08:00
<view :class="getDictLabelByValue(item.state).cssClass" >
<span class="text">{{ getDictLabelByValue(item.state).dictLabel }}</span></view>
2024-06-09 20:22:43 +08:00
2024-06-02 11:10:25 +08:00
</view>
</view>
</up-list-item>
</up-list>
</view>
</template>
<script setup>
import { onShow, onLoad } from '@dcloudio/uni-app'
import { getDicts } from "@/api/system/dict/data"
import { ref, reactive, getCurrentInstance } from 'vue'
import { useStore } from 'vuex';
const emit = defineEmits(['scrolltolower']);
const { proxy } = getCurrentInstance();
2024-06-05 16:57:58 +08:00
const activityState = ref([])//字典
2024-06-09 20:22:43 +08:00
const activityState2 = ref([])//字典 take_part_state
2024-06-04 18:57:45 +08:00
const iconConfig = proxy.iconConfig;
const tu21 = iconConfig.tu21;
const tu22 = iconConfig.tu22;
const tu51 = iconConfig.tu51;
const tu52 = iconConfig.tu52;
const tu53 = iconConfig.tu53;
2024-06-02 11:10:25 +08:00
const props = defineProps({
modelValue: Array
});
const scrolltolower = () => {
emit('scrolltolower'); // 如果不需要传递数据,可以省略第二个参数
};
2024-06-02 19:09:14 +08:00
const toInfo = (item) => {
proxy.$tab.navigateTo(`/pages/activity/info?id=${item.id}`);
}
2024-06-05 16:57:58 +08:00
const getDictLabelByValue = (state) => {
const dict = activityState.value.find((dict) => dict.dictValue === state);
2024-06-09 20:22:43 +08:00
return dict ? dict : '未知状态';
};
const getDictLabelByValue2 = (state) => {
2024-06-09 23:10:23 +08:00
if(state == null)return null;
2024-06-09 20:22:43 +08:00
const dict = activityState2.value.find((dict) => dict.dictValue === state);
2024-06-09 23:10:23 +08:00
if( dict== undefined | dict.dictValue == 0){
2024-06-09 20:22:43 +08:00
return null;
}
if(dict.dictValue == 1 | dict.dictValue == 2){
dict.dictLabel = "已报名"
2024-06-09 23:10:23 +08:00
return dict ? dict.dictLabel : '未知状态';
2024-06-09 20:22:43 +08:00
}
2024-06-09 23:10:23 +08:00
return dict ? dict.dictLabel : '未知状态';
2024-06-05 16:57:58 +08:00
};
onLoad((options) => {
getDicts('activity_state').then(e => {
activityState.value = e.data
console.log(activityState.value);
})
2024-06-09 20:22:43 +08:00
getDicts('take_part_state').then(e => {
activityState2.value = e.data
})
2024-06-05 16:57:58 +08:00
})
onShow(() => {
console.log('Page onShow')
})
2024-06-02 11:10:25 +08:00
</script>
<style lang="scss" scoped>
.scrollable-list {
2024-06-02 19:09:14 +08:00
overflow-x: hidden;
overflow-y: auto;
2024-06-02 11:10:25 +08:00
}
.listInfo {
position: relative;
2024-06-02 19:09:14 +08:00
width: 686rpx;
2024-06-02 11:10:25 +08:00
height: 328rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;
background: #ffffff;
margin: 0 auto;
margin-top: 12rpx;
margin-bottom: 12rpx;
padding-top: 24rpx;
padding-left: 24rpx;
.titile {
2024-06-09 15:37:59 +08:00
font-weight: 600;
2024-06-02 11:10:25 +08:00
height: 80rpx;
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%;
}
}
2024-06-09 20:22:43 +08:00
.statsInfo1 {
position: absolute;
right: 130rpx;
bottom: 24rpx;
}
2024-06-02 11:10:25 +08:00
2024-06-09 20:22:43 +08:00
.statsInfo2 {
2024-06-02 11:10:25 +08:00
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>