OfficeApp/subpkg/archives/archives.vue
2023-08-02 17:25:58 +08:00

239 lines
6.3 KiB
Vue

<template>
<view class="">
<view class="personnel_list">
<view class="item" v-for="(item, index) in list" :key="item.id">
<view class="top">
<!-- <image class="avatar" :src="item.avatar||'../../static/img/public/man.png'"></image> -->
<!-- <u--image class="u_avatar" :showLoading="true" :src="item.avatar||'../../static/img/public/man.png'"
width="112.28rpx" height="112.28rpx" shape="circle">
</u--image> -->
<view class="text">
<view class="name">{{item.name}}</view>
<view class="mobile">
<uni-icons type="phone" color="#999999FF"></uni-icons><text>{{item.phone}}</text>
</view>
<view class="mobile">
<uni-icons type="calendar" color="#999999FF"></uni-icons><text>{{item.create_time}}</text>
</view>
</view>
<view class="right" v-if="showView">
<view class="top" @click="navTo('/subpkg/archivesDetail/archivesDetail?id='+item.id)">
查看
</view>
<view class="bottom" @click="navTo('/subpkg/updateArchives/updateArchives?id='+item.id)">
更新
</view>
</view>
</view>
<view class="bottom">
<view class="circle"></view>
<view class="green">所属片区</view>
<view>{{item.address}}</view>
</view>
</view>
<u-loadmore :status="loadConfig.status" :loading-text="loadConfig.loadingText"
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
</view>
<button class="new_btn" v-if="showView"
@click="navTo('/subpkg/newArchives/newArchives')">信息登记</button>
<!-- <button class="new_btn" @click="navTo('/subpkg/updateArchives/updateArchives')">信息更新(测试中)</button> -->
</view>
</template>
<script>
import { informationList } from "@/api/information.js"
import { Toast } from "../../libs/uniApi";
export default {
data() {
return {
user_id: -1,
list: [],
loadConfig: {
page: 1,
limit: 15,
loadingText: '努力加载中',
loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~',
status: 'loadmore'
},
}
},
onLoad(options) {
if(options.id)this.user_id = options.id;
else if(this.$store.state.app.userInfo.admin_id==0){ //如果用户是小队长,将带上自己的id
this.user_id = this.$store.state.app.userInfo.id;
}
},
onShow() {
this.initLoadconfig();
this.loadInformationList();
},
computed: {
// 是否显示查看和更新按钮
showView() {
return !this.$store.state.app.userInfo.admin_id&&this.$store.state.app.userInfo.is_captain;
}
},
onReachBottom() {
this.loadInformationList();
},
methods: {
navTo(url) {
url ?
uni.navigateTo({
url: url,
}) : Toast('暂未开放')
},
initLoadconfig() {
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,
limit: this.loadConfig.limit,
user_id: that.user_id
})
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 {
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;
}
.personnel_list {
padding: 28rpx 0;
margin-bottom: 130rpx;
.item {
margin: 0 auto;
width: 694rpx;
// height: 201rpx;
background: #FFFFFF;
border-radius: 14rpx 14rpx 14rpx 14rpx;
opacity: 1;
margin-bottom: 21rpx;
box-sizing: border-box;
padding: 28rpx;
.top {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
.avatar {
width: 88rpx;
height: 88rpx;
border-radius: 50%;
margin-right: 18rpx;
}
.u_avatar {
margin-right: 18rpx;
}
.text {
display: flex;
justify-content: space-around;
flex-direction: column;
height: 100%;
.name {
font-size: 32rpx;
font-weight: 500;
color: #333333;
}
.mobile {
color: #999999;
font-size: 28rpx;
}
}
.right {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
.top,
.bottom {
width: 158rpx;
height: 53rpx;
background: #FFFFFF;
border-radius: 26rpx 26rpx 26rpx 26rpx;
opacity: 1;
border: 2rpx solid #3274F9;
color: #3274F9;
display: flex;
align-items: center;
justify-content: center;
}
.bottom {
border: 2rpx solid #F9AA32;
color: #F9AA32;
margin-top: 18rpx;
}
}
}
.bottom {
display: flex;
justify-content: left;
align-items: center;
margin-top: 20rpx;
.circle {
width: 11rpx;
height: 11rpx;
opacity: 1;
border: 2rpx solid #34A853;
margin-right: 10rpx;
border-radius: 50%;
}
.green {
font-weight: 400;
color: #34A853;
line-height: 0rpx;
margin-right: 18rpx;
-webkit-background-clip: text;
}
}
}
}
</style>