调整页面,新增自动刷新
This commit is contained in:
parent
1785aaa4a2
commit
1ed919adec
@ -1,230 +1,212 @@
|
||||
<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="../../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>
|
||||
</view>
|
||||
<view class="t_bottom">片区:<text class="address">{{item.address}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<u-line color="#cccccc"></u-line>
|
||||
<view class="bottom">
|
||||
<view>更新时间: {{item.create_time}}</view>
|
||||
<view class="right" v-if="showView">
|
||||
<view class="update" @click="navTo('/subpkg/updateArchives/updateArchives?id='+item.id)">
|
||||
更新
|
||||
</view>
|
||||
<view class="look" @click="navTo('/subpkg/archivesDetail/archivesDetail?id='+item.id)">
|
||||
查看
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-empty v-if="loadConfig.status=='nomore'&& list.length==0" text="没有档案" icon="/static/img/empty/list.png">
|
||||
</u-empty>
|
||||
<u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
|
||||
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
|
||||
</view>
|
||||
<mybtn text="信息登记" v-if="showView" @click="navTo('/subpkg/newArchives/newArchives')"></mybtn>
|
||||
</view>
|
||||
<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="../../static/img/public/record.png"></image>
|
||||
<view class="body">
|
||||
<view>姓名:<text class="name">{{item.name}}</text></view>
|
||||
<view>片区:<text class="name">{{item.address}}</text></view>
|
||||
<view>电话:<text class="name">{{item.phone}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<u-line color="#cccccc"></u-line>
|
||||
<view class="bottom">
|
||||
<view>更新时间: {{item.create_time}}</view>
|
||||
<view class="right" v-if="showView">
|
||||
<view class="update" @click="navTo('/subpkg/updateArchives/updateArchives?id='+item.id)">
|
||||
更新
|
||||
</view>
|
||||
<view class="look" @click="navTo('/subpkg/archivesDetail/archivesDetail?id='+item.id)">
|
||||
查看
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-empty v-if="loadConfig.status=='nomore'&& list.length==0" text="没有档案" icon="/static/img/empty/list.png">
|
||||
</u-empty>
|
||||
<u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
|
||||
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
|
||||
</view>
|
||||
<mybtn text="信息登记" v-if="showView" @click="navTo('/subpkg/newArchives/newArchives')"></mybtn>
|
||||
</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;
|
||||
}
|
||||
this.loadInformationList();
|
||||
},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
computed: {
|
||||
// 是否显示查看和更新按钮
|
||||
showView() {
|
||||
return !this.$store.state.app.userInfo.admin_id && this.$store.state.app.userInfo.is_captain;
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.loadInformationList();
|
||||
},
|
||||
methods: {
|
||||
navTo(url) {
|
||||
if (url) {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
success() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
} else Toast('暂未开放');
|
||||
},
|
||||
async initLoad() {
|
||||
this.loadConfig.page = 1;
|
||||
this.loadConfig.status = "loadmore";
|
||||
this.list = [];
|
||||
await this.loadInformationList();
|
||||
uni.stopPullDownRefresh();
|
||||
},
|
||||
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() {
|
||||
this.initLoad();
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
this.loadInformationList();
|
||||
uni.$on('loadArchives', this.initLoad);
|
||||
},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
computed: {
|
||||
// 是否显示查看和更新按钮
|
||||
showView() {
|
||||
return !this.$store.state.app.userInfo.admin_id && this.$store.state.app.userInfo.is_captain;
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.loadInformationList();
|
||||
},
|
||||
methods: {
|
||||
navTo(url) {
|
||||
if (url) {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
success() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
} else Toast('暂未开放');
|
||||
},
|
||||
async initLoad() {
|
||||
this.loadConfig.page = 1;
|
||||
this.loadConfig.status = "loadmore";
|
||||
this.list = [];
|
||||
await this.loadInformationList();
|
||||
uni.stopPullDownRefresh();
|
||||
},
|
||||
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() {
|
||||
this.initLoad();
|
||||
}
|
||||
}
|
||||
</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;
|
||||
}
|
||||
.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;
|
||||
.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;
|
||||
font-size: 24.53rpx;
|
||||
color: #999999FF;
|
||||
.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;
|
||||
font-size: 24.53rpx;
|
||||
color: #999999FF;
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
|
||||
.avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin-right: 18rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin-right: 18rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.body {
|
||||
flex: 1;
|
||||
.body {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
|
||||
.t_top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 18rpx;
|
||||
.name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
display: inline-block;
|
||||
margin-left: 18rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
.bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 20rpx;
|
||||
font-size: 25rpx;
|
||||
|
||||
.mobile {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.right {
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
|
||||
.t_bottom {
|
||||
width: 500rpx;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
.look {
|
||||
color: $theme-oa-color;
|
||||
}
|
||||
|
||||
.address {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.update {
|
||||
color: #34A853;
|
||||
margin-right: 38rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 20rpx;
|
||||
font-size: 25rpx;
|
||||
|
||||
.right {
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
|
||||
.look {
|
||||
color: $theme-oa-color;
|
||||
}
|
||||
|
||||
.update {
|
||||
color: #34A853;
|
||||
margin-right: 38rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
@ -279,6 +279,7 @@
|
||||
title: "添加成功",
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
uni.$emit('loadArchives');
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user