底部气泡提交

master
jiangjunjie 2 weeks ago
parent cb0a10392d
commit ab38167e05
  1. 222
      src/components/footer-bar-btn.vue

@ -1,39 +1,37 @@
<template> <template>
<div v-if="keyWordshow && manualService == '1'" class="qipaomain"> <div class="qipaomain">
<div v-for="(item, index) in keywordslist" :key="index"> <div v-for="(item, index) in keywordslist" :key="index">
<div class="footer-bar-btn an-move-left" :class="elder ? 'elder-wrapper' : ''"> <div class="footer-bar-btn an-move-left">
<a href="javascript:;" class="footer-items-list _line-fine-btn" v-for="(item1, index1) in item" :key="index1" <a href="javascript:;" class="footer-items-list _line-fine-btn" v-show="item.name"
v-show="item1.name" @click="keywordsClick(item1)">{{ longToShort(item1.name) }}</a> @click="keywordsClick(item)">{{ longToShort(item.name) }}</a>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, inject, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import { storeToRefs } from 'pinia'
import { useAppStore } from '@/store/app.js'
import { Post } from '@/utils/https' import { Post } from '@/utils/https'
const emit = defineEmits(['onFooterBtnChoose']) defineEmits(['onFooterBtnChoose'])
const store = inject('appStore', null) const store = useAppStore()
const userId = inject('userId', ref('')) const { source, planCode, userInfo, manualService, mescrollContent, elder } = storeToRefs(store)
const source = inject('source', ref(''))
const mescrollContent = inject('mescrollContent', null)
const manualService = inject('manualService', ref('1'))
const userInfo = inject('userInfo', ref({}))
const planCode = inject('planCode', ref(''))
const elder = inject('elder', false)
const keywordslist = ref([]) const keywordslist = ref([])
const issubmit = ref(true) const issubmit = ref(true) // 防止重复发送
const keyWordshow = ref(false)
const keyWordshow = computed(() => keywordslist.value.length > 0)
const isRobotService = computed(() => String(manualService.value) === '1')
function scrollTopBody() { function scrollTopBody() {
setTimeout(() => { setTimeout(() => {
// 滚动到底部
try { try {
if (mescrollContent?.value) { const el = mescrollContent.value
mescrollContent.value.scrollTop = mescrollContent.value.scrollHeight || 0 if (el) el.scrollTop = el.scrollHeight || 0
}
} catch (error) { } catch (error) {
console.log(error.message) console.log(error.message)
} }
@ -41,60 +39,56 @@ function scrollTopBody() {
} }
function keywordsClick(item) { function keywordsClick(item) {
const sendParams = { const sendParmas = {
reqAndResType: '1', reqAndResType: '1', // 1文本 2图片 3问题评价
msgText: item.name, msgText: item.name,
msgSource: manualService.value || manualService, msgSource: manualService.value, // 1机器人 2人工
questionType: 1, questionType: 1,
} }
if (issubmit.value) { if (!issubmit.value) return
issubmit.value = false issubmit.value = false
scrollTopBody() scrollTopBody()
if (store?.dispatch) { store
store .sendingRobot(sendParmas)
.dispatch('sendingRobot', sendParams) .catch((err) => {
.then(() => { console.log(err)
issubmit.value = true })
}) .finally(() => {
.catch((err) => { issubmit.value = true
issubmit.value = true })
console.log(err)
})
}
}
} }
async function initFooterBtn() { async function initFooterBtn() {
const param = { const param = {
category: 4, category: 4,
source: source.value || source, source: source.value,
planCode: planCode.value || planCode, planCode: planCode.value,
keyWord: '', keyWord: '',
sceneId: (userInfo.value || userInfo)?.sceneId || '', sceneId: userInfo.value?.sceneId || '',
} }
Post('config/activity', param) try {
.then((res) => { const res = await Post('config/activity', param)
console.log('config/activity 响应:', res) if (res.code && res.code != 0) return
if (res.code && res.code !== 0) return keywordslist.value = res.data
for (let i = 0; i < 3; i++) { // for (let i = 0; i < 3; i++) {
const list = [] // const list = []
for (let j = 0; j < 3; j++) { // for (let j = 0; j < 3; j++) {
if (res.data[i * 3 + j]) list[j] = res.data[i * 3 + j] // if (res.data[i * 3 + j]) list[j] = res.data[i * 3 + j]
} // }
if (list.length > 0) keywordslist.value.unshift(list) // // 将list添加到keywordslist的首位
} // if (list.length > 0) keywordslist.value.unshift(list)
if (keywordslist.value.length > 0) keyWordshow.value = true // }
}) } catch (error) {
.catch((err) => { console.log(error)
console.log('config/activity 失败:', err) }
})
} }
function longToShort(name) { function longToShort(name) {
// return 111
// console.log(name, 1111)
return name.length > 6 ? name.slice(0, 5) + '...' : name return name.length > 6 ? name.slice(0, 5) + '...' : name
} }
@ -104,5 +98,115 @@ onMounted(() => {
</script> </script>
<style scoped> <style scoped>
/* ... 样式保持不变 ... */ .qipaomain {
background-color: #ebf1ff;
overflow-x: auto;
display: flex;
padding: 0 9.5px;
}
.footer-bar-btn {
height: auto;
min-height: 33px;
line-height: 3px;
overflow-x: scroll;
overflow-y: hidden;
/* padding: 0 9.5px; */
white-space: nowrap;
text-align: left;
-webkit-overflow-scrolling: touch;
}
.footer-bar-btn::-webkit-scrollbar {
display: none;
}
.footer-items-list {
display: inline-block;
font-family: 'SourceHanSansCN-Normal';
font-size: 13px;
line-height: 13px;
color: #848a96;
letter-spacing: 0;
text-align: justify;
padding: 7px 16px 6px 16px;
margin: 0 5.5px;
background-color: #fff;
position: relative;
border-radius: 82px;
-webkit-animation: slideInRight 0.5s ease-in-out both;
animation: slideInRight 0.5s ease-in-out both;
}
.footerBtn .footer-items-list:active {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
color: #fff !important;
background-color: #8ec2ff !important;
}
.footer-items-list:nth-child(2) {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
.footer-items-list:nth-child(3) {
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.footer-items-list:nth-child(4) {
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
}
.footer-items-list:nth-child(5) {
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
.footer-items-list:nth-child(6) {
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.footer-items-list:nth-child(7) {
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
.footer-items-list:nth-child(8) {
-webkit-animation-delay: 1.4s;
animation-delay: 1.4s;
}
.footer-items-list:nth-child(9) {
-webkit-animation-delay: 1.6s;
animation-delay: 1.6s;
}
.footer-items-list:nth-child(10) {
-webkit-animation-delay: 1.8s;
animation-delay: 1.8s;
}
.footer-items-list:nth-child(11) {
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.elder-wrapper {
padding: 0 16px;
}
.elder-wrapper .footer-items-list {
font-family: PingFangSC-Medium;
font-size: 18px;
line-height: 18px;
color: #025cea;
margin: 0 8px 6px 0;
}
.elder-wrapper ._line-fine-btn::before {
border: 0.5px solid #dddddd;
}
</style> </style>

Loading…
Cancel
Save