OfficeApp/subpkg/archives/archives.vue

217 lines
5.6 KiB
Vue
Raw Normal View History

<template>
<view class="">
2023-08-01 10:08:26 +08:00
<view class="personnel_list">
2023-08-02 09:57:46 +08:00
<view class="item" v-for="(item, index) in list" :key="item.id">
2023-08-01 10:08:26 +08:00
<view class="top">
2023-08-04 16:09:05 +08:00
<image class="avatar" src="../../static/img/public/record.png"></image>
<view class="body">
<view class="t_top">
<view>姓名:<text class="name">{{item.name}}</text></view>
<view>电话:<text class="mobile">{{item.phone}}</text></view>
2023-08-02 09:57:46 +08:00
</view>
2023-08-04 16:09:05 +08:00
<view class="t_bottom">片区:<text class="address">{{item.address}}</text></view>
2023-08-01 10:08:26 +08:00
</view>
2023-08-04 16:09:05 +08:00
</view>
<u-line color="#cccccc"></u-line>
<view class="bottom">
<view>更新时间: {{item.create_time}}</view>
2023-08-02 17:25:58 +08:00
<view class="right" v-if="showView">
2023-08-04 16:09:05 +08:00
<view class="update" @click="navTo('/subpkg/updateArchives/updateArchives?id='+item.id)">
2023-08-02 09:57:46 +08:00
更新
2023-08-01 10:08:26 +08:00
</view>
2023-08-04 16:09:05 +08:00
<view class="look" @click="navTo('/subpkg/archivesDetail/archivesDetail?id='+item.id)">
查看
</view>
2023-08-01 10:08:26 +08:00
</view>
</view>
</view>
2023-08-05 15:16:05 +08:00
<u-empty v-if="loadConfig.status=='nomore'&& list.length==0" text="没有档案" icon="/static/img/empty/list.png"></u-empty>
2023-08-04 16:09:05 +08:00
<u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
2023-08-01 10:08:26 +08:00
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
</view>
2023-08-04 16:09:05 +08:00
<mybtn text="信息登记" v-if="showView" @click="navTo('/subpkg/newArchives/newArchives')"></mybtn>
</view>
</template>
<script>
2023-08-01 10:08:26 +08:00
import { informationList } from "@/api/information.js"
import { Toast } from "../../libs/uniApi";
export default {
data() {
return {
2023-08-02 17:25:58 +08:00
user_id: -1,
2023-08-01 10:08:26 +08:00
list: [],
loadConfig: {
page: 1,
limit: 15,
loadingText: '努力加载中',
loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~',
status: 'loadmore'
},
}
},
2023-08-01 16:43:13 +08:00
onLoad(options) {
2023-08-04 16:09:05 +08:00
if (options.id) this.user_id = options.id;
else if (this.$store.state.app.userInfo.admin_id == 0) { //如果用户是小队长,将带上自己的id
2023-08-02 17:25:58 +08:00
this.user_id = this.$store.state.app.userInfo.id;
}
2023-08-01 10:08:26 +08:00
},
onShow() {
this.initLoadconfig();
this.loadInformationList();
},
2023-08-02 09:57:46 +08:00
computed: {
2023-08-01 10:08:26 +08:00
// 是否显示查看和更新按钮
2023-08-02 09:57:46 +08:00
showView() {
2023-08-04 16:09:05 +08:00
return !this.$store.state.app.userInfo.admin_id && this.$store.state.app.userInfo.is_captain;
}
},
2023-08-02 09:57:46 +08:00
onReachBottom() {
this.loadInformationList();
},
methods: {
navTo(url) {
2023-08-04 17:43:13 +08:00
if(url){
uni.showLoading({
title: '加载中',
mask: true
})
uni.navigateTo({
url: url,
2023-08-04 17:43:13 +08:00
success() {
uni.hideLoading()
}
})
}
else Toast('暂未开放');
},
2023-08-02 09:57:46 +08:00
initLoadconfig() {
2023-08-01 10:08:26 +08:00
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
this.list = [];
},
async loadInformationList() {
let that = this;
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await informationList({
page: this.loadConfig.page,
2023-08-02 09:59:38 +08:00
limit: this.loadConfig.limit,
user_id: that.user_id
2023-08-01 10:08:26 +08:00
})
this.loadConfig.status = "loadmore"
if (res.data.length < this.loadConfig.limit) {
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
this.list = [...this.list, ...res.data];
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
.new_btn {
2023-08-01 10:08:26 +08:00
position: fixed;
bottom: 28rpx;
left: 50%;
transform: translate(-50%);
margin-top: 32rpx;
// margin-bottom: 40rpx;
width: 694rpx;
height: 84rpx;
background: $theme-oa-color;
border-radius: 42rpx 42rpx 42rpx 42rpx;
color: #fff;
line-height: 80rpx;
text-align: center;
}
2023-08-01 10:08:26 +08:00
.personnel_list {
padding: 28rpx 0;
2023-08-02 17:25:58 +08:00
margin-bottom: 130rpx;
2023-08-01 10:08:26 +08:00
2023-08-02 09:57:46 +08:00
.item {
2023-08-01 10:08:26 +08:00
margin: 0 auto;
width: 694rpx;
2023-08-02 09:57:46 +08:00
// height: 201rpx;
2023-08-01 10:08:26 +08:00
background: #FFFFFF;
border-radius: 14rpx 14rpx 14rpx 14rpx;
2023-08-02 09:57:46 +08:00
opacity: 1;
margin-bottom: 21rpx;
box-sizing: border-box;
2023-08-01 10:08:26 +08:00
padding: 28rpx;
2023-08-04 16:09:05 +08:00
font-size: 24.53rpx;
color: #999999FF;
2023-08-01 10:08:26 +08:00
.top {
display: flex;
2023-08-02 09:57:46 +08:00
align-items: center;
width: 100%;
2023-08-02 09:57:46 +08:00
.avatar {
2023-08-04 16:09:05 +08:00
width: 120rpx;
height: 120rpx;
2023-08-02 09:57:46 +08:00
margin-right: 18rpx;
2023-08-05 15:16:05 +08:00
margin-bottom: 12rpx;
2023-08-02 09:57:46 +08:00
}
2023-08-04 16:09:05 +08:00
.body{
flex: 1;
.t_top{
2023-08-02 09:57:46 +08:00
display: flex;
2023-08-04 16:09:05 +08:00
justify-content: space-between;
margin-bottom: 18rpx;
.name{
font-size: 32rpx;
color: #333;
}
.mobile{
font-size: 28rpx;
color: #333;
}
2023-08-02 09:57:46 +08:00
}
2023-08-04 16:09:05 +08:00
.t_bottom{
width: 500rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
.address{
font-size: 28rpx;
color: #333;
}
2023-08-02 09:57:46 +08:00
}
2023-08-01 10:08:26 +08:00
}
}
.bottom {
display: flex;
2023-08-04 16:09:05 +08:00
justify-content: space-between;
2023-08-02 09:57:46 +08:00
align-items: center;
margin-top: 20rpx;
2023-08-03 14:05:16 +08:00
font-size: 25rpx;
2023-08-03 17:44:02 +08:00
2023-08-04 16:09:05 +08:00
.right{
font-size: 28rpx;
display: flex;
.look{
color: $theme-oa-color;
}
.update{
color: #34A853;
margin-right: 38rpx;
}
2023-08-03 17:44:02 +08:00
}
2023-08-04 16:09:05 +08:00
2023-08-01 10:08:26 +08:00
}
2023-08-02 09:57:46 +08:00
2023-08-01 10:08:26 +08:00
}
2023-08-02 09:57:46 +08:00
2023-08-01 10:08:26 +08:00
}
</style>