最近签到记录加载优化

This commit is contained in:
kuaifan 2023-01-29 00:13:08 +08:00
parent 8d89ed6f35
commit 72c991b62b
2 changed files with 37 additions and 18 deletions

View File

@ -2,7 +2,10 @@
<div class="setting-item submit"> <div class="setting-item submit">
<Form ref="formData" label-width="auto" @submit.native.prevent> <Form ref="formData" label-width="auto" @submit.native.prevent>
<Divider orientation="left" style="margin-top:0">{{$L('签到记录')}}</Divider> <Divider orientation="left" style="margin-top:0">{{$L('签到记录')}}</Divider>
<Timeline class="setting-checkin-lately"> <div v-if="latelyLoad > 0" class="setting-checkin-load">
<Loading/>
</div>
<Timeline v-else class="setting-checkin-lately">
<TimelineItem <TimelineItem
v-for="(item, key) in latelyData" v-for="(item, key) in latelyData"
:key="key" :key="key"
@ -18,6 +21,7 @@
<Alert> <Alert>
{{$L('设备连接上指定路由器WiFi后自动签到。')}} {{$L('设备连接上指定路由器WiFi后自动签到。')}}
</Alert> </Alert>
<div class="setting-checkin-row">
<Row class="setting-template"> <Row class="setting-template">
<Col span="12">{{$L('设备MAC地址')}}</Col> <Col span="12">{{$L('设备MAC地址')}}</Col>
<Col span="12">{{$L('备注')}}</Col> <Col span="12">{{$L('备注')}}</Col>
@ -35,6 +39,7 @@
<Input v-model="item.remark" :maxlength="100" :placeholder="$L('备注')"/> <Input v-model="item.remark" :maxlength="100" :placeholder="$L('备注')"/>
</Col> </Col>
</Row> </Row>
</div>
<Button type="default" icon="md-add" @click="addDatum">{{$L('添加设备')}}</Button> <Button type="default" icon="md-add" @click="addDatum">{{$L('添加设备')}}</Button>
</Form> </Form>
<div class="setting-footer"> <div class="setting-footer">
@ -68,6 +73,7 @@ export default {
'remark': '', 'remark': '',
}, },
latelyLoad: 0,
latelyData: [], latelyData: [],
calendarShow: false, calendarShow: false,
@ -152,6 +158,7 @@ export default {
}, },
getLately() { getLately() {
this.latelyLoad++
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'users/checkin/list', url: 'users/checkin/list',
data: { data: {
@ -159,6 +166,8 @@ export default {
} }
}).then(({data}) => { }).then(({data}) => {
this.latelyFormat(data) this.latelyFormat(data)
}).finally(_ => {
this.latelyLoad--
}) })
}, },

View File

@ -163,6 +163,13 @@
line-height: 32px; line-height: 32px;
margin-bottom: -10px; margin-bottom: -10px;
} }
.setting-checkin-load {
margin-bottom: 12px;
.common-loading {
width: 20px;
height: 20px;
}
}
.setting-checkin-lately { .setting-checkin-lately {
> li { > li {
padding-bottom: 8px; padding-bottom: 8px;
@ -175,6 +182,9 @@
} }
} }
} }
.setting-checkin-row {
overflow: auto;
}
.setting-checkin-button { .setting-checkin-button {
padding-bottom: 4px; padding-bottom: 4px;
cursor: pointer; cursor: pointer;