Merge branch 'dev-AI-v5' into dev
This commit is contained in:
@@ -112,6 +112,10 @@ export default {
|
||||
keyboardHeight: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
voiceException: {
|
||||
type: String,
|
||||
default: '没有听清您说了什么,请再说一遍'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -262,11 +266,11 @@ export default {
|
||||
fail: err => {
|
||||
console.log(err)
|
||||
uni.hideLoading()
|
||||
_this.$toast('没有听清您说了什么,请再说一遍')
|
||||
_this.$toast(_this.voiceException)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_this.$toast('没有听清您说了什么,请再说一遍')
|
||||
_this.$toast(_this.voiceException)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -282,7 +286,7 @@ export default {
|
||||
_this.getTransResultReq()
|
||||
}).catch(() => {
|
||||
uni.hideLoading()
|
||||
_this.$toast('没有听清您说了什么,请再说一遍')
|
||||
_this.$toast(_this.voiceException)
|
||||
})
|
||||
},
|
||||
getTransResultReq() {
|
||||
@@ -296,7 +300,7 @@ export default {
|
||||
uni.hideLoading()
|
||||
_this.clearIntervalFn()
|
||||
if (data === '__NULL__') {
|
||||
_this.$toast('没有听清您说了什么,请再说一遍')
|
||||
_this.$toast(_this.voiceException)
|
||||
} else {
|
||||
if (data.length > 0) {
|
||||
const prompt = data[0].Text
|
||||
@@ -308,7 +312,7 @@ export default {
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.hideLoading()
|
||||
_this.$toast('没有听清您说了什么,请再说一遍')
|
||||
_this.$toast(_this.voiceException)
|
||||
})
|
||||
}, 1000)
|
||||
},
|
||||
|
||||
@@ -112,7 +112,9 @@
|
||||
<script>
|
||||
import {
|
||||
getChatList,
|
||||
deleteChatListByType
|
||||
deleteChatListByType,
|
||||
getCountyAiChatList,
|
||||
deleteCountyChatListByType
|
||||
} from '@/api/chat/index'
|
||||
export default {
|
||||
name: 'AiHistoryList',
|
||||
@@ -125,6 +127,10 @@ export default {
|
||||
formModule: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
countyId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -142,7 +148,17 @@ export default {
|
||||
this.getChatListReq()
|
||||
},
|
||||
getChatListReq() {
|
||||
getChatList().then(res => {
|
||||
let reqFn = null
|
||||
let params = {}
|
||||
if (this.countyId) {
|
||||
reqFn = getCountyAiChatList
|
||||
params = {
|
||||
countyId: this.countyId
|
||||
}
|
||||
} else {
|
||||
reqFn = getChatList
|
||||
}
|
||||
reqFn(params).then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.todayList = data['今天'] || []
|
||||
@@ -152,7 +168,15 @@ export default {
|
||||
})
|
||||
},
|
||||
deleteRecords(type) {
|
||||
deleteChatListByType(type).then(res => {
|
||||
let reqFn = null
|
||||
let params = ''
|
||||
if (this.countyId) {
|
||||
reqFn = deleteCountyChatListByType
|
||||
params = `?countyId=${this.countyId}&type=${type}`
|
||||
} else {
|
||||
reqFn = deleteChatListByType
|
||||
}
|
||||
reqFn(type, params).then(res => {
|
||||
const { success } = res
|
||||
if (success) {
|
||||
this.getChatListReq()
|
||||
@@ -160,7 +184,7 @@ export default {
|
||||
})
|
||||
},
|
||||
historyItemClick(item) {
|
||||
const paramsStr = `?chatNumber=${item.chatNumber}&title=${item.title}&click=1`
|
||||
const paramsStr = `?chatNumber=${item.chatNumber}&title=${item.title}&click=1&countyId=${this.countyId}`
|
||||
if (!this.formModule) {
|
||||
uni.navigateTo({
|
||||
url: '/aiChat/views/history' + paramsStr
|
||||
|
||||
@@ -100,10 +100,7 @@ export const chatMixins = {
|
||||
}.bind(this)).exec()
|
||||
},
|
||||
onUnload() {
|
||||
if (this.audioContext) {
|
||||
this.audioContext.stop()
|
||||
}
|
||||
wx.getBackgroundAudioManager().stop()
|
||||
this.audioStopHandle()
|
||||
this.closeWsFn()
|
||||
},
|
||||
created() {
|
||||
@@ -447,9 +444,15 @@ export const chatMixins = {
|
||||
this.audioAyy = []
|
||||
if (this.audioContext) {
|
||||
this.audioContext.stop()
|
||||
this.audioContext.destroy() // 强制销毁释放资源
|
||||
this.audioContext = null
|
||||
}
|
||||
this.isPlayAudio = false
|
||||
wx.getBackgroundAudioManager().stop()
|
||||
|
||||
// 强制关闭微信小程序背景音频
|
||||
if (typeof wx !== 'undefined' && wx.getBackgroundAudioManager) {
|
||||
wx.getBackgroundAudioManager().stop()
|
||||
}
|
||||
},
|
||||
ttsHandle(item) {
|
||||
this.audioAyy = []
|
||||
|
||||
+327
-89
@@ -3,9 +3,18 @@ import {
|
||||
getCompletionsV3,
|
||||
deleteChatItemByConversationId,
|
||||
// getAnalyzeKeywordsV1,
|
||||
getAnalyzeKeywordsChangeV3
|
||||
getAnalyzeKeywordsChangeV3,
|
||||
getSseCountyAiConfigV1,
|
||||
getCountyAiCompletionsV1,
|
||||
getGiftRecommendOptions,
|
||||
getGiftRecommendPrompt
|
||||
} from '@/api/chat/index'
|
||||
import {
|
||||
getExceptionConfig,
|
||||
getBottomNavigationConfigList
|
||||
} from '@/api/public'
|
||||
import {
|
||||
getProductDetail,
|
||||
postCartAdd
|
||||
} from '@/api/store'
|
||||
import { VUE_APP_API_URL } from '@/config'
|
||||
@@ -21,29 +30,7 @@ export const chatMixinsV2 = {
|
||||
token: cookie.get('login_status'),
|
||||
userInfo: cookie.get('userInfo'),
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
bottomTools: Object.freeze([
|
||||
{
|
||||
icon: 'icon-50',
|
||||
text: '我要送礼',
|
||||
type: 'prompt',
|
||||
prompt: '我要送礼,请给我推荐一些平台的礼品',
|
||||
url: ''
|
||||
},
|
||||
{
|
||||
icon: 'icon-51',
|
||||
text: '订单查询',
|
||||
type: 'prompt',
|
||||
prompt: '帮我查询我的待发货、待收货订单信息',
|
||||
url: ''
|
||||
},
|
||||
{
|
||||
icon: 'icon-52',
|
||||
text: '拍照识图',
|
||||
type: 'link',
|
||||
prompt: '',
|
||||
url: '/aiChat/views/imageRecognition'
|
||||
}
|
||||
]),
|
||||
bottomTools: [],
|
||||
scrollData: {},
|
||||
scrollTop: 0,
|
||||
isScrollToBottom: false,
|
||||
@@ -57,31 +44,19 @@ export const chatMixinsV2 = {
|
||||
loading: false,
|
||||
chatNumber: '',
|
||||
infoResData: {},
|
||||
chatMessageList: [
|
||||
/*
|
||||
{
|
||||
type: -2,
|
||||
isError: false,
|
||||
showCursor: false,
|
||||
conversationId: '',
|
||||
prompt: '',
|
||||
nodes: '-------------监听 WebSocket 接受到服务器的消息事件',
|
||||
content: '-------------监听 WebSocket 接受到服务器的消息事件',
|
||||
listQuestion: [
|
||||
'监听 WebSocket 接受到服务器的消息事件',
|
||||
'监听 WebSocket 接受到服务器的消息事件',
|
||||
'监听 WebSocket 接受到服务器的消息事件'
|
||||
]
|
||||
}
|
||||
*/
|
||||
],
|
||||
errorMsg: Object.freeze('您提的问题未能理解,云灵思想跑偏啦,重新整理一下问题或者重新提问,让云灵再试试!'),
|
||||
chatMessageList: [],
|
||||
audioAyy: [],
|
||||
isPlayAudio: false,
|
||||
audioContext: null,
|
||||
audioPlayId: '',
|
||||
showGiftBtn: false,
|
||||
buyLoading: false
|
||||
buyLoading: false,
|
||||
exceptionConfig: {
|
||||
model_exception: '您提的问题未能理解,云灵思想跑偏啦,重新整理一下问题或者重新提问,让云灵再试试!',
|
||||
voice_exception: ''
|
||||
},
|
||||
giftStepLoading: false,
|
||||
onlyOneToAddCart: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -106,12 +81,12 @@ export const chatMixinsV2 = {
|
||||
}.bind(this)).exec()
|
||||
},
|
||||
onUnload() {
|
||||
if (this.audioContext) {
|
||||
this.audioContext.stop()
|
||||
}
|
||||
wx.getBackgroundAudioManager().stop()
|
||||
this.audioStopHandle()
|
||||
this.closeWsFn()
|
||||
},
|
||||
onHide() {
|
||||
this.audioStopHandle()
|
||||
},
|
||||
created() {
|
||||
const _this = this
|
||||
uni.getSystemInfo({
|
||||
@@ -131,7 +106,37 @@ export const chatMixinsV2 = {
|
||||
},
|
||||
methods: {
|
||||
createdCallbak() {
|
||||
console.log('页面初始话回调')
|
||||
this.$nextTick(() => {
|
||||
this.scrollToBottomHandle()
|
||||
getExceptionConfig().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.exceptionConfig = data || {}
|
||||
}
|
||||
})
|
||||
// 县域AI没有底部快捷操作和送礼配置
|
||||
if (!this.countyId) {
|
||||
getBottomNavigationConfigList().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.bottomTools = data || []
|
||||
this.bottomTools.forEach(item => {
|
||||
item.display = true
|
||||
})
|
||||
}
|
||||
})
|
||||
getGiftRecommendOptions().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.giftBuyOptions = data || {}
|
||||
}
|
||||
})
|
||||
}
|
||||
this.extraReqFn()
|
||||
})
|
||||
},
|
||||
extraReqFn() {
|
||||
console.log('首页/历史详情页面单独请求接口逻辑')
|
||||
},
|
||||
inputFocusHandle(value) {
|
||||
this.onFocus = value === 1
|
||||
@@ -215,7 +220,16 @@ export const chatMixinsV2 = {
|
||||
handleLoginFailure()
|
||||
return
|
||||
}
|
||||
const prompt = params.prompt
|
||||
if (params.prompt.length > 500) {
|
||||
uni.showToast({
|
||||
title: "字数已超出限制",
|
||||
icon: "none",
|
||||
duration: 5000
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.loading) return
|
||||
const prompt = params.prompt.substr(0, 500)
|
||||
if (params.init !== 1) {
|
||||
_this.chatMessageList.push({
|
||||
prompt,
|
||||
@@ -257,21 +271,49 @@ export const chatMixinsV2 = {
|
||||
})
|
||||
_this.loading = true
|
||||
_this.showCursor = false
|
||||
getSseConfigV1({
|
||||
'chatNumber': _this.chatNumber,
|
||||
prompt
|
||||
}).then(resConfig => {
|
||||
let reqFn = null
|
||||
let postData = {}
|
||||
if (_this.countyId) {
|
||||
reqFn = getSseCountyAiConfigV1
|
||||
postData = {
|
||||
'countyId': _this.countyId,
|
||||
'chatNumber': _this.chatNumber,
|
||||
prompt
|
||||
}
|
||||
} else {
|
||||
reqFn = getSseConfigV1
|
||||
postData = {
|
||||
'chatNumber': _this.chatNumber,
|
||||
prompt
|
||||
}
|
||||
}
|
||||
reqFn(postData).then(resConfig => {
|
||||
const conversationId = resConfig.data.conversationId
|
||||
_this.chatNumber = resConfig.data.chatNumber || ''
|
||||
_this.chatMessageList[_this.chatMessageListLength - 1].showCursor = true
|
||||
_this.chatMessageList[_this.chatMessageListLength - 1].conversationId = conversationId
|
||||
if (conversationId) {
|
||||
_this.initWebSocket(conversationId, () => {
|
||||
getCompletionsV3({
|
||||
conversationId,
|
||||
ws: true,
|
||||
isNoNeedPublicErrorNotification: 1
|
||||
}).then(sseRes => {
|
||||
|
||||
let completionsReqFn = null
|
||||
let completionsPostData = {}
|
||||
if (_this.countyId) {
|
||||
completionsReqFn = getCountyAiCompletionsV1
|
||||
completionsPostData = {
|
||||
conversationId,
|
||||
countyId: _this.countyId,
|
||||
ws: true,
|
||||
isNoNeedPublicErrorNotification: 1
|
||||
}
|
||||
} else {
|
||||
completionsReqFn = getCompletionsV3
|
||||
completionsPostData = {
|
||||
conversationId,
|
||||
ws: true,
|
||||
isNoNeedPublicErrorNotification: 1
|
||||
}
|
||||
}
|
||||
completionsReqFn(completionsPostData).then(sseRes => {
|
||||
console.log(sseRes)
|
||||
// _this.closeWsFn()
|
||||
}).catch(err => {
|
||||
@@ -483,16 +525,59 @@ export const chatMixinsV2 = {
|
||||
})
|
||||
},
|
||||
productItemBuyNowClickHandle(item) {
|
||||
this.audioStopHandle()
|
||||
this.showGiftBtn = false
|
||||
this.cart_num = 1
|
||||
this.addToCart(item)
|
||||
this.productItemBuyNowOrGiftBuy(item, 1)
|
||||
},
|
||||
productItemGiftBuyClickHandle(item) {
|
||||
this.audioStopHandle()
|
||||
this.showGiftBtn = true
|
||||
this.productItemBuyNowOrGiftBuy(item, 2)
|
||||
},
|
||||
productItemBuyNowOrGiftBuy(item, BuyNowOrGiftBuyType) {
|
||||
this.audioStopHandle()
|
||||
this.cart_num = 1
|
||||
this.addToCart(item)
|
||||
this.m_id = item.id
|
||||
getProductDetail(item.id).then(res => {
|
||||
const { data } = res
|
||||
this.storeInfo = {...data.storeInfo}
|
||||
if(data.storeInfo.stock === 0) {
|
||||
uni.showToast({
|
||||
title: "产品库存不足,请选择其他商品",
|
||||
icon: "none",
|
||||
duration: 5000
|
||||
})
|
||||
return
|
||||
}
|
||||
this.isWenwan = data.isWenwan
|
||||
this.qualifications = data.qualifications || []
|
||||
// 给 attr 赋值,将请求回来的规格赋值给 attr
|
||||
if (this.source !== 'pre' && this.source !== 'day' && this.source !== 'kill' && this.source !== 'spe') {
|
||||
this.attr.productAttr = data.productAttr || []
|
||||
this.productValueArr = []
|
||||
for (const key in data.productValue) {
|
||||
this.productValueArr.push({
|
||||
attrItemkey: key,
|
||||
...data.productValue[key]
|
||||
})
|
||||
}
|
||||
// 初始化认为所有的规格都是可以选的
|
||||
this.attr.productAttr.map(item => {
|
||||
item.attrValue.map(subItem => {
|
||||
subItem.canUsed = true
|
||||
})
|
||||
})
|
||||
}
|
||||
this.attr.defaultSku = data.defaultSku
|
||||
this.attr.defaultSkuIndex = data.defaultSkuIndex
|
||||
this.DefaultSelect()
|
||||
// 是否单一规格
|
||||
const onlyOne = Object.keys(data.productValue).length === 1
|
||||
|
||||
if(onlyOne) {
|
||||
this.buyNowOrGiftBuyReq(BuyNowOrGiftBuyType)
|
||||
return
|
||||
}
|
||||
this.attr.cartAttr = !this.isOpen ? true : false
|
||||
})
|
||||
},
|
||||
buyNowOrGiftBuyReq(type) {
|
||||
const _this = this
|
||||
@@ -570,8 +655,8 @@ export const chatMixinsV2 = {
|
||||
},
|
||||
chatErrorSetContent() {
|
||||
this.chatMessageList[this.chatMessageListLength - 1].isError = true
|
||||
this.chatMessageList[this.chatMessageListLength - 1].content = this.errorMsg
|
||||
this.chatMessageList[this.chatMessageListLength - 1].nodes = this.errorMsg
|
||||
this.chatMessageList[this.chatMessageListLength - 1].content = this.exceptionConfig.model_exception
|
||||
this.chatMessageList[this.chatMessageListLength - 1].nodes = this.exceptionConfig.model_exception
|
||||
this.closeWsFn()
|
||||
},
|
||||
closeWsFn() {
|
||||
@@ -589,13 +674,26 @@ export const chatMixinsV2 = {
|
||||
})
|
||||
},
|
||||
audioStopHandle() {
|
||||
// 强制关闭微信小程序背景音频
|
||||
try {
|
||||
const bgAudio = wx.getBackgroundAudioManager ? wx.getBackgroundAudioManager() : null
|
||||
if (bgAudio && typeof bgAudio.stop === 'function') {
|
||||
bgAudio.stop()
|
||||
bgAudio.src = ''
|
||||
bgAudio.title = ''
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('stop background audio failed', e)
|
||||
}
|
||||
this.audioPlayId = ''
|
||||
// Fix bug#4049
|
||||
this.audioAyy = []
|
||||
if (this.audioContext) {
|
||||
this.audioContext.stop()
|
||||
this.audioContext.destroy() // 强制销毁释放资源
|
||||
this.audioContext = null
|
||||
}
|
||||
this.isPlayAudio = false
|
||||
wx.getBackgroundAudioManager().stop()
|
||||
},
|
||||
ttsHandle(item) {
|
||||
this.audioAyy = []
|
||||
@@ -604,13 +702,13 @@ export const chatMixinsV2 = {
|
||||
// this.audioContext.destroy()
|
||||
}
|
||||
// 如果正在播放,点击当前播放的则认为是暂停
|
||||
if (this.isPlayAudio && item.conversationId === this.audioPlayId) {
|
||||
if (this.isPlayAudio && [item.conversationId, item.messageId, item.parentMessageId].includes(this.audioPlayId)) {
|
||||
this.isPlayAudio = false
|
||||
this.audioPlayId = ''
|
||||
return
|
||||
}
|
||||
this.isPlayAudio = false
|
||||
this.audioPlayId = item.conversationId
|
||||
this.audioPlayId = item.conversationId || item.messageId || item.parentMessageId
|
||||
const flag = 1
|
||||
if (flag === 1) {
|
||||
console.log(removeMarkdown(item.content).replace(/[\n\t\s]/g, ''))
|
||||
@@ -674,34 +772,74 @@ export const chatMixinsV2 = {
|
||||
}
|
||||
},
|
||||
playNextChunk() {
|
||||
if (this.audioAyy.length > 0 && this.audioPlayId) {
|
||||
const src = this.audioAyy.shift()
|
||||
this.isPlayAudio = true
|
||||
const audioContext = uni.createInnerAudioContext({
|
||||
// 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项
|
||||
useWebAudioImplement: false
|
||||
})
|
||||
this.audioContext = audioContext
|
||||
audioContext.src = src
|
||||
audioContext.onEnded(() => {
|
||||
audioContext.destroy()
|
||||
this.playNextChunk()
|
||||
})
|
||||
audioContext.play()
|
||||
console.log('------------src:' + src)
|
||||
} else {
|
||||
console.log('------------end')
|
||||
if (!this.audioAyy.length || !this.audioPlayId) {
|
||||
this.isPlayAudio = false
|
||||
return
|
||||
}
|
||||
|
||||
// 销毁旧实例
|
||||
if (this.audioContext) {
|
||||
this.audioContext.stop()
|
||||
this.audioContext.destroy()
|
||||
this.audioContext = null
|
||||
}
|
||||
|
||||
const src = this.audioAyy.shift()
|
||||
this.isPlayAudio = true
|
||||
|
||||
const audioContext = uni.createInnerAudioContext({
|
||||
useWebAudioImplement: true // 短音频建议 true
|
||||
})
|
||||
|
||||
this.audioContext = audioContext
|
||||
audioContext.src = src
|
||||
|
||||
audioContext.onPlay(() => {
|
||||
console.log('audio play:', src)
|
||||
})
|
||||
|
||||
audioContext.onEnded(() => {
|
||||
this.audioContext = null
|
||||
audioContext.destroy()
|
||||
this.playNextChunk()
|
||||
})
|
||||
|
||||
audioContext.onError((err) => {
|
||||
console.error('audio error', err)
|
||||
this.audioContext = null
|
||||
audioContext.destroy()
|
||||
this.playNextChunk()
|
||||
})
|
||||
|
||||
audioContext.play()
|
||||
},
|
||||
bottomToolClickHandle(item) {
|
||||
if (item.type === 'prompt') {
|
||||
// 非界面跳转的需要校验登录状态
|
||||
if (!this.token && item.navType !== 'url') {
|
||||
handleLoginFailure()
|
||||
return
|
||||
}
|
||||
const idx = this.bottomTools.findIndex((i) => i.giftCardEnabled === 1)
|
||||
if (item.giftCardEnabled === 1) {
|
||||
// 新建会话
|
||||
this.createNewHandle('giftChat')
|
||||
this.$set(this, 'showGiftSteps', true)
|
||||
if (idx > -1) {
|
||||
this.$set(this.bottomTools[idx], 'display', false)
|
||||
}
|
||||
return
|
||||
}
|
||||
this.$set(this, 'showGiftSteps', false)
|
||||
if (idx > -1) {
|
||||
this.$set(this.bottomTools[idx], 'display', true)
|
||||
}
|
||||
if (item.navType === 'prompt') {
|
||||
this.streamReq({
|
||||
prompt: item.prompt,
|
||||
prompt: item.promptContent,
|
||||
init: 0
|
||||
})
|
||||
}
|
||||
if (item.type === 'link') {
|
||||
if (item.navType === 'url') {
|
||||
uni.navigateTo({
|
||||
url: item.url
|
||||
})
|
||||
@@ -711,6 +849,106 @@ export const chatMixinsV2 = {
|
||||
uni.navigateTo({
|
||||
url: '/pagesOrder/order/OrderDetails/index?id=' + order.orderId
|
||||
})
|
||||
},
|
||||
isGiftOptionSelected(configId, optionId) {
|
||||
if (!this.giftSelections[configId]) return false
|
||||
return this.giftSelections[configId].includes(optionId)
|
||||
},
|
||||
toggleGiftOption(configId, optionId) {
|
||||
if (!this.giftSelections[configId]) {
|
||||
this.$set(this.giftSelections, configId, [])
|
||||
}
|
||||
const index = this.giftSelections[configId].indexOf(optionId)
|
||||
if (index > -1) {
|
||||
this.giftSelections[configId].splice(index, 1)
|
||||
} else {
|
||||
this.giftSelections[configId].push(optionId)
|
||||
}
|
||||
},
|
||||
prevGiftStep() {
|
||||
if (this.currentGiftStepIndex > 0) {
|
||||
this.currentGiftStepIndex--
|
||||
}
|
||||
},
|
||||
nextGiftStep() {
|
||||
const currentStep = this.giftBuyOptions[this.currentGiftStepIndex]
|
||||
let hasSelection = false
|
||||
|
||||
// 校验是否已选择
|
||||
if (currentStep.type === 'option_card') {
|
||||
const selectedIds = this.giftSelections[currentStep.id] || []
|
||||
hasSelection = selectedIds.length > 0
|
||||
} else if (currentStep.type === 'price_input') {
|
||||
hasSelection = !!this.giftBudget
|
||||
}
|
||||
|
||||
if (!hasSelection) {
|
||||
uni.showToast({
|
||||
title: '请完善信息后再点击下一步',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (this.currentGiftStepIndex < this.giftBuyOptions.length - 1) {
|
||||
this.currentGiftStepIndex++
|
||||
} else {
|
||||
this.finishGiftSteps()
|
||||
}
|
||||
},
|
||||
skipGiftStep() {
|
||||
if (this.currentGiftStepIndex < this.giftBuyOptions.length - 1) {
|
||||
this.currentGiftStepIndex++
|
||||
} else {
|
||||
this.finishGiftSteps()
|
||||
}
|
||||
},
|
||||
finishGiftSteps() {
|
||||
if (this.giftStepLoading || this.loading) return
|
||||
const selectedSteps = []
|
||||
this.giftBuyOptions.forEach(step => {
|
||||
if (step.type === 'option_card') {
|
||||
const selectedIds = this.giftSelections[step.id] || []
|
||||
if (selectedIds.length > 0) {
|
||||
const selectedNames = step.options.filter(opt => selectedIds.includes(opt.id)).map(opt => opt.optionName)
|
||||
selectedSteps.push({
|
||||
sort: step.sort,
|
||||
title: step.title,
|
||||
type: step.type,
|
||||
options: selectedNames
|
||||
})
|
||||
}
|
||||
} else if (step.type === 'price_input') {
|
||||
if (this.giftBudget) {
|
||||
selectedSteps.push({
|
||||
sort: step.sort,
|
||||
title: step.title,
|
||||
type: step.type,
|
||||
options: [this.giftBudget]
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(selectedSteps)
|
||||
uni.showLoading()
|
||||
this.giftStepLoading = true
|
||||
getGiftRecommendPrompt(selectedSteps).then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.showGiftSteps = false
|
||||
this.streamReq({
|
||||
prompt: data.prompt || '我想送礼',
|
||||
init: 0
|
||||
})
|
||||
// 清空所有送礼选项
|
||||
this.giftSelections = {}
|
||||
this.giftBudget = ''
|
||||
this.currentGiftStepIndex = 0
|
||||
}
|
||||
}).finally(() => {
|
||||
uni.hideLoading()
|
||||
this.giftStepLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+53
-12
@@ -45,14 +45,14 @@
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.type === -2" class="chat-message-body">
|
||||
<view v-if="item.nodes && item.nodes.length" class="avatar">
|
||||
<view class="avatar">
|
||||
<image
|
||||
:src="webUrl + '/aiChat/avatar.png'"
|
||||
class="chat-avatar"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<view v-if="item.nodes && item.nodes.length" class="item-left">
|
||||
<view class="item-left">
|
||||
<view class="txt">
|
||||
<view
|
||||
ref="rich-text-box"
|
||||
@@ -67,7 +67,7 @@
|
||||
space="nbsp"
|
||||
/>
|
||||
<view v-if="!(item.nodes && item.nodes.length) && loading" class="loader-wrap">
|
||||
<div class="loader" />
|
||||
<div class="loading2" />
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
@@ -109,13 +109,13 @@
|
||||
</view>
|
||||
<view
|
||||
:class="{
|
||||
'playing': audioPlayId === item.conversationId && isPlayAudio
|
||||
'playing': [item.conversationId, item.messageId, item.parentMessageId].includes(audioPlayId) && isPlayAudio
|
||||
}"
|
||||
class="item"
|
||||
@click="ttsHandle(item)"
|
||||
>
|
||||
<image
|
||||
:src="webUrl + '/aiChat/' + ((audioPlayId === item.conversationId && isPlayAudio) ? 'audio-on' : 'audio-off') +'.png'"
|
||||
:src="webUrl + '/aiChat/' + (([item.conversationId, item.messageId, item.parentMessageId].includes(audioPlayId) && isPlayAudio) ? 'audio-on' : 'audio-off') +'.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
@@ -379,7 +379,12 @@
|
||||
@click="scrollToBottomHandle"
|
||||
/>
|
||||
</view>
|
||||
<view class="container">
|
||||
<view
|
||||
:class="{
|
||||
'container-county': !!countyId
|
||||
}"
|
||||
class="container"
|
||||
>
|
||||
<view
|
||||
v-if="chatNumber"
|
||||
class="new-chat"
|
||||
@@ -393,17 +398,21 @@
|
||||
开启新对话
|
||||
</view>
|
||||
<view
|
||||
v-if="!countyId"
|
||||
v-for="(item, index) in bottomTools"
|
||||
:key="index"
|
||||
:class="{
|
||||
'hide': !item.display
|
||||
}"
|
||||
class="bottom-tool-item"
|
||||
@click="bottomToolClickHandle(item)"
|
||||
>
|
||||
<image
|
||||
:src="webUrl + '/aiChat/' + item.icon + '.png'"
|
||||
:src="item.icon"
|
||||
class="tool-icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
{{ item.text }}
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -411,6 +420,7 @@
|
||||
ref="bottomSend"
|
||||
:loading="loading"
|
||||
:keyboard-height="keyboardHeight"
|
||||
:voice-exception="exceptionConfig.voice_exception"
|
||||
@send="streamReq"
|
||||
@history="historyViewHandle"
|
||||
@focus="inputFocusHandle"
|
||||
@@ -418,6 +428,7 @@
|
||||
<AiHistoryList
|
||||
ref="historyView"
|
||||
:status-bar-height="statusBarHeight"
|
||||
:county-id="countyId"
|
||||
form-module="history"
|
||||
@enter-history="audioStopHandle"
|
||||
/>
|
||||
@@ -445,7 +456,8 @@ import BottomSend from '../components/bottomSend.vue'
|
||||
import OrderItem from '../components/orderItem.vue'
|
||||
import ProductWindow from '@/components/ProductWindow'
|
||||
import {
|
||||
historyChatMessage
|
||||
historyChatMessage,
|
||||
getCountyAiHistoryChatMessage
|
||||
} from '@/api/chat/index'
|
||||
import { formatAiMsgContent } from '../utils/aiChat'
|
||||
export default {
|
||||
@@ -459,19 +471,27 @@ export default {
|
||||
mixins: [chatMixinsV2, goCartMixin],
|
||||
data() {
|
||||
return {
|
||||
pageTitle: ''
|
||||
pageTitle: '',
|
||||
countyId: ''
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.chatNumber = options.chatNumber
|
||||
this.pageTitle = options.title
|
||||
this.pageTitle = options.title || ''
|
||||
this.countyId = options.countyId || ''
|
||||
this.pageTitle = this.pageTitle.length > 8 ? (this.pageTitle.substring(0, 8) + '...') : this.pageTitle
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.loading = true
|
||||
historyChatMessage({
|
||||
let reqFn = null
|
||||
if (this.countyId) {
|
||||
reqFn = getCountyAiHistoryChatMessage
|
||||
} else {
|
||||
reqFn = historyChatMessage
|
||||
}
|
||||
reqFn({
|
||||
chatNumber: this.chatNumber
|
||||
}).then(res => {
|
||||
const { success, data = [] } = res
|
||||
@@ -547,6 +567,9 @@ export default {
|
||||
}
|
||||
})
|
||||
console.log(this.chatMessageList)
|
||||
this.$nextTick(() => {
|
||||
this.scrollToBottomHandle()
|
||||
})
|
||||
} catch (err) {
|
||||
uni.showModal({
|
||||
title: '错误提示',
|
||||
@@ -572,6 +595,24 @@ export default {
|
||||
createNewHandle() {
|
||||
uni.setStorageSync('addNewChat', '1')
|
||||
uni.navigateBack()
|
||||
},
|
||||
bottomToolClickHandle(item) {
|
||||
if (item.giftCardEnabled === 1) {
|
||||
uni.setStorageSync('addNewChat', '2')
|
||||
uni.navigateBack()
|
||||
return
|
||||
}
|
||||
if (item.navType === 'prompt') {
|
||||
this.streamReq({
|
||||
prompt: item.promptContent,
|
||||
init: 0
|
||||
})
|
||||
}
|
||||
if (item.navType === 'url') {
|
||||
uni.navigateTo({
|
||||
url: item.url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="sheet-divider" />
|
||||
<view class="goods-grid">
|
||||
<view v-if="!loaded" class="loading-state">
|
||||
<u-loading-icon mode="circle" size="36" text="正在识别中..." vertical textSize="14"></u-loading-icon>
|
||||
</view>
|
||||
<view v-else class="goods-grid">
|
||||
<view
|
||||
v-for="(item, index) in goodsList"
|
||||
:key="index"
|
||||
@@ -66,6 +69,9 @@
|
||||
lazy-load
|
||||
/>
|
||||
</view>
|
||||
<view v-if="item.similarityScore > 0" class="goods-desc">
|
||||
相似度{{ item.similarityScore }}%
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -84,6 +90,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loaded: false,
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
statusBarHeight: 20,
|
||||
imageUrl: '',
|
||||
@@ -245,6 +252,13 @@ export default {
|
||||
margin: 0 32rpx;
|
||||
}
|
||||
|
||||
.loading-state {
|
||||
padding: 120rpx 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
}
|
||||
@@ -301,6 +315,12 @@ export default {
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.goods-desc {
|
||||
padding: 10rpx 14rpx 20rpx 14rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.price-left {
|
||||
display: flex;
|
||||
|
||||
+226
-34
@@ -16,7 +16,7 @@
|
||||
transparent="auto"
|
||||
barPlaceholder="hidden"
|
||||
title="云灵"
|
||||
@click-left="clickBackHandle"
|
||||
@click-left="pageContainerBeforeleave"
|
||||
/>
|
||||
<page-container
|
||||
:show="true"
|
||||
@@ -40,17 +40,25 @@
|
||||
conversationId: '123'
|
||||
})">播放</button> -->
|
||||
<block v-if="chatMessageListLength < 1">
|
||||
<view class="home-wrap">
|
||||
<view
|
||||
:class="{
|
||||
'county-home-wrap': !!countyId
|
||||
}"
|
||||
class="home-wrap"
|
||||
>
|
||||
<view class="home-focus-wrap">
|
||||
<view class="focus-guide-wrap">
|
||||
<view class="guide-left">
|
||||
<image
|
||||
:src="webUrl + '/aiChat/logo-01.gif'"
|
||||
class="avatar"
|
||||
:src="webUrl + '/aiChat/logo-transition.png'"
|
||||
:class="{
|
||||
'county-avatar': !!countyId
|
||||
}"
|
||||
class="avatar avatar-bounce"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<view class="guide-right">
|
||||
<view v-if="!showGiftSteps" class="guide-right">
|
||||
<view class="title">{{ settingInfo.helloMessageTitle }}</view>
|
||||
<view class="content">{{ settingInfo.helloMessageContent }}</view>
|
||||
</view>
|
||||
@@ -99,7 +107,8 @@
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view> -->
|
||||
<view class="topic-wrap">
|
||||
<!-- 大家都在问 -->
|
||||
<view v-if="!showGiftSteps && !countyId" class="topic-wrap">
|
||||
<view class="title">
|
||||
<view class="title-left">大家都在问</view>
|
||||
<view class="title-right" @click="loadData('click')">
|
||||
@@ -133,6 +142,61 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 县域 -->
|
||||
<view v-if="!showGiftSteps && countyId" class="county-tools-wrap">
|
||||
<view class="list-cont">
|
||||
<view
|
||||
v-for="(item, index) in countyTools"
|
||||
:key="index"
|
||||
class="list-item"
|
||||
@click="countyToolItemClickHandle(item)"
|
||||
>
|
||||
<image
|
||||
:src="item.icon"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<view class="name">{{ item.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 在这里实现送礼步骤 -->
|
||||
<view v-if="showGiftSteps" class="gift-steps-wrap">
|
||||
<view
|
||||
v-for="(item, index) in giftBuyOptions"
|
||||
:key="index"
|
||||
style="width: 100%;"
|
||||
>
|
||||
<view v-show="currentGiftStepIndex === index" class="gift-step-item">
|
||||
<view class="gift-step-title">{{ item.title }}</view>
|
||||
<view v-if="item.type === 'option_card'" class="gift-options">
|
||||
<view
|
||||
v-for="opt in item.options"
|
||||
:key="opt.id"
|
||||
class="gift-option-item"
|
||||
:class="{ active: isGiftOptionSelected(item.id, opt.id) }"
|
||||
@click="toggleGiftOption(item.id, opt.id)"
|
||||
>
|
||||
{{ opt.optionName }}
|
||||
<image v-if="isGiftOptionSelected(item.id, opt.id)" :src="webUrl + '/aiChat/gift-options-check.png'" class="icon-check" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.type === 'price_input'" class="gift-price-input">
|
||||
<view class="input-wrap">
|
||||
<text class="label">价格预算:</text>
|
||||
<input v-model="giftBudget" placeholder="例如100以内/300~500元" class="input-budget" placeholder-style="color: #ccc;" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="gift-step-actions">
|
||||
<view class="action-btn-group">
|
||||
<view v-if="currentGiftStepIndex > 0" class="btn btn-prev" @click="prevGiftStep">上一步</view>
|
||||
<view class="btn btn-next" :class="{'full-width': currentGiftStepIndex === 0}" @click="nextGiftStep">下一步</view>
|
||||
</view>
|
||||
<view class="btn-skip" @click="skipGiftStep">跳过</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view v-if="chatMessageListLength > 0" class="chat-wrap">
|
||||
@@ -224,13 +288,13 @@
|
||||
</view>
|
||||
<view
|
||||
:class="{
|
||||
'playing': audioPlayId === item.conversationId && isPlayAudio
|
||||
'playing': [item.conversationId, item.messageId, item.parentMessageId].includes(audioPlayId) && isPlayAudio
|
||||
}"
|
||||
class="item"
|
||||
@click="ttsHandle(item)"
|
||||
>
|
||||
<image
|
||||
:src="webUrl + '/aiChat/' + ((audioPlayId === item.conversationId && isPlayAudio) ? 'audio-on' : 'audio-off') +'.png'"
|
||||
:src="webUrl + '/aiChat/' + (([item.conversationId, item.messageId, item.parentMessageId].includes(audioPlayId) && isPlayAudio) ? 'audio-on' : 'audio-off') +'.png'"
|
||||
class="icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
@@ -500,9 +564,14 @@
|
||||
@click="scrollToBottomHandle"
|
||||
/>
|
||||
</view>
|
||||
<view class="container">
|
||||
<view
|
||||
:class="{
|
||||
'container-county': !!countyId
|
||||
}"
|
||||
class="container"
|
||||
>
|
||||
<view
|
||||
v-if="chatNumber"
|
||||
v-if="chatNumber || showGiftSteps"
|
||||
class="new-chat"
|
||||
@click="createNewHandle"
|
||||
>
|
||||
@@ -514,17 +583,21 @@
|
||||
开启新对话
|
||||
</view>
|
||||
<view
|
||||
v-if="!countyId"
|
||||
v-for="(item, index) in bottomTools"
|
||||
:key="index"
|
||||
:class="{
|
||||
'hide': !item.display
|
||||
}"
|
||||
class="bottom-tool-item"
|
||||
@click="bottomToolClickHandle(item)"
|
||||
>
|
||||
<image
|
||||
:src="webUrl + '/aiChat/' + item.icon + '.png'"
|
||||
:src="item.icon"
|
||||
class="tool-icon"
|
||||
mode="widthFix"
|
||||
/>
|
||||
{{ item.text }}
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -532,6 +605,7 @@
|
||||
ref="bottomSend"
|
||||
:loading="loading"
|
||||
:keyboard-height="keyboardHeight"
|
||||
:voice-exception="exceptionConfig.voice_exception"
|
||||
@send="streamReq"
|
||||
@add="createNewHandle"
|
||||
@history="historyViewHandle"
|
||||
@@ -540,6 +614,7 @@
|
||||
<AiHistoryList
|
||||
ref="historyView"
|
||||
:status-bar-height="statusBarHeight"
|
||||
:county-id="countyId"
|
||||
@enter-history="audioStopHandle"
|
||||
/>
|
||||
<ProductWindow
|
||||
@@ -565,6 +640,9 @@ import {
|
||||
getAiSystemInfoSetting,
|
||||
getAiSystemInfoTopic
|
||||
} from '@/api/public'
|
||||
import {
|
||||
getCountyAiDetail
|
||||
} from '@/api/chat/index'
|
||||
import AiHistoryList from '../components/historyList'
|
||||
import BottomSend from '../components/bottomSend.vue'
|
||||
import OrderItem from '../components/orderItem.vue'
|
||||
@@ -581,39 +659,68 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
cityName: '',
|
||||
countyId: '',
|
||||
animationWidth: '150%',
|
||||
animationStr: '',
|
||||
settingInfo: {},
|
||||
topicList: [],
|
||||
onlyOneToAddCart: false,
|
||||
topicIsRotate: false
|
||||
topicIsRotate: false,
|
||||
showGiftSteps: false,
|
||||
currentGiftStepIndex: 0,
|
||||
giftSelections: {},
|
||||
giftBudget: '',
|
||||
giftBuyOptions: [],
|
||||
countyTools: []
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.cityName = options.cityName || ''
|
||||
this.countyId = options.countyId || ''
|
||||
},
|
||||
onShow() {
|
||||
const addNewChat = uni.getStorageSync('addNewChat') === '1'
|
||||
// 1-新对话,2-我要送礼
|
||||
const addNewChat = uni.getStorageSync('addNewChat') || ''
|
||||
// 从历史界面点击新增对话
|
||||
if (addNewChat && this.chatNumber) {
|
||||
console.log(addNewChat)
|
||||
if (addNewChat) {
|
||||
if (addNewChat === '1' && (this.chatNumber || this.showGiftSteps)) {
|
||||
this.createNewHandle()
|
||||
}
|
||||
if (addNewChat === '2') {
|
||||
const giftOptionItem = this.bottomTools.find((i) => i.giftCardEnabled === 1)
|
||||
if (giftOptionItem) {
|
||||
this.bottomToolClickHandle(giftOptionItem)
|
||||
}
|
||||
}
|
||||
uni.removeStorageSync('addNewChat')
|
||||
this.createNewHandle()
|
||||
}
|
||||
this.audioStopHandle()
|
||||
},
|
||||
methods: {
|
||||
createdCallbak() {
|
||||
extraReqFn() {
|
||||
this.$nextTick(() => {
|
||||
this.scrollToBottomHandle()
|
||||
getAiSystemInfoSetting().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.settingInfo = data
|
||||
this.animationWidth = `${data.systemTopicDivMaxWidth * 750}rpx`
|
||||
this.animationStr = `TranslateXSwiper-${data.systemTopicDivMaxWidth * 10} ${data.systemTopicDivScrollDuration}s infinite linear alternate`
|
||||
}
|
||||
})
|
||||
this.loadData()
|
||||
if (this.countyId) {
|
||||
getCountyAiDetail({
|
||||
countyId: this.countyId
|
||||
}).then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.settingInfo.helloMessageTitle = data.title || ''
|
||||
this.settingInfo.helloMessageContent = data.introduction || ''
|
||||
this.countyTools = data.modules || []
|
||||
}
|
||||
})
|
||||
} else {
|
||||
getAiSystemInfoSetting().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.settingInfo = data
|
||||
this.animationWidth = `${data.systemTopicDivMaxWidth * 750}rpx`
|
||||
this.animationStr = `TranslateXSwiper-${data.systemTopicDivMaxWidth * 10} ${data.systemTopicDivScrollDuration}s infinite linear alternate`
|
||||
}
|
||||
})
|
||||
this.loadData()
|
||||
}
|
||||
})
|
||||
},
|
||||
loadData(type = '') {
|
||||
@@ -643,13 +750,12 @@ export default {
|
||||
})
|
||||
},
|
||||
// 创建新会话
|
||||
createNewHandle() {
|
||||
createNewHandle(type = '') {
|
||||
this.closeAttrWindow()
|
||||
if (this.audioContext) {
|
||||
this.audioContext.stop()
|
||||
}
|
||||
wx.getBackgroundAudioManager().stop()
|
||||
if (!this.chatNumber) return
|
||||
this.closeWsFn()
|
||||
this.chatNumber = ''
|
||||
this.showCursor = false
|
||||
@@ -657,9 +763,21 @@ export default {
|
||||
this.getConfigLoading = false
|
||||
this.chatMessageList = []
|
||||
this.loadData()
|
||||
// 清空所有送礼选项
|
||||
this.giftSelections = {}
|
||||
this.giftBudget = ''
|
||||
this.currentGiftStepIndex = 0
|
||||
if (type !== 'giftChat') {
|
||||
const idx = this.bottomTools.findIndex((i) => i.giftCardEnabled === 1)
|
||||
this.$set(this, 'showGiftSteps', false)
|
||||
if (idx > -1) {
|
||||
this.$set(this.bottomTools[idx], 'display', true)
|
||||
}
|
||||
}
|
||||
},
|
||||
/*
|
||||
clickBackHandle() {
|
||||
if (!this.chatNumber) {
|
||||
if (!this.chatNumber && !this.showGiftSteps) {
|
||||
if (getCurrentPages().length > 1) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
@@ -671,8 +789,9 @@ export default {
|
||||
this.createNewHandle()
|
||||
}
|
||||
},
|
||||
*/
|
||||
pageContainerBeforeleave() {
|
||||
if (!this.chatNumber) {
|
||||
if (!this.chatNumber && !this.showGiftSteps) {
|
||||
if (getCurrentPages().length > 1) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
@@ -683,6 +802,19 @@ export default {
|
||||
} else {
|
||||
this.createNewHandle()
|
||||
}
|
||||
},
|
||||
countyToolItemClickHandle(item) {
|
||||
if (item.moduleType === 'prompt') {
|
||||
this.streamReq({
|
||||
prompt: item.promptContent,
|
||||
init: 0
|
||||
})
|
||||
}
|
||||
if (item.moduleType === 'url') {
|
||||
uni.navigateTo({
|
||||
url: item.url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -728,6 +860,7 @@ export default {
|
||||
height: calc(100vh - 240rpx);
|
||||
padding: 0 0 240rpx 0;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.focus-guide-wrap {
|
||||
display: flex;
|
||||
@@ -737,8 +870,13 @@ export default {
|
||||
.guide-left {
|
||||
.avatar {
|
||||
display: block;
|
||||
width: 230rpx;
|
||||
height: 404rpx;
|
||||
width: 400rpx;
|
||||
}
|
||||
.county-avatar {
|
||||
width: 360rpx;
|
||||
}
|
||||
.avatar-bounce {
|
||||
animation: bounce 2s infinite ease-in-out;
|
||||
}
|
||||
}
|
||||
.guide-right {
|
||||
@@ -822,4 +960,58 @@ export default {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes bounce {
|
||||
0%, 100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-20rpx);
|
||||
}
|
||||
}
|
||||
|
||||
.county-home-wrap {
|
||||
justify-content: flex-start;
|
||||
.guide-right {
|
||||
.content {
|
||||
padding: 30rpx 32rpx 0 32rpx;
|
||||
color: #666;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
.county-tools-wrap {
|
||||
width: 100%;
|
||||
padding: 40rpx 0 0 0;
|
||||
.list-cont {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
padding: 0 60rpx;
|
||||
box-sizing: border-box;
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 28%;
|
||||
padding: 20rpx 0 12rpx 0;
|
||||
margin: 0 0 24rpx 0;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 12rpx rgba(0, 0, 0, 0.1);
|
||||
.icon {
|
||||
display: block;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin: 0 8rpx 0 0;
|
||||
}
|
||||
.name {
|
||||
padding: 8rpx 0 0 0;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -38,6 +38,10 @@ export function deleteChatListByType(type) {
|
||||
return request.delete('/v1/chat/type/' + type, {}, { login: true })
|
||||
}
|
||||
|
||||
export function deleteCountyChatListByType(type, params) {
|
||||
return request.delete('/county-ai/chat/type/' + type + params, {}, { login: true })
|
||||
}
|
||||
|
||||
export function getWeatherData(params) {
|
||||
return request.get('/v1/chat/weatherData', params, { login: true })
|
||||
}
|
||||
@@ -59,3 +63,33 @@ export function getAnalyzeKeywordsChangeV3(data) {
|
||||
export function getAnalyzeByImageV3(data) {
|
||||
return request.post('/v1/chat/image/recognition', data, { login: true })
|
||||
}
|
||||
|
||||
// 获取送礼选项配置
|
||||
export function getGiftRecommendOptions(params) {
|
||||
return request.get('/ai/gift-recommend/options', params, { login: true })
|
||||
}
|
||||
|
||||
// 获取县域AI详情
|
||||
export function getCountyAiDetail(params) {
|
||||
return request.get('/county-ai/detail', params, { login: true })
|
||||
}
|
||||
|
||||
export function getSseCountyAiConfigV1(data) {
|
||||
return request.post('/county-ai/chat', data, { login: true })
|
||||
}
|
||||
|
||||
export function getCountyAiCompletionsV1(params) {
|
||||
return request.get('/county-ai/chat/recognize', params, { login: true })
|
||||
}
|
||||
|
||||
export function getCountyAiChatList(params) {
|
||||
return request.get('/county-ai/chat/list', params, { login: true })
|
||||
}
|
||||
|
||||
export function getCountyAiHistoryChatMessage(params) {
|
||||
return request.get('/county-ai/chat/message', params, { login: true })
|
||||
}
|
||||
|
||||
export function getGiftRecommendPrompt(data) {
|
||||
return request.post('/ai/gift-recommend/build-prompt', data, { login: true })
|
||||
}
|
||||
|
||||
@@ -223,6 +223,16 @@ export function getAiSystemInfoTopic() {
|
||||
return request.get('/ai/systemTopic', {}, { login: false })
|
||||
}
|
||||
|
||||
// 获取异常提示配置
|
||||
export function getExceptionConfig() {
|
||||
return request.get('/ai/exceptionConfig', {}, { login: true })
|
||||
}
|
||||
|
||||
// 获取已启用的底部导航配置列表
|
||||
export function getBottomNavigationConfigList() {
|
||||
return request.get('/ai/bottom-navigation/list', {}, { login: true })
|
||||
}
|
||||
|
||||
// 获取通用分享配置
|
||||
export function getWeixinShareConfig() {
|
||||
return request.get('/weixinShareConfig', {}, { login: false })
|
||||
|
||||
@@ -111,6 +111,12 @@ page {
|
||||
box-sizing: border-box;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.container-county {
|
||||
justify-content: flex-end;
|
||||
.new-chat {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.new-chat {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -161,6 +167,9 @@ page {
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
&.hide {
|
||||
display: none;
|
||||
}
|
||||
.tool-icon {
|
||||
display: block;
|
||||
width: 32rpx;
|
||||
@@ -1365,3 +1374,126 @@ page {
|
||||
transform: rotate(720deg);
|
||||
}
|
||||
}
|
||||
|
||||
.gift-steps-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 0 80rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.gift-step-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 60rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.gift-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
|
||||
.gift-option-item {
|
||||
width: 48%;
|
||||
height: 72rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #f2f4ff;
|
||||
color: #333;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 20rpx;
|
||||
font-size: 28rpx;
|
||||
position: relative;
|
||||
transition: all 0.2s;
|
||||
|
||||
&.active {
|
||||
background-color: #3D4CF0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-check {
|
||||
margin-left: 8rpx;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.gift-price-input {
|
||||
width: 100%;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.input-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24rpx;
|
||||
height: 88rpx;
|
||||
background-color: #f2f4ff;
|
||||
border-radius: 12rpx;
|
||||
|
||||
.label {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.input-budget {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.gift-step-actions {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.action-btn-group {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.btn {
|
||||
height: 62rpx;
|
||||
line-height: 62rpx;
|
||||
text-align: center;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
|
||||
&-prev {
|
||||
width: 48%;
|
||||
background-color: #fff;
|
||||
color: #3D4CF0;
|
||||
border: 2rpx solid #3D4CF0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
&-next {
|
||||
width: 48%;
|
||||
background-color: #3D4CF0;
|
||||
color: #fff;
|
||||
|
||||
&.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-skip {
|
||||
font-size: 28rpx;
|
||||
color: #3D4CF0;
|
||||
padding: 10rpx 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,19 @@
|
||||
import {
|
||||
getAiSystemInfoSetting
|
||||
} from '@/api/public'
|
||||
import {
|
||||
getCountyAiDetail
|
||||
} from '@/api/chat/index'
|
||||
export default {
|
||||
name: 'AiEntrance',
|
||||
props: {
|
||||
cityName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
countyId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -33,6 +40,19 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
if (this.countyId) {
|
||||
getCountyAiDetail({
|
||||
countyId: this.countyId
|
||||
}).then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
const aiImage = data.aiImage || ''
|
||||
this.settingInfo.mainImage = aiImage
|
||||
this.showImg = !!aiImage
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
getAiSystemInfoSetting().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
@@ -43,7 +63,7 @@ export default {
|
||||
},
|
||||
enterAiChat() {
|
||||
uni.navigateTo({
|
||||
url: '/aiChat/views/index?click=1&cityName=' + (this.cityName || this.localCityName)
|
||||
url: '/aiChat/views/index?click=1&cityName=' + (this.cityName || this.localCityName) + '&countyId=' + (this.countyId || '')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@
|
||||
{
|
||||
"path": "pages/VideoPlayBackList/VideoPlayBackList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "寻看点",
|
||||
"navigationBarTitleText": "使用指南",
|
||||
"navigationBarBackgroundColor": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<!-- 导航v9 -->
|
||||
<view class="menus-wrap">
|
||||
<view class="menus-bg" />
|
||||
<scroll-view scroll-x :scroll-into-view="scrollView" class="scroll-view" scroll-with-animation @scroll="onscroll" >
|
||||
<scroll-view scroll-x :scroll-into-view="scrollView" class="scroll-view" scroll-with-animation>
|
||||
<view class="menus-list">
|
||||
<view
|
||||
v-for="(item, index) in menus"
|
||||
|
||||
@@ -904,7 +904,10 @@
|
||||
@ok="handleOk"
|
||||
/>
|
||||
<FunctionGuide @hide="setGuide('countyFamousIndex')" :maxStep="2" :guideData="functionGuideData" ref="FunctionGuide"></FunctionGuide>
|
||||
<AiEntrance />
|
||||
<AiEntrance
|
||||
v-if="isLoad"
|
||||
:county-id="inn.areaId"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
+3
-3
@@ -80,7 +80,7 @@ function baseRequest(options) {
|
||||
_params = {
|
||||
params: params
|
||||
}
|
||||
} else if (['post', 'POST'].includes(options.method)) {
|
||||
} else if (['post', 'POST', 'put', 'PUT', 'patch', 'PATCH', 'delete', 'DELETE'].includes(options.method)) {
|
||||
_params = params || data
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ function baseRequest(options) {
|
||||
* 参考文档 https://www.kancloud.cn/yunye/axios/234845
|
||||
*
|
||||
*/
|
||||
const request = ["post", "put", "patch"].reduce((request, method) => {
|
||||
const request = ["post", "put", "patch", "delete"].reduce((request, method) => {
|
||||
/**
|
||||
*
|
||||
* @param url string 接口地址
|
||||
@@ -169,7 +169,7 @@ const request = ["post", "put", "patch"].reduce((request, method) => {
|
||||
return request;
|
||||
}, {});
|
||||
|
||||
["get", "delete", "head"].forEach(method => {
|
||||
["get", "head"].forEach(method => {
|
||||
/**
|
||||
*
|
||||
* @param url string 接口地址
|
||||
|
||||
Reference in New Issue
Block a user