123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <view>
- <scroll-view scroll-x class="bg-white nav text-center echo-fixed-top">
- <view class="cu-item" :class="item.id==cateid?'text-green cur':''" v-for="(item, index) in allcate" :key="item.id" @tap="tabSelect" :data-id="item.id">
- {{item.title}}
- </view>
- </scroll-view>
- <view class="echo-fixed-top-empty"></view>
-
- <view class="uni-list echo-media-list">
- <block v-for="(item,index) in plist" :key="index">
- <view class="uni-list-cell" hover-class="uni-list-cell-hover" @click="goDetail(item.id)">
- <view class="uni-media-list">
- <view class="uni-media-list-body">
- <view class="uni-media-list-text-top text-cut">{{item.title}}</view>
- <view class="uni-media-list-text-bottom flex justify-between">
- <text>{{item.createtime_text}}</text>
- <text class="text-red" v-if="item.priority>0">置顶</text>
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
-
- <uni-load-more :status="pstatus"></uni-load-more>
-
- </view>
- </template>
- <script>
- import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
- var _this;
- export default {
- components: {
- uniLoadMore
- },
- data() {
- return {
- cateid: 0,
- allcate: [],
-
- pstatus: 'more',
- ppage: 1,
- psize: 20,
- plist: []
- };
- },
- onLoad: function(option){
- _this = this;
- _this.cateid = option.cateid || 0;
- _this.$req.ajax({
- path: "question/allcate"
- }).then((data) => {
- _this.allcate = data.allcate;
- _this.getMore();
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- },
- onShareAppMessage: function(res) {
- return {
- title: "常见问题",
- path: "/pages/question/question"
- }
- },
- onPullDownRefresh: function() {
- _this.ppage = 1;
- _this.pstatus = 'more';
- _this.plist = [];
- _this.getMore();
- },
- onReachBottom: function() {
- if (_this.pstatus !== 'more') {
- return;
- }
- _this.getMore();
- },
- methods: {
- tabSelect: function(e) {
- _this.cateid = e.currentTarget.dataset.id;
- _this.pageRefresh();
- },
- pageRefresh: function() {
- _this.pstatus = 'more';
- _this.ppage = 1;
- _this.plist = [];
- _this.getMore();
- },
- getMore: function() {
- _this.$req.ajax({
- path: "question/listquestion",
- data: {
- ppage: _this.ppage,
- psize: _this.psize,
- cateid: _this.cateid
- }
- }).then((data) => {
- _this.pstatus = data.pstatus;
- _this.plist = _this.plist.concat(data.plist);
- _this.ppage += 1;
- uni.stopPullDownRefresh();
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- },
- goDetail: function(questionid) {
- uni.navigateTo({
- url: '/pages/question/detail?questionid=' + questionid
- });
- }
- }
- }
- </script>
- <style>
- </style>
|