123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <template>
- <view>
- <block v-for="(item,index) in plist" :key="index">
-
- <view class="cu-card article no-card solid-bottom">
- <view class="cu-item shadow">
- <view class="title" @click="goDetail(item.article.id)"><view class="text-cut">{{item.article.title}}</view></view>
- <view class="content">
- <image :src="item.article.tilpic" mode="aspectFill" @click="goDetail(item.article.id)"></image>
- <view class="desc">
- <view class="text-content" @click="goDetail(item.article.id)">{{item.article.summary}}</view>
- <view class="flex justify-between">
- <view class="text-gray text-sm">收藏于:{{item.createtime}}</view>
- <view class="cu-tag bg-red light sm round" @click="delCollect(index)">删除</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </block>
-
- <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 {
- userinfo: {},
-
- pstatus: 'more',
- ppage: 1,
- psize: 20,
- plist: []
- };
- },
- onLoad: function(){
- _this = this;
- _this.userinfo = _this.checkLogin("/pages/my/collect");
- _this.getMore();
- },
- onPullDownRefresh: function() {
- _this.ppage = 1;
- _this.pstatus = 'more';
- _this.plist = [];
- _this.getMore();
- },
- onReachBottom: function() {
- if (_this.pstatus !== 'more') {
- return;
- }
- _this.getMore();
- },
- methods: {
- getMore: function() {
- _this.$req.ajax({
- path: "my/listcollect",
- data: {
- ppage: _this.ppage,
- psize: _this.psize,
- userid: _this.userinfo.id
- }
- }).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(articleid) {
- uni.navigateTo({
- url: '/pages/article/detail?articleid=' + articleid
- });
- },
- delCollect: function(index) {
- console.log("_this.plist[index].id: " + JSON.stringify(_this.plist[index].id));
- _this.$req.ajax({
- path: "my/delcollect",
- data: {
- id: _this.plist[index].id,
- userid: _this.userinfo.id
- }
- }).then((data) => {
- uni.showModal({
- title: '信息提示',
- content: '收藏移除成功',
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- _this.plist.splice(index, 1);
- }
- }
- });
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- }
- }
- }
- </script>
- <style>
- </style>
|