调整页面,新增自动刷新
This commit is contained in:
parent
1785aaa4a2
commit
1ed919adec
@ -1,230 +1,212 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="personnel_list">
|
<view class="personnel_list">
|
||||||
<view class="item" v-for="(item, index) in list" :key="item.id">
|
<view class="item" v-for="(item, index) in list" :key="item.id">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<image class="avatar" src="../../static/img/public/record.png"></image>
|
<image class="avatar" src="../../static/img/public/record.png"></image>
|
||||||
<view class="body">
|
<view class="body">
|
||||||
<view class="t_top">
|
<view>姓名:<text class="name">{{item.name}}</text></view>
|
||||||
<view>姓名:<text class="name">{{item.name}}</text></view>
|
<view>片区:<text class="name">{{item.address}}</text></view>
|
||||||
<view>电话:<text class="mobile">{{item.phone}}</text></view>
|
<view>电话:<text class="name">{{item.phone}}</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="t_bottom">片区:<text class="address">{{item.address}}</text></view>
|
</view>
|
||||||
</view>
|
<u-line color="#cccccc"></u-line>
|
||||||
</view>
|
<view class="bottom">
|
||||||
<u-line color="#cccccc"></u-line>
|
<view>更新时间: {{item.create_time}}</view>
|
||||||
<view class="bottom">
|
<view class="right" v-if="showView">
|
||||||
<view>更新时间: {{item.create_time}}</view>
|
<view class="update" @click="navTo('/subpkg/updateArchives/updateArchives?id='+item.id)">
|
||||||
<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 class="look" @click="navTo('/subpkg/archivesDetail/archivesDetail?id='+item.id)">
|
</view>
|
||||||
查看
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<u-empty v-if="loadConfig.status=='nomore'&& list.length==0" text="没有档案" icon="/static/img/empty/list.png">
|
||||||
</view>
|
</u-empty>
|
||||||
<u-empty v-if="loadConfig.status=='nomore'&& list.length==0" text="没有档案" icon="/static/img/empty/list.png">
|
<u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
|
||||||
</u-empty>
|
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
|
||||||
<u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
|
</view>
|
||||||
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
|
<mybtn text="信息登记" v-if="showView" @click="navTo('/subpkg/newArchives/newArchives')"></mybtn>
|
||||||
</view>
|
</view>
|
||||||
<mybtn text="信息登记" v-if="showView" @click="navTo('/subpkg/newArchives/newArchives')"></mybtn>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
informationList
|
informationList
|
||||||
} from "@/api/information.js"
|
} from "@/api/information.js"
|
||||||
import {
|
import {
|
||||||
Toast
|
Toast
|
||||||
} from "../../libs/uniApi";
|
} from "../../libs/uniApi";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
user_id: -1,
|
user_id: -1,
|
||||||
list: [],
|
list: [],
|
||||||
loadConfig: {
|
loadConfig: {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 15,
|
limit: 15,
|
||||||
loadingText: '努力加载中',
|
loadingText: '努力加载中',
|
||||||
loadmoreText: '轻轻上拉',
|
loadmoreText: '轻轻上拉',
|
||||||
nomoreText: '我也是有底线的~~',
|
nomoreText: '我也是有底线的~~',
|
||||||
status: 'loadmore'
|
status: 'loadmore'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
if (options.id) this.user_id = options.id;
|
if (options.id) this.user_id = options.id;
|
||||||
else if (this.$store.state.app.userInfo.admin_id == 0) { //如果用户是小队长,将带上自己的id
|
else if (this.$store.state.app.userInfo.admin_id == 0) { //如果用户是小队长,将带上自己的id
|
||||||
this.user_id = this.$store.state.app.userInfo.id;
|
this.user_id = this.$store.state.app.userInfo.id;
|
||||||
}
|
}
|
||||||
this.loadInformationList();
|
this.loadInformationList();
|
||||||
},
|
uni.$on('loadArchives', this.initLoad);
|
||||||
onShow() {
|
},
|
||||||
|
onShow() {
|
||||||
},
|
|
||||||
computed: {
|
},
|
||||||
// 是否显示查看和更新按钮
|
computed: {
|
||||||
showView() {
|
// 是否显示查看和更新按钮
|
||||||
return !this.$store.state.app.userInfo.admin_id && this.$store.state.app.userInfo.is_captain;
|
showView() {
|
||||||
}
|
return !this.$store.state.app.userInfo.admin_id && this.$store.state.app.userInfo.is_captain;
|
||||||
},
|
}
|
||||||
onReachBottom() {
|
},
|
||||||
this.loadInformationList();
|
onReachBottom() {
|
||||||
},
|
this.loadInformationList();
|
||||||
methods: {
|
},
|
||||||
navTo(url) {
|
methods: {
|
||||||
if (url) {
|
navTo(url) {
|
||||||
uni.showLoading({
|
if (url) {
|
||||||
title: '加载中',
|
uni.showLoading({
|
||||||
mask: true
|
title: '加载中',
|
||||||
})
|
mask: true
|
||||||
uni.navigateTo({
|
})
|
||||||
url: url,
|
uni.navigateTo({
|
||||||
success() {
|
url: url,
|
||||||
uni.hideLoading()
|
success() {
|
||||||
}
|
uni.hideLoading()
|
||||||
})
|
}
|
||||||
} else Toast('暂未开放');
|
})
|
||||||
},
|
} else Toast('暂未开放');
|
||||||
async initLoad() {
|
},
|
||||||
this.loadConfig.page = 1;
|
async initLoad() {
|
||||||
this.loadConfig.status = "loadmore";
|
this.loadConfig.page = 1;
|
||||||
this.list = [];
|
this.loadConfig.status = "loadmore";
|
||||||
await this.loadInformationList();
|
this.list = [];
|
||||||
uni.stopPullDownRefresh();
|
await this.loadInformationList();
|
||||||
},
|
uni.stopPullDownRefresh();
|
||||||
async loadInformationList() {
|
},
|
||||||
let that = this;
|
async loadInformationList() {
|
||||||
if (this.loadConfig.status == "nomore") return;
|
let that = this;
|
||||||
this.loadConfig.status = "loading"
|
if (this.loadConfig.status == "nomore") return;
|
||||||
let res = await informationList({
|
this.loadConfig.status = "loading"
|
||||||
page: this.loadConfig.page,
|
let res = await informationList({
|
||||||
limit: this.loadConfig.limit,
|
page: this.loadConfig.page,
|
||||||
user_id: that.user_id
|
limit: this.loadConfig.limit,
|
||||||
})
|
user_id: that.user_id
|
||||||
this.loadConfig.status = "loadmore"
|
})
|
||||||
if (res.data.length < this.loadConfig.limit) {
|
this.loadConfig.status = "loadmore"
|
||||||
this.loadConfig.status = "nomore"
|
if (res.data.length < this.loadConfig.limit) {
|
||||||
} else {
|
this.loadConfig.status = "nomore"
|
||||||
this.loadConfig.page++;
|
} else {
|
||||||
}
|
this.loadConfig.page++;
|
||||||
this.list = [...this.list, ...res.data];
|
}
|
||||||
}
|
this.list = [...this.list, ...res.data];
|
||||||
},
|
}
|
||||||
onPullDownRefresh() {
|
},
|
||||||
this.initLoad();
|
onPullDownRefresh() {
|
||||||
}
|
this.initLoad();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.new_btn {
|
.new_btn {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 28rpx;
|
bottom: 28rpx;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%);
|
transform: translate(-50%);
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
// margin-bottom: 40rpx;
|
// margin-bottom: 40rpx;
|
||||||
width: 694rpx;
|
width: 694rpx;
|
||||||
height: 84rpx;
|
height: 84rpx;
|
||||||
background: $theme-oa-color;
|
background: $theme-oa-color;
|
||||||
border-radius: 42rpx 42rpx 42rpx 42rpx;
|
border-radius: 42rpx 42rpx 42rpx 42rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.personnel_list {
|
.personnel_list {
|
||||||
padding: 28rpx 0;
|
padding: 28rpx 0;
|
||||||
margin-bottom: 130rpx;
|
margin-bottom: 130rpx;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 694rpx;
|
width: 694rpx;
|
||||||
// height: 201rpx;
|
// height: 201rpx;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
margin-bottom: 21rpx;
|
margin-bottom: 21rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 28rpx;
|
padding: 28rpx;
|
||||||
font-size: 24.53rpx;
|
font-size: 24.53rpx;
|
||||||
color: #999999FF;
|
color: #999999FF;
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 120rpx;
|
width: 120rpx;
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
margin-right: 18rpx;
|
margin-right: 18rpx;
|
||||||
margin-bottom: 12rpx;
|
margin-bottom: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
.t_top {
|
.name {
|
||||||
display: flex;
|
font-size: 28rpx;
|
||||||
justify-content: space-between;
|
color: #333;
|
||||||
margin-bottom: 18rpx;
|
font-weight: 500;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 18rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.name {
|
.bottom {
|
||||||
font-size: 32rpx;
|
display: flex;
|
||||||
color: #333;
|
justify-content: space-between;
|
||||||
}
|
align-items: center;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
font-size: 25rpx;
|
||||||
|
|
||||||
.mobile {
|
.right {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
display: flex;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.t_bottom {
|
.look {
|
||||||
width: 500rpx;
|
color: $theme-oa-color;
|
||||||
overflow: hidden;
|
}
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
|
|
||||||
.address {
|
.update {
|
||||||
font-size: 28rpx;
|
color: #34A853;
|
||||||
color: #333;
|
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: "添加成功",
|
title: "添加成功",
|
||||||
success: () => {
|
success: () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
uni.$emit('loadArchives');
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user