123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- <template>
- <div class="bgColor">
- <div class="header">公告列表</div>
- <div class="search">
- <input type="text" placeholder="搜索" v-model="search" @input="searchData()">
- </div>
- <div slot="content" class="scroll-wrapper nav">
- <div class="demo">
- <div class="scroll-list-wrap">
- <cube-scroll
- ref="scroll"
- :data="items"
- :options="options"
- @pulling-down="onPullingDown"
- @pulling-up="onPullingUp"
- >
- <div class="list">
- <div class="item" v-for="item in items" @click="toDetail(item)">
- <div
- class="title overflowEllipsis2"
- style="-webkit-box-orient: vertical !important;"
- >{{item.title}}</div>
- <i class="iconfont icon-moren"></i>
- <p class="time">{{item.createTime}}</p>
- </div>
- </div>
- <div class="wushuju" v-show="items.length==0&&wushuju&&!loadShow">
- <img src="./../../static/images/wushuju.svg" alt>
- <p>暂无公告</p>
- </div>
- <template v-if="customPullDown" slot="pulldown" slot-scope="props">
- <div
- v-if="props.pullDownRefresh"
- class="cube-pulldown-wrapper"
- :style="props.pullDownStyle"
- >
- <div
- v-show="props.beforePullDown"
- class="before-trigger"
- :style="{paddingTop: props.bubbleY + 'px'}"
- >
- <span :class="{rotate: props.bubbleY > pullDownRefreshThreshold - 40}">↓</span>
- </div>
- <div class="after-trigger" v-show="!props.beforePullDown">
- <div v-show="props.isPullingDown" class="loading">
- <cube-loading></cube-loading>
- </div>
- <div v-show="!props.isPullingDown" class="text">
- <!-- <span class="refresh-text">更新成功</span> -->
- <span class="refresh-text"></span>
- </div>
- </div>
- </div>
- </template>
- </cube-scroll>
- </div>
- </div>
- </div>
- <load-ing v-show="loadShow&&!items.length"></load-ing>
- </div>
- </template>
- <script>
- import Vue from "vue";
- import LoadIng from "./../views/loading.vue";
- export default {
- data() {
- return {
- pullDownRefresh: true,
- pullDownRefreshThreshold: 60,
- pullDownRefreshStop: 40,
- pullDownRefreshTxt: "Refresh success",
- pullUpLoad: true,
- pullUpLoadThreshold: 0,
- pullUpLoadMoreTxt: "加载更多",
- pullUpLoadNoMoreTxt: "没有更多数据",
- wushuju: false,
- customPullDown: true,
- loadShow: true,
- noMore: false,
- sum: 10,
- idx: 0,
- search: "",
- items: [],
- searching:false
- };
- },
- computed: {
- options() {
- return {
- pullDownRefresh: this.pullDownRefreshObj,
- pullUpLoad: this.pullUpLoadObj,
- scrollbar: true
- };
- },
- pullDownRefreshObj: function() {
- return this.pullDownRefresh
- ? {
- threshold: parseInt(this.pullDownRefreshThreshold),
- txt: this.pullDownRefreshTxt
- }
- : false;
- },
- pullUpLoadObj: function() {
- return this.pullUpLoad
- ? {
- threshold: parseInt(this.pullUpLoadThreshold),
- txt: {
- more: this.pullUpLoadMoreTxt,
- noMore: this.pullUpLoadNoMoreTxt
- }
- }
- : false;
- }
- },
- components: {
- LoadIng
- },
- methods: {
- // 搜索
- searchData() {
- var that = this;
- that.idx = 0;
- that.items = [];
- that.searching=true;
- that.getData();
- },
- // 获取数据
- getData() {
- var that = this;
- that.loadShow = true;
- that.$http
- .post("service/user/data/fetchDataList/notice", {
- idx: that.idx,
- sum: that.sum,
- notice: { title: that.search, status: 1 }
- })
- .then(function(res) {
- if (res.data.list.length > 0) {
- if (that.searching) {
- that.items = res.data.list;
- } else {
- that.items = that.items.concat(res.data.list);
- }
- that.wushuju = false;
- } else {
- that.wushuju = true;
- that.$refs.scroll.forceUpdate();
- }
- that.loadShow = false;
- });
- },
- // 查看详情
- toDetail(item) {
- this.$router.push({ name: "GuideDetail", params: { data: item } });
- },
- onPullingDown() {
- var that = this;
- that.idx = 0;
- that.sum = 10;
- that.items = [];
- that.loadShow = true;
- setTimeout(() => {
- that.getData();
- }, 500);
- },
- onPullingUp() {
- var that = this;
- that.idx += 1;
- that.searching=false;
- that.loadShow = true;
- that.getData();
- },
- updatePullDownRefresh(val) {
- this.pullDownRefresh = val;
- },
- updatePullDownRefreshThreshold(val) {
- this.pullDownRefreshThreshold = val;
- },
- updatePullDownRefreshTxt(val) {
- this.pullDownRefreshTxt = val;
- },
- updatePullUpLoad(val) {
- this.pullUpLoad = val;
- },
- updatePullUpLoadThreshold(val) {
- this.pullUpLoadThreshold = val;
- },
- updatePullUpLoadMoreTxt(val) {
- this.pullUpLoadMoreTxt = val;
- },
- updatePullUpLoadNoMoreTxt(val) {
- this.pullUpLoadNoMoreTxt = val;
- },
- updateCustomPullDown(val) {
- this.customPullDown = val;
- },
- rebuildScroll() {
- Vue.nextTick(() => {
- this.$refs.scroll.destroy();
- this.$refs.scroll.initScroll();
- });
- }
- },
- mounted() {},
- created() {
- this.getData();
- }
- };
- </script>
- <style lang="stylus" rel="stylesheet/stylus" scoped>
- .scroll-list-wrap {
- /* height: 350px */
- height: 87vh;
- /* border: 1px solid rgba(0, 0, 0, 0.1) */
- border-radius: 5px;
- transform: rotate(0deg); // fix 子元素超出边框圆角部分不隐藏的问题
- overflow: hidden;
- padding-top: 14vh;
- }
- .foods-wrapper {
- .food-item {
- display: flex;
- /* min-width: 0 */
- /* padding: 18px
- border-bottom: 1px solid rgba(7, 17, 27, 0.1) */
- &:last-child {
- border-none();
- margin-bottom: 0;
- }
- .food-content {
- flex: 1;
- min-width: 0;
- .cartcontrol-wrapper {
- position: absolute;
- right: 0;
- bottom: 12px;
- .scroll-wrapper {
- .cube-pulldown-wrapper {
- .before-trigger {
- font-size: 30px;
- line-height: 30px;
- align-self: flex-end;
- span {
- display: inline-block;
- transition: all 0.3s;
- color: #666;
- &.rotate {
- transform: rotate(180deg);
- }
- }
- }
- .after-trigger {
- .refresh-text {
- color: grey;
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
- <style scoped lang='less'>
- .bgColor {
- background-color: white;
- }
- .header {
- width: 100%;
- height: 0.88rem;
- line-height: 0.88rem;
- text-align: center;
- color: #fff;
- font-size: 0.37rem;
- background: linear-gradient(#2e2f32, #414246);
- position: fixed;
- top: 0;
- z-index: 6;
- }
- .search {
- padding: 0.16rem 0.24rem;
- box-sizing: border-box;
- width: 100%;
- background-color: #eeeeee;
- border-bottom: 0.01rem #b7b7b7 solid;
- position: fixed;
- top: 0.88rem;
- z-index: 6;
- input {
- width: 100%;
- height: 0.56rem;
- border-radius: 4px;
- text-align: center;
- font-size: 0.28rem;
- &:focus {
- outline: none;
- }
- }
- }
- .list {
- .item {
- padding-left: 0.24rem;
- border-bottom: 0.01rem solid #e3e3e3;
- position: relative;
- padding-right: 0.9rem;
- .iconfont {
- position: absolute;
- right: 0.24rem;
- top: 40%;
- color: #999;
- }
- .title {
- font-size: 0.32rem;
- color: #333;
- line-height: 0.45rem;
- // padding-right: 0.96rem;
- padding-top: 0.24rem;
- position: relative;
- max-height: 0.9rem;
- // max-width: 88%;
- i {
- position: absolute;
- right: 0.24rem;
- top: 56%;
- color: #999;
- font-size: 0.34rem;
- }
- }
- .time {
- font-size: 0.24rem;
- color: #999;
- line-height: 0.6rem;
- }
- }
- }
- .loading {
- height: 2rem;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .wushuju {
- margin-top: 2.4rem;
- text-align: center;
- color: #999;
- }
- .wushuju img {
- width: 5.12rem;
- height: 2.84rem;
- }
- </style>
|