update
This commit is contained in:
parent
50839d796a
commit
c53830e185
@ -1,150 +1,150 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<u-navbar :is-back="false" z-index="99999">
|
<u-navbar :is-back="false" z-index="99999">
|
||||||
<u-tabs :list="tabList" font-size="35" name="cateName" bg-color="#fff" :current="current"
|
<u-tabs :list="tabList" font-size="35" name="cateName" bg-color="#fff" :current="current"
|
||||||
@change="tabChange"></u-tabs>
|
@change="tabChange"></u-tabs>
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
<!-- 最新 -->
|
<!-- 最新 -->
|
||||||
<view v-if="current === 1">
|
<view v-if="current === 1">
|
||||||
<post-list :list="lastPost" :loadStatus="loadStatus2"></post-list>
|
<post-list :list="lastPost" :loadStatus="loadStatus2"></post-list>
|
||||||
</view>
|
</view>
|
||||||
<!-- 关注 -->
|
<!-- 关注 -->
|
||||||
<view v-if="current === 0">
|
<view v-if="current === 0">
|
||||||
<post-list :list="followUserPost" :loadStatus="loadStatus1"></post-list>
|
<post-list :list="followUserPost" :loadStatus="loadStatus1"></post-list>
|
||||||
</view>
|
</view>
|
||||||
<!-- 发贴入口 -->
|
<!-- 发贴入口 -->
|
||||||
<add-post-tag></add-post-tag>
|
<add-post-tag></add-post-tag>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import postList from '../../components/post-list/post-list.vue';
|
import postList from '../../components/post-list/post-list.vue';
|
||||||
import addPostTag from '../../components/add-post-tag/add-post-tag.vue';
|
import addPostTag from '../../components/add-post-tag/add-post-tag.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
postList,
|
postList,
|
||||||
addPostTag
|
addPostTag
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
sessionUid: uni.getStorageSync('userInfo').uid,
|
sessionUid: uni.getStorageSync('userInfo').uid,
|
||||||
loadStatus1: 'loadmore',
|
loadStatus1: 'loadmore',
|
||||||
loadStatus2: 'loadmore',
|
loadStatus2: 'loadmore',
|
||||||
page1: 1,
|
page1: 1,
|
||||||
page2: 1,
|
page2: 1,
|
||||||
shareCover: '',
|
shareCover: '',
|
||||||
followUserPost: [],
|
followUserPost: [],
|
||||||
lastPost: [],
|
lastPost: [],
|
||||||
tabList: [{
|
tabList: [{
|
||||||
name: '关注'
|
name: '关注'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '最新'
|
name: '最新'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
current: 1,
|
current: 1,
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onShareAppMessage(res) {
|
onShareAppMessage(res) {
|
||||||
return {
|
return {
|
||||||
title: this.$c.miniappName,
|
title: this.$c.miniappName,
|
||||||
path: '/pages/index/index',
|
path: '/pages/index/index',
|
||||||
imageUrl: this.shareCover
|
imageUrl: this.shareCover
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.getLastPost();
|
this.getLastPost();
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
if (this.current === 0) {
|
if (this.current === 0) {
|
||||||
this.page1++;
|
this.page1++;
|
||||||
this.getFollowUserPost();
|
this.getFollowUserPost();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.current === 1) {
|
if (this.current === 1) {
|
||||||
this.page2++;
|
this.page2++;
|
||||||
this.getLastPost();
|
this.getLastPost();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
if (this.current === 0) {
|
if (this.current === 0) {
|
||||||
this.page1 = 1;
|
this.page1 = 1;
|
||||||
this.followUserPost = [];
|
this.followUserPost = [];
|
||||||
this.getFollowUserPost();
|
this.getFollowUserPost();
|
||||||
}
|
}
|
||||||
if (this.current === 1) {
|
if (this.current === 1) {
|
||||||
this.page2 = 1;
|
this.page2 = 1;
|
||||||
this.lastPost = [];
|
this.lastPost = [];
|
||||||
this.getLastPost();
|
this.getLastPost();
|
||||||
}
|
}
|
||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
tabChange(index) {
|
tabChange(index) {
|
||||||
this.current = index;
|
this.current = index;
|
||||||
this.followUserPost = [];
|
this.followUserPost = [];
|
||||||
this.lastPost = [];
|
this.lastPost = [];
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
this.page1 = 1;
|
this.page1 = 1;
|
||||||
this.getFollowUserPost();
|
this.getFollowUserPost();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (index === 1) {
|
if (index === 1) {
|
||||||
this.page2 = 1;
|
this.page2 = 1;
|
||||||
this.getLastPost();
|
this.getLastPost();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getSysInfo() {
|
getSysInfo() {
|
||||||
this.$H.get('system/miniConfig').then(res => {
|
this.$H.get('system/miniConfig').then(res => {
|
||||||
this.shareCover = res.result.intro;
|
this.shareCover = res.result.intro;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 获取关注用户帖子
|
// 获取关注用户帖子
|
||||||
getFollowUserPost() {
|
getFollowUserPost() {
|
||||||
this.loadStatus1 = 'loading';
|
this.loadStatus1 = 'loading';
|
||||||
this.$H
|
this.$H
|
||||||
.get('post/followUserPost', {
|
.get('post/followUserPost', {
|
||||||
page: this.page1
|
page: this.page1
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code == 0 && res.result) {
|
if (res.code == 0 && res.result) {
|
||||||
this.followUserPost = this.followUserPost.concat(res.result.data);
|
this.followUserPost = this.followUserPost.concat(res.result.data);
|
||||||
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
|
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
|
||||||
this.loadStatus1 = 'nomore';
|
this.loadStatus1 = 'nomore';
|
||||||
} else {
|
} else {
|
||||||
this.loadStatus1 = 'loadmore';
|
this.loadStatus1 = 'loadmore';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.loadStatus1 = 'nomore';
|
this.loadStatus1 = 'nomore';
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//获取最新帖子
|
//获取最新帖子
|
||||||
getLastPost() {
|
getLastPost() {
|
||||||
this.loadStatus2 = 'loading';
|
this.loadStatus2 = 'loading';
|
||||||
this.$H
|
this.$H
|
||||||
.get('post/lastPost', {
|
.get('post/lastPost', {
|
||||||
page: this.page2
|
page: this.page2
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.lastPost = this.lastPost.concat(res.result.data);
|
this.lastPost = this.lastPost.concat(res.result.data);
|
||||||
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
|
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
|
||||||
this.loadStatus2 = 'nomore';
|
this.loadStatus2 = 'nomore';
|
||||||
} else {
|
} else {
|
||||||
this.loadStatus2 = 'loadmore';
|
this.loadStatus2 = 'loadmore';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #F5F5F5;
|
background-color: #F5F5F5;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -3,12 +3,12 @@ const shareH5Url = "https://www.linfeng.tech/#/"; //H5分享路径
|
|||||||
|
|
||||||
|
|
||||||
//本地环境配置
|
//本地环境配置
|
||||||
const baseUrl = "localhost:8080";
|
// const baseUrl = "localhost:8080";
|
||||||
const domain = 'http://' + baseUrl + "/app/";
|
// const domain = 'http://' + baseUrl + "/app/";
|
||||||
|
|
||||||
//线上环境配置
|
//线上环境配置
|
||||||
// const baseUrl = "wxapi.linfeng.tech";
|
const baseUrl = "wxapi.linfeng.tech";
|
||||||
// const domain = 'https://' + baseUrl + "/app/";
|
const domain = 'https://' + baseUrl + "/app/";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user