Browse Source

评论详情、主页列表接口

master
Enzo 4 years ago
parent
commit
e1bb08e814
  1. 23
      pages/discover/discover.vue
  2. 82
      pages/discover/discoverdetails.vue
  3. 159
      pages/user/my/my.vue

23
pages/discover/discover.vue

@ -8,9 +8,9 @@
<swiper-item v-for="(tab, tabIndex) in tab_list" :key="tabIndex"> <swiper-item v-for="(tab, tabIndex) in tab_list" :key="tabIndex">
<scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" <scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher"
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh"> @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
<view v-for="(item,index) of tab.list">
<view v-for="(item,index) of tab.list" :key="index">
<view class="lf-p-32"> <view class="lf-p-32">
<view class="lf-flex" @click="$url('/pages/user/my/my')">
<view class="lf-flex" @click="$url('/pages/user/my/my?user_id='+item.user_id)">
<view class="tag-father"> <view class="tag-father">
<image :src="item.user.avatar" mode="aspectFill" class="head-img"></image> <image :src="item.user.avatar" mode="aspectFill" class="head-img"></image>
<view class="head-tag">V</view> <view class="head-tag">V</view>
@ -24,10 +24,10 @@
{{item.content}} {{item.content}}
</view> </view>
<view class="lf-flex-wrap lf-m-t-20"> <view class="lf-flex-wrap lf-m-t-20">
<image v-for="(picture,index) in item.attachs" class="qzone-img" :src="picture.url" mode="aspectFill"></image>
<image v-for="(picture,index2) in item.attachs" :key="index2" class="qzone-img" :src="picture.url" mode="aspectFill"></image>
</view> </view>
<view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50"> <view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50">
<view class="lf-row-center" @click="addLike(item.id)">
<view class="lf-row-center" @click.stop="addLike(item.id)">
<text class="lf-iconfont icon-xihuanlike lf-color-price" v-if="item.is_like"></text> <text class="lf-iconfont icon-xihuanlike lf-color-price" v-if="item.is_like"></text>
<text class="lf-iconfont icon-xihuan" v-else></text> <text class="lf-iconfont icon-xihuan" v-else></text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.likes_count}}</text> <text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.likes_count}}</text>
@ -111,7 +111,7 @@
discover_id: id discover_id: id
}, },
header: { header: {
Authorization: `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjczYTViNTA1NDNlYmNmMjFkNmZiMGJlNzc0NmJmMDE4MDc3MTRkY2Y1MjBiMjM3MGQyZDAyYzQxMTlmMDU4ZTkwMTUxNDQwOTk4MjJhODFhIn0.eyJhdWQiOiIzIiwianRpIjoiNzNhNWI1MDU0M2ViY2YyMWQ2ZmIwYmU3NzQ2YmYwMTgwNzcxNGRjZjUyMGIyMzcwZDJkMDJjNDExOWYwNThlOTAxNTE0NDA5OTgyMmE4MWEiLCJpYXQiOjE2MzExNjk1MDIsIm5iZiI6MTYzMTE2OTUwMiwiZXhwIjoxNjYyNzA1NTAyLCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.p0YoIC_bhOxIOugYxDQTOFIK9t2ORiHQq9H6JWzdByBJKWkFDBisKaXZJvzn1HdU5cjNQnHaBfWpG1Ed15cQlB2LdpXxxc38iaaGW2J6WhlLhVkehloii-TtlZTOeqNrpAHbSe5DRrmm_L07Llm9wr1T1A6pP3MhzdHiZ9d6748j3_cJjK4CJUl3WfYRTaozLFlI00OCW4zzGfgivSighjSFyhqMoHnQ2iSoeWdcJnYpXzXQdc5AXvXOt6eIIa7o2F6Ma1tUseTYVijEVfngdfd21JI1eH6tHrSqUItkQHAart9o74dJn9micI3WrN5yEBXgzemqWkQGV4QzFHLyd3wk-XvP1s2GhCeWlJZOQADzgzhLoxzFUbgM5xULWHp3yfpePGISlM4ZpBwTHcqQt1i_UkNX_zCxa3RYQbZFDfWW0-UPbvHw40t5BY6X7nTPMhPjPGnnPq18jyYBrWBbC9vBWs2o2IHAe5VlkHtmy_v5fymFJLfFzS784Nxp2qPJFWxI7IfrpNckHxohhs5LoieQivw2MyU2shFOUjgwe0xQgyg6UBg5PwNknGTTmzYdavCM4BiQ7moqOuoI15ccIEmc_uMiuLVEfDPlzejP9PQv6mj6IlkJ8HSu4KZU-LxKmtLnGeEwMjVAZBIhsOwzMkaMF1nZ70pgv2YYwBQyVVs`
Authorization: this.$cookieStorage.get('user_token')
}, },
}) })
.then(res => { .then(res => {
@ -197,7 +197,11 @@
let tab_item = this.tab_list[this.tab_current]; let tab_item = this.tab_list[this.tab_current];
if(tab_item.isPage){ if(tab_item.isPage){
tab_item.page = tab_item.page + 1; tab_item.page = tab_item.page + 1;
this.getHotActivity();
if(this.tab_current == 2) {
this.getMyAttention();
}else {
this.getHotActivity();
}
} }
}, },
// //
@ -208,7 +212,11 @@
tab_item.loadingClass = true; tab_item.loadingClass = true;
tab_item.list = [] tab_item.list = []
tab_item.loadingText = '正在加载中'; tab_item.loadingText = '正在加载中';
this.getHotActivity(options);
if(this.tab_current == 2) {
this.getMyAttention();
}else {
this.getHotActivity(options);
}
}, },
// scroll-view // scroll-view
onRefresherrefresh(){ onRefresherrefresh(){
@ -219,7 +227,6 @@
this.tab_current = event; this.tab_current = event;
if(this.tab_current == 2) { if(this.tab_current == 2) {
this.getMyAttention(); this.getMyAttention();
console.log('执行关注列表');
}else { }else {
this.getHotActivity(); this.getHotActivity();
} }

82
pages/discover/discoverdetails.vue

@ -19,7 +19,7 @@
{{discover_details.content}} {{discover_details.content}}
</view> </view>
<view class="lf-flex-wrap lf-m-t-20"> <view class="lf-flex-wrap lf-m-t-20">
<image v-for="(item,index) in discover_details.attachs" class="qzone-img" :src="item.url" mode="aspectFill"></image>
<image v-for="(item,index) in discover_details.attachs" :key="index" class="qzone-img" :src="item.url" mode="aspectFill"></image>
</view> </view>
<view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50"> <view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50">
<view class="lf-row-center" @click="addLike(discover_details.id)"> <view class="lf-row-center" @click="addLike(discover_details.id)">
@ -39,11 +39,11 @@
</view> </view>
<self-line/> <self-line/>
<!-- 评论 --> <!-- 评论 -->
<view class="comment" v-if="discover_details.comments.length != 0">
<view class="lf-color-555 lf-font-24"> {{discover_details.comments_count}}条评论</view>
<view class="comment" v-if="commentList.length != 0">
<view class="lf-color-555 lf-font-24"> {{commentList.total}}条评论</view>
<!-- 评论开始 --> <!-- 评论开始 -->
<view v-for="(commentitem,commentindex) of commentList">
<view class="lf-m-t-20" @click="applyComment(commentitem.user.id)" v-if="!commentitem.to_user">
<view v-for="(commentitem,commentindex) of commentList" :key="commentindex">
<view class="lf-m-t-20" @click="applyComment(commentitem.user.id,commentitem.id)">
<view class="lf-flex"> <view class="lf-flex">
<view> <view>
<image class="comment-img" :src="commentitem.user.avatar" mode="aspectFill"></image> <image class="comment-img" :src="commentitem.user.avatar" mode="aspectFill"></image>
@ -55,38 +55,40 @@
</view> </view>
</view> </view>
<view class="lf-m-l-32" style="position: absolute;right:33rpx;"> <view class="lf-m-l-32" style="position: absolute;right:33rpx;">
<view @click="giveaLike(commentitem.id)">
<text class="lf-iconfont icon-shoucang"></text>
<view @click.stop="giveaLike(commentitem.id)">
<text class="lf-iconfont icon-xihuanlike lf-color-price" v-if="commentitem.is_like"></text>
<text class="lf-iconfont icon-xihuan" v-else></text>
</view> </view>
<view class="lf-color-555 lf-font-24 lf-row-center">{{commentitem.likes_count}}</view> <view class="lf-color-555 lf-font-24 lf-row-center">{{commentitem.likes_count}}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="comment-replay" v-else>
<view class="lf-flex" @click="applyComment(commentitem.user.id)">
<view class="comment-replay" v-if="$isRight(commentitem.sub)" v-for="(subitem,index2) of commentitem.sub" :key="index2">
<view class="lf-flex" @click="applySub(subitem.user.id,subitem.parent_id)">
<view class="lf-flex lf-m-t-30"> <view class="lf-flex lf-m-t-30">
<view> <view>
<image class="comment-img" :src="commentitem.user.avatar" mode="aspectFill"></image>
<image class="comment-img" :src="subitem.user.avatar" mode="aspectFill"></image>
</view> </view>
<view class="lf-flex-column lf-m-l-20"> <view class="lf-flex-column lf-m-l-20">
<view class="lf-flex"> <view class="lf-flex">
<view class="lf-color-999 lf-font-24 lf-m-r-10">{{commentitem.user.nick_name}}</view>
<view class="lf-color-999 lf-font-24 lf-m-r-10">{{subitem.user.nick_name}}</view>
<view class="lf-row-center" style="max-width: 446rpx;"> <view class="lf-row-center" style="max-width: 446rpx;">
<text class="lf-color-333 lf-m-r-10">回复</text> <text class="lf-color-333 lf-m-r-10">回复</text>
<text class="lf-font-24 lf-color-999">{{commentitem.to_user.nick_name}}:</text>
<text class="lf-font-24 lf-color-999">{{subitem.to_user.nick_name}}:</text>
</view> </view>
</view> </view>
<view style="max-width: 460rpx;"> <view style="max-width: 460rpx;">
<text class="lf-font-26 lf-color-black lf-m-l-10">{{commentitem.content}}</text>
<text class="lf-color-999 lf-font-24 lf-m-l-10">{{commentitem.created_at}}</text>
<text class="lf-font-26 lf-color-black lf-m-l-10">{{subitem.content}}</text>
<text class="lf-color-999 lf-font-24 lf-m-l-10">{{subitem.created_at}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="lf-m-t-30" style="position: absolute;right:33rpx;"> <view class="lf-m-t-30" style="position: absolute;right:33rpx;">
<view @click="giveaLike(commentitem.id)">
<text class="lf-iconfont icon-shoucang"></text>
<view @click.stop="giveaLike(subitem.id)">
<text class="lf-iconfont icon-xihuanlike lf-color-price" v-if="subitem.is_like"></text>
<text class="lf-iconfont icon-xihuan" v-else></text>
</view> </view>
<view class="lf-color-555 lf-font-24 lf-row-center">{{commentitem.likes_count}}</view>
<view class="lf-color-555 lf-font-24 lf-row-center">{{subitem.likes_count}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -98,7 +100,8 @@
<!-- 底部tab --> <!-- 底部tab -->
<view class="comment-tab"> <view class="comment-tab">
<view> <view>
<input class="rom-search" type="text" @confirm="sendComment(discover_details.id)" :cursor-spacing="8" v-model="comment" placeholder="说点什么" />
<input class="rom-search" type="text" v-if="ifApply" :focus="ifApply" @confirm="applyComment(apply_userid,apply_commentid)" :cursor-spacing="8" v-model="comment" placeholder="说点什么" />
<input class="rom-search" type="text" v-else @confirm="sendComment(discover_details.id)" :cursor-spacing="8" v-model="comment" placeholder="说点什么" />
</view> </view>
<view class="lf-row-center"> <view class="lf-row-center">
<view class="lf-row-center lf-m-r-35" @click="addLike(discover_details.id)"> <view class="lf-row-center lf-m-r-35" @click="addLike(discover_details.id)">
@ -127,7 +130,10 @@
discover_details: '', discover_details: '',
is_like: false, is_like: false,
comment: '', comment: '',
commentList: []
commentList: [],
ifApply: false,
apply_userid: 0,
apply_commentid: 0
} }
}, },
onLoad(e) { onLoad(e) {
@ -136,6 +142,11 @@
this.getCommentList(); this.getCommentList();
}, },
methods: { methods: {
applySub(userid,commentid) {
this.ifApply = true;
this.apply_userid = userid;
this.apply_commentid = commentid;
},
// //
giveaLike(comment_id) { giveaLike(comment_id) {
this.$http this.$http
@ -145,7 +156,7 @@
comment_id: comment_id comment_id: comment_id
}, },
header: { header: {
Authorization: `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImFhNDcwZDYxZGRjODNhMjYxM2M3NzQ4MzFiNzYyYmUzMzgwZTA0ZGMyN2EzMjQyNmI4YWM5YjBlMDBlMGFlZGVkZTQ2OGZlMWU2M2Q3ODJkIn0.eyJhdWQiOiIzIiwianRpIjoiYWE0NzBkNjFkZGM4M2EyNjEzYzc3NDgzMWI3NjJiZTMzODBlMDRkYzI3YTMyNDI2YjhhYzliMGUwMGUwYWVkZWRlNDY4ZmUxZTYzZDc4MmQiLCJpYXQiOjE2MzE2MTMxNjksIm5iZiI6MTYzMTYxMzE2OSwiZXhwIjoxNjYzMTQ5MTY5LCJzdWIiOiI2Iiwic2NvcGVzIjpbXX0.B9vW9urpv4KlYYMLRV0tN6iZNvlhgCeaO31pZC0ZQTIZx4aahhDb7wAw9yZH0_fHHcn6GXu95O6MPI2jzgCOXcNygHV-gztxBGUiRhg-Qb9NraAZEzXpqEgQKHvbqr6NSmnu1Kx_oT6tmWFmYtXQn5Pi6lxtUCfiDGYZItQDdiORAly6BvkgQjaLsNCLMvO1dhRN3nvM3giR5nI0zmJVNbwwfIfH9Vp8uicr7la5aL_EoZnkVJRrd0WOZCOs2U5zzQJLwnwknkWXBS6sWy0wJCVd0lXJwDitsE8i0r8OchnAWW_Jq12O5frYwrhfe9DEl0CvTz6em72_YbFlC0PB63z19QGnccWBj1pl2bU9Ti_K7-9f-Kn8ZKnt03AmYmN77YaNqOwMutlifI7_ZKRRcQ45ivxtgeLaLtFPJ6pJ3bhYu8IjIUER9zzrWLa785eWbuMsE3rPfnU7XAxXriYa7TGvo2mtz3_b9hJL3fBp3Ll3TTOPcoRraN922Xd7dxfiE9wdPI9SIvwzu_fqm5xh-xaaqJUhSvRSzWODsdJQW5NSl08jHFIr-anEXbjThMtk1HX_r6X742fzncuLMNSnYvkoDIe0X4fzfjp25sV27b0cUodzsCbKyyC8aZDbRuQ6n1TxiGxUBnivXkBSKxXLiWjDRThRZ-AhRRC6IRzmTOo`
Authorization: this.$cookieStorage.get('user_token')
}, },
}) })
.then(res => { .then(res => {
@ -153,6 +164,7 @@
if (res.data.status) { if (res.data.status) {
this.$msg('点赞成功').then(() => { this.$msg('点赞成功').then(() => {
console.log('更新点赞列表') console.log('更新点赞列表')
this.getCommentList()
}) })
} else { } else {
wx.showModal({ wx.showModal({
@ -183,16 +195,16 @@
api: 'api/discover/comment/list', api: 'api/discover/comment/list',
data: { data: {
discover_id: this.discover_id, discover_id: this.discover_id,
user_id: 1
user_id: 6
}, },
header: { header: {
Authorization: `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjczYTViNTA1NDNlYmNmMjFkNmZiMGJlNzc0NmJmMDE4MDc3MTRkY2Y1MjBiMjM3MGQyZDAyYzQxMTlmMDU4ZTkwMTUxNDQwOTk4MjJhODFhIn0.eyJhdWQiOiIzIiwianRpIjoiNzNhNWI1MDU0M2ViY2YyMWQ2ZmIwYmU3NzQ2YmYwMTgwNzcxNGRjZjUyMGIyMzcwZDJkMDJjNDExOWYwNThlOTAxNTE0NDA5OTgyMmE4MWEiLCJpYXQiOjE2MzExNjk1MDIsIm5iZiI6MTYzMTE2OTUwMiwiZXhwIjoxNjYyNzA1NTAyLCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.p0YoIC_bhOxIOugYxDQTOFIK9t2ORiHQq9H6JWzdByBJKWkFDBisKaXZJvzn1HdU5cjNQnHaBfWpG1Ed15cQlB2LdpXxxc38iaaGW2J6WhlLhVkehloii-TtlZTOeqNrpAHbSe5DRrmm_L07Llm9wr1T1A6pP3MhzdHiZ9d6748j3_cJjK4CJUl3WfYRTaozLFlI00OCW4zzGfgivSighjSFyhqMoHnQ2iSoeWdcJnYpXzXQdc5AXvXOt6eIIa7o2F6Ma1tUseTYVijEVfngdfd21JI1eH6tHrSqUItkQHAart9o74dJn9micI3WrN5yEBXgzemqWkQGV4QzFHLyd3wk-XvP1s2GhCeWlJZOQADzgzhLoxzFUbgM5xULWHp3yfpePGISlM4ZpBwTHcqQt1i_UkNX_zCxa3RYQbZFDfWW0-UPbvHw40t5BY6X7nTPMhPjPGnnPq18jyYBrWBbC9vBWs2o2IHAe5VlkHtmy_v5fymFJLfFzS784Nxp2qPJFWxI7IfrpNckHxohhs5LoieQivw2MyU2shFOUjgwe0xQgyg6UBg5PwNknGTTmzYdavCM4BiQ7moqOuoI15ccIEmc_uMiuLVEfDPlzejP9PQv6mj6IlkJ8HSu4KZU-LxKmtLnGeEwMjVAZBIhsOwzMkaMF1nZ70pgv2YYwBQyVVs`
Authorization: this.$cookieStorage.get('user_token')
}, },
}) })
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.status) { if (res.data.status) {
this.commentList = res.data.data.data.reverse();
this.commentList = res.data.data.data;
console.log('当前评论列表',this.commentList) console.log('当前评论列表',this.commentList)
} else { } else {
wx.showModal({ wx.showModal({
@ -216,24 +228,27 @@
}); });
}); });
}, },
applyComment(touserid) {
applyComment(touserid,commentid) {
this.$http this.$http
.post({ .post({
api: 'api/discover/comment', api: 'api/discover/comment',
data: { data: {
discover_id: this.discover_id, discover_id: this.discover_id,
content: this.comment, content: this.comment,
to_user_id: touserid
to_user_id: touserid,
parent_id: commentid
}, },
header: { header: {
Authorization: `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImFhNDcwZDYxZGRjODNhMjYxM2M3NzQ4MzFiNzYyYmUzMzgwZTA0ZGMyN2EzMjQyNmI4YWM5YjBlMDBlMGFlZGVkZTQ2OGZlMWU2M2Q3ODJkIn0.eyJhdWQiOiIzIiwianRpIjoiYWE0NzBkNjFkZGM4M2EyNjEzYzc3NDgzMWI3NjJiZTMzODBlMDRkYzI3YTMyNDI2YjhhYzliMGUwMGUwYWVkZWRlNDY4ZmUxZTYzZDc4MmQiLCJpYXQiOjE2MzE2MTMxNjksIm5iZiI6MTYzMTYxMzE2OSwiZXhwIjoxNjYzMTQ5MTY5LCJzdWIiOiI2Iiwic2NvcGVzIjpbXX0.B9vW9urpv4KlYYMLRV0tN6iZNvlhgCeaO31pZC0ZQTIZx4aahhDb7wAw9yZH0_fHHcn6GXu95O6MPI2jzgCOXcNygHV-gztxBGUiRhg-Qb9NraAZEzXpqEgQKHvbqr6NSmnu1Kx_oT6tmWFmYtXQn5Pi6lxtUCfiDGYZItQDdiORAly6BvkgQjaLsNCLMvO1dhRN3nvM3giR5nI0zmJVNbwwfIfH9Vp8uicr7la5aL_EoZnkVJRrd0WOZCOs2U5zzQJLwnwknkWXBS6sWy0wJCVd0lXJwDitsE8i0r8OchnAWW_Jq12O5frYwrhfe9DEl0CvTz6em72_YbFlC0PB63z19QGnccWBj1pl2bU9Ti_K7-9f-Kn8ZKnt03AmYmN77YaNqOwMutlifI7_ZKRRcQ45ivxtgeLaLtFPJ6pJ3bhYu8IjIUER9zzrWLa785eWbuMsE3rPfnU7XAxXriYa7TGvo2mtz3_b9hJL3fBp3Ll3TTOPcoRraN922Xd7dxfiE9wdPI9SIvwzu_fqm5xh-xaaqJUhSvRSzWODsdJQW5NSl08jHFIr-anEXbjThMtk1HX_r6X742fzncuLMNSnYvkoDIe0X4fzfjp25sV27b0cUodzsCbKyyC8aZDbRuQ6n1TxiGxUBnivXkBSKxXLiWjDRThRZ-AhRRC6IRzmTOo`
Authorization: this.$cookieStorage.get('user_token')
}, },
}) })
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.status) { if (res.data.status) {
this.$msg('回复成功').then(() => { this.$msg('回复成功').then(() => {
console.log('更新回复列表')
console.log('更新回复列表');
this.comment = '';
this.getCommentList();
}) })
} else { } else {
wx.showModal({ wx.showModal({
@ -264,10 +279,11 @@
data: { data: {
discover_id: id, discover_id: id,
content: this.comment, content: this.comment,
to_user_id: 0
to_user_id: 0,
parent_id: 0
}, },
header: { header: {
Authorization: `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImFhNDcwZDYxZGRjODNhMjYxM2M3NzQ4MzFiNzYyYmUzMzgwZTA0ZGMyN2EzMjQyNmI4YWM5YjBlMDBlMGFlZGVkZTQ2OGZlMWU2M2Q3ODJkIn0.eyJhdWQiOiIzIiwianRpIjoiYWE0NzBkNjFkZGM4M2EyNjEzYzc3NDgzMWI3NjJiZTMzODBlMDRkYzI3YTMyNDI2YjhhYzliMGUwMGUwYWVkZWRlNDY4ZmUxZTYzZDc4MmQiLCJpYXQiOjE2MzE2MTMxNjksIm5iZiI6MTYzMTYxMzE2OSwiZXhwIjoxNjYzMTQ5MTY5LCJzdWIiOiI2Iiwic2NvcGVzIjpbXX0.B9vW9urpv4KlYYMLRV0tN6iZNvlhgCeaO31pZC0ZQTIZx4aahhDb7wAw9yZH0_fHHcn6GXu95O6MPI2jzgCOXcNygHV-gztxBGUiRhg-Qb9NraAZEzXpqEgQKHvbqr6NSmnu1Kx_oT6tmWFmYtXQn5Pi6lxtUCfiDGYZItQDdiORAly6BvkgQjaLsNCLMvO1dhRN3nvM3giR5nI0zmJVNbwwfIfH9Vp8uicr7la5aL_EoZnkVJRrd0WOZCOs2U5zzQJLwnwknkWXBS6sWy0wJCVd0lXJwDitsE8i0r8OchnAWW_Jq12O5frYwrhfe9DEl0CvTz6em72_YbFlC0PB63z19QGnccWBj1pl2bU9Ti_K7-9f-Kn8ZKnt03AmYmN77YaNqOwMutlifI7_ZKRRcQ45ivxtgeLaLtFPJ6pJ3bhYu8IjIUER9zzrWLa785eWbuMsE3rPfnU7XAxXriYa7TGvo2mtz3_b9hJL3fBp3Ll3TTOPcoRraN922Xd7dxfiE9wdPI9SIvwzu_fqm5xh-xaaqJUhSvRSzWODsdJQW5NSl08jHFIr-anEXbjThMtk1HX_r6X742fzncuLMNSnYvkoDIe0X4fzfjp25sV27b0cUodzsCbKyyC8aZDbRuQ6n1TxiGxUBnivXkBSKxXLiWjDRThRZ-AhRRC6IRzmTOo`
Authorization: this.$cookieStorage.get('user_token')
}, },
}) })
.then(res => { .then(res => {
@ -275,6 +291,8 @@
if (res.data.status) { if (res.data.status) {
this.$msg('评论成功').then(() => { this.$msg('评论成功').then(() => {
console.log('更新评论列表') console.log('更新评论列表')
this.comment = '';
this.getCommentList();
}) })
} else { } else {
wx.showModal({ wx.showModal({
@ -306,13 +324,13 @@
discover_id: id discover_id: id
}, },
header: { header: {
Authorization: `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjczYTViNTA1NDNlYmNmMjFkNmZiMGJlNzc0NmJmMDE4MDc3MTRkY2Y1MjBiMjM3MGQyZDAyYzQxMTlmMDU4ZTkwMTUxNDQwOTk4MjJhODFhIn0.eyJhdWQiOiIzIiwianRpIjoiNzNhNWI1MDU0M2ViY2YyMWQ2ZmIwYmU3NzQ2YmYwMTgwNzcxNGRjZjUyMGIyMzcwZDJkMDJjNDExOWYwNThlOTAxNTE0NDA5OTgyMmE4MWEiLCJpYXQiOjE2MzExNjk1MDIsIm5iZiI6MTYzMTE2OTUwMiwiZXhwIjoxNjYyNzA1NTAyLCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.p0YoIC_bhOxIOugYxDQTOFIK9t2ORiHQq9H6JWzdByBJKWkFDBisKaXZJvzn1HdU5cjNQnHaBfWpG1Ed15cQlB2LdpXxxc38iaaGW2J6WhlLhVkehloii-TtlZTOeqNrpAHbSe5DRrmm_L07Llm9wr1T1A6pP3MhzdHiZ9d6748j3_cJjK4CJUl3WfYRTaozLFlI00OCW4zzGfgivSighjSFyhqMoHnQ2iSoeWdcJnYpXzXQdc5AXvXOt6eIIa7o2F6Ma1tUseTYVijEVfngdfd21JI1eH6tHrSqUItkQHAart9o74dJn9micI3WrN5yEBXgzemqWkQGV4QzFHLyd3wk-XvP1s2GhCeWlJZOQADzgzhLoxzFUbgM5xULWHp3yfpePGISlM4ZpBwTHcqQt1i_UkNX_zCxa3RYQbZFDfWW0-UPbvHw40t5BY6X7nTPMhPjPGnnPq18jyYBrWBbC9vBWs2o2IHAe5VlkHtmy_v5fymFJLfFzS784Nxp2qPJFWxI7IfrpNckHxohhs5LoieQivw2MyU2shFOUjgwe0xQgyg6UBg5PwNknGTTmzYdavCM4BiQ7moqOuoI15ccIEmc_uMiuLVEfDPlzejP9PQv6mj6IlkJ8HSu4KZU-LxKmtLnGeEwMjVAZBIhsOwzMkaMF1nZ70pgv2YYwBQyVVs`
Authorization: this.$cookieStorage.get('user_token')
}, },
}) })
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.status) { if (res.data.status) {
this.getHotActivity();
this.getCommentList();
} else { } else {
wx.showModal({ wx.showModal({
content: res.data.message || '请下拉页面刷新重试', content: res.data.message || '请下拉页面刷新重试',
@ -341,7 +359,7 @@
api: 'api/discover/detail', api: 'api/discover/detail',
data: { data: {
id: this.discover_id, id: this.discover_id,
user_id: 1
user_id: 6
}, },
}) })
.then(res => { .then(res => {

159
pages/user/my/my.vue

@ -1,70 +1,48 @@
<template> <template>
<view> <view>
<lf-nav :spreadOut="true" :showIcon="true" bgColor="#F3F8F8" title="个人主页"></lf-nav> <lf-nav :spreadOut="true" :showIcon="true" bgColor="#F3F8F8" title="个人主页"></lf-nav>
<view class="user-top">
<view class="user-top" v-if="$isRight(discover_info)">
<view class="lf-row-between lf-w-100"> <view class="lf-row-between lf-w-100">
<view class="lf-flex"> <view class="lf-flex">
<view class="tag-father"> <view class="tag-father">
<image src="https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png" mode="aspectFill" class="head-img"></image>
<image :src="discover_info.avatar" mode="aspectFill" class="head-img"></image>
<view class="head-tag">V</view> <view class="head-tag">V</view>
</view> </view>
<view class="lf-flex-column lf-m-l-20"> <view class="lf-flex-column lf-m-l-20">
<text class="lf-font-42 lf-color-black lf-font-bold">最新</text>
<text class="lf-font-28 lf-color-black">0 关注 | 0 粉丝</text>
<text class="lf-font-42 lf-color-black lf-font-bold">{{discover_info.username}}</text>
<text class="lf-font-28 lf-color-black">{{discover_info.my_follow_count}}关注 | {{discover_info.follow_me_count}}粉丝</text>
</view> </view>
</view> </view>
<view> <view>
<button class="head-btn">关注</button>
<button class="head-btn" v-if="discover_info.is_follow == true">已关注</button>
<button class="head-btn" v-if="discover_info.is_follow == false">关注</button>
<view v-if="discover_info.is_follow == -1"></view>
</view> </view>
</view> </view>
</view> </view>
<view class="lf-m-32" @click="$url('/pages/discover/discoverdetails')">
<view class="lf-m-32" v-for="(item,index) in discover_info.list.data" :key="index" @click="goDetails(item.id)">
<view class="lf-font-48 lf-color-black lf-font-bold"> <view class="lf-font-48 lf-color-black lf-font-bold">
08月27日
{{item.create_time[0]}}
</view> </view>
<view class="lf-color-777 lf-font-24"> <view class="lf-color-777 lf-font-24">
18:39
{{item.create_time[1]}}
</view> </view>
<view class="lf-flex-wrap lf-m-t-20"> <view class="lf-flex-wrap lf-m-t-20">
<image v-for="item in 9" class="qzone-img" src="https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png" mode="aspectFill"></image>
<image v-for="(picture,index2) in item.attachs" :key="index2" class="qzone-img" :src="picture.url" mode="aspectFill"></image>
</view> </view>
<view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50"> <view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50">
<view class="lf-row-center"> <view class="lf-row-center">
<text class="lf-iconfont icon-xihuan"></text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">379</text>
<text class="lf-iconfont icon-xihuanlike lf-color-price" v-if="item.is_like"></text>
<text class="lf-iconfont icon-xihuan" v-else></text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.likes_count}}</text>
</view> </view>
<view class="lf-row-center"> <view class="lf-row-center">
<text class="lf-iconfont icon-chakan"></text> <text class="lf-iconfont icon-chakan"></text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">3579</text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.view_count}}</text>
</view> </view>
<view class="lf-row-center"> <view class="lf-row-center">
<text class="lf-iconfont icon-pinglun-"></text> <text class="lf-iconfont icon-pinglun-"></text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">63</text>
</view>
</view>
</view>
<view class="lf-m-32">
<view class="lf-font-48 lf-color-black lf-font-bold">
08月27日
</view>
<view class="lf-color-777 lf-font-24">
18:39
</view>
<view class="lf-flex-wrap lf-m-t-20">
<image v-for="item in 9" class="qzone-img" src="https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png" mode="aspectFill"></image>
</view>
<view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50">
<view class="lf-row-center">
<text class="lf-iconfont icon-shoucang"></text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">379</text>
</view>
<view class="lf-row-center">
<text class="lf-iconfont icon-fabu"></text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">3579</text>
</view>
<view class="lf-row-center">
<text class="lf-iconfont icon-fenxiang"></text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">63</text>
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.comments_count}}</text>
</view> </view>
</view> </view>
</view> </view>
@ -73,7 +51,110 @@
</template> </template>
<script> <script>
export default {
data() {
return {
user_id: 0,
page: 1,
page_size: 15,
discover_info: ''
}
},
onLoad(e) {
this.user_id = e.user_id;
let user_info = this.$cookieStorage.get('user_token');
if(user_info) {
this.loginList();
}else {
this.noLoginList();
}
},
methods: {
goDetails(id) {
this.$url('/pages/discover/discoverdetails?discover_id='+id)
},
//
noLoginList() {
this.$http
.get({
api: 'api/discover/user/',
data: {
page: this.page,
page_size: this.page_size
},
header: {
Authorization: this.$cookieStorage.get('user_token')
},
})
.then(res => {
if (res.data.code == 200) {
if (res.data.status) {
this.discover_info = res.data.data;
console.log('未登录时的发现列表',this.discover_info);
} else {
wx.showModal({
content: res.data.message || '请下拉页面刷新重试',
showCancel: false
});
}
} else {
wx.showModal({
content: res.data.message || '请下拉页面刷新重试',
showCancel: false
});
}
wx.hideLoading();
})
.catch(() => {
wx.hideLoading();
wx.showModal({
content: '请求失败',
showCancel: false
});
});
},
//
loginList() {
this.$http
.get({
api: 'api/discover/my/'+this.user_id,
data: {
page: this.page,
page_size: this.page_size
},
header: {
Authorization: this.$cookieStorage.get('user_token')
},
})
.then(res => {
if (res.data.code == 200) {
if (res.data.status) {
this.discover_info = res.data.data;
console.log('登录时的发现列表',this.discover_info);
} else {
wx.showModal({
content: res.data.message || '请下拉页面刷新重试',
showCancel: false
});
}
} else {
wx.showModal({
content: res.data.message || '请下拉页面刷新重试',
showCancel: false
});
}
wx.hideLoading();
})
.catch(() => {
wx.hideLoading();
wx.showModal({
content: '请求失败',
showCancel: false
});
});
},
}
}
</script> </script>
<style> <style>

Loading…
Cancel
Save