feat: 推荐帖子 调整
This commit is contained in:
@@ -1,2 +1,5 @@
|
|||||||
|
// 滚动到底部
|
||||||
export const SCROLL_TO_BOTTOM = 'SCROLL_TO_BOTTOM'
|
export const SCROLL_TO_BOTTOM = 'SCROLL_TO_BOTTOM'
|
||||||
|
|
||||||
|
// 推荐帖子
|
||||||
|
export const RECOMMEND_POSTS_TITLE = 'RECOMMEND_POSTS_TITLE'
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { defineEmits } from 'vue'
|
import { defineEmits } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { SCROLL_TO_BOTTOM } from '../../constant/constant'
|
import { SCROLL_TO_BOTTOM, RECOMMEND_POSTS_TITLE } from '@/constant/constant'
|
||||||
import { MessageRole, MessageType, CompName } from '../../model/ChatModel';
|
import { MessageRole, MessageType, CompName } from '../../model/ChatModel';
|
||||||
|
|
||||||
import ChatTopWelcome from './ChatTopWelcome.vue';
|
import ChatTopWelcome from './ChatTopWelcome.vue';
|
||||||
@@ -231,6 +231,13 @@
|
|||||||
scrollToBottom()
|
scrollToBottom()
|
||||||
}, 200)
|
}, 200)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
uni.$on(RECOMMEND_POSTS_TITLE, (value) => {
|
||||||
|
console.log('RECOMMEND_POSTS_TITLE:', value)
|
||||||
|
if(value && value.length > 0) {
|
||||||
|
handleReply(value)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 获取最近一次的会话id
|
/// 获取最近一次的会话id
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view v-for="item in themeDTOList" :key="item.title">
|
<view v-for="item in themeDTOList" :key="item.title">
|
||||||
<DiscoveryCradContentList :recommendTheme="item" />
|
<RecommendPostsList :recommendTheme="item" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
import { ref, nextTick } from 'vue'
|
import { ref, nextTick } from 'vue'
|
||||||
import { onMounted } from 'vue'
|
import { onMounted } from 'vue'
|
||||||
import { discoveryCradComponent } from '@/request/api/MainPageDataApi'
|
import { discoveryCradComponent } from '@/request/api/MainPageDataApi'
|
||||||
|
import RecommendPostsList from '../recommend/RecommendPostsList.vue'
|
||||||
import { SCROLL_TO_BOTTOM } from '@/constant/constant'
|
import { SCROLL_TO_BOTTOM } from '@/constant/constant'
|
||||||
import DiscoveryCradContentList from './DiscoveryCradContentList.vue'
|
|
||||||
|
|
||||||
const themeDTOList = ref([])
|
const themeDTOList = ref([])
|
||||||
|
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="container">
|
|
||||||
<ModuleTitle :title="recommendTheme.themeName" />
|
|
||||||
<view class="container-scroll">
|
|
||||||
<view class="mk-card-item" v-for="(item, index) in recommendTheme.recommendPostsList" :key="index">
|
|
||||||
<image :src="item.coverPhoto" mode="widthFix"></image>
|
|
||||||
<text>{{ item.topic }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import ModuleTitle from '@/components/ModuleTitle/index.vue'
|
|
||||||
|
|
||||||
import { defineProps } from 'vue'
|
|
||||||
const props = defineProps({
|
|
||||||
recommendTheme: {
|
|
||||||
type: Object,
|
|
||||||
default: {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.container {
|
|
||||||
|
|
||||||
.container-scroll {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
overflow-x: auto;
|
|
||||||
margin-top: 4px;
|
|
||||||
|
|
||||||
/* 隐藏滚动条 */
|
|
||||||
scrollbar-width: none;
|
|
||||||
&::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mk-card-item {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: start;
|
|
||||||
width: 188px;
|
|
||||||
height: 154px;
|
|
||||||
background-color: #ffffff;
|
|
||||||
border-radius: 10px;
|
|
||||||
margin-right: 8px;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 188px;
|
|
||||||
height: 112px;
|
|
||||||
}
|
|
||||||
text {
|
|
||||||
padding: 12px;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<ModuleTitle :title="recommendTheme.themeName" />
|
<ModuleTitle :title="recommendTheme.themeName" />
|
||||||
<view class="container-scroll">
|
<view class="container-scroll">
|
||||||
<view class="mk-card-item" v-for="(item, index) in recommendTheme.recommendPostsList" :key="index">
|
<view class="mk-card-item" v-for="(item, index) in recommendTheme.recommendPostsList" :key="index" @click="sendReply(item)">
|
||||||
<image :src="item.coverPhoto" mode="widthFix"></image>
|
<image :src="item.coverPhoto" mode="widthFix"></image>
|
||||||
<text>{{ item.topic }}</text>
|
<text>{{ item.topic }} dd</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import ModuleTitle from '@/components/ModuleTitle/index.vue'
|
import ModuleTitle from '@/components/ModuleTitle/index.vue'
|
||||||
|
import { RECOMMEND_POSTS_TITLE } from '@/constant/constant.js'
|
||||||
|
|
||||||
import { defineProps } from 'vue'
|
import { defineProps } from 'vue'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
recommendTheme: {
|
recommendTheme: {
|
||||||
@@ -20,6 +22,13 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const sendReply = (item) => {
|
||||||
|
// 向父组件传递数据
|
||||||
|
const topic = item.topic.replace(/^#/, '');
|
||||||
|
console.log("======>", topic)
|
||||||
|
uni.$emit(RECOMMEND_POSTS_TITLE, topic);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user