feat: 主页的接口对接
This commit is contained in:
@@ -18,8 +18,11 @@
|
||||
:scroll-with-animation="true"
|
||||
class="area-msg-list"
|
||||
>
|
||||
<!-- logo栏 -->
|
||||
<ChatTopBanner class="chat-container-top-bannar"></ChatTopBanner>
|
||||
<!-- welcome栏 -->
|
||||
<ChatTopWelcome class="chat-container-top-bannar"
|
||||
:initPageImages="mainPageDataModel.initPageImages"
|
||||
:welcomeContent="mainPageDataModel.welcomeContent">
|
||||
</ChatTopWelcome>
|
||||
|
||||
<view class="area-msg-list-content" v-for="item in chatMsgList" :key="item.msgId" :id="item.msgId">
|
||||
|
||||
@@ -35,8 +38,12 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<ChatCardOther class="message-item-other" :text="item.msg">
|
||||
<OneFeelMK001/>
|
||||
<OneFeelMK002/>
|
||||
<OneFeelMK001 :activityList="mainPageDataModel.activityList"/>
|
||||
|
||||
<template v-for="(item) in mainPageDataModel.recommendTheme">
|
||||
<OneFeelMK002 :recommendTheme="item"/>
|
||||
</template>
|
||||
|
||||
</ChatCardOther>
|
||||
</template>
|
||||
</view>
|
||||
@@ -47,7 +54,7 @@
|
||||
|
||||
<!-- 输入框区域 -->
|
||||
<view class="footer-area">
|
||||
<ChatMoreTips @replySent="handleReply" :itemList="guideWords"></ChatMoreTips>
|
||||
<ChatMoreTips @replySent="handleReply" :itemList="mainPageDataModel.guideWords"></ChatMoreTips>
|
||||
<ChatQuickAccess @replySent="handleReply"></ChatQuickAccess>
|
||||
<ChatInputArea
|
||||
v-model:inputMessage="inputMessage"
|
||||
@@ -61,11 +68,11 @@
|
||||
</template>
|
||||
|
||||
<script setup >
|
||||
import { onMounted, getCurrentInstance, nextTick } from 'vue'
|
||||
import { onMounted, nextTick } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { defineEmits } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import ChatTopBanner from './ChatTopBanner.vue';
|
||||
import ChatTopWelcome from './ChatTopWelcome.vue';
|
||||
import ChatTopBgImg from './ChatTopBgImg.vue';
|
||||
import ChatTopNavBar from './ChatTopNavBar.vue';
|
||||
import ChatCardAI from './ChatCardAI.vue';
|
||||
@@ -76,11 +83,10 @@
|
||||
import ChatInputArea from './ChatInputArea.vue'
|
||||
import CommandWrapper from '@/components/CommandWrapper/index.vue'
|
||||
|
||||
import { MessageRole, ChatModel, MessageType } from '../../model/ChatModel';
|
||||
import { MessageRole, MessageType } from '../../model/ChatModel';
|
||||
|
||||
import OneFeelMK001 from '../module/OneFeelMK001.vue';
|
||||
import OneFeelMK002 from '../module/OneFeelMK002.vue';
|
||||
import request from '../../request/base/request';
|
||||
import { agentChatStream } from '../../request/api/AgentChatStream';
|
||||
import { mainPageData } from '../../request/api/MainPageData';
|
||||
|
||||
@@ -93,10 +99,13 @@
|
||||
|
||||
const chatMsgList = ref([])
|
||||
const inputMessage = ref('')
|
||||
|
||||
const activityList = ref([])
|
||||
|
||||
/// 从个渠道获取如二维,没有的时候就返回首页的数据
|
||||
const sceneId = ref('')
|
||||
const mainPageDataModel = ref({})
|
||||
const guideWords = ref([])
|
||||
|
||||
|
||||
// 锚点ID(控制滚动位置)
|
||||
const lastMsgId = ref('anchor-bottom');
|
||||
|
||||
@@ -122,29 +131,24 @@
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
// getMainPageData()
|
||||
initData()
|
||||
getMainPageData()
|
||||
})
|
||||
|
||||
const getMainPageData = async() => {
|
||||
mainPageDataModel.value = await mainPageData()
|
||||
guideWords.value = mainPageDataModel.value.guideWords
|
||||
|
||||
const res = await mainPageData(sceneId.value)
|
||||
if(res.code === 0) {
|
||||
mainPageDataModel.value = res.data
|
||||
initData()
|
||||
}
|
||||
}
|
||||
|
||||
const initData = () => {
|
||||
const msg = {
|
||||
msgId: `msg_${0}`,
|
||||
msgType: MessageRole.AI,
|
||||
msg: '查信息、预定下单、探索玩法、呼叫服务、我通通可以满足,快试试问我问题吧!',
|
||||
}
|
||||
chatMsgList.value.push(msg)
|
||||
const msg1 = {
|
||||
msgId: `msg_${1}`,
|
||||
msgType: MessageRole.OTHER,
|
||||
msg: '',
|
||||
}
|
||||
chatMsgList.value.push(msg1)
|
||||
chatMsgList.value.push(msg)
|
||||
}
|
||||
|
||||
const handleTouchEnd = () => {
|
||||
|
||||
Reference in New Issue
Block a user