|
|
- <template>
- <view class="pages">
- <!-- <view class="sort-search">
- <u-search
- v-model="keyword"
- bg-color="#fff"
- height="80"
- placeholder="日照香炉生紫烟"
- :action-style="{color: '#fff'}"
- />
- </view> -->
- <view class="top_bg_text" :style="'background-image: url('+pageImage+')'">
- </view>
- <view class="item" v-for="(items,index) in list" :key="index" @click="toDetale(items.id)">
- <view class="left_box">
- <text class="title m-t-20">{{items.title}}</text>
- <text>{{items.subTitle}}</text>
- <!-- <rich-text :nodes='items.article'></rich-text> -->
- <!-- <u-parse :html="items.article" ></u-parse> -->
- </view>
- <image class="img_" :src="items.cover" mode=""></image>
- </view>
- </view>
- </template>
-
- <script>
- import config from "./config.js"
- export default {
- data() {
- return {
- htmls: '<text>adada</text>',
- pageImage: '', //背景图
- list: [],
- pageNo: 1,
- pageSize:10,
- title: '',
- total: null,
- islock: false, // 加载更多的锁
- }
- },
- onReachBottom() {
- if(!this.isLock) {
- if(this.pageNo * this.pageSize > this.total && this.total!== null) {
- // 没有更多加载了
- this.isLock = true;
- this.$Toast('没有更多数据了呢!');
- setTimeout(()=> {
- // 3秒后解锁
- this.isLock = false;
- },3000)
- return
- }
- this.isLock = true;
- this.pageNo+=1;
- this.getanswerList();
- }
- },
- onUnload() {
- var that = this;
- let page_url = getCurrentPages()
- console.log("=========" + getCurrentPages());
- if (page_url.length > 1) {
- var url = page_url[1].route;
- console.log(url);
- if (url == "pagesB/homeGridList/answerQuestionsPrize/index") {
- // 回首页
- uni.switchTab({
- url: "/pages/home/home",
- })
- }
- }
- },
- onLoad(options) {
- this.pageImage = options.pageImage
- this.getanswerList();
- },
- methods: {
- getanswerList() {
- uni.showLoading();
- const params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize
- }
- this.$api('answerList',params).then( res => {
- let { code, result, message} = res
- if(code == 200) {
- uni.hideLoading();
- this.isLock = false;
- this.list = this.list.concat(result.records);
- }else {
- this.$Toast(message)
- }
- }).catch(err => {
- this.isLock = false;
- uni.hideLoading()
- this.$Toast(err.message)
- })
- },
- toDetale(id) {
- uni.navigateTo({
- url: "./detale/detale?id="+id
- })
- },
- }
- }
- </script>
-
- <style lang="scss" scoped>
-
- .sort-search {
- padding: 0 20rpx 20rpx;
- background: $u-type-primary;
- }
- .pages{
- background-color: #F5F5F5;
- height: 100%;
- .item{
- width: 100%;
- display: flex;
- margin-top: 21rpx;
- background-color: #fff;
- font-size: 27rpx;
- box-sizing: border-box;
- padding-left: 26rpx;
- padding-right: 20rpx;
- .left_box{
- flex: 1;
- display: flex;
- flex-direction: column;
- .title{
- font-weight: bold;
- margin-top: 16prx;
- margin-bottom: 7rpx;
- color: #000;
- }
- .alt{
- color: #707070;
- }
- }
- .img_{
- width: 188rpx;
- height: 212rpx;
- margin: 20rpx;
- }
- }
- }
- .top_bg_text{
- width: 100%;
- height: 184rpx;
- margin-top: 30rpx;
- background-size: 100% 184rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- .title_max{
- margin-top: 20rpx;
- font-size: 54rpx;
- font-weight: bold;
- color: #73B8DE;
- }
- .title_min{
- margin-top: 10rpx;
- font-size: 28rpx;
- color: #73B8DE;
- }
- }
- </style>
|