123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- {extend name="public/container"}
- {block name="title"}签到明细{/block}
- {block name="head_top"}
- <style>
- body {
- background: #f5f5f5;
- }
- .loading {
- font-size: .4rem;
- text-align: center;
- color: #999;
- }
- .loaded {
- font-size: .28rem;
- line-height: .72rem;
- text-align: center;
- color: #999;
- }
- .nothing {
- position: absolute;
- top: 30%;
- left: 50%;
- width: 4rem;
- height: 4rem;
- -webkit-transform: translate(-50%, -50%);
- transform: translate(-50%, -50%);
- }
- </style>
- {/block}
- {block name="content"}
- <div v-cloak id="app">
- <div class="sign-list">
- <div v-if="signList.length" class="list">
- <div v-for="(item, index) in signList" class="item">
- <div class="text">
- <div class="name">签到</div>
- <div class="time">{{ item.add_time }}</div>
- </div>
- <div class="num">+{{ item.number }}</div>
- </div>
- </div>
- <div v-show="loading" class="loading">
- <span class="fa fa-spinner"></span>
- </div>
- <div v-if="loadend && signList.length" class="loaded">{{loadTitle}}</div>
- <div v-if="!signList.length && !loading">
- <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
- </div>
- </div>
- <shortcut></shortcut>
- </div>
- <script>
- require(['vue', 'helper', 'store', '{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, $h, store) {
- var app = new Vue({
- el: '#app',
- data: {
- signList: [],
- limit: 20,
- page: 1,
- loadend: false,
- loading: false,
- loadTitle:''
- },
- computed: {
- },
- mounted: function () {
- this.$nextTick(function () {
- var that = this;
- that.getSignList();
- window.addEventListener('scroll', function () {
- var clientHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
- scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight,
- scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
- if (clientHeight + scrollTop >= scrollHeight) {
- that.getSignList();
- }
- });
- });
- },
- methods: {
- getSignList: function () {
- var that = this;
- if (this.loadend) return;
- if (this.loading) return;
- this.loading = true;
- store.baseGet($h.U({ c: 'auth_api', a: 'getUserSignList', p: { page: that.page, limit: that.limit } }), function (res) {
- var list = res.data.data;
- var signList = $h.SplitArray(list, that.signList);
- that.loading = false;
- that.loadend = list.length < that.limit;
- that.loadTitle = that.loadend ? '已全部加载' : '上拉加载更多';
- that.page = that.page + 1;
- that.$set(that, 'signList', signList);
- }, function (params) {
- that.loadTitle = '上拉加载更多';
- that.loading = false;
- });
- }
- }
- });
- });
- </script>
- {/block}
|