Feat(云灵AI):界面初始化

This commit is contained in:
lifizer
2025-03-27 18:12:48 +08:00
parent 01c1a44a32
commit 615b89c8a5
21 changed files with 7240 additions and 316 deletions
+197
View File
@@ -0,0 +1,197 @@
<template>
<view
:class="scrollTop > 0 ? 'page-scroll' : ''"
class="fix-tabbar-page"
>
<hx-navbar
:back="true"
:fixed="true"
color="#333"
:statusBar="true"
transparent="hidden"
barPlaceholder="hidden"
title="云灵AI智能助手"
/>
<view
id="fixTbabarBody"
:style="{
'padding-top': (44 + statusBarHeight) + 'px'
}"
class="fix-tabbar-body"
>
<view class="chat-wrap">
<view v-if="chatMessageListLength > 0" class="chat-list-wrap">
<view
v-for="(item, index) in chatMessageList"
:key="index"
class="chat-message-item"
>
<view v-if="item.type === -1" class="chat-message-body">
<view class="item-right">
<view class="txt">
{{ item.prompt }}
</view>
</view>
</view>
<view v-if="item.type === -2" class="chat-message-body">
<view class="avatar">
<image
:src="'http://resource.xdd618.com/v1ppYx3WizxJ72a1af114c9931828888d959066fa3e7-20240314125834.png'"
class="chat-avatar"
mode="widthFix"
/>
</view>
<view class="item-left">
<view class="txt">
<view
ref="rich-text-box"
:class="{
'show-cursor': item.showCursor
}"
class="rich-text-box"
>
<rich-text
v-if="item.nodes && item.nodes.length"
:nodes="item.nodes"
space="nbsp"
/>
<view v-if="!(item.nodes && item.nodes.length) && loading" class="loader-wrap">
<div class="loader" />
</view>
</view>
</view>
</view>
<view
v-if="index === (chatMessageListLength - 1) && item.listQuestion.length > 0"
class="suggestion-wrap"
>
<view class="suggestion-list">
<view
v-for="(question, questionIndex) in item.listQuestion"
:key="questionIndex"
class="item"
@click="suggestionItemClickHandle(question)"
>
<view class="label">
<image
:src="webUrl + '/icon-30.png'"
class="pic"
mode="widthFix"
/>
</view>
{{ question }}
</view>
</view>
</view>
</view>
</view>
</view>
<view id="bottom_postion" class="bottom-postion" />
</view>
</view>
<view
v-if="chatMessageListLength > 0 && !isScrollToBottom && !loading"
class="page-to-bottom"
>
<image
:src="webUrl + '/icon-29.png'"
class="icon"
mode="widthFix"
@click="scrollToBottomHandle"
/>
</view>
<bottom-send
ref="bottomSend"
:loading="loading"
@send="streamReq"
@add="createNewHandle"
/>
</view>
</template>
<script>
import { chatMixins } from '@/mixins/chatMixins.js'
export default {
name: 'AiChatIndexPage',
mixins: [chatMixins],
methods: {
createdCallbak() {
this.$nextTick(() => {
this.scrollToBottomHandle()
})
},
// 创建新会话
createNewHandle() {
if (!this.chatNumber) return
this.chatNumber = ''
this.showCursor = false
this.loading = false
this.getConfigLoading = false
this.infoResData = {}
this.chatMessageList = []
}
}
}
</script>
<style lang="scss" scoped>
.guide-wrap {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 706rpx;
padding: 24rpx 0 0 0;
margin: 0 auto;
.pic {
display: block;
width: 706rpx;
}
.pic2 {
position: absolute;
top: 42rpx;
left: 68rpx;
display: block;
width: 120rpx;
height: 120rpx;
}
}
.chat-wrap {
padding: 0 0 180rpx 0;
.chat-info-wrap {
padding: 24rpx;
.chat-list-wrap2 {
padding: 0;
}
}
.no-info-list {
height: 240rpx;
line-height: 240rpx;
text-align: center;
color: #999;
}
}
.loading-wrap {
text-align: center;
color: #666;
line-height: 120rpx;
}
.rich-text-box {
max-width: 100%;
}
.show-cursor .cursor {
display: inline-block;
color: #FA9108;
font-weight: bold;
animation: blinking 1s infinite;
}
@keyframes blinking {
from {
opacity: 1.0;
}
to {
opacity: 0.0;
}
}
</style>
+315 -307
View File
@@ -1,9 +1,19 @@
<template>
<view class="cloud-page">
<view class="search-box">
<uni-search-bar placeholder="输入搜索关键词" @confirm="search" @clear="clearName"></uni-search-bar>
<view class="search-box flex">
<view class="city-box" @click="goCity('cloud')">
<image
:src="webUrl+'/20220903142929759087.png'"
mode="scaleToFill"
/>
<text>{{ cityName }}</text>
</view>
<uni-search-bar
placeholder="输入搜索关键词"
@confirm="search"
@clear="clearName"
/>
</view>
<view class="nav-box">
<view
v-for="(item, index) in typeList"
@@ -12,370 +22,368 @@
@click="changeType(index)"
>
<image :src="item.icon" mode="scaleToFill"></image>
<view class="nav">{{item.name}}</view>
<view class="nav">{{ item.name }}</view>
</view>
</view>
<view class="list-box">
<text class="type-name">{{typeList[type]['name']}}</text>
<view class="city-box" @click="goCity('cloud')">
<image :src="webUrl+'/20220903142929759087.png'" mode="scaleToFill"></image>
<text>{{cityName}}</text>
</view>
<view class="list" v-if="hotelList.length">
<view
v-if="hotelList.length"
class="list"
>
<custom-waterfalls-flow :value="hotelList" imageKey="cover">
<view class="item" v-for="(item,index) in hotelList" :key="index" slot="slot{{index}}"
@click="goInnDetail(item)">
<view
v-for="(item,index) in hotelList"
:key="index"
slot="slot{{index}}"
class="item"
@click="goInnDetail(item)"
>
<view class="cover-box">
<image class="cover" :src="item.cover" mode="scaleToFill"></image>
<image
:src="item.cover"
mode="scaleToFill"
class="cover"
/>
<view class="my-mask">
<image class="icon" :src="webUrl+'/20220510142728577618.png'" mode="scaleToFill"></image>
<text>{{item.cityName}}</text>
<image
class="icon"
:src="webUrl+'/20220510142728577618.png'"
mode="scaleToFill"
/>
<text>{{ item.cityName }}</text>
</view>
</view>
<view class="more-t">{{item.content}}</view>
<view class="more-t">{{ item.content }}</view>
<view class="flex ai-center" style="margin-bottom: 18rpx;">
<image class="logo" :src="item.logo" mode="scaleToFill"></image>
<text class="one-t">{{item.name}}</text>
<image
class="logo"
:src="item.logo"
mode="scaleToFill"
/>
<text class="one-t">{{ item.name }}</text>
</view>
</view>
</custom-waterfalls-flow>
</view>
<view class="v4-nodata" v-else>
<image src="@/static/images/img_nodata.png" mode="scaleToFill" />
<view class="text">暂无数据</view>
</view>
</view>
</view>
</template>
<script>
import config from '@/utils/mapConfig';
import {
getHotelTypeList,
getHotelList
} from "@/api/inn.js";
export default {
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
typeList: [],
name: "",
page: 1,
type: 0,
tabName: "", // 跳转初始分类名
hotelList: [],
cityName: "丽江市",
paramCity: ""
}
import config from '@/utils/mapConfig'
import {
getHotelTypeList,
getHotelList
} from '@/api/inn.js'
export default {
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
typeList: [],
name: '',
page: 1,
type: 0,
// 跳转初始分类名
tabName: '',
hotelList: [],
cityName: '丽江市',
paramCity: ''
}
},
onLoad(){
this.fetchTypeList()
},
onShow() {
const name = uni.getStorageSync('name')
if (name) {
this.tabName = name
uni.removeStorageSync('name')
}
const memCityName = uni.getStorageSync('cityName')
if (memCityName.length) {
this.cityName = memCityName
this.paramCity = memCityName
this.page = 1
this.hotelList = []
this.fetchList()
uni.removeStorageSync('cityName')
}
},
onReachBottom() {
this.page++
this.fetchList()
},
methods: {
goCity() {
uni.navigateTo({
url:`/pages/chose-city/chose-city?type=2&city=${this.cityName}`
})
},
onLoad(){
this.fetchTypeList()
},
onShow() {
let name = uni.getStorageSync("name");
if (name) {
this.tabName = name;
uni.removeStorageSync("name");
}
//获取当前定位地址
getCurAddress() {
const that = this
//定位
uni.showLoading({
title: '定位中...'
})
uni.getLocation({
type: 'wgs84',
success: function(res) {
let latitude = res.latitude
let longitude = res.longitude
// #ifdef H5
Vue.jsonp(
'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' +
config.key, {
output: 'jsonp',
}).then(json => {
// Success.
uni.hideLoading();
that.cityName = json.result.ad_info.city
that.paramCity = json.result.ad_info.city
//定位成功刷新数据
that.fetchList()
}).catch(err => {
uni.hideLoading()
})
// #endif
let memCityName = uni.getStorageSync("cityName")
if (memCityName.length) {
this.cityName = memCityName;
this.paramCity = memCityName;
this.page = 1;
this.hotelList = [];
this.fetchList();
uni.removeStorageSync("cityName")
}
},
onReachBottom() {
this.page++;
this.fetchList();
},
methods: {
goCity() {
uni.navigateTo({
url:`/pages/chose-city/chose-city?type=2&city=${this.cityName}`
})
},
//获取当前定位地址
getCurAddress() {
var that = this;
//定位
uni.showLoading({
title: '定位中...'
});
uni.getLocation({
type: 'wgs84',
success: function(res) {
let latitude = res.latitude;
let longitude = res.longitude;
// #ifdef H5
Vue.jsonp(
'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' +
config.key, {
output: 'jsonp',
}).then(json => {
// Success.
// #ifndef H5
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
'&key=' + config.key,
success: function(res) {
uni.hideLoading();
that.cityName = json.result.ad_info.city;
that.paramCity = json.result.ad_info.city;
that.cityName = res.data.result.ad_info.city
that.paramCity = res.data.result.ad_info.city
//定位成功刷新数据
that.fetchList()
}).catch(err => {
uni.hideLoading();
})
// #endif
// #ifndef H5
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
'&key=' + config.key,
success: function(res) {
uni.hideLoading();
that.cityName = res.data.result.ad_info.city;
that.paramCity = res.data.result.ad_info.city;
//定位成功刷新数据
that.fetchList()
},
fail: function(res) {
uni.hideLoading();
},
complete: function() {}
});
// #endif
},
fail: function(res) {
uni.hideLoading();
}
});
},
fetchTypeList() {
this.hotelList = []
getHotelTypeList().then(res => {
if (res.status === 200) {
for (let i = 0; i < res.data.length; i++) {
if (this.tabName == res.data[i].name) this.type = i;
},
fail: function(res) {
uni.hideLoading()
}
this.typeList = res.data
let memCityName = uni.getStorageSync("cityName")
if (memCityName.length) {
this.cityName = memCityName;
this.paramCity = memCityName;
this.page = 1;
this.list = [];
this.fetchList();
uni.removeStorageSync("cityName")
} else {
this.getCurAddress();
})
// #endif
},
fail: function(res) {
uni.hideLoading()
}
})
},
fetchTypeList() {
this.hotelList = []
getHotelTypeList().then(res => {
const { status, data } = res
if (status === 200) {
for (let i = 0; i < data.length; i++) {
if (this.tabName == data[i].name) {
this.type = i
}
}
})
},
search(e) {
this.name = e.value;
this.page = 1;
this.hotelList = [];
this.fetchList();
},
clearName() {
this.name = "";
this.page = 1;
this.hotelList = [];
this.fetchList();
},
changeType(index) {
this.type = index;
this.page = 1;
this.hotelList = [];
this.fetchList();
},
fetchList() {
getHotelList({
name: this.name,
page: this.page,
type: this.typeList[this.type].id,
cityName: this.paramCity
}).then(res => {
if (res.status === 200) {
this.paramCity = this.cityName;
for (let i = 0; i < res.data.length; i++) {
res.data[i].hide = true;
this.hotelList.push(res.data[i])
}
this.typeList = data
const memCityName = uni.getStorageSync('cityName')
if (memCityName.length) {
this.cityName = memCityName
this.paramCity = memCityName
this.page = 1
this.list = []
this.fetchList()
uni.removeStorageSync('cityName')
} else {
this.getCurAddress()
}
})
},
goInnDetail: function(item) {
//跳转到客栈详情
this.$yrouter.push({
path: "/pagesInn/inn/innHome",
query: {
id: item.id
}
})
},
search(e) {
this.name = e.value
this.page = 1
this.hotelList = []
this.fetchList()
},
clearName() {
this.name = ''
this.page = 1
this.hotelList = []
this.fetchList()
},
changeType(index) {
this.type = index
this.page = 1
this.hotelList = []
this.fetchList()
},
fetchList() {
getHotelList({
name: this.name,
page: this.page,
type: this.typeList[this.type].id,
cityName: this.paramCity
}).then(res => {
if (res.status === 200) {
this.paramCity = this.cityName
for (let i = 0; i < res.data.length; i++) {
res.data[i].hide = true
this.hotelList.push(res.data[i])
}
});
},
}
})
},
goInnDetail(item) {
//跳转到客栈详情
this.$yrouter.push({
path: '/pagesInn/inn/innHome',
query: {
id: item.id
}
})
}
}
}
</script>
<style scoped lang="less">
.cloud-page {
.search-box {
padding: 0 12rpx;
background: #fff;
.cloud-page {
.search-box {
padding: 0 12rpx;
background: #fff;
/deep/.uni-searchbar__box {
border-radius: 44rpx !important;
}
/deep/.uni-searchbar__box {
border-radius: 44rpx !important;
}
}
.city-box {
position: absolute;
right: 30rpx;
display: inline-flex;
align-items: center;
margin-left: 32rpx;
padding: 8rpx 18rpx 8rpx 16rpx;
border-radius: 30px;
background: #fff;
image {
width: 32rpx;
height: 32rpx;
margin-right: 4rpx;
}
.city-box {
position: absolute;
right: 30rpx;
display: inline-flex;
text {
color: #333;
font-size: 28rpx;
}
}
.nav-box {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 36rpx 24rpx;
background: #fff;
overflow-x: auto;
.item {
display: flex;
flex-direction: column;
align-items: center;
margin-left: 32rpx;
padding: 8rpx 18rpx 8rpx 16rpx;
border-radius: 30px;
background: #fff;
margin-left: 70rpx;
image {
width: 32rpx;
height: 32rpx;
margin-right: 4rpx;
width: 64rpx;
height: 64rpx;
}
text {
color: #333;
font-size: 28rpx;
.nav {
color: #666;
font-size: 24rpx;
line-height: 34rpx;
font-weight: bold;
}
}
.nav-box {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 36rpx 24rpx;
background: #fff;
overflow-x: auto;
.item:first-child {
margin-left: 0;
}
}
.item {
display: flex;
flex-direction: column;
align-items: center;
margin-left: 70rpx;
::-webkit-scrollbar {
display: none;
}
image {
width: 64rpx;
height: 64rpx;
}
.list-box {
padding: 20rpx 32rpx;
.nav {
color: #666;
font-size: 24rpx;
line-height: 34rpx;
font-weight: bold;
}
}
.item:first-child {
margin-left: 0;
}
.type-name {
position: relative;
font-size: 28rpx;
line-height: 40rpx;
color: #080F1A;
}
::-webkit-scrollbar {
display: none;
.type-name::before {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 10rpx;
background: rgba(253, 104, 93, 0.39);
z-index: -1;
}
.list-box {
padding: 20rpx 32rpx;
.list {
margin-top: 20rpx;
.type-name {
.cover {
width: 332rpx;
height: 332rpx;
vertical-align: middle;
}
.icon {
width: 22rpx;
height: 22rpx;
margin-right: 10rpx;
vertical-align: middle;
}
.logo {
width: 36rpx;
height: 36rpx;
vertical-align: middle;
margin: 0 8rpx;
border-radius: 50%;
}
.cover-box {
position: relative;
font-size: 28rpx;
line-height: 40rpx;
color: #080F1A;
height: auto;
.my-mask {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 56rpx;
line-height: 56rpx;
box-sizing: border-box;
padding: 0 24rpx;
background: linear-gradient(rgba(51, 51, 51, 0), rgba(0, 0, 0, 1));
color: #fff;
font-size: 22rpx;
}
}
.type-name::before {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 10rpx;
background: rgba(253, 104, 93, 0.39);
z-index: -1;
}
.list {
margin-top: 20rpx;
.cover {
width: 332rpx;
height: 332rpx;
vertical-align: middle;
}
.icon {
width: 22rpx;
height: 22rpx;
margin-right: 10rpx;
vertical-align: middle;
}
.logo {
width: 36rpx;
height: 36rpx;
vertical-align: middle;
margin: 0 8rpx;
border-radius: 50%;
}
.cover-box {
position: relative;
height: auto;
.my-mask {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 56rpx;
line-height: 56rpx;
box-sizing: border-box;
padding: 0 24rpx;
background: linear-gradient(rgba(51, 51, 51, 0), rgba(0, 0, 0, 1));
color: #fff;
font-size: 22rpx;
}
}
.more-t {
margin: 10rpx;
}
.more-t {
margin: 10rpx;
}
}
}
}
</style>
+4 -1
View File
@@ -353,6 +353,7 @@
paddingBottom="200rpx"
/>
<FunctionGuide :maxStep="15" @hide="setGuide('index')" :guideData="functionGuideData" ref="FunctionGuide"></FunctionGuide>
<AiEntrance />
<xdd-tabbar :curr-index="0" @getElementData="elementData" @getIcon="getIcon"/>
</view>
</template>
@@ -368,6 +369,7 @@ import ProductWindow from '@/components/ProductWindow'
import goCartMixin from '@/mixins/goCartMixins'
import FunctionGuide from '@/components/FunctionGuide'
import GuideMixins from '@/mixins/GuideMixins'
import AiEntrance from '@/components/aiChat/entrance'
import {
getSearchPageConfig
} from '@/api/search'
@@ -383,7 +385,8 @@ export default {
XddTabbar,
XddProductItem,
ProductWindow,
FunctionGuide
FunctionGuide,
AiEntrance
},
mixins: [pageListenMixins, goCartMixin, GuideMixins],
data() {