Merge branch 'dev' into test
@@ -26,4 +26,5 @@ export default {
|
|||||||
@import "./assets/css/reset.less";
|
@import "./assets/css/reset.less";
|
||||||
@import "./assets/css/style.less";
|
@import "./assets/css/style.less";
|
||||||
@import "./assets/css/v12-style.less";
|
@import "./assets/css/v12-style.less";
|
||||||
|
@import "./assets/css/aiChat.less";
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,327 @@
|
|||||||
|
<template>
|
||||||
|
<view
|
||||||
|
:class="{
|
||||||
|
'focus': inputOnFocus
|
||||||
|
}"
|
||||||
|
:style="{
|
||||||
|
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
|
||||||
|
}"
|
||||||
|
class="fix-page-bottom"
|
||||||
|
>
|
||||||
|
<view v-if="inputModel === 'input'" class="bottom-body flex-center-between">
|
||||||
|
<view class="history-wrap" @click="historyViewHandle">
|
||||||
|
历史
|
||||||
|
</view>
|
||||||
|
<view class="input-container">
|
||||||
|
<!-- 输入模式切换 -->
|
||||||
|
<view
|
||||||
|
class="input-model"
|
||||||
|
@click="toggleInputModel"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/microphone.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<!-- 输入框 -->
|
||||||
|
<view class="input-wrap flex-center-between">
|
||||||
|
<input
|
||||||
|
v-model.trim="prompt"
|
||||||
|
:show-confirm-bar="false"
|
||||||
|
:adjust-position="false"
|
||||||
|
:disabled="loading"
|
||||||
|
:maxlength="-1"
|
||||||
|
class="inp"
|
||||||
|
@confirm="sendHandle"
|
||||||
|
@focus="promptInputFocusHandle"
|
||||||
|
@blur="promptInputBlurHandle"
|
||||||
|
/>
|
||||||
|
<view v-if="!prompt && !inputOnFocus" class="placeholder-txt">发消息...</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="send-btn"
|
||||||
|
@click="sendHandle"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/send.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 语音输入 -->
|
||||||
|
<view
|
||||||
|
v-if="inputModel === 'sound'"
|
||||||
|
class="sound-input-wrap"
|
||||||
|
>
|
||||||
|
<view class="toggle-btn">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-06.png'"
|
||||||
|
class="input-icon"
|
||||||
|
mode="widthFix"
|
||||||
|
@click="toggleInputModel"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="sound-wrap"
|
||||||
|
@touchstart="startRecord"
|
||||||
|
@touchend="stopRecord"
|
||||||
|
>
|
||||||
|
<view v-if="startTaskFlag" class="music-wrap">
|
||||||
|
<view class="item one" />
|
||||||
|
<view class="item two" />
|
||||||
|
<view class="item three" />
|
||||||
|
<view class="item four" />
|
||||||
|
<view class="item five" />
|
||||||
|
<view class="item six" />
|
||||||
|
<view class="item seven" />
|
||||||
|
</view>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/microphone-big.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
<view v-if="startTaskFlag" class="music-wrap music-wrap2">
|
||||||
|
<view class="item one" />
|
||||||
|
<view class="item two" />
|
||||||
|
<view class="item three" />
|
||||||
|
<view class="item four" />
|
||||||
|
<view class="item five" />
|
||||||
|
<view class="item six" />
|
||||||
|
<view class="item seven" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
makeFileTransTask,
|
||||||
|
getFileTransResult
|
||||||
|
} from '@/api/voiceToText/index'
|
||||||
|
import { VUE_APP_API_URL } from '@/config'
|
||||||
|
import cookie from '@/utils/store/cookie'
|
||||||
|
export default {
|
||||||
|
name: 'BottomSend',
|
||||||
|
props: {
|
||||||
|
loading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
keyboardHeight: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
token: cookie.get('login_status'),
|
||||||
|
userInfo: cookie.get('userInfo'),
|
||||||
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||||
|
// 输入模式:input-键盘,sound-语音
|
||||||
|
inputModel: 'input',
|
||||||
|
prompt: '',
|
||||||
|
recordManager: null,
|
||||||
|
// 录音权限是否开通
|
||||||
|
recordPermission: false,
|
||||||
|
taskId: '',
|
||||||
|
taskTimer: null,
|
||||||
|
startTaskFlag: false,
|
||||||
|
// 输入框是否聚焦
|
||||||
|
inputOnFocus: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.clearIntervalFn()
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
uni.getSetting({
|
||||||
|
success: res => {
|
||||||
|
if (res.authSetting['scope.record']) {
|
||||||
|
this.recordPermission = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
promptInputFocusHandle() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.inputOnFocus = true
|
||||||
|
this.$emit('focus', 1)
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
|
promptInputBlurHandle() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.inputOnFocus = false
|
||||||
|
this.$emit('focus', 0)
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
|
toggleInputModel() {
|
||||||
|
if (!this.token) {
|
||||||
|
uni.reLaunch({ url: '/pages/auth/login' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.loading) return
|
||||||
|
if (this.inputModel === 'input') {
|
||||||
|
uni.getSetting({
|
||||||
|
success: res => {
|
||||||
|
if (!res.authSetting['scope.record']) {
|
||||||
|
uni.authorize({
|
||||||
|
scope: 'scope.record',
|
||||||
|
success: () => {
|
||||||
|
console.log('获取录音权限成功')
|
||||||
|
this.recordPermission = true
|
||||||
|
this.inputModel = 'sound'
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
console.log('获取录音权限失败')
|
||||||
|
this.recordPermission = false
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '需要获取麦克风权限',
|
||||||
|
confirmText: '前往设置',
|
||||||
|
confirmColor: '#3D4CF1',
|
||||||
|
success(res2) {
|
||||||
|
if (res2.confirm) {
|
||||||
|
wx.openSetting()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.recordPermission = true
|
||||||
|
this.inputModel = 'sound'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.inputModel === 'sound') {
|
||||||
|
this.clearIntervalFn()
|
||||||
|
this.inputModel = 'input'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
},
|
||||||
|
startRecord() {
|
||||||
|
if (this.loading) {
|
||||||
|
this.$toast('正在检索')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 正在识别,不触发相关动作
|
||||||
|
if (this.startTaskFlag || this.taskTimer) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.recordManager = uni.getRecorderManager()
|
||||||
|
console.log('启动录音')
|
||||||
|
this.startTaskFlag = true
|
||||||
|
this.recordManager.start({
|
||||||
|
duration: 60 * 1000,
|
||||||
|
frameSize: 1,
|
||||||
|
sampleRate: 16000,
|
||||||
|
format: 'wav'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
stopRecord() {
|
||||||
|
const _this = this
|
||||||
|
// 正在识别,不触发相关动作
|
||||||
|
if (this.taskTimer) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (_this.recordManager) {
|
||||||
|
_this.recordManager.stop()
|
||||||
|
console.log('停止录音')
|
||||||
|
_this.startTaskFlag = false
|
||||||
|
_this.recordManager.onStop((res) => {
|
||||||
|
console.log('录音结束------------')
|
||||||
|
console.log(res)
|
||||||
|
const { tempFilePath, fileSize, duration } = res
|
||||||
|
if (tempFilePath && fileSize && duration) {
|
||||||
|
_this.taskId = ''
|
||||||
|
_this.clearIntervalFn()
|
||||||
|
uni.showLoading({ title: '识别中...' })
|
||||||
|
uni.uploadFile({
|
||||||
|
url: `${VUE_APP_API_URL}/api/upload`,
|
||||||
|
filePath: tempFilePath,
|
||||||
|
header: {
|
||||||
|
Authorization: 'Bearer ' + (_this.token || '')
|
||||||
|
},
|
||||||
|
name: 'file',
|
||||||
|
success: uploadRes => {
|
||||||
|
console.log(JSON.parse(uploadRes.data))
|
||||||
|
_this.renderTransTask(uploadRes)
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
console.log(err)
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
renderTransTask(uploadRes) {
|
||||||
|
const _this = this
|
||||||
|
const file = JSON.parse(uploadRes.data).link || ''
|
||||||
|
if (!file) return
|
||||||
|
makeFileTransTask({
|
||||||
|
file
|
||||||
|
}).then(taskRes => {
|
||||||
|
_this.taskId = taskRes.data
|
||||||
|
_this.getTransResultReq()
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getTransResultReq() {
|
||||||
|
const _this = this
|
||||||
|
_this.taskTimer = setInterval(() => {
|
||||||
|
getFileTransResult({
|
||||||
|
taskId: _this.taskId
|
||||||
|
}).then(res => {
|
||||||
|
const { success, data = [] } = res
|
||||||
|
if (success && data) {
|
||||||
|
uni.hideLoading()
|
||||||
|
_this.clearIntervalFn()
|
||||||
|
if (data === '__NULL__') {
|
||||||
|
_this.$toast('豁然没有听清您说了什么,请再说一遍')
|
||||||
|
} else {
|
||||||
|
if (data.length > 0) {
|
||||||
|
const prompt = data[0].Text
|
||||||
|
if (prompt) {
|
||||||
|
_this.$emit('send', { prompt: prompt.replace('。', '') })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
clearIntervalFn() {
|
||||||
|
this.taskTimer && clearInterval(this.taskTimer)
|
||||||
|
this.taskTimer = null
|
||||||
|
setTimeout(() => {
|
||||||
|
this.startTaskFlag = false
|
||||||
|
}, 300)
|
||||||
|
},
|
||||||
|
sendHandle() {
|
||||||
|
if (this.loading) return
|
||||||
|
if (!this.prompt) {
|
||||||
|
this.$toast('请输入您想问的内容')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$emit('send', { prompt: this.prompt })
|
||||||
|
this.prompt = ''
|
||||||
|
this.inputOnFocus = false
|
||||||
|
},
|
||||||
|
historyViewHandle() {
|
||||||
|
this.$emit('history')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,268 @@
|
|||||||
|
<template>
|
||||||
|
<view
|
||||||
|
:class="{
|
||||||
|
'show': showLayer
|
||||||
|
}"
|
||||||
|
class="history-wrap"
|
||||||
|
>
|
||||||
|
<view class="layer" @click="closeLayer" />
|
||||||
|
<view
|
||||||
|
:style="{
|
||||||
|
'padding-top': statusBarHeight + 'px'
|
||||||
|
}"
|
||||||
|
class="history-container"
|
||||||
|
>
|
||||||
|
<view class="history-type">
|
||||||
|
<view class="title">
|
||||||
|
<view class="txt">今日</view>
|
||||||
|
<image
|
||||||
|
v-if="todayList.length > 0"
|
||||||
|
:src="webUrl + '/aiChat/delete.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
@click="deleteRecords(2)"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view v-if="todayList.length > 0" class="list-cont">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in todayList"
|
||||||
|
:key="index"
|
||||||
|
class="item"
|
||||||
|
@click="historyItemClick(item)"
|
||||||
|
>
|
||||||
|
<view class="item-txt one-t">
|
||||||
|
{{ item.title }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="no-data">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/orderIcon/nodata1.png'"
|
||||||
|
class="img"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="history-type">
|
||||||
|
<view class="title">
|
||||||
|
<view class="txt">30天内</view>
|
||||||
|
<image
|
||||||
|
v-if="list.length > 0"
|
||||||
|
:src="webUrl + '/aiChat/delete.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
@click="deleteRecords(2)"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view v-if="list.length > 0" class="list-cont">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:key="index"
|
||||||
|
class="item"
|
||||||
|
@click="historyItemClick(item)"
|
||||||
|
>
|
||||||
|
<view class="item-txt one-t">
|
||||||
|
{{ item.title }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="no-data">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/orderIcon/nodata1.png'"
|
||||||
|
class="img"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="history-type">
|
||||||
|
<view class="title">
|
||||||
|
<view class="txt">超过30天</view>
|
||||||
|
<image
|
||||||
|
v-if="moreList.length > 0"
|
||||||
|
:src="webUrl + '/aiChat/delete.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
@click="deleteRecords(3)"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view v-if="moreList.length > 0" class="list-cont">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in moreList"
|
||||||
|
:key="index"
|
||||||
|
class="item"
|
||||||
|
@click="historyItemClick(item)"
|
||||||
|
>
|
||||||
|
<view class="item-txt one-t">
|
||||||
|
{{ item.title }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="no-data">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/orderIcon/nodata1.png'"
|
||||||
|
class="img"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getChatList,
|
||||||
|
deleteChatListByType
|
||||||
|
} from '@/api/chat/index'
|
||||||
|
export default {
|
||||||
|
name: 'AiHistoryList',
|
||||||
|
props: {
|
||||||
|
statusBarHeight: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
// 来源模块:''-首页,'history'-历史记录
|
||||||
|
formModule: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||||
|
showLayer: false,
|
||||||
|
todayList: [],
|
||||||
|
list: [],
|
||||||
|
moreList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showView() {
|
||||||
|
this.showLayer = true
|
||||||
|
this.getChatListReq()
|
||||||
|
},
|
||||||
|
getChatListReq() {
|
||||||
|
getChatList().then(res => {
|
||||||
|
const { success, data } = res
|
||||||
|
if (success) {
|
||||||
|
this.todayList = data['今天'] || []
|
||||||
|
this.list = data['30天内'] || []
|
||||||
|
this.moreList = data['超过30天'] || []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deleteRecords(type) {
|
||||||
|
deleteChatListByType(type).then(res => {
|
||||||
|
const { success } = res
|
||||||
|
if (success) {
|
||||||
|
this.getChatListReq()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
historyItemClick(item) {
|
||||||
|
const paramsStr = `?chatNumber=${item.chatNumber}&title=${item.title}`
|
||||||
|
if (!this.formModule) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/aiChat/views/history' + paramsStr
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/aiChat/views/history' + paramsStr
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.closeLayer()
|
||||||
|
},
|
||||||
|
closeLayer() {
|
||||||
|
this.showLayer = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.history-wrap {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 1001;
|
||||||
|
transform: translateX(-100%);
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.3s;
|
||||||
|
.layer {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 2;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
.history-container {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 5;
|
||||||
|
width: 75%;
|
||||||
|
padding: 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-top-right-radius: 60rpx;
|
||||||
|
border-bottom-right-radius: 60rpx;
|
||||||
|
overflow-y: auto;
|
||||||
|
background-color: #fff;
|
||||||
|
.history-type + .history-type {
|
||||||
|
padding: 40rpx 0 0 0;
|
||||||
|
}
|
||||||
|
.history-type {
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
.txt {
|
||||||
|
font-size: 34rpx;
|
||||||
|
line-height: 50rpx;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list-cont {
|
||||||
|
padding: 24rpx 0 0 0;
|
||||||
|
.item + .item {
|
||||||
|
margin: 12rpx 0 0 0;
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
.item-txt {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 60rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
color: #333;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
background-color: #F1F2FF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.no-data {
|
||||||
|
.img {
|
||||||
|
display: block;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
margin: 40rpx auto 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.show {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,312 @@
|
|||||||
|
import {
|
||||||
|
getSseConfigV1,
|
||||||
|
getCompletions,
|
||||||
|
deleteChatItemByConversationId
|
||||||
|
} from '@/api/chat/index'
|
||||||
|
import { VUE_APP_API_URL } from '@/config'
|
||||||
|
import settings from '@/config/baseSetting.js'
|
||||||
|
import { formatAiMsgContent } from '../utils/aiChat'
|
||||||
|
import cookie from '@/utils/store/cookie'
|
||||||
|
import { handleLoginFailure } from '@/utils'
|
||||||
|
export const chatMixins = {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
token: cookie.get('login_status'),
|
||||||
|
userInfo: cookie.get('userInfo'),
|
||||||
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||||
|
scrollData: {},
|
||||||
|
scrollTop: 0,
|
||||||
|
isScrollToBottom: false,
|
||||||
|
// 状态栏高度
|
||||||
|
statusBarHeight: 20,
|
||||||
|
fileHttpStr: Object.freeze(VUE_APP_API_URL + settings.sysPrefix),
|
||||||
|
keyboardHeight: 0,
|
||||||
|
optionsFrom: '',
|
||||||
|
onFocus: false,
|
||||||
|
loading: false,
|
||||||
|
chatNumber: '',
|
||||||
|
infoResData: {},
|
||||||
|
chatMessageList: [
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
type: -2,
|
||||||
|
isError: false,
|
||||||
|
showCursor: false,
|
||||||
|
conversationId: '',
|
||||||
|
prompt: '',
|
||||||
|
nodes: '-------------监听 WebSocket 接受到服务器的消息事件',
|
||||||
|
content: '-------------监听 WebSocket 接受到服务器的消息事件',
|
||||||
|
listQuestion: [
|
||||||
|
'监听 WebSocket 接受到服务器的消息事件',
|
||||||
|
'监听 WebSocket 接受到服务器的消息事件',
|
||||||
|
'监听 WebSocket 接受到服务器的消息事件'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
],
|
||||||
|
errorMsg: Object.freeze('您提的问题未能理解,云灵思想跑偏啦,重新整理一下问题或者重新提问,让云灵再试试!')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
chatMessageListLength() {
|
||||||
|
return this.chatMessageList.length
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onPageScroll(e) {
|
||||||
|
this.scrollData = e
|
||||||
|
const scrollTop = e.scrollTop
|
||||||
|
this.scrollTop = scrollTop
|
||||||
|
const query = wx.createSelectorQuery().in(this)
|
||||||
|
query.select('#fixTbabarBody').boundingClientRect(function(rect) {
|
||||||
|
const contentHeight = rect.height
|
||||||
|
const windowInfo = wx.getWindowInfo()
|
||||||
|
const windowHeight = windowInfo.windowHeight
|
||||||
|
if (scrollTop + windowHeight + 30 >= contentHeight) {
|
||||||
|
this.isScrollToBottom = true
|
||||||
|
} else {
|
||||||
|
this.isScrollToBottom = false
|
||||||
|
}
|
||||||
|
}.bind(this)).exec()
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
// 监听键盘高度变化
|
||||||
|
wx.onKeyboardHeightChange((res) => {
|
||||||
|
console.log('监听键盘高度变化%s', res.height)
|
||||||
|
this.keyboardHeight = res.height
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
this.closeWsFn()
|
||||||
|
// console.log('在页面卸载时取消监听')
|
||||||
|
// wx.offKeyboardHeightChange()
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
const _this = this
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: (e) => {
|
||||||
|
let statusBar = 0
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
statusBar = e.statusBarHeight
|
||||||
|
const custom = uni.getMenuButtonBoundingClientRect()
|
||||||
|
_this.rightDistance = e.windowWidth - custom.left + 10
|
||||||
|
// #endif
|
||||||
|
// 状态栏高度
|
||||||
|
_this.statusBarHeight = statusBar
|
||||||
|
}
|
||||||
|
})
|
||||||
|
_this.createdCallbak()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createdCallbak() {
|
||||||
|
console.log('页面初始话回调')
|
||||||
|
},
|
||||||
|
inputFocusHandle(value) {
|
||||||
|
this.onFocus = value === 1
|
||||||
|
},
|
||||||
|
historyViewHandle() {
|
||||||
|
console.log(this.$refs.historyView)
|
||||||
|
this.$refs.historyView.showView()
|
||||||
|
},
|
||||||
|
copyContentHandle(data) {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data,
|
||||||
|
success: () =>
|
||||||
|
uni.showToast({
|
||||||
|
title: '已复制'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
shareHandle() {
|
||||||
|
wx.showShareMenu({
|
||||||
|
withShareTicket: true,
|
||||||
|
menus: ['shareAppMessage', 'shareTimeline'],
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
scrollToBottomHandle() {
|
||||||
|
uni.pageScrollTo({
|
||||||
|
duration: 100,
|
||||||
|
selector: '#bottom_postion'
|
||||||
|
})
|
||||||
|
this.isScrollToBottom = true
|
||||||
|
},
|
||||||
|
// 重新生成
|
||||||
|
regenerateHandle(item) {
|
||||||
|
deleteChatItemByConversationId(item.conversationId).then(res => {
|
||||||
|
const { success } = res
|
||||||
|
if (success) {
|
||||||
|
this.chatMessageList.splice(this.chatMessageListLength - 1, 1)
|
||||||
|
this.streamReq({
|
||||||
|
prompt: item.prompt,
|
||||||
|
init: 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 建议提问
|
||||||
|
suggestionItemClickHandle(question) {
|
||||||
|
this.streamReq({
|
||||||
|
prompt: question,
|
||||||
|
init: 0
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 大家都在问
|
||||||
|
topicItemClickHandle(question) {
|
||||||
|
this.streamReq({
|
||||||
|
prompt: question,
|
||||||
|
init: 0
|
||||||
|
})
|
||||||
|
},
|
||||||
|
streamReq(params) {
|
||||||
|
const _this = this
|
||||||
|
// 需要校验登录状态
|
||||||
|
if (!_this.token) {
|
||||||
|
handleLoginFailure()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const prompt = params.prompt
|
||||||
|
if (params.init !== 1) {
|
||||||
|
_this.chatMessageList.push({
|
||||||
|
prompt,
|
||||||
|
type: -1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_this.$nextTick(() => {
|
||||||
|
_this.scrollToBottomHandle()
|
||||||
|
})
|
||||||
|
_this.chatMessageList.push({
|
||||||
|
content: '',
|
||||||
|
nodes: '',
|
||||||
|
isError: false,
|
||||||
|
showCursor: false,
|
||||||
|
conversationId: '',
|
||||||
|
prompt,
|
||||||
|
listQuestion: [],
|
||||||
|
type: -2
|
||||||
|
})
|
||||||
|
_this.loading = true
|
||||||
|
_this.initWebSocket(() => {
|
||||||
|
_this.showCursor = false
|
||||||
|
getSseConfigV1({
|
||||||
|
'chatNumber': _this.chatNumber,
|
||||||
|
prompt
|
||||||
|
}).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
|
||||||
|
getCompletions({
|
||||||
|
conversationId,
|
||||||
|
ws: true,
|
||||||
|
isNoNeedPublicErrorNotification: 1
|
||||||
|
}).then(sseRes => {
|
||||||
|
console.log(sseRes)
|
||||||
|
// _this.closeWsFn()
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
_this.chatMessageList[_this.chatMessageListLength - 1].isError = true
|
||||||
|
_this.chatMessageList[_this.chatMessageListLength - 1].content = _this.errorMsg
|
||||||
|
_this.chatMessageList[_this.chatMessageListLength - 1].nodes = _this.errorMsg
|
||||||
|
_this.closeWsFn()
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
_this.chatMessageList[_this.chatMessageListLength - 1].isError = true
|
||||||
|
_this.chatMessageList[_this.chatMessageListLength - 1].content = _this.errorMsg
|
||||||
|
_this.chatMessageList[_this.chatMessageListLength - 1].nodes = _this.errorMsg
|
||||||
|
_this.closeWsFn()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closeWsFn() {
|
||||||
|
this.loading = false
|
||||||
|
if (this.chatMessageListLength) {
|
||||||
|
this.chatMessageList[this.chatMessageListLength - 1].showCursor = false
|
||||||
|
}
|
||||||
|
uni.closeSocket({
|
||||||
|
success: () => {
|
||||||
|
console.log('-----关闭连接')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.scrollToBottomHandle()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
initWebSocket(cb) {
|
||||||
|
const _this = this
|
||||||
|
console.log('------------------创建连接')
|
||||||
|
uni.connectSocket({
|
||||||
|
url: VUE_APP_API_URL.replace('https', 'wss') + settings.sysPrefix + `v1/chat/websocket/${_this.userInfo.unionId}`,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json'
|
||||||
|
},
|
||||||
|
timeout: 10 * 1000,
|
||||||
|
success: () => {
|
||||||
|
console.log('------------WebSocket初始化成功')
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
uni.showModal({
|
||||||
|
showCancel: false,
|
||||||
|
content: err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
uni.onSocketMessage(res => {
|
||||||
|
_this.websocketOnmessage(res)
|
||||||
|
})
|
||||||
|
uni.onSocketOpen(() => {
|
||||||
|
cb && cb()
|
||||||
|
_this.websocketOnopen()
|
||||||
|
})
|
||||||
|
uni.onSocketError(err => {
|
||||||
|
_this.websocketOnerror(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
websocketOnmessage(res) {
|
||||||
|
console.log('-------------监听 WebSocket 接受到服务器的消息事件')
|
||||||
|
const resData = JSON.parse(res.data)
|
||||||
|
if (resData) {
|
||||||
|
const message = resData.message
|
||||||
|
if (message && this.chatMessageListLength > 1) {
|
||||||
|
const mesContent = message.content
|
||||||
|
this.chatMessageList[this.chatMessageListLength - 1].nodes = formatAiMsgContent(mesContent)
|
||||||
|
this.chatMessageList[this.chatMessageListLength - 1].content = mesContent
|
||||||
|
this.chatMessageList[this.chatMessageListLength - 1].listQuestion = message.listQuestion || []
|
||||||
|
this.$forceUpdate()
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.scrollToBottomHandle()
|
||||||
|
if (message.finish) {
|
||||||
|
this.closeWsFn()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
websocketOnopen() {
|
||||||
|
console.log('------------------监听 WebSocket 连接打开事件')
|
||||||
|
// this.websocketSend(JSON.stringify({ msg: '1' }))
|
||||||
|
},
|
||||||
|
websocketOnerror(e) {
|
||||||
|
console.log('-----------------监听 WebSocket 错误事件')
|
||||||
|
console.log(e)
|
||||||
|
},
|
||||||
|
websocketSend(msg) {
|
||||||
|
// 数据发送
|
||||||
|
try {
|
||||||
|
uni.sendSocketMessage({
|
||||||
|
data: msg,
|
||||||
|
success: () => {
|
||||||
|
console.log('-----------发送消息成功了')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.log('send failed (' + err.code + ')')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
// 引入markdown-it库
|
||||||
|
import MarkdownIt from './/markdown-it.min.js'
|
||||||
|
// hljs是由 Highlight.js 经兼容性修改后的文件,请勿直接升级。否则会造成uni-app-vue3-Android下有兼容问题
|
||||||
|
import hljs from './highlight/highlight-uni.min.js'
|
||||||
|
|
||||||
|
// 初始化 MarkdownIt库
|
||||||
|
const markdownIt = MarkdownIt({
|
||||||
|
// 在源码中启用 HTML 标签
|
||||||
|
html: true,
|
||||||
|
// 如果结果以 <pre ... 开头,内部包装器则会跳过。
|
||||||
|
highlight: function(str, lang) {
|
||||||
|
// if (lang && hljs.getLanguage(lang)) {
|
||||||
|
// console.error('lang', lang)
|
||||||
|
// try {
|
||||||
|
// return '<pre class="hljs" style="padding: 5px 8px;margin: 5px 0;overflow: auto;display: block;"><code>' +
|
||||||
|
// hljs.highlight('lang', str, true).value +
|
||||||
|
// '</code></pre>';
|
||||||
|
// } catch (__) {}
|
||||||
|
// }
|
||||||
|
// 经过highlight.js处理后的html
|
||||||
|
let preCode = ''
|
||||||
|
try {
|
||||||
|
preCode = hljs.highlightAuto(str).value
|
||||||
|
} catch (err) {
|
||||||
|
preCode = markdownIt.utils.escapeHtml(str)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 以换行进行分割
|
||||||
|
const lines = preCode.split(/\n/).slice(0, -1)
|
||||||
|
// 添加自定义行号
|
||||||
|
let html = lines.map((item, index) => {
|
||||||
|
// 去掉空行
|
||||||
|
if (item === '') {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return '<li><span class="line-num" data-line="' + (index + 1) + '"></span>' + item + '</li>'
|
||||||
|
}).join('')
|
||||||
|
html = '<ol style="padding: 0px 30px;">' + html + '</ol>'
|
||||||
|
let htmlCode = `<div style="background:#0d1117;margin-top: 5px;color: #888;padding:5px 0;border-radius: 5px;">`
|
||||||
|
htmlCode += `<pre class="hljs" style="padding:0 8px;margin-bottom:5px;overflow: auto;display: block;border-radius: 5px;"><code>${html}</code></pre>`
|
||||||
|
htmlCode += '</div>'
|
||||||
|
return htmlCode
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export function formatAiMsgContent(val) {
|
||||||
|
if (!val) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
let htmlString = ''
|
||||||
|
// 修改转换结果的htmlString值 用于正确给界面增加鼠标闪烁的效果
|
||||||
|
// 判断markdown中代码块标识符的数量是否为偶数
|
||||||
|
if (val.split('```').length % 2) {
|
||||||
|
let msgContent = val
|
||||||
|
if (msgContent[msgContent.length - 1] !== '\n') {
|
||||||
|
msgContent += '\n'
|
||||||
|
}
|
||||||
|
msgContent += ' <span class="cursor">|</span>'
|
||||||
|
htmlString = markdownIt.render(msgContent)
|
||||||
|
} else {
|
||||||
|
htmlString = markdownIt.render(val)
|
||||||
|
htmlString = markdownIt.render(val) + ' \n <span class="cursor">|</span>'
|
||||||
|
}
|
||||||
|
// console.log(htmlString)
|
||||||
|
return htmlString
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简单实现防抖方法
|
||||||
|
*
|
||||||
|
* 防抖(debounce)函数在第一次触发给定的函数时,不立即执行函数,而是给出一个期限值(delay),比如100ms。
|
||||||
|
* 如果100ms内再次执行函数,就重新开始计时,直到计时结束后再真正执行函数。
|
||||||
|
* 这样做的好处是如果短时间内大量触发同一事件,只会执行一次函数。
|
||||||
|
*
|
||||||
|
* @param fn 要防抖的函数
|
||||||
|
* @param delay 防抖的毫秒数
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
export function simpleDebounce(fn, delay = 100) {
|
||||||
|
let timer = null
|
||||||
|
return function() {
|
||||||
|
const args = arguments
|
||||||
|
if (timer) {
|
||||||
|
clearTimeout(timer)
|
||||||
|
}
|
||||||
|
timer = setTimeout(() => {
|
||||||
|
fn.apply(null, args)
|
||||||
|
}, delay)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
|
||||||
|
Theme: GitHub Dark
|
||||||
|
Description: Dark theme as seen on github.com
|
||||||
|
Author: github.com
|
||||||
|
Maintainer: @Hirse
|
||||||
|
Updated: 2021-05-15
|
||||||
|
|
||||||
|
Outdated base version: https://github.com/primer/github-syntax-dark
|
||||||
|
Current colors taken from GitHub's CSS
|
||||||
|
*/.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}
|
||||||
@@ -0,0 +1,360 @@
|
|||||||
|
<template>
|
||||||
|
<view
|
||||||
|
:class="scrollTop > 0 ? 'page-scroll' : ''"
|
||||||
|
class="fix-tabbar-page"
|
||||||
|
>
|
||||||
|
<hx-navbar
|
||||||
|
:back="true"
|
||||||
|
:fixed="true"
|
||||||
|
:statusBar="true"
|
||||||
|
:pageScroll.sync="scrollData"
|
||||||
|
:title="pageTitle"
|
||||||
|
color="#333"
|
||||||
|
transparent="auto"
|
||||||
|
barPlaceholder="hidden"
|
||||||
|
/>
|
||||||
|
<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="webUrl + '/aiChat/avatar.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
|
||||||
|
v-if="!item.showCursor && item.nodes && item.nodes.length && !item.isError"
|
||||||
|
class="bottom-btns"
|
||||||
|
>
|
||||||
|
<!-- <button
|
||||||
|
open-type="share"
|
||||||
|
plain="true"
|
||||||
|
class="item"
|
||||||
|
@click="shareHandle"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/icon-25.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
分享
|
||||||
|
</button> -->
|
||||||
|
<view class="item" @click="copyContentHandle(item.content)">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-02.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
复制
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="index === (chatMessageListLength - 1)"
|
||||||
|
class="item"
|
||||||
|
@click="regenerateHandle(item)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-04.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
重新生成
|
||||||
|
</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="item-cont">
|
||||||
|
<view class="txt">
|
||||||
|
{{ question }}
|
||||||
|
</view>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-03.png'"
|
||||||
|
class="pic"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view id="bottom_postion" class="bottom-postion" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
:class="{
|
||||||
|
'focus': onFocus
|
||||||
|
}"
|
||||||
|
:style="{
|
||||||
|
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
|
||||||
|
}"
|
||||||
|
class="page-to-bottom"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
v-if="chatMessageListLength > 0 && !isScrollToBottom && !loading"
|
||||||
|
:src="webUrl + '/aiChat/down.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
@click="scrollToBottomHandle"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<bottom-send
|
||||||
|
ref="bottomSend"
|
||||||
|
:loading="loading"
|
||||||
|
:keyboard-height="keyboardHeight"
|
||||||
|
@send="streamReq"
|
||||||
|
@history="historyViewHandle"
|
||||||
|
@focus="inputFocusHandle"
|
||||||
|
/>
|
||||||
|
<AiHistoryList
|
||||||
|
ref="historyView"
|
||||||
|
:status-bar-height="statusBarHeight"
|
||||||
|
form-module="history"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { chatMixins } from '../mixins/chatMixins.js'
|
||||||
|
import AiHistoryList from '../components/historyList'
|
||||||
|
import BottomSend from '../components/bottomSend.vue'
|
||||||
|
import {
|
||||||
|
historyChatMessage
|
||||||
|
} from '@/api/chat/index'
|
||||||
|
import { formatAiMsgContent } from '../utils/aiChat'
|
||||||
|
export default {
|
||||||
|
name: 'AiChatHistoryPage',
|
||||||
|
components: {
|
||||||
|
AiHistoryList,
|
||||||
|
BottomSend
|
||||||
|
},
|
||||||
|
mixins: [chatMixins],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageTitle: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(optisons) {
|
||||||
|
console.log(optisons)
|
||||||
|
this.chatNumber = optisons.chatNumber
|
||||||
|
this.pageTitle = optisons.title
|
||||||
|
this.pageTitle = this.pageTitle.length > 8 ? (this.pageTitle.substring(0, 8) + '...') : this.pageTitle
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
this.loading = true
|
||||||
|
historyChatMessage({
|
||||||
|
chatNumber: this.chatNumber
|
||||||
|
}).then(res => {
|
||||||
|
const { success, data = [] } = res
|
||||||
|
if (success) {
|
||||||
|
this.loading = false
|
||||||
|
try {
|
||||||
|
data.map(item => {
|
||||||
|
if (item.role === 'user') {
|
||||||
|
this.chatMessageList.push({
|
||||||
|
type: -1,
|
||||||
|
prompt: item.content
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (item.contentType === 'text') {
|
||||||
|
this.chatMessageList.push({
|
||||||
|
...item,
|
||||||
|
nodes: formatAiMsgContent(item.content),
|
||||||
|
prompt: this.getParentPrompt(data, item.parentMessageId),
|
||||||
|
conversationId: item.messageId,
|
||||||
|
showCursor: false,
|
||||||
|
listQuestion: item.listQuestion || [],
|
||||||
|
type: -2
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '错误提示',
|
||||||
|
content: JSON.stringify(err)
|
||||||
|
})
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getParentPrompt(list = '', parentMessageId) {
|
||||||
|
let prompt = ''
|
||||||
|
list.map(item => {
|
||||||
|
if (item.messageId === parentMessageId) {
|
||||||
|
prompt = item.content
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return prompt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.chat-wrap {
|
||||||
|
padding: 0 0 180rpx 0;
|
||||||
|
.chat-info-wrap {
|
||||||
|
padding: 24rpx;
|
||||||
|
.chat-list-wrap2 {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.loading-wrap {
|
||||||
|
text-align: center;
|
||||||
|
color: #666;
|
||||||
|
line-height: 120rpx;
|
||||||
|
}
|
||||||
|
.rich-text-box {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
.show-cursor .cursor {
|
||||||
|
display: inline-block;
|
||||||
|
color: #3D4CF1;
|
||||||
|
font-weight: bold;
|
||||||
|
animation: blinking 1s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blinking {
|
||||||
|
from {
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.focus-guide-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 60rpx 40rpx;
|
||||||
|
.guide-left {
|
||||||
|
.avatar {
|
||||||
|
display: block;
|
||||||
|
width: 267rpx;
|
||||||
|
height: 530rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.guide-right {
|
||||||
|
padding: 30rpx;
|
||||||
|
margin: 0 0 0 40rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0rpx 12rpx 30rpx rgba(0,0,0,0.1);
|
||||||
|
.title {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 30rpx 0 0 0;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.topic-wrap {
|
||||||
|
width: 100%;
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
.txt {
|
||||||
|
width: 186rpx;
|
||||||
|
height: 46rpx;
|
||||||
|
margin: 0 20rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 46rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 26rpx;
|
||||||
|
background-color: #3D4CF1;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
display: flex;
|
||||||
|
width: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list-wrap {
|
||||||
|
width: 100%;
|
||||||
|
margin: 60rpx 0 0 0;
|
||||||
|
overflow-x: auto;
|
||||||
|
.list-cont {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 150%;
|
||||||
|
.list-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 40rpx;
|
||||||
|
padding: 0 12rpx;
|
||||||
|
margin: 0 30rpx 30rpx 0;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
background: rgba(255,255,255,0.39);
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.1);
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin: 0 8rpx 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,444 @@
|
|||||||
|
<template>
|
||||||
|
<view
|
||||||
|
:class="scrollTop > 0 ? 'page-scroll' : ''"
|
||||||
|
class="fix-tabbar-page"
|
||||||
|
>
|
||||||
|
<hx-navbar
|
||||||
|
:back="false"
|
||||||
|
:fixed="true"
|
||||||
|
:statusBar="true"
|
||||||
|
:pageScroll.sync="scrollData"
|
||||||
|
left-icon="arrowleft"
|
||||||
|
color="#333"
|
||||||
|
transparent="auto"
|
||||||
|
barPlaceholder="hidden"
|
||||||
|
title="云灵AI智能助手"
|
||||||
|
@click-left="clickBackHandle"
|
||||||
|
/>
|
||||||
|
<view
|
||||||
|
id="fixTbabarBody"
|
||||||
|
:style="{
|
||||||
|
'padding-top': (44 + statusBarHeight) + 'px'
|
||||||
|
}"
|
||||||
|
class="fix-tabbar-body"
|
||||||
|
>
|
||||||
|
<block v-if="chatMessageListLength < 1">
|
||||||
|
<view class="home-focus-wrap">
|
||||||
|
<view class="focus-guide-wrap">
|
||||||
|
<view class="guide-left">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/logo-01.gif'"
|
||||||
|
class="avatar"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="guide-right">
|
||||||
|
<view class="trangle" />
|
||||||
|
<view class="title">{{ settingInfo.helloMessageTitle }}</view>
|
||||||
|
<view class="content">{{ settingInfo.helloMessageContent }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="topic-wrap">
|
||||||
|
<view class="title">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-01.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
<view class="txt">#大家都在问</view>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-01.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="list-wrap">
|
||||||
|
<view
|
||||||
|
:style="{
|
||||||
|
'width': animationWidth,
|
||||||
|
'animation': animationStr
|
||||||
|
}"
|
||||||
|
class="list-cont"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in topicList"
|
||||||
|
:key="index"
|
||||||
|
class="list-item"
|
||||||
|
@click="topicItemClickHandle(item.title)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
v-if="item.isHot"
|
||||||
|
:src="webUrl + '/aiChat/hot.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
{{ item.title }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<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="webUrl + '/aiChat/avatar.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="loading2" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="!item.showCursor && item.nodes && item.nodes.length && !item.isError"
|
||||||
|
class="bottom-btns"
|
||||||
|
>
|
||||||
|
<!-- <button
|
||||||
|
open-type="share"
|
||||||
|
plain="true"
|
||||||
|
class="item"
|
||||||
|
@click="shareHandle"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/icon-25.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
分享
|
||||||
|
</button> -->
|
||||||
|
<view class="item" @click="copyContentHandle(item.content)">
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-02.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
复制
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="index === (chatMessageListLength - 1)"
|
||||||
|
class="item"
|
||||||
|
@click="regenerateHandle(item)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-04.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
重新生成
|
||||||
|
</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="item-cont">
|
||||||
|
<view class="txt">
|
||||||
|
{{ question }}
|
||||||
|
</view>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-03.png'"
|
||||||
|
class="pic"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view id="bottom_postion" class="bottom-postion" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
:class="{
|
||||||
|
'focus': onFocus
|
||||||
|
}"
|
||||||
|
:style="{
|
||||||
|
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
|
||||||
|
}"
|
||||||
|
class="page-to-bottom"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
v-if="chatNumber"
|
||||||
|
class="new-chat"
|
||||||
|
@click="createNewHandle"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="webUrl + '/aiChat/icon-05.png'"
|
||||||
|
class="btn-icon"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
开启新对话
|
||||||
|
</view>
|
||||||
|
<image
|
||||||
|
v-if="chatMessageListLength > 0 && !isScrollToBottom && !loading"
|
||||||
|
:src="webUrl + '/aiChat/down.png'"
|
||||||
|
class="icon"
|
||||||
|
mode="widthFix"
|
||||||
|
@click="scrollToBottomHandle"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<bottom-send
|
||||||
|
ref="bottomSend"
|
||||||
|
:loading="loading"
|
||||||
|
:keyboard-height="keyboardHeight"
|
||||||
|
@send="streamReq"
|
||||||
|
@add="createNewHandle"
|
||||||
|
@history="historyViewHandle"
|
||||||
|
@focus="inputFocusHandle"
|
||||||
|
/>
|
||||||
|
<AiHistoryList
|
||||||
|
ref="historyView"
|
||||||
|
:status-bar-height="statusBarHeight"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { chatMixins } from '../mixins/chatMixins.js'
|
||||||
|
import {
|
||||||
|
getAiSystemInfoSetting,
|
||||||
|
getAiSystemInfoTopic
|
||||||
|
} from '@/api/public'
|
||||||
|
import AiHistoryList from '../components/historyList'
|
||||||
|
import BottomSend from '../components/bottomSend.vue'
|
||||||
|
export default {
|
||||||
|
name: 'AiChatIndexPage',
|
||||||
|
components: {
|
||||||
|
AiHistoryList,
|
||||||
|
BottomSend
|
||||||
|
},
|
||||||
|
mixins: [chatMixins],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
animationWidth: '150%',
|
||||||
|
animationStr: '',
|
||||||
|
settingInfo: {},
|
||||||
|
topicList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
createdCallbak() {
|
||||||
|
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`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
getAiSystemInfoTopic().then(res => {
|
||||||
|
const { success, data } = res
|
||||||
|
if (success) {
|
||||||
|
this.topicList = data || []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 创建新会话
|
||||||
|
createNewHandle() {
|
||||||
|
if (!this.chatNumber) return
|
||||||
|
this.closeWsFn()
|
||||||
|
this.chatNumber = ''
|
||||||
|
this.showCursor = false
|
||||||
|
this.loading = false
|
||||||
|
this.getConfigLoading = false
|
||||||
|
this.chatMessageList = []
|
||||||
|
},
|
||||||
|
clickBackHandle() {
|
||||||
|
console.log(1)
|
||||||
|
if (!this.chatNumber) {
|
||||||
|
if (getCurrentPages().length > 1) {
|
||||||
|
uni.navigateBack()
|
||||||
|
} else {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/home/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.createNewHandle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.chat-wrap {
|
||||||
|
padding: 0 0 180rpx 0;
|
||||||
|
.chat-info-wrap {
|
||||||
|
padding: 24rpx;
|
||||||
|
.chat-list-wrap2 {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.loading-wrap {
|
||||||
|
text-align: center;
|
||||||
|
color: #666;
|
||||||
|
line-height: 120rpx;
|
||||||
|
}
|
||||||
|
.rich-text-box {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
.show-cursor .cursor {
|
||||||
|
display: inline-block;
|
||||||
|
color: #3D4CF1;
|
||||||
|
font-weight: bold;
|
||||||
|
animation: blinking 1s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blinking {
|
||||||
|
from {
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.focus-guide-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 60rpx 40rpx;
|
||||||
|
.guide-left {
|
||||||
|
.avatar {
|
||||||
|
display: block;
|
||||||
|
width: 267rpx;
|
||||||
|
height: 530rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.guide-right {
|
||||||
|
position: relative;
|
||||||
|
padding: 30rpx;
|
||||||
|
margin: 0 0 0 40rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0rpx 12rpx 30rpx rgba(0,0,0,0.1);
|
||||||
|
.trangle {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 120rpx;
|
||||||
|
left: -15rpx;
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: -30rpx 12rpx 30rpx rgba(0,0,0,0.1);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
width: 110%;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 30rpx 0 0 0;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.topic-wrap {
|
||||||
|
width: 100%;
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
.txt {
|
||||||
|
width: 186rpx;
|
||||||
|
height: 46rpx;
|
||||||
|
margin: 0 20rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 46rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
background-color: #3D4CF1;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
display: flex;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list-wrap {
|
||||||
|
width: 100%;
|
||||||
|
margin: 60rpx 0 0 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
.list-cont {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 750 * 1.5rpx;
|
||||||
|
padding: 0 0 0 24rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
// animation: translateXSwiper 10s infinite linear alternate;
|
||||||
|
.list-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 48rpx;
|
||||||
|
padding: 0 18rpx;
|
||||||
|
margin: 0 30rpx 30rpx 0;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
background: rgba(255,255,255,0.39);
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.1);
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin: 0 8rpx 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes translateXSwiper {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getSseConfigV1(data) {
|
||||||
|
return request.post('/v1/chat/sse/message', data, { login: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCompletions(params) {
|
||||||
|
return request.get('/v1/chat/sse/completions', params, { login: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteChatItemByConversationId(id) {
|
||||||
|
return request.delete('/v1/chat/message/' + id, {}, { login: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getChatList(params) {
|
||||||
|
return request.get('/v1/chat', params, { login: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function historyChatMessage(params) {
|
||||||
|
return request.get('/v1/chat/message', params, { login: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteChatListByType(type) {
|
||||||
|
return request.delete('/v1/chat/type/' + type, {}, { login: true })
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getAction(url, params) {
|
||||||
|
return request.get(url, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function postAction(url, data) {
|
||||||
|
return request.post(url, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function putAction(url, data) {
|
||||||
|
return request.put(url, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteAction(url, data) {
|
||||||
|
return request.delete(url, data)
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ export function getSplashScreen() {
|
|||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
export function getHomeData(params) {
|
export function getHomeData(params) {
|
||||||
return request.get("index", params, {
|
return request.get("/index", params, {
|
||||||
login: false
|
login: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -211,4 +211,14 @@ export function getXiaoZhi() {
|
|||||||
|
|
||||||
export function pushSystemStatic(data) {
|
export function pushSystemStatic(data) {
|
||||||
return request.post("/systemStats/push", data, { login: false })
|
return request.post("/systemStats/push", data, { login: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取AI系统设置
|
||||||
|
export function getAiSystemInfoSetting() {
|
||||||
|
return request.get('/ai/systemInfo', {}, { login: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取AI系统预设话题列表
|
||||||
|
export function getAiSystemInfoTopic() {
|
||||||
|
return request.get('/ai/systemTopic', {}, { login: false })
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function makeFileTransTask(data) {
|
||||||
|
return request.post('/app/voiceToText/makeFileTransTask', data, { login: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getFileTransResult(data) {
|
||||||
|
return request.post('/app/voiceToText/getFileTransResult', data, { login: true })
|
||||||
|
}
|
||||||
@@ -0,0 +1,922 @@
|
|||||||
|
page {
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.flex-center-between {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.fix-tabbar-page {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100vh;
|
||||||
|
background: linear-gradient(155deg, rgba(61, 76, 241, 0.15) 0%, rgba(255,255,255,1) 25%, rgba(255,255,255,1) 75%, rgba(61, 76, 241, 0.15) 100%);
|
||||||
|
// background-color: #fff;
|
||||||
|
// background-size: 100% 100vh;
|
||||||
|
// background-image: url(https://wxapp.xdd618.com/api/file/pic/aiChat/bg.png);
|
||||||
|
// background-repeat: no-repeat;
|
||||||
|
// background-attachment: fixed;
|
||||||
|
.fix-tabbar-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 99;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 44px;
|
||||||
|
padding-left: 24rpx;
|
||||||
|
// background-color: #fff;
|
||||||
|
transition: all 0.15s;
|
||||||
|
.my-icon {
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 54rpx;
|
||||||
|
height: 54rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tabbar-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 0 0 20rpx;
|
||||||
|
.tabbar-item {
|
||||||
|
position: relative;
|
||||||
|
margin: 0 0 0 20rpx;
|
||||||
|
.txt {
|
||||||
|
position: relative;
|
||||||
|
z-index: 5;
|
||||||
|
width: 112rpx;
|
||||||
|
font-size: 40rpx;
|
||||||
|
line-height: 48rpx;
|
||||||
|
color: #707070;
|
||||||
|
}
|
||||||
|
.bg {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
right: 0;
|
||||||
|
bottom: -8rpx;
|
||||||
|
opacity: 0;
|
||||||
|
.img {
|
||||||
|
display: block;
|
||||||
|
width: 112rpx;
|
||||||
|
height: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.curr {
|
||||||
|
.txt {
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 48rpx;
|
||||||
|
}
|
||||||
|
.bg {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.new-chat-btn {
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 54rpx;
|
||||||
|
height: 54rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.fix-tabbar-body {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
min-height: 100vh;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.page-to-bottom {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 180rpx;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 8;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
transition: all 0.2s;
|
||||||
|
&.focus {
|
||||||
|
// transform: translateY(-40rpx);
|
||||||
|
}
|
||||||
|
.new-chat {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 68rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
line-height: 68rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.16);
|
||||||
|
.btn-icon {
|
||||||
|
display: block;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rrpx;
|
||||||
|
margin: 0 8rpx 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 68rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
margin: 0 0 0 24rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.fix-page-bottom {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 9;
|
||||||
|
padding: 24rpx 24rpx 48rpx 24rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
transition: all 0.2s;
|
||||||
|
&.focus {
|
||||||
|
// transform: translateY(-40rpx);
|
||||||
|
}
|
||||||
|
.bottom-body {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
min-height: 100rpx;
|
||||||
|
.history-wrap {
|
||||||
|
width: 98rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 100rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0rpx 6rpx 20rpx rgba(19,27,65,0.16);
|
||||||
|
}
|
||||||
|
.input-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 100rpx;
|
||||||
|
width: calc(100% - 122rpx);
|
||||||
|
padding: 6rpx 6rpx 6rpx 24rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0rpx 6rpx 20rpx rgba(19,27,65,0.16);
|
||||||
|
}
|
||||||
|
.input-model {
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.input-wrap {
|
||||||
|
position: relative;
|
||||||
|
width: calc(100% - 160rpx);
|
||||||
|
.inp {
|
||||||
|
position: relative;
|
||||||
|
z-index: 5;
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
border: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
line-height: 88rpx;
|
||||||
|
color: #333;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
.placeholder-txt {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 50%;
|
||||||
|
z-index: 2;
|
||||||
|
color: #999;
|
||||||
|
font-size: 28rpx;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.send-btn {
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 88rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sound-input-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex: 1;
|
||||||
|
height: 100rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 30rpx;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0rpx 6rpx 20rpx rgba(19,27,65,0.16);
|
||||||
|
.toggle-btn {
|
||||||
|
.input-icon {
|
||||||
|
display: block;
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sound-wrap {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
margin: 0 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.has-bg-body {
|
||||||
|
position: relative;
|
||||||
|
.bg {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 2;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cont {
|
||||||
|
position: relative;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.page-fff {
|
||||||
|
.fix-tabbar-header {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.fix-tabbar-body {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.page-scroll {
|
||||||
|
.fix-tabbar-header {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.page-fff-linear-fff {
|
||||||
|
.fix-tabbar-header {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.fix-tabbar-body {
|
||||||
|
background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,234,216,0.67) 75%, rgba(255,255,255,0) 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.fix-page-back {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
z-index: 8;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12rpx 24rpx;
|
||||||
|
border-radius: 0 28rpx 28rpx 0;
|
||||||
|
background-color: #fff;
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
&.bg {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.article-back-wrap {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.article-back-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 80rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
border-radius: 40rpx 40rpx 40rpx 0;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
background: linear-gradient(45deg, #FA9108 0%, #FFC25C 100%);
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.16);
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.chat-list-wrap {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
padding: 24rpx;
|
||||||
|
.chat-message-item + .chat-message-item {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
}
|
||||||
|
.chat-message-item {
|
||||||
|
.res-time {
|
||||||
|
text-align: center;
|
||||||
|
padding: 12rpx 0;
|
||||||
|
color: #BEBEBE;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
.chat-message-body {
|
||||||
|
.chat-avatar {
|
||||||
|
display: block;
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
margin: 0 0 8rpx 0;
|
||||||
|
}
|
||||||
|
.item-left {
|
||||||
|
display: flex;
|
||||||
|
.txt {
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 32rpx;
|
||||||
|
border-radius: 0 40rpx 40rpx 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #333;
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 48rpx;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.web-info-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 0 24rpx 0;
|
||||||
|
.info-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
.icon {
|
||||||
|
margin: 0 8rpx 0 0;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
.info-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.img-list {
|
||||||
|
display: flex;
|
||||||
|
margin: 0 8rpx 0 0;
|
||||||
|
.web-logo {
|
||||||
|
display: block;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 0 -6rpx 0 0;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.web-info-body {
|
||||||
|
height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: all 0.2s;
|
||||||
|
.web-item + .web-item {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
.web-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.web-logo {
|
||||||
|
display: block;
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.web-txt {
|
||||||
|
width: calc(100% - 50rpx);
|
||||||
|
margin: 0 0 0 14rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #1F37DC;
|
||||||
|
line-height: 36rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.show-web-body {
|
||||||
|
height: auto;
|
||||||
|
padding: 12rpx 0 20rpx 0;
|
||||||
|
margin: 0 0 20rpx 0;
|
||||||
|
border-bottom: 1rpx solid #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.suggestion-wrap {
|
||||||
|
.title {
|
||||||
|
padding: 24rpx 0 0 0;
|
||||||
|
color: #999;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 38rpx;
|
||||||
|
}
|
||||||
|
.suggestion-list {
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
.item-cont {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 44rpx;
|
||||||
|
padding: 12rpx 20rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
margin: 24rpx 0 0 0;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #333;
|
||||||
|
line-height: 44rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.1);
|
||||||
|
.txt {
|
||||||
|
flex: 1;
|
||||||
|
max-width: calc(100% - 80rpx);
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.pic {
|
||||||
|
display: block;
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item-right {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
.txt {
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 20rpx 32rpx;
|
||||||
|
border-radius: 40rpx 40rpx 0 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 48rpx;
|
||||||
|
background: #3D4CF1;
|
||||||
|
box-shadow: 0rpx 6rpx 12rpx rgba(0,0,0,0.16);
|
||||||
|
.copy-btn {
|
||||||
|
display: inline-block;
|
||||||
|
margin: -6rpx 0 0 12rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.bottom-btns {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding: 20rpx 0 0 0;
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin: 0 48rpx 0 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
color: #999;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: none;
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
margin: 0 6rpx 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info-list-wrap {
|
||||||
|
padding: 24rpx 12rpx 80rpx 12rpx;
|
||||||
|
margin: 24rpx 0 0 0;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
background: linear-gradient(180deg, #FEF1D4 0%, rgba(255,234,216,0.67) 57%, rgba(255,255,255,0) 100%);
|
||||||
|
.info-header {
|
||||||
|
padding: 0 24rpx;
|
||||||
|
.total {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333;
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
}
|
||||||
|
.num {
|
||||||
|
margin: 0 8rpx;
|
||||||
|
color: #FA9108;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sub-header {
|
||||||
|
padding: 12rpx 0 0 0;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
.blue {
|
||||||
|
color: #1634FF;
|
||||||
|
}
|
||||||
|
.date {
|
||||||
|
color: #999;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info-new-item {
|
||||||
|
padding: 24rpx;
|
||||||
|
margin: 16rpx 0 0 0;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
.title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 44rpx;
|
||||||
|
}
|
||||||
|
.desc {
|
||||||
|
padding: 24rpx 0 12rpx 0;
|
||||||
|
color: #999;
|
||||||
|
font-size: 24rpx;
|
||||||
|
.orgin {
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
margin: 0 6rpx 0 20rpx;
|
||||||
|
&:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.date {
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.relate-wrap {
|
||||||
|
padding: 20rpx;
|
||||||
|
margin: 0 12rpx;
|
||||||
|
border-radius: 20rpx 20rpx 20rpx 0;
|
||||||
|
background-color: #fff;
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 40rpx;
|
||||||
|
color: #1634FF;
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 20rpx 20rpx 0 20rpx;
|
||||||
|
.item {
|
||||||
|
margin: 0 24rpx 24rpx 0;
|
||||||
|
color: #151E5D;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.article-body {
|
||||||
|
padding: 24rpx;
|
||||||
|
}
|
||||||
|
.article-html-wrap {
|
||||||
|
padding: 24rpx;
|
||||||
|
margin: 24rpx 0 0 0;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
.article-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 44rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.article-time {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
.icon {
|
||||||
|
display: block;
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
margin: 0 0 0 40rpx;
|
||||||
|
&:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.bottom-postion {
|
||||||
|
width: 100%;
|
||||||
|
height: 60rpx;
|
||||||
|
}
|
||||||
|
.rich-text-box {
|
||||||
|
max-width: 100%;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
word-break: normal;
|
||||||
|
white-space: initial;
|
||||||
|
.cursor {
|
||||||
|
color: #3D4CF1;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.show-cursor {
|
||||||
|
.cursor {
|
||||||
|
color: #3D4CF1;
|
||||||
|
opacity: 1;
|
||||||
|
animation: blinking 1s infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes blinking {
|
||||||
|
from {
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*==================首页跑马灯效果动画====================*/
|
||||||
|
// todo:用循环函数生成存在语法报错At-rule options not recognised,后期再仔细阅读官方文档,解决@keyframes关键字问题
|
||||||
|
@keyframes TranslateXSwiper-15 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 0.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-20 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 1rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-25 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 1.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-30 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 2rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-35 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 2.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-40 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 3rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-45 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 3.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-50 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 4rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-55 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 4.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-60 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-65 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 5.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-70 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 6rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-75 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 6.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-80 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 7rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-85 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 7.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-90 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 8rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-95 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 8.5rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes TranslateXSwiper-100 {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateX(-750 * 9rpx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.loader-wrap {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
.loader {
|
||||||
|
width: 25px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
display: grid;
|
||||||
|
border: 2px solid #0000;
|
||||||
|
border-radius: 50%;
|
||||||
|
border-color: #ccc #0000;
|
||||||
|
animation: l16 1s infinite linear;
|
||||||
|
}
|
||||||
|
.loader::before,
|
||||||
|
.loader::after {
|
||||||
|
content: " ";
|
||||||
|
grid-area: 1/1;
|
||||||
|
margin: 2px;
|
||||||
|
border: inherit;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.loader::before {
|
||||||
|
border-color: #3D4CF1 #0000;
|
||||||
|
animation: inherit;
|
||||||
|
animation-duration: .5s;
|
||||||
|
animation-direction: reverse;
|
||||||
|
}
|
||||||
|
.loader::after {
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
@keyframes l16 {
|
||||||
|
100%{transform: rotate(1turn)}
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading2 {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border: 2px solid #3D4CF1;
|
||||||
|
border-top-color: transparent;
|
||||||
|
border-radius: 100%;
|
||||||
|
animation: circle infinite 0.75s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转转转动画
|
||||||
|
@keyframes circle {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.music-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100rpx;
|
||||||
|
transform: scale(0.5) translateX(50%);
|
||||||
|
.item {
|
||||||
|
width: 6px;
|
||||||
|
margin: 0 8rpx;
|
||||||
|
border-radius: 6px;
|
||||||
|
background-color: #3D4CF1;
|
||||||
|
}
|
||||||
|
.one {
|
||||||
|
height: 86rpx;
|
||||||
|
animation: radius-animation .58s infinite linear;
|
||||||
|
}
|
||||||
|
.two {
|
||||||
|
height: 50rpx;
|
||||||
|
animation: radius-animation .6s infinite linear;
|
||||||
|
}
|
||||||
|
.three {
|
||||||
|
height: 76rpx;
|
||||||
|
animation: radius-animation .57s infinite linear;
|
||||||
|
}
|
||||||
|
.four {
|
||||||
|
height: 100rpx;
|
||||||
|
animation: radius-animation .52s infinite linear;
|
||||||
|
}
|
||||||
|
.five {
|
||||||
|
height: 76rpx;
|
||||||
|
animation: radius-animation .4s infinite linear;
|
||||||
|
}
|
||||||
|
.six {
|
||||||
|
height: 50rpx;
|
||||||
|
animation: radius-animation .45s infinite linear;
|
||||||
|
}
|
||||||
|
.seven {
|
||||||
|
height: 86rpx;
|
||||||
|
animation: radius-animation .7s infinite linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.music-wrap2 {
|
||||||
|
transform: scale(0.5) translateX(-50%);
|
||||||
|
}
|
||||||
|
@keyframes radius-animation {
|
||||||
|
100% {
|
||||||
|
height: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -138,7 +138,10 @@ export default {
|
|||||||
deep: true
|
deep: true
|
||||||
},
|
},
|
||||||
cartNumber(val) {
|
cartNumber(val) {
|
||||||
console.log(+val <= 1 || val === '', 'cartNumber');
|
console.log(this.attr, 'cartNumber');
|
||||||
|
if (val > this.attrObj.productSelect.stock) {
|
||||||
|
val = this.attrObj.productSelect.stock
|
||||||
|
}
|
||||||
this.$emit('input', +val)
|
this.$emit('input', +val)
|
||||||
this.$emit("changeFun", { action: "ChangeCartNum", value: +val })
|
this.$emit("changeFun", { action: "ChangeCartNum", value: +val })
|
||||||
}
|
}
|
||||||
@@ -154,6 +157,10 @@ export default {
|
|||||||
this.cartNumber = 1
|
this.cartNumber = 1
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
}
|
}
|
||||||
|
if(+e > this.attrObj.productSelect.stock) {
|
||||||
|
this.cartNumber = this.attrObj.productSelect.stock
|
||||||
|
this.$forceUpdate()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
reRender(data) {
|
reRender(data) {
|
||||||
this.$set(this, 'attrObj', JSON.parse(JSON.stringify(data)))
|
this.$set(this, 'attrObj', JSON.parse(JSON.stringify(data)))
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<template>
|
||||||
|
<view v-if="showImg" class="ai-entrance">
|
||||||
|
<image
|
||||||
|
:src="settingInfo.mainImage"
|
||||||
|
mode="widthFix"
|
||||||
|
class="img"
|
||||||
|
@click="enterAiChat()"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getAiSystemInfoSetting
|
||||||
|
} from '@/api/public'
|
||||||
|
export default {
|
||||||
|
name: 'AiEntrance',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showImg: false,
|
||||||
|
settingInfo: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
getAiSystemInfoSetting().then(res => {
|
||||||
|
const { success, data } = res
|
||||||
|
if (success) {
|
||||||
|
this.settingInfo = data
|
||||||
|
this.showImg = data.showOnAppIndex === 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
enterAiChat() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/aiChat/views/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.ai-entrance {
|
||||||
|
position: fixed;
|
||||||
|
right: 0;
|
||||||
|
top: 50%;
|
||||||
|
z-index: 5;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
.img {
|
||||||
|
width: 88rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
const baseStr = 'edc_epro_prod:'
|
||||||
|
const settings = {
|
||||||
|
storage: {
|
||||||
|
systemInfo: `${baseStr}systemInfo`,
|
||||||
|
firstLaunch: `${baseStr}firstLaunch`,
|
||||||
|
token: `${baseStr}token`,
|
||||||
|
userInfo: `${baseStr}userInfo`,
|
||||||
|
webInfo: `${baseStr}webInfo`
|
||||||
|
},
|
||||||
|
/* 拦截器超时时长 */
|
||||||
|
timeout: 120 * 1000,
|
||||||
|
/* 系统接口前缀,没有统一的填空字符串 */
|
||||||
|
sysPrefix: '/',
|
||||||
|
/* 是否收集错误日志 */
|
||||||
|
collectRequestError: false
|
||||||
|
}
|
||||||
|
|
||||||
|
export default settings
|
||||||
@@ -617,7 +617,7 @@
|
|||||||
{
|
{
|
||||||
"path": "views/heritage",
|
"path": "views/heritage",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "非遗技艺"
|
"navigationBarTitleText": "非遗文创"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -629,14 +629,14 @@
|
|||||||
{
|
{
|
||||||
"path": "views/heritage/index",
|
"path": "views/heritage/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "非遗技艺",
|
"navigationBarTitleText": "非遗文创",
|
||||||
"navigationBarBackgroundColor": "#FAEED8"
|
"navigationBarBackgroundColor": "#FAEED8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "views/heritage/details",
|
"path": "views/heritage/details",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "非遗技艺",
|
"navigationBarTitleText": "非遗文创",
|
||||||
"navigationBarBackgroundColor": "#FAEED8"
|
"navigationBarBackgroundColor": "#FAEED8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -842,6 +842,27 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"root": "aiChat",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"path": "views/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "云灵AI智能助手",
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTextStyle": "white"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "views/history",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "云灵AI智能助手",
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTextStyle": "white"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"root": "v4",
|
"root": "v4",
|
||||||
"pages": [
|
"pages": [
|
||||||
@@ -961,26 +982,26 @@
|
|||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"pagePath": "pages/home/index",
|
"pagePath": "pages/home/index",
|
||||||
"iconPath": "static/tabbar/icon-home.png",
|
"iconPath": "/static/images/tabbar/tabbar-01-on.png",
|
||||||
"selectedIconPath": "static/tabbar/icon-home-hot.png",
|
"selectedIconPath": "/static/images/tabbar/tabbar-01-on.png",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/cloud/haveFun",
|
"pagePath": "pages/cloud/haveFun",
|
||||||
"iconPath": "static/tabbar/icon-land.png",
|
"iconPath": "/static/images/tabbar/tabbar-01-on.png",
|
||||||
"selectedIconPath": "static/tabbar/icon-land-hot.png",
|
"selectedIconPath": "/static/images/tabbar/tabbar-01-on.png",
|
||||||
"text": "寻趣味"
|
"text": "寻趣味"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/cart",
|
"pagePath": "pages/cart",
|
||||||
"iconPath": "static/tabbar/icon-cart.png",
|
"iconPath": "/static/images/tabbar/tabbar-01-on.png",
|
||||||
"selectedIconPath": "static/tabbar/icon-cart-hot.png",
|
"selectedIconPath": "/static/images/tabbar/tabbar-01-on.png",
|
||||||
"text": "购物车"
|
"text": "购物车"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/user/User/index",
|
"pagePath": "pages/user/User/index",
|
||||||
"iconPath": "static/tabbar/icon-user.png",
|
"iconPath": "/static/images/tabbar/tabbar-01-on.png",
|
||||||
"selectedIconPath": "static/tabbar/icon-user-hot.png",
|
"selectedIconPath": "/static/images/tabbar/tabbar-01-on.png",
|
||||||
"text": "我的"
|
"text": "我的"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ export default {
|
|||||||
const cartChooseAddress = uni.getStorageSync('cartChooseAddress') || {}
|
const cartChooseAddress = uni.getStorageSync('cartChooseAddress') || {}
|
||||||
if (cartChooseAddress.id) {
|
if (cartChooseAddress.id) {
|
||||||
this.addressInfo = cartChooseAddress
|
this.addressInfo = cartChooseAddress
|
||||||
uni.setStorageSync('cartChooseAddress', {})
|
// uni.setStorageSync('cartChooseAddress', {})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.getAddress()
|
this.getAddress()
|
||||||
@@ -452,7 +452,7 @@ export default {
|
|||||||
getAddressList({page: 1, limit: 9999}).then(res => {
|
getAddressList({page: 1, limit: 9999}).then(res => {
|
||||||
const { data = [] } = res
|
const { data = [] } = res
|
||||||
this.addressList = data
|
this.addressList = data
|
||||||
this.addressInfo = data.find(e => e.isDefault == 1) || (data && data[0]) || null
|
this.addressInfo = data.find(e => e.isDefault == 1) || uni.getStorageSync('cartChooseAddress') || (data && data[0]) || null
|
||||||
if (!this.addressInfo.id) {
|
if (!this.addressInfo.id) {
|
||||||
this.addressInfo = data.find(e => e.isDefault == 1) || (data && data[0]) || null
|
this.addressInfo = data.find(e => e.isDefault == 1) || (data && data[0]) || null
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,9 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="cloud-page">
|
<view class="cloud-page">
|
||||||
<view class="search-box">
|
<view class="search-box flex">
|
||||||
<uni-search-bar placeholder="输入搜索关键词" @confirm="search" @clear="clearName"></uni-search-bar>
|
<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>
|
||||||
|
|
||||||
<view class="nav-box">
|
<view class="nav-box">
|
||||||
<view
|
<view
|
||||||
v-for="(item, index) in typeList"
|
v-for="(item, index) in typeList"
|
||||||
@@ -12,370 +22,368 @@
|
|||||||
@click="changeType(index)"
|
@click="changeType(index)"
|
||||||
>
|
>
|
||||||
<image :src="item.icon" mode="scaleToFill"></image>
|
<image :src="item.icon" mode="scaleToFill"></image>
|
||||||
<view class="nav">{{item.name}}</view>
|
<view class="nav">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="list-box">
|
<view class="list-box">
|
||||||
<text class="type-name">{{typeList[type]['name']}}</text>
|
<view
|
||||||
|
v-if="hotelList.length"
|
||||||
<view class="city-box" @click="goCity('cloud')">
|
class="list"
|
||||||
<image :src="webUrl+'/20220903142929759087.png'" mode="scaleToFill"></image>
|
>
|
||||||
<text>{{cityName}}</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="list" v-if="hotelList.length">
|
|
||||||
<custom-waterfalls-flow :value="hotelList" imageKey="cover">
|
<custom-waterfalls-flow :value="hotelList" imageKey="cover">
|
||||||
<view class="item" v-for="(item,index) in hotelList" :key="index" slot="slot{{index}}"
|
<view
|
||||||
@click="goInnDetail(item)">
|
v-for="(item,index) in hotelList"
|
||||||
|
:key="index"
|
||||||
|
slot="slot{{index}}"
|
||||||
|
class="item"
|
||||||
|
@click="goInnDetail(item)"
|
||||||
|
>
|
||||||
<view class="cover-box">
|
<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">
|
<view class="my-mask">
|
||||||
<image class="icon" :src="webUrl+'/20220510142728577618.png'" mode="scaleToFill"></image>
|
<image
|
||||||
<text>{{item.cityName}}</text>
|
class="icon"
|
||||||
|
:src="webUrl+'/20220510142728577618.png'"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<text>{{ item.cityName }}</text>
|
||||||
</view>
|
</view>
|
||||||
</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;">
|
<view class="flex ai-center" style="margin-bottom: 18rpx;">
|
||||||
<image class="logo" :src="item.logo" mode="scaleToFill"></image>
|
<image
|
||||||
<text class="one-t">{{item.name}}</text>
|
class="logo"
|
||||||
|
:src="item.logo"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<text class="one-t">{{ item.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</custom-waterfalls-flow>
|
</custom-waterfalls-flow>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="v4-nodata" v-else>
|
<view class="v4-nodata" v-else>
|
||||||
<image src="@/static/images/img_nodata.png" mode="scaleToFill" />
|
<image src="@/static/images/img_nodata.png" mode="scaleToFill" />
|
||||||
<view class="text">暂无数据</view>
|
<view class="text">暂无数据</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import config from '@/utils/mapConfig';
|
import config from '@/utils/mapConfig'
|
||||||
import {
|
import {
|
||||||
getHotelTypeList,
|
getHotelTypeList,
|
||||||
getHotelList
|
getHotelList
|
||||||
} from "@/api/inn.js";
|
} from '@/api/inn.js'
|
||||||
|
export default {
|
||||||
export default {
|
data() {
|
||||||
data() {
|
return {
|
||||||
return {
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
typeList: [],
|
||||||
typeList: [],
|
name: '',
|
||||||
name: "",
|
page: 1,
|
||||||
page: 1,
|
type: 0,
|
||||||
type: 0,
|
// 跳转初始分类名
|
||||||
tabName: "", // 跳转初始分类名
|
tabName: '',
|
||||||
hotelList: [],
|
hotelList: [],
|
||||||
cityName: "丽江市",
|
cityName: '丽江市',
|
||||||
paramCity: ""
|
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()
|
getCurAddress() {
|
||||||
},
|
const that = this
|
||||||
onShow() {
|
//定位
|
||||||
let name = uni.getStorageSync("name");
|
uni.showLoading({
|
||||||
if (name) {
|
title: '定位中...'
|
||||||
this.tabName = name;
|
})
|
||||||
uni.removeStorageSync("name");
|
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")
|
// #ifndef H5
|
||||||
if (memCityName.length) {
|
uni.request({
|
||||||
this.cityName = memCityName;
|
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
|
||||||
this.paramCity = memCityName;
|
'&key=' + config.key,
|
||||||
this.page = 1;
|
success: function(res) {
|
||||||
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.
|
|
||||||
uni.hideLoading();
|
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()
|
that.fetchList()
|
||||||
}).catch(err => {
|
},
|
||||||
uni.hideLoading();
|
fail: function(res) {
|
||||||
})
|
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;
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
this.typeList = res.data
|
// #endif
|
||||||
|
},
|
||||||
let memCityName = uni.getStorageSync("cityName")
|
fail: function(res) {
|
||||||
if (memCityName.length) {
|
uni.hideLoading()
|
||||||
this.cityName = memCityName;
|
}
|
||||||
this.paramCity = memCityName;
|
})
|
||||||
this.page = 1;
|
},
|
||||||
this.list = [];
|
fetchTypeList() {
|
||||||
this.fetchList();
|
this.hotelList = []
|
||||||
|
getHotelTypeList().then(res => {
|
||||||
uni.removeStorageSync("cityName")
|
const { status, data } = res
|
||||||
} else {
|
if (status === 200) {
|
||||||
this.getCurAddress();
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
if (this.tabName == data[i].name) {
|
||||||
|
this.type = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
this.typeList = data
|
||||||
},
|
const memCityName = uni.getStorageSync('cityName')
|
||||||
search(e) {
|
if (memCityName.length) {
|
||||||
this.name = e.value;
|
this.cityName = memCityName
|
||||||
this.page = 1;
|
this.paramCity = memCityName
|
||||||
this.hotelList = [];
|
this.page = 1
|
||||||
this.fetchList();
|
this.list = []
|
||||||
},
|
this.fetchList()
|
||||||
|
uni.removeStorageSync('cityName')
|
||||||
clearName() {
|
} else {
|
||||||
this.name = "";
|
this.getCurAddress()
|
||||||
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: function(item) {
|
search(e) {
|
||||||
//跳转到客栈详情
|
this.name = e.value
|
||||||
this.$yrouter.push({
|
this.page = 1
|
||||||
path: "/pagesInn/inn/innHome",
|
this.hotelList = []
|
||||||
query: {
|
this.fetchList()
|
||||||
id: item.id
|
},
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.cloud-page {
|
.cloud-page {
|
||||||
.search-box {
|
.search-box {
|
||||||
padding: 0 12rpx;
|
padding: 0 12rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
||||||
/deep/.uni-searchbar__box {
|
/deep/.uni-searchbar__box {
|
||||||
border-radius: 44rpx !important;
|
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 {
|
text {
|
||||||
position: absolute;
|
color: #333;
|
||||||
right: 30rpx;
|
font-size: 28rpx;
|
||||||
display: inline-flex;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
align-items: center;
|
||||||
margin-left: 32rpx;
|
margin-left: 70rpx;
|
||||||
padding: 8rpx 18rpx 8rpx 16rpx;
|
|
||||||
border-radius: 30px;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 32rpx;
|
width: 64rpx;
|
||||||
height: 32rpx;
|
height: 64rpx;
|
||||||
margin-right: 4rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
text {
|
.nav {
|
||||||
color: #333;
|
color: #666;
|
||||||
font-size: 28rpx;
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-box {
|
.item:first-child {
|
||||||
display: flex;
|
margin-left: 0;
|
||||||
justify-content: space-between;
|
}
|
||||||
align-items: center;
|
}
|
||||||
padding: 16rpx 36rpx 24rpx;
|
|
||||||
background: #fff;
|
|
||||||
overflow-x: auto;
|
|
||||||
|
|
||||||
.item {
|
::-webkit-scrollbar {
|
||||||
display: flex;
|
display: none;
|
||||||
flex-direction: column;
|
}
|
||||||
align-items: center;
|
|
||||||
margin-left: 70rpx;
|
|
||||||
|
|
||||||
image {
|
.list-box {
|
||||||
width: 64rpx;
|
padding: 20rpx 32rpx;
|
||||||
height: 64rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav {
|
.type-name {
|
||||||
color: #666;
|
position: relative;
|
||||||
font-size: 24rpx;
|
font-size: 28rpx;
|
||||||
line-height: 34rpx;
|
line-height: 40rpx;
|
||||||
font-weight: bold;
|
color: #080F1A;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.item:first-child {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar {
|
.type-name::before {
|
||||||
display: none;
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 10rpx;
|
||||||
|
background: rgba(253, 104, 93, 0.39);
|
||||||
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-box {
|
.list {
|
||||||
padding: 20rpx 32rpx;
|
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;
|
position: relative;
|
||||||
font-size: 28rpx;
|
height: auto;
|
||||||
line-height: 40rpx;
|
|
||||||
color: #080F1A;
|
.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 {
|
.more-t {
|
||||||
content: "";
|
margin: 10rpx;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -353,6 +353,7 @@
|
|||||||
paddingBottom="200rpx"
|
paddingBottom="200rpx"
|
||||||
/>
|
/>
|
||||||
<FunctionGuide :maxStep="15" @hide="setGuide('index')" :guideData="functionGuideData" ref="FunctionGuide"></FunctionGuide>
|
<FunctionGuide :maxStep="15" @hide="setGuide('index')" :guideData="functionGuideData" ref="FunctionGuide"></FunctionGuide>
|
||||||
|
<AiEntrance />
|
||||||
<xdd-tabbar :curr-index="0" @getElementData="elementData" @getIcon="getIcon"/>
|
<xdd-tabbar :curr-index="0" @getElementData="elementData" @getIcon="getIcon"/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -368,6 +369,7 @@ import ProductWindow from '@/components/ProductWindow'
|
|||||||
import goCartMixin from '@/mixins/goCartMixins'
|
import goCartMixin from '@/mixins/goCartMixins'
|
||||||
import FunctionGuide from '@/components/FunctionGuide'
|
import FunctionGuide from '@/components/FunctionGuide'
|
||||||
import GuideMixins from '@/mixins/GuideMixins'
|
import GuideMixins from '@/mixins/GuideMixins'
|
||||||
|
import AiEntrance from '@/components/aiChat/entrance'
|
||||||
import {
|
import {
|
||||||
getSearchPageConfig
|
getSearchPageConfig
|
||||||
} from '@/api/search'
|
} from '@/api/search'
|
||||||
@@ -383,7 +385,8 @@ export default {
|
|||||||
XddTabbar,
|
XddTabbar,
|
||||||
XddProductItem,
|
XddProductItem,
|
||||||
ProductWindow,
|
ProductWindow,
|
||||||
FunctionGuide
|
FunctionGuide,
|
||||||
|
AiEntrance
|
||||||
},
|
},
|
||||||
mixins: [pageListenMixins, goCartMixin, GuideMixins],
|
mixins: [pageListenMixins, goCartMixin, GuideMixins],
|
||||||
data() {
|
data() {
|
||||||
@@ -450,6 +453,9 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
wx.offKeyboardHeightChange()
|
||||||
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
this.pageToHideHandle()
|
this.pageToHideHandle()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ export default {
|
|||||||
postOrderComputed(this.orderGroupInfo.orderKey, {
|
postOrderComputed(this.orderGroupInfo.orderKey, {
|
||||||
addressId: this.addressInfo.id,
|
addressId: this.addressInfo.id,
|
||||||
useIntegral: this.useIntegral ? 1 : 0,
|
useIntegral: this.useIntegral ? 1 : 0,
|
||||||
couponId: this.couponId || 0,
|
couponId: this.couponList.usable.length === 0 ? 0 : this.couponId || 0,
|
||||||
usePoints: this.usePointsCheck ? 1 : 0,
|
usePoints: this.usePointsCheck ? 1 : 0,
|
||||||
shipping_type: parseInt(shipping_type) + 1
|
shipping_type: parseInt(shipping_type) + 1
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
@@ -670,7 +670,7 @@ export default {
|
|||||||
phone: this.contactsTel,
|
phone: this.contactsTel,
|
||||||
addressId: this.addressInfo.id,
|
addressId: this.addressInfo.id,
|
||||||
useIntegral: this.useIntegral ? 1 : 0,
|
useIntegral: this.useIntegral ? 1 : 0,
|
||||||
couponId: this.couponId || 0,
|
couponId: this.couponList.usable.length === 0 ? 0 : this.couponId || 0,
|
||||||
usePoints: this.usePointsNumber || 0,
|
usePoints: this.usePointsNumber || 0,
|
||||||
payType: this.active,
|
payType: this.active,
|
||||||
pinkId: this.pinkId,
|
pinkId: this.pinkId,
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
item.district
|
item.district
|
||||||
}}{{ item.detail }}
|
}}{{ item.detail }}
|
||||||
</view>
|
</view>
|
||||||
|
<view v-if="currentId === item.id && choosMode" class="tip-icon">
|
||||||
|
<u-icon name="checkbox-mark" color="#C52733" size="20"></u-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!choosMode" class="operation acea-row row-between-wrapper">
|
<view v-if="!choosMode" class="operation acea-row row-between-wrapper">
|
||||||
<view class="select-btn">
|
<view class="select-btn">
|
||||||
@@ -93,6 +96,13 @@ export default {
|
|||||||
pageKeyId: Object.freeze('userAddressIndex')
|
pageKeyId: Object.freeze('userAddressIndex')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
// 当前地址id
|
||||||
|
currentId() {
|
||||||
|
const current = uni.getStorageSync('cartChooseAddress') || {}
|
||||||
|
return current.id || null
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.AddressList()
|
this.AddressList()
|
||||||
},
|
},
|
||||||
@@ -116,6 +126,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
tapAddress(item) {
|
tapAddress(item) {
|
||||||
|
console.log(item);
|
||||||
|
|
||||||
// 来源订单创建页面
|
// 来源订单创建页面
|
||||||
if (this.choosMode === 1) {
|
if (this.choosMode === 1) {
|
||||||
uni.setStorageSync('chooseAddress', item)
|
uni.setStorageSync('chooseAddress', item)
|
||||||
@@ -229,4 +241,9 @@ export default {
|
|||||||
margin-left: 32rpx;
|
margin-left: 32rpx;
|
||||||
margin-right: 32rpx;
|
margin-right: 32rpx;
|
||||||
}
|
}
|
||||||
|
.tip-icon{
|
||||||
|
position: absolute;
|
||||||
|
right: 10rpx;
|
||||||
|
bottom: 10rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -518,6 +518,8 @@ export default {
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const id = options.id || ''
|
const id = options.id || ''
|
||||||
const from = options.from
|
const from = options.from
|
||||||
|
console.log(from);
|
||||||
|
|
||||||
switch (from) {
|
switch (from) {
|
||||||
// 特产
|
// 特产
|
||||||
case 'techan':
|
case 'techan':
|
||||||
@@ -552,7 +554,7 @@ export default {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (id) {
|
if (id) {
|
||||||
this.id = uni.getStorageSync('homeId') || id
|
this.id = from ? id : uni.getStorageSync('homeId') || id
|
||||||
this.partnerId = options.partnerId || null
|
this.partnerId = options.partnerId || null
|
||||||
} else {
|
} else {
|
||||||
let obj = uni.getEnterOptionsSync()
|
let obj = uni.getEnterOptionsSync()
|
||||||
|
|||||||
@@ -93,6 +93,12 @@
|
|||||||
>
|
>
|
||||||
已过期
|
已过期
|
||||||
</view>
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="item.status === 9"
|
||||||
|
class="btn btn-grey"
|
||||||
|
>
|
||||||
|
已取消
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 553 B |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 656 B |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 934 B |
@@ -74,9 +74,6 @@ function baseRequest(options) {
|
|||||||
|
|
||||||
// 结构请求需要的参数
|
// 结构请求需要的参数
|
||||||
const {url, params, data, login, ...option} = options
|
const {url, params, data, login, ...option} = options
|
||||||
console.log(params, '=====params');
|
|
||||||
console.log(params, '=====data');
|
|
||||||
console.log(option, '=======option');
|
|
||||||
let _params = {}
|
let _params = {}
|
||||||
if(['get', 'GET'].includes(options.method)) {
|
if(['get', 'GET'].includes(options.method)) {
|
||||||
_params = {
|
_params = {
|
||||||
@@ -89,6 +86,15 @@ function baseRequest(options) {
|
|||||||
// 发起请求
|
// 发起请求
|
||||||
return http[options.method](url, _params).then(res => {
|
return http[options.method](url, _params).then(res => {
|
||||||
const resData = res.data || {};
|
const resData = res.data || {};
|
||||||
|
// AI对话某个请求返回为空需要处理这种情况
|
||||||
|
if (['get', 'GET'].includes(options.method) && _params.params.isNoNeedPublicErrorNotification === 1) {
|
||||||
|
console.log('----')
|
||||||
|
if (resData.status === 500) {
|
||||||
|
return Promise.reject({msg: resData.msg, res, data});
|
||||||
|
} else {
|
||||||
|
return Promise.resolve({})
|
||||||
|
}
|
||||||
|
}
|
||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
return Promise.reject({msg: "请求失败", res, resData});
|
return Promise.reject({msg: "请求失败", res, resData});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ function pushSysBySecondsHandle() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statsData.length < 1) {
|
if (statsData.length < 1) {
|
||||||
console.log('*************没有页面埋点数据则不用上报,节约网络请求')
|
// console.log('*************没有页面埋点数据则不用上报,节约网络请求')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 设备类型phone、pad、pc、unknow
|
// 设备类型phone、pad、pc、unknow
|
||||||
@@ -169,7 +169,7 @@ function pushSysBySecondsHandle() {
|
|||||||
deviceType: deviceType === 'phone' ? osName : 'unknown',
|
deviceType: deviceType === 'phone' ? osName : 'unknown',
|
||||||
statsData
|
statsData
|
||||||
}
|
}
|
||||||
console.log('开始上报数据-------------------')
|
// console.log('开始上报数据-------------------')
|
||||||
pushSystemStatic(postData).then(res => {
|
pushSystemStatic(postData).then(res => {
|
||||||
const { success } = res
|
const { success } = res
|
||||||
if (success) {
|
if (success) {
|
||||||
@@ -177,7 +177,7 @@ function pushSysBySecondsHandle() {
|
|||||||
for (const key in Vue.prototype.$pageToWatchData) {
|
for (const key in Vue.prototype.$pageToWatchData) {
|
||||||
Vue.prototype.$pageToWatchData[key] = []
|
Vue.prototype.$pageToWatchData[key] = []
|
||||||
}
|
}
|
||||||
console.log('*************清除上次未登录缓存的页面埋点数据')
|
// console.log('*************清除上次未登录缓存的页面埋点数据')
|
||||||
uni.removeStorageSync(pageViewDataCacheKey)
|
uni.removeStorageSync(pageViewDataCacheKey)
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|||||||