talk_appAmin/pages/work/renzhen_sh/renzhen_sh.vue

420 lines
11 KiB
Vue

<template>
<view>
<!-- tabs标签 -->
<view class="tabsinfo flex alignCenter justifyCenter">
<up-tabs :list="list4" lineWidth="24" lineHeight="4" @click="tabsClick" lineColor="#6aa2ff" :activeStyle="{
color: '#000000',
fontSize: '30rpx',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#999999',
fontSize: '28rpx',
transform: 'scale(1.05)'
}" itemStyle=" width: 185rpx; padding-bottom:18rpx;">
</up-tabs>
</view>
<!-- 审核的信息 -->
<!-- 审核的信息 -->
<up-list @scrolltolower="scrolltolower" :showScrollbar="false" :pagingEnabled="true">
<up-list-item v-for="(item, index) in modelValue" :key="index" v-if="modelValue && modelValue.length">
<view class="shenghe_item" @click="gotoworkinfo(item)">
<view class="user_header">
<view class="">
<view class="user_img">
<image :src="item.avatarInfo == null || item.avatarInfo == '' ? '../../../static/images/icon/tu3-9.jpg' :avatarIcon(item.avatarInfo)" mode=""></image>
<!-- <image :src=avatarIcon(item.avatar) mode=""></image> -->
</view>
<!-- 预防 style 状态 溢出 -->
<view class="user_msg" style="width: 440rpx;" >
<!-- nickName 为 用户昵称, infoName 为 实名信息名字-->
<h4>{{ item.nickName == null || item.nickName == '' ? 'XXX': item.nickName }}</h4>
<!-- 牛逼 通过才 显示时间 和 学校是吧 -->
<!-- <p v-if="item.auditInfo == 1"
style="width: 500rpx; height: 50rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
{{item.createTime ? timeAgo(item.createTime) : '错误时间' }}·{{ item.dept.parentName ? item.dept.parentName : '错误学校'}}</p> -->
<p style="width: 500rpx; height: 50rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
{{item.createTime ? timeAgo(item.createTime) : '错误时间' }}·{{ item.dept.parentName ? item.dept.parentName : '区域负责人'}}</p>
</view>
</view>
<view class="text_style">
<view v-if="item.auditInfo == 1"
style="font-size: 24rpx;color: #00CCBE ;width: 74rpx; height: 25rpx;">已通过</view>
<view v-else-if="item.auditInfo == 4"
style="font-size: 24rpx;color: #6AA2FF ;width: 74rpx; height: 25rpx;">待审核</view>
<view v-else-if="item.auditInfo == 5"
style="font-size: 24rpx;color: #FFABAB ;width: 74rpx; height: 25rpx;">未通过</view>
</view>
</view>
<!-- 审核的文章标题 -->
<view class="shenghe_title">
<view class="lin1">
姓名:{{ item.infoName }}
</view>
<view class="lin1">
年级:{{ item.infoGrade }}
</view>
<view class="lin2">
学号:{{ item.infoCode }}
</view>
<view class="lin2">
系别:{{ item.dept && item.dept.deptName ? item.dept.deptName : '错误系别' }}
<!-- 系别:{{ item.dept.deptName }} -->
</view>
<view class="lin2">
学校:{{ item.dept && item.dept.parentName ? item.dept.parentName : '区域负责人' }}
<!-- 学校:{{ item.dept.parentName }} -->
</view>
</view>
</view>
</up-list-item>
<view class="" v-else>
<view class="noContent">
<image src="@/static/images/icon/tu4-9.png" class="img6"></image>
<view class="noContentText"></view>
</view>
</view>
</up-list>
</view>
</template>
<script setup>
import { getStudentlistInfo } from "@/api/system/userinfo.js";
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 store = useStore();
const iconConfig = proxy.iconConfig;
const bjt = iconConfig.bjt;
const tu51 = iconConfig.tu51;
const tu52 = iconConfig.tu52;
const tu53 = iconConfig.tu53;
const QNDomain = store.state.user.QNDomain;
const list4 = ref([
{ name: '全部审核', state: 9 },
{ name: '待审核', state: 4 },
{ name: '已通过', state: 1 },
{ name: '未通过', state: 5 },
]);
function gotoworkinfo(item){
proxy.$tab.navigateTo(`/pages/work/renzhen_sh/renzhen_info?id=${item.userId}`);
}
const total = ref()
const actiInfoList = ref()
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 5,
doingsStatus: null,
newUser: null,
birthday: null,
infoName: null,
infoGrade: null,
infoCode: null,
infoDocument: null,
codeDocument: null,
codeInfo: null,
backgroundImage: null,
auditInfo: null,
auditTime: null,
auditUserId: null,
area: null,
infoRank: null,
infoCoin: null,
infoActive: null,
infoAssist: null,
followCount: null,
fanCount: null,
dept:{
parentName: null,
deptName: null
}
},
rules: {
auditStatus: [
{ required: true, message: "状态0正常1待脱敏 2待审核 3脱敏未通过 4 审核未通过 5草稿不能为空", trigger: "change" }
],
}
});
const avatarIcon = (e) => {
return QNDomain + e;
};
// 表单重置
function reset() {
form.value = {
userId: null,
doingsStatus: null,
newUser: null,
birthday: null,
infoName: null,
infoGrade: null,
infoCode: null,
infoDocument: null,
codeDocument: null,
codeInfo: null,
backgroundImage: null,
auditInfo: null,
auditTime: null,
auditUserId: null,
area: null,
infoRank: null,
infoCoin: null,
infoActive: null,
infoAssist: null,
followCount: null,
fanCount: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
dept:{
parentName: null,
deptName: null
}
};
proxy.resetForm("userinfoRef");
}
const { queryParams, form, rules } = toRefs(data);
const modelValue = ref()
// 在data中添加isLoading标志
const isLoading = ref(false);
function timeAgo(input) {
const date = new Date(input);
if (isNaN(date)) {
throw new Error('Invalid date');
}
const now = new Date();
const diff = now - date;
const minutes = Math.floor(diff / 60000); // 1 minute = 60000 ms
const hours = Math.floor(diff / 3600000); // 1 hour = 3600000 ms
const days = Math.floor(diff / 86400000); // 1 day = 86400000 ms
if(diff < 0){
return formatDate(date);
}
if (minutes < 60) {
if (minutes == 0) {
return '刚刚';
}
return `${minutes}分钟前`;
} else if (hours < 24) {
return `${hours}小时前`;
} else if (days < 3) {
return `${days}天前`;
} else {
return formatDate(date);
}
}
function formatDate(input) {
const date = new Date(input);
if (isNaN(date)) {
throw new Error('Invalid date');
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}.${month}.${day}`;
}
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 getStudentlistInfo(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/mine/myActivity/info?id=${item.id}`);
}
//删除分页信息
const removePage = () => {
queryParams.value.pageNum = 1
queryParams.value.pageSize = 5
}
const activityState = ref()
onLoad((options) => {
// getDicts('activity_state').then(e => {
// activityState.value = e.data;
// })
reset()
getList()
})
// 下拉刷新
onPullDownRefresh((options) => {
removePage();
console.log("下拉刷新,", queryParams.value);
getList();
})
//按照条件查询
const tabsClick = (index) => {
removePage()
if (index.state == 9) {
queryParams.value.auditInfo = null;
} else {
queryParams.value.auditInfo = index.state
}
getList()
}
const getList = () => {
getStudentlistInfo(queryParams.value)
.then(res => {
console.log("数据:",res.rows)
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 scoped>
.tabsinfo {
background-color: #fff;
height: 80rpx;
margin-bottom: 24rpx;
}
.shenghe_item {
width: 686rpx;
background: #ffffff;
padding: 48rpx 32rpx 26rpx 32rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;
margin: 0 auto;
margin-bottom: 24rpx;
}
.user_header {
width: 100%;
display: flex;
justify-content: space-between;
height: 84rpx;
.user_img {
width: 84rpx;
height: 84rpx;
margin-right: 19rpx;
image {
width: 84rpx;
height: 84rpx;
border-radius: 50%;
}
}
.user_msg {
h4 {
font-weight: 600;
height: 31rpx;
font-size: 30rpx;
text-align: left;
color: #000000 100%;
margin-bottom: 18rpx;
}
p {
height: 30rpx;
font-size: 30rpx;
color: #999999;
}
}
.text_style {
right: 0;
font-weight: 400;
width: 84rpx;
height: 28rpx;
font-size: 28rpx;
text-align: left;
color: #6AA2FF;
}
}
.user_header>view {
display: flex;
}
.shenghe_title {
width: 100%;
display: flex;
flex-wrap: wrap;
color: #333333;
.lin1{
width: 50%;
margin-top: 32rpx;
}
.lin2{
width: 100%;
margin-top: 24rpx;
}
}
.img6 {
width: 326rpx;
height: 280rpx;
}
.noContent {
margin-top: 150rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.noContentText {
font-weight: 400;
width: 490rpx;
height: 30rpx;
font-size: 30rpx;
text-align: center;
color: #333333;
}
</style>