Refactor(云灵AI):列表数据对接
This commit is contained in:
+161
-22
@@ -45,14 +45,14 @@
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.type === -2" class="chat-message-body">
|
||||
<view class="avatar">
|
||||
<view v-if="item.nodes && item.nodes.length" class="avatar">
|
||||
<image
|
||||
:src="webUrl + '/aiChat/avatar.png'"
|
||||
class="chat-avatar"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<view class="item-left">
|
||||
<view v-if="item.nodes && item.nodes.length" class="item-left">
|
||||
<view class="txt">
|
||||
<view
|
||||
ref="rich-text-box"
|
||||
@@ -126,12 +126,71 @@
|
||||
</view>
|
||||
<!-- 换一换 -->
|
||||
<view
|
||||
v-if="!item.showCursor && item.nodes && item.nodes.length && !item.isError && item.showMoreInfo.show"
|
||||
v-if="!item.showCursor &&
|
||||
!item.isError &&
|
||||
(item.orderList.length > 0 ||
|
||||
item.giftGoodsList.length > 0 ||
|
||||
item.goodsList.length > 0 ||
|
||||
item.shopList.length > 0 ||
|
||||
item.prizeList.length > 0 ||
|
||||
item.ichList.length > 0 ||
|
||||
item.qianxianList.length > 0
|
||||
)
|
||||
"
|
||||
class="change-list-wrap"
|
||||
>
|
||||
<view v-if="item.showMoreInfo.showType === '特产商品'" class="list-wrap">
|
||||
<!-- 礼品 -->
|
||||
<view
|
||||
v-if="item.giftGoodsList.length > 0"
|
||||
class="recommend-goods-wrap"
|
||||
>
|
||||
<swiper
|
||||
class="goods-swiper"
|
||||
:indicator-dots="false"
|
||||
:autoplay="false"
|
||||
:current="item.currentSwiperIndex"
|
||||
previous-margin="120rpx"
|
||||
next-margin="120rpx"
|
||||
circular
|
||||
@change="e => onSwiperChange(index, e)"
|
||||
>
|
||||
<swiper-item
|
||||
v-for="(goodItem, goodIndex) in item.giftGoodsList"
|
||||
:key="goodIndex"
|
||||
>
|
||||
<view
|
||||
:class="{ 'active': item.currentSwiperIndex === goodIndex }"
|
||||
class="goods-item"
|
||||
@click="productItemClickHandle(goodItem)"
|
||||
>
|
||||
<view class="supplier" @click.stop="productItemSupplierClickHandle(goodItem)">
|
||||
<image
|
||||
:src="webUrl + '/aiChat/icon-57.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
lazy-load
|
||||
/>
|
||||
<text class="s-name">{{ goodItem.storeName }}</text>
|
||||
<u-icon name="arrow-right" color="#999" size="12"></u-icon>
|
||||
</view>
|
||||
<view class="title one-t">{{ goodItem.name }}</view>
|
||||
<image :src="goodItem.img" class="p-img" mode="aspectFill" lazy-load />
|
||||
<view class="price">
|
||||
<text class="unit">¥</text>
|
||||
<text class="num">{{ goodItem.price }}</text>
|
||||
</view>
|
||||
<view class="actions">
|
||||
<view class="btn-buy" @click.stop="productItemBuyNowClickHandle(goodItem)">立即下单</view>
|
||||
<view class="btn-gift" @click.stop="productItemGiftBuyClickHandle(goodItem)">送给朋友</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- 特产商品 -->
|
||||
<view v-if="item.goodsList.length > 0" class="list-wrap">
|
||||
<view
|
||||
v-for="(productItem, productIndex) in item.showMoreInfo.resultItems"
|
||||
v-for="(productItem, productIndex) in item.goodsList"
|
||||
:key="productIndex"
|
||||
class="product-item"
|
||||
@click="productItemClickHandle(productItem)"
|
||||
@@ -139,6 +198,7 @@
|
||||
<image
|
||||
:src="productItem.img"
|
||||
class="img"
|
||||
lazy-load
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name one-t">
|
||||
@@ -153,9 +213,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '店铺'" class="list-wrap">
|
||||
<!-- 店铺 -->
|
||||
<view v-if="item.shopList.length > 0" class="list-wrap">
|
||||
<view
|
||||
v-for="(hotel, hotelIndex) in item.showMoreInfo.resultItems"
|
||||
v-for="(hotel, hotelIndex) in item.shopList"
|
||||
:key="hotelIndex"
|
||||
class="product-item"
|
||||
@click="hotelItemClickHandle(hotel)"
|
||||
@@ -166,6 +227,7 @@
|
||||
<image
|
||||
:src="hotel.img"
|
||||
class="img"
|
||||
lazy-load
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name one-t">
|
||||
@@ -177,9 +239,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '非遗文化'" class="list-wrap">
|
||||
<!-- 非遗 -->
|
||||
<view v-if="item.ichList.length > 0" class="list-wrap">
|
||||
<view
|
||||
v-for="(ich, ichIndex) in item.showMoreInfo.resultItems"
|
||||
v-for="(ich, ichIndex) in item.ichList"
|
||||
:key="ichIndex"
|
||||
class="product-item"
|
||||
@click="ichItemClickHandle(ich)"
|
||||
@@ -198,9 +261,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '千县名品'" class="list-wrap">
|
||||
<!-- 千县 -->
|
||||
<view v-if="item.qianxianList.length > 0" class="list-wrap">
|
||||
<view
|
||||
v-for="(qianxian, qianxianIndex) in item.showMoreInfo.resultItems"
|
||||
v-for="(qianxian, qianxianIndex) in item.qianxianList"
|
||||
:key="qianxianIndex"
|
||||
class="product-item"
|
||||
@click="qianxianItemClickHandle(qianxian)"
|
||||
@@ -208,6 +272,7 @@
|
||||
<image
|
||||
:src="qianxian.img"
|
||||
class="img"
|
||||
lazy-load
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="name name2 one-t">
|
||||
@@ -216,9 +281,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType === '优惠活动'" class="list-wrap prize-list-wrap">
|
||||
<!-- 抽奖 -->
|
||||
<view v-if="item.prizeList.length > 0" class="list-wrap prize-list-wrap">
|
||||
<view
|
||||
v-for="(prize, prizeIndex) in item.showMoreInfo.resultItems"
|
||||
v-for="(prize, prizeIndex) in item.prizeList"
|
||||
:key="prizeIndex"
|
||||
class="prize-item"
|
||||
@click="prizeItemClickHandle(prize)"
|
||||
@@ -227,18 +293,42 @@
|
||||
:src="prize.img"
|
||||
class="img"
|
||||
mode="widthFix"
|
||||
lazy-load
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.showMoreInfo.showType !== '优惠活动'" class="change-btn">
|
||||
<!-- 订单 -->
|
||||
<view v-if="item.orderList.length > 0" class="order-list-wrap">
|
||||
<view
|
||||
v-for="(order, orderIndex) in item.orderList"
|
||||
:key="orderIndex"
|
||||
class="order-item-wrap"
|
||||
>
|
||||
<order-item
|
||||
:item="order"
|
||||
@viewOrderTrack="viewOrderTrackHandle"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="(item.shopList.length > 0 ||
|
||||
item.goodsList.length > 0 ||
|
||||
item.giftGoodsList.length > 0 ||
|
||||
item.ichList.length > 0 ||
|
||||
item.qianxianList.length > 0 ||
|
||||
item.shopList.length > 0) && item.showChangeBtn
|
||||
"
|
||||
class="change-btn"
|
||||
>
|
||||
<image
|
||||
:src="webUrl + '/aiChat/icon-change.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
@click="analyzeKeywordsChangeHandle(item.conversationId, item.showMoreInfo)"
|
||||
@click="analyzeKeywordsChangeHandle(item.conversationId, item)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 建议提问 -->
|
||||
<view
|
||||
v-if="index === (chatMessageListLength - 1) && item.listQuestion.length > 0"
|
||||
class="suggestion-wrap"
|
||||
@@ -328,9 +418,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { chatMixins } from '../mixins/chatMixins.js'
|
||||
import { chatMixinsV2 } from '../mixins/chatMixinsV2.js'
|
||||
import AiHistoryList from '../components/historyList'
|
||||
import BottomSend from '../components/bottomSend.vue'
|
||||
import OrderItem from '../components/orderItem.vue'
|
||||
import {
|
||||
historyChatMessage
|
||||
} from '@/api/chat/index'
|
||||
@@ -339,9 +430,10 @@ export default {
|
||||
name: 'AiChatHistoryPage',
|
||||
components: {
|
||||
AiHistoryList,
|
||||
BottomSend
|
||||
BottomSend,
|
||||
OrderItem
|
||||
},
|
||||
mixins: [chatMixins],
|
||||
mixins: [chatMixinsV2],
|
||||
data() {
|
||||
return {
|
||||
pageTitle: ''
|
||||
@@ -370,20 +462,67 @@ export default {
|
||||
prompt: item.content
|
||||
})
|
||||
} else {
|
||||
if (item.contentType === 'text') {
|
||||
this.chatMessageList.push({
|
||||
if (['text', 'skill_list'].includes(item.contentType)) {
|
||||
const tempItemData = {
|
||||
...item,
|
||||
nodes: formatAiMsgContent(item.content),
|
||||
prompt: this.getParentPrompt(data, item.parentMessageId),
|
||||
conversationId: item.messageId,
|
||||
showCursor: false,
|
||||
listQuestion: item.listQuestion || [],
|
||||
// 特产商品
|
||||
goodsList: [],
|
||||
// 礼品商品
|
||||
giftGoodsList: [],
|
||||
// 非遗文化
|
||||
ichList: [],
|
||||
// 千县名品
|
||||
qianxianList: [],
|
||||
// 抽奖
|
||||
prizeList: [],
|
||||
// 店铺
|
||||
shopList: [],
|
||||
// 地标好物--屏蔽原因:实现此功能时,后端通过AI动态返回的图片不满足需求,后面就不要了
|
||||
landmarksList: [],
|
||||
// 订单
|
||||
orderList: [],
|
||||
type: -2,
|
||||
showMoreInfo: {}
|
||||
})
|
||||
showMoreInfo: {},
|
||||
currentSwiperIndex: 0,
|
||||
showChangeBtn: false
|
||||
}
|
||||
if (item.cardData) {
|
||||
const { contentType, finish, items = [] } = item.cardData
|
||||
if (contentType === 'order') {
|
||||
tempItemData.orderList = items || []
|
||||
}
|
||||
if (contentType === 'shop') {
|
||||
tempItemData.shopList = items || []
|
||||
}
|
||||
if (contentType === 'gift') {
|
||||
tempItemData.giftGoodsList = items || []
|
||||
}
|
||||
if (contentType === 'discount') {
|
||||
tempItemData.prizeList = items || []
|
||||
}
|
||||
if (contentType === 'goods') {
|
||||
tempItemData.goodsList = items || []
|
||||
}
|
||||
if (contentType === 'famous') {
|
||||
tempItemData.qianxianList = items || []
|
||||
}
|
||||
if (contentType === 'ich') {
|
||||
tempItemData.ichList = items || []
|
||||
}
|
||||
if (contentType === 'landmarks') {
|
||||
tempItemData.landmarksList = items || []
|
||||
}
|
||||
}
|
||||
this.chatMessageList.push(tempItemData)
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(this.chatMessageList)
|
||||
} catch (err) {
|
||||
uni.showModal({
|
||||
title: '错误提示',
|
||||
|
||||
Reference in New Issue
Block a user