暂时删除种草栏目及页面
This commit is contained in:
parent
5efa3241e5
commit
fc2764d0f3
@ -94,10 +94,6 @@
|
||||
<mall-news :list="mallNews"></mall-news>
|
||||
</view>
|
||||
|
||||
<!-- 附近店铺 -->
|
||||
<!-- <view class="m-t-20" v-if="nearbyShop.length">
|
||||
<shop-recommend type="nearby-shops" title="附近店铺" :list="nearbyShop" url="/bundle_b/pages/nearby_shops/nearby_shops"></shop-recommend>
|
||||
</view> -->
|
||||
|
||||
<view class="m-t-20" v-if="appConfig.index_setting.host_show && hotGoods.length">
|
||||
<active-area :list="hotListGoods" :price-type="priceType" type="hot" title="热销榜单" url="/pages/active_list/active_list?type=hot"></active-area>
|
||||
@ -106,10 +102,6 @@
|
||||
<!-- <view class="m-t-20" v-if="appConfig.index_setting.new_show && newGoods.length">
|
||||
<active-area :list="newGoods" :price-type="priceType" type="new" title="新品推荐" url="/pages/active_list/active_list?type=new"></active-area>
|
||||
</view> -->
|
||||
|
||||
<!-- <view class="m-t-20" v-if="appConfig.index_setting.community_show && communityArticle.length">
|
||||
<community-recommend :list="communityArticle" title="种草社区" url="/pages/community/community"></community-recommend>
|
||||
</view> -->
|
||||
|
||||
<view class="m-t-20" v-if="appConfig.index_setting.shop_show && shopLists.length">
|
||||
<shop-recommend type="shop-recommends" title="店铺推荐" :list="shopLists"></shop-recommend>
|
||||
|
||||
17
pages.json
17
pages.json
@ -50,17 +50,6 @@
|
||||
"navigationBarTitleText": "新品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/community/community",
|
||||
"name": "community",
|
||||
"meta": {
|
||||
"auth": false,
|
||||
"keepScroll": true
|
||||
},
|
||||
"style": {
|
||||
"navigationBarTitleText": "种草"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/shop_cart/shop_cart",
|
||||
"name": "shop_cart",
|
||||
@ -1333,12 +1322,6 @@
|
||||
// "selectedIconPath": "/static/images/tab_sort_s.png",
|
||||
// "text": "分类"
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "pages/community/community",
|
||||
// "iconPath": "/static/images/tab-community.png",
|
||||
// "selectedIconPath": "/static/images/tab-community_s.png",
|
||||
// "text": "种草"
|
||||
// },
|
||||
{
|
||||
"pagePath": "pages/new_goods/index",
|
||||
"iconPath": "/static/images/tab_new.png",
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
<template>
|
||||
<view class="community">
|
||||
<template v-if="appConfig.is_open_community">
|
||||
<like-header @change="handleNav" :current="currentNav" />
|
||||
<view class="container">
|
||||
<follow :active="currentNav" v-show="currentNav===0" @share="handleShare"></follow>
|
||||
<explore :active="currentNav" v-show="currentNav===1"></explore>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="community-empty flex-col col-center row-center">
|
||||
<image class="img-null" :src="aliOSSDomain + 'uniapp/follow_null.png'"></image>
|
||||
<view class="muted mt20">当前页面暂无内容~</view>
|
||||
</view>
|
||||
</template>
|
||||
<tabbar></tabbar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LikeHeader from "./components/like-header.vue"
|
||||
import Explore from "./components/explore.vue"
|
||||
import Follow from "./components/follow.vue"
|
||||
export default {
|
||||
components: {
|
||||
LikeHeader,
|
||||
Explore,
|
||||
Follow
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentNav: 1,
|
||||
communityShareItem: {}
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off("changeItem")
|
||||
uni.$off("hasNew")
|
||||
},
|
||||
onShareAppMessage() {
|
||||
const promise = new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
title: `${this.communityShareItem.user.nickname},TA的内容超级棒`,
|
||||
path: '/bundle_b/pages/community_user/community_user?id=' + this
|
||||
.communityShareItem.id,
|
||||
imageUrl: this.communityShareItem.image
|
||||
})
|
||||
}, 10)
|
||||
})
|
||||
return {
|
||||
title: '自定义转发标题',
|
||||
path: '/page/user/user',
|
||||
promise
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleNav(event) {
|
||||
this.currentNav = Number(event)
|
||||
},
|
||||
handleShare(event) {
|
||||
this.communityShareItem = event
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.community {
|
||||
display: flex;
|
||||
height: calc(100vh - var(--window-bottom));
|
||||
overflow: hidden;
|
||||
flex-direction: column;
|
||||
|
||||
&-empty {
|
||||
height: calc(100vh - var(--window-bottom));
|
||||
}
|
||||
|
||||
.container {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: scroll;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,81 +0,0 @@
|
||||
<template>
|
||||
<view class="explore">
|
||||
<!-- 搜索 -->
|
||||
<view>
|
||||
<router-link
|
||||
:to="{path: '/bundle_b/pages/community_search/community_search'}">
|
||||
<u-search disabled
|
||||
placeholder="请输入搜索内容" height="64" focus
|
||||
></u-search>
|
||||
</router-link>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<tabs :current="current" @change="changeTabs" height="100" >
|
||||
<tab v-for="(item, index) in tabList" :key="index" :name="item.name">
|
||||
<lists :cateId="item.id" :i="index" :index="current"></lists>
|
||||
</tab>
|
||||
</tabs>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCommunityCate,
|
||||
getCommunityArticleLists
|
||||
} from '@/api/community.js';
|
||||
import Lists from "./lists.vue"
|
||||
export default {
|
||||
components: {
|
||||
Lists
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabList: [{
|
||||
name: '全部',
|
||||
id: ''
|
||||
}],
|
||||
current: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initRecommendTopic()
|
||||
},
|
||||
methods: {
|
||||
initMescroll(event) {
|
||||
this.isInit = true;
|
||||
this.mescroll = event;
|
||||
},
|
||||
handleCancel() {
|
||||
this.keyword = '';
|
||||
},
|
||||
changeTabs(event) {
|
||||
this.current = event;
|
||||
},
|
||||
// 初始化获取话题
|
||||
initRecommendTopic() {
|
||||
getCommunityCate().then(res => {
|
||||
if( res.code === 1 ) {
|
||||
this.tabList = [{
|
||||
name: '全部',
|
||||
id: ''
|
||||
}, ...res.data]
|
||||
} else {
|
||||
this.$toast({ title: res.msg })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.explore {
|
||||
.content {
|
||||
height: calc(100vh - 92px - var(--window-bottom));
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,402 +0,0 @@
|
||||
<template>
|
||||
<view class="follow">
|
||||
<mescroll-uni ref="mescrollRef" top="0" :height="height" @init="initMescroll" @down="downCallback"
|
||||
@up="upCallback" :down="downOption" :up="upOption">
|
||||
|
||||
<block v-for="(item, index) in lists" :key="index">
|
||||
<view class="content-box">
|
||||
<!-- 内容头部信息 -->
|
||||
<router-link :to="'/bundle_b/pages/community_user/community_user?id=' + item.user.id">
|
||||
<view class="header flex row-between">
|
||||
<view class="flex">
|
||||
<!-- 头像 -->
|
||||
<u-image width="70" height="70" :src="item.user.avatar" borderRadius="50%"></u-image>
|
||||
<!-- 昵称 -->
|
||||
<text class="normal bold m-l-16">{{ item.user.nickname }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="muted">{{ item.create_time }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</router-link>
|
||||
<!-- 内容媒体信息 -->
|
||||
<view class="swiper-container">
|
||||
<product-swiper :imgUrls="item.images" :autoplay="false" borderRadius="14"></product-swiper>
|
||||
</view>
|
||||
|
||||
<!-- 提到的宝贝( 商品 ) -->
|
||||
<view class="goods-box bb flex row-between" @click="handleOpenGoods(item.id)"
|
||||
v-if="item.goods_data.length">
|
||||
<text class="nr lighter">查看TA提到的宝贝({{item.goods_data.length}})</text>
|
||||
<!-- <text class="tips xs">300+人评价</text> -->
|
||||
<view class="goods flex">
|
||||
<block v-for="(goodsItem, goodsIndex) in item.goods_data" :key="goodsItem.id">
|
||||
<u-image v-if="goodsIndex <= 2" :src="goodsItem.image" width="58" height="58"
|
||||
class="m-l-6"></u-image>
|
||||
</block>
|
||||
<u-icon name="arrow-right" class="m-l-10"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提到的店铺( 店铺 ) -->
|
||||
<view class="goods-box bb flex row-between" @click="handleOpenShop(item.id)"
|
||||
v-if="item.shop_data.length">
|
||||
<text class="nr lighter">查看TA提到的店铺({{item.shop_data.length}})</text>
|
||||
<!-- <text class="tips xs">300+人评价</text> -->
|
||||
<view class="goods flex">
|
||||
<block v-for="(shopItem, shopIndex) in item.shop_data" :key="shopIndex">
|
||||
<u-image v-if="shopIndex <= 2" :src="shopItem.logo" width="58" height="58"
|
||||
class="m-l-6"></u-image>
|
||||
</block>
|
||||
<u-icon name="arrow-right" class="m-l-10"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 内容文字 -->
|
||||
<view class="content ">
|
||||
<view class="text" v-if="item.show">
|
||||
{{ item.beforeContent }}...
|
||||
<text class="primary nr m-l-20" @click="handleShowContent(index)">展开</text>
|
||||
</view>
|
||||
<view class="text" v-else>
|
||||
{{ item.content }}
|
||||
</view>
|
||||
<view class="tags" v-if="item.topic">
|
||||
<navigator hover-class="none"
|
||||
:url="'/bundle_b/pages/community_topic/community_topic?id=' + item.topic.id +'&name=' + item.topic.name">
|
||||
<text class="sm"># {{ item.topic.name }}</text>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部 -->
|
||||
<view class="footer flex row-between">
|
||||
<view>
|
||||
<button open-type="share" @click="handleShare(item)" class="flex-col col--center"
|
||||
hover-class="none">
|
||||
<image :src="aliOSSDomain + 'uniapp/icon_forward.png'"></image>
|
||||
</button>
|
||||
</view>
|
||||
<view class="flex nr lighter">
|
||||
<view class="flex likes-box">
|
||||
<view class="likes" :class="item.is_like==0 ? 'leave':'entry'"
|
||||
@click="handleCommunityLike(item.is_like, item)">
|
||||
</view>
|
||||
<image class="m-l-30"></image>
|
||||
<text>{{ item.like }}</text>
|
||||
</view>
|
||||
<view class="m-l-40" @click="handleOpenComment(item.id)">
|
||||
<image :src="aliOSSDomain + 'uniapp/icon_evaluate.png'"></image>
|
||||
<text>{{ item.comment }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</mescroll-uni>
|
||||
|
||||
<!-- 提到的商品 -->
|
||||
<community-goods v-model="showGoodsPopup" v-if="showGoodsPopup" :communityId="communityId"></community-goods>
|
||||
|
||||
<!-- 提到的店铺 -->
|
||||
<community-shop v-model="showShopPopup" :communityId="communityId"></community-shop>
|
||||
|
||||
<!-- 评论 -->
|
||||
<community-comment-popup v-model="showComment" v-if="showComment" :communityId="communityId">
|
||||
</community-comment-popup>
|
||||
|
||||
<!-- #ifdef H5 -->
|
||||
<u-popup :custom-style="{'background': 'none'}" class="share-tips" v-model="showTips" mode="top">
|
||||
<view style="overflow: hidden;">
|
||||
<image :src="aliOSSDomain + 'uniapp/share_arrow.png'" class="share-arrow" />
|
||||
<view class="white" style="text-align: center;margin-top: 280rpx;">
|
||||
<view class="bold lg">立即分享给好友吧</view>
|
||||
<view class="sm m-t-10">点击屏幕右上角将本页面分享给好友</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCommunityFollow,
|
||||
apiCommunityCommentLike
|
||||
} from '@/api/community.js';
|
||||
import {
|
||||
debounce
|
||||
} from "@/utils/tools.js"
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
||||
import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
|
||||
export default {
|
||||
mixins: [MescrollMixin, MescrollMoreItemMixin],
|
||||
props: {
|
||||
active: {
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
height: '',
|
||||
canReset: true,
|
||||
isLikes: false,
|
||||
communityId: '',
|
||||
upOption: {
|
||||
empty: {
|
||||
icon: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/follow_null.png',
|
||||
tip: '暂未关注任何种草官哦~', // 提示
|
||||
fixed: true,
|
||||
top: "200rpx",
|
||||
}
|
||||
},
|
||||
lists: [],
|
||||
show: false,
|
||||
showGoodsPopup: false,
|
||||
showShopPopup: false,
|
||||
showTips: false,
|
||||
showComment: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
active() {
|
||||
uni.$emit('hasNew', 0)
|
||||
this.mescroll.resetUpScroll()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.handleCommunityLike = debounce(this.handleCommunityLike, 100)
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
this.height = res.windowHeight - 46 + 'px';
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
initMescroll(event) {
|
||||
this.isInit = true;
|
||||
this.mescroll = event;
|
||||
},
|
||||
async upCallback(page) {
|
||||
const index = this.current;
|
||||
const pageNum = page.num
|
||||
const pageSize = page.size
|
||||
|
||||
getCommunityFollow({
|
||||
page_no: pageNum,
|
||||
page_size: pageSize,
|
||||
}).then(res => {
|
||||
// 如果是第一页需手动置空列表
|
||||
if (pageNum == 1) this.lists = []
|
||||
const hasNext = !!res.data.more;
|
||||
res.data.list = this.handleContent(res.data.list)
|
||||
this.lists = [...this.lists, ...res.data.list]
|
||||
this.mescroll.endSuccess(res.data.list.length, hasNext);
|
||||
}).catch((err) => {
|
||||
this.mescroll.endErr()
|
||||
})
|
||||
},
|
||||
// 处理打开商品推荐
|
||||
handleOpenGoods(id) {
|
||||
this.communityId = id;
|
||||
this.showGoodsPopup = true;
|
||||
},
|
||||
// 处理打开获取店铺推荐
|
||||
handleOpenShop(id) {
|
||||
this.communityId = id;
|
||||
this.showShopPopup = true;
|
||||
},
|
||||
// 处理内容超过固定长度或换行的就显示展开
|
||||
handleContent(list) {
|
||||
return list.filter(item => {
|
||||
if (item.content.indexOf('\n') > -1) {
|
||||
const arr = item.content.split('\n')
|
||||
if (arr.length >= 3) {
|
||||
item.show = true
|
||||
if (arr[0].length >= 25 || arr[1].length >= 25 || arr[2].length > 20) {
|
||||
item.beforeContent = item.content.slice(0, arr[0].length + arr[1].length + arr[2].length - 10)
|
||||
} else {
|
||||
item.beforeContent = item.content.slice(0, arr[0].length + arr[1].length + arr[
|
||||
2].length - 10)
|
||||
}
|
||||
} else {
|
||||
if (item.content.length >= 70) {
|
||||
item.show = true
|
||||
item.beforeContent = item.content.slice(0, 70)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (item.content.length >= 70) {
|
||||
item.show = true
|
||||
item.beforeContent = item.content.slice(0, 70)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
},
|
||||
handleShowContent(index) {
|
||||
this.$set(this.lists[index], 'show', false)
|
||||
},
|
||||
handleShare(item) {
|
||||
// #ifdef MP
|
||||
this.$emit('share', item)
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
this.showTips = true
|
||||
// #endif
|
||||
// #ifndef MP
|
||||
this.$store.commit('setCommunity', {
|
||||
...item,
|
||||
url: 'bundle_b/pages/community_detail/community_detail'
|
||||
})
|
||||
this.$store.dispatch('communityShare')
|
||||
// #endif
|
||||
},
|
||||
handleCommunityLike(status, item) {
|
||||
switch (status) {
|
||||
case 0:
|
||||
this.$set(item, 'like', item.like + 1)
|
||||
this.$set(item, 'is_like', 1)
|
||||
break;
|
||||
case 1:
|
||||
this.$set(item, 'like', item.like - 1)
|
||||
this.$set(item, 'is_like', 0)
|
||||
break;
|
||||
}
|
||||
apiCommunityCommentLike({
|
||||
id: item.id,
|
||||
status: status ? 0 : 1,
|
||||
type: 1
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
uni.$emit('changeItem', {
|
||||
like: item.like,
|
||||
is_like: item.is_like,
|
||||
id: item.id
|
||||
})
|
||||
} else {
|
||||
switch (status) {
|
||||
case 0:
|
||||
this.$set(item, 'like', item.like - 1)
|
||||
this.$set(item, 'is_like', 0)
|
||||
break;
|
||||
case 1:
|
||||
this.$set(item, 'like', item.like + 1)
|
||||
this.$set(item, 'is_like', 1)
|
||||
break;
|
||||
}
|
||||
this.$toast({
|
||||
title: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleOpenComment(id) {
|
||||
this.communityId = id;
|
||||
this.showComment = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content-box {
|
||||
padding-bottom: 20rpx;
|
||||
background-color: $-color-white;
|
||||
|
||||
.bb {
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-size: 28rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
}
|
||||
|
||||
.swiper-container {
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.goods-box {
|
||||
padding: 15rpx 24rpx;
|
||||
|
||||
.tips {
|
||||
padding: 0 10rpx;
|
||||
color: $-color-primary;
|
||||
border-radius: 20rpx;
|
||||
border: 1px solid $-color-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 24rpx;
|
||||
padding-bottom: 0;
|
||||
|
||||
.text {
|
||||
white-space: pre-line;
|
||||
line-height: 48rpx;
|
||||
font-size: 28rpx;
|
||||
color: $-color-normal;
|
||||
}
|
||||
|
||||
.tags {
|
||||
padding-top: 24rpx;
|
||||
|
||||
text {
|
||||
margin-right: 20rpx;
|
||||
border-radius: 26rpx;
|
||||
padding: 8rpx 24rpx;
|
||||
color: $-color-primary;
|
||||
background: rgba($-color-primary, .1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 0 24rpx;
|
||||
|
||||
image {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
vertical-align: middle;
|
||||
margin: 24rpx 6rpx;
|
||||
}
|
||||
|
||||
// 点赞动画
|
||||
.likes-box {
|
||||
position: relative;
|
||||
|
||||
.likes {
|
||||
z-index: 99;
|
||||
left: -36rpx;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin-right: 6rpx;
|
||||
position: absolute;
|
||||
background: url('https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/likes.png') no-repeat;
|
||||
background-position: left;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
// 没点赞
|
||||
.leave {
|
||||
background-position: left;
|
||||
}
|
||||
|
||||
// 点赞
|
||||
.entry {
|
||||
background-position: right;
|
||||
transition: background .6s steps(28);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.share-tips .share-arrow {
|
||||
width: 140rpx;
|
||||
height: 250rpx;
|
||||
float: right;
|
||||
margin: 15rpx 31rpx 0 0;
|
||||
}
|
||||
</style>
|
||||
@ -1,96 +0,0 @@
|
||||
<template>
|
||||
<view class="header flex row-between">
|
||||
<router-link class="photo" to="/bundle_b/pages/published_works/published_works">
|
||||
<u-image :src="aliOSSDomain + 'uniapp/icon_photo.png'" width="60" height="60" borderRadius="50%"></u-image>
|
||||
</router-link>
|
||||
<view class="mainnav flex">
|
||||
<view class="mainnav--item" :class="{'active': current === 0}" @click="changeNav(0)">
|
||||
<text>关注</text>
|
||||
<text v-if="hasNew" class="new"></text>
|
||||
</view>
|
||||
<view class="mainnav--item" :class="{'active': current === 1}" @click="changeNav(1)">
|
||||
<text>发现</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="user flex row-right">
|
||||
<router-link to="/bundle_b/pages/community_search/community_search">
|
||||
<u-icon v-if="current==0" name="search" size="34" class="m-r-20"></u-icon>
|
||||
</router-link>
|
||||
<router-link to="/bundle_b/pages/community_user/community_user">
|
||||
<u-image :src="userInfo.avatar ? userInfo.avatar : aliOSSDomain + 'uniapp/portrait_empty.png'" width="60" height="60" borderRadius="50%"></u-image>
|
||||
</router-link>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex"
|
||||
export default {
|
||||
name: 'like-header',
|
||||
props: {
|
||||
current: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
hasNew: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
uni.$on('hasNew', item => {
|
||||
this.hasNew = item
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
changeNav(index) {
|
||||
if(!this.isLogin) return this.$Router.push('/pages/login/login')
|
||||
this.$emit('change', index);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header {
|
||||
padding: 16rpx 24rpx;
|
||||
background-color: $-color-white;
|
||||
.photo {
|
||||
width: 120rpx;
|
||||
}
|
||||
|
||||
.mainnav {
|
||||
&--item {
|
||||
width: 120rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
color: #BBBBBB;
|
||||
transition: all .2s linear;
|
||||
|
||||
.new {
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
margin-bottom: 24rpx;
|
||||
background-color: $-color-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.active {
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
.user {
|
||||
width: 120rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,93 +0,0 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<mescroll-uni ref="mescrollRef" top="0" bottom="200rpx" :height="height" @init="mescrollInit"
|
||||
@down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
|
||||
<u-waterfall ref="uWaterfall" v-model="lists" :add-time="50">
|
||||
<template v-slot:left="{leftList}">
|
||||
<view style="padding:0 9rpx 0 30rpx">
|
||||
<community-list width="336rpx" type="waterfall" :list="leftList"></community-list>
|
||||
</view>
|
||||
</template>
|
||||
<template v-slot:right="{rightList}">
|
||||
<view style="padding:0 30rpx 0 9rpx;">
|
||||
<community-list width="336rpx" type="waterfall" :list="rightList"></community-list>
|
||||
</view>
|
||||
</template>
|
||||
</u-waterfall>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCommunityArticleLists
|
||||
} from '@/api/community.js';
|
||||
import {
|
||||
trottle
|
||||
} from "@/utils/tools.js"
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
||||
import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
|
||||
export default {
|
||||
mixins: [MescrollMixin, MescrollMoreItemMixin],
|
||||
props: {
|
||||
cateId: {
|
||||
type: [String, Number]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
height: '',
|
||||
upOption: {
|
||||
empty: {
|
||||
icon: 'https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/news_null.png',
|
||||
tip: '暂无任何内容...',
|
||||
fixed: true,
|
||||
top: "0",
|
||||
}
|
||||
},
|
||||
lists: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
uni.$on('changeItem', (event) => {
|
||||
const index = this.lists.findIndex(el => el.id == event.id)
|
||||
if (index == -1) return
|
||||
this.$refs.uWaterfall.modify(event.id, 'like', event.like)
|
||||
this.$refs.uWaterfall.modify(event.id, 'is_like', event.is_like)
|
||||
})
|
||||
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
this.height = res.windowHeight - 46 + 'px';
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
async upCallback(page) {
|
||||
const pageNum = page.num
|
||||
const pageSize = page.size
|
||||
|
||||
getCommunityArticleLists({
|
||||
cate_id: this.cateId,
|
||||
page_no: pageNum,
|
||||
page_size: pageSize,
|
||||
}).then(res => {
|
||||
if (pageNum == 1) {
|
||||
this.$refs.uWaterfall.clear()
|
||||
this.lists = []
|
||||
}
|
||||
const hasNext = !!res.data.more;
|
||||
// 异步:让vue能够监听到数据改变过了
|
||||
|
||||
// has_new 是通知父组件将关注右上角的是否新更新小点显示或隐藏
|
||||
uni.$emit('hasNew', res.data.has_new)
|
||||
|
||||
setTimeout(() => {
|
||||
this.lists = [...this.lists, ...res.data.list]
|
||||
}, 0)
|
||||
this.mescroll.endSuccess(res.data.list.length, hasNext);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB |
Loading…
Reference in New Issue
Block a user