Commit d19ee38a by 李伟康

0804需求

1 parent 0807eec2
...@@ -16,6 +16,11 @@ body .app { ...@@ -16,6 +16,11 @@ body .app {
--envSafeAreaInsetBottom: env(safe-area-inset-bottom); --envSafeAreaInsetBottom: env(safe-area-inset-bottom);
} }
.isFullSucreen {
padding-bottom: var(--constantSafeAreaInsetBottom) !important;
padding-bottom: var(--envSafeAreaInsetBottom) !important;
}
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
...@@ -79,6 +84,7 @@ img { ...@@ -79,6 +84,7 @@ img {
.van-dropdown-menu { .van-dropdown-menu {
margin-left: auto; margin-left: auto;
.icon-down { .icon-down {
transition: all 0.25s; transition: all 0.25s;
} }
...@@ -95,6 +101,7 @@ img { ...@@ -95,6 +101,7 @@ img {
.van-dropdown-menu__title { .van-dropdown-menu__title {
color: #545454 !important; color: #545454 !important;
font-size: 16px; font-size: 16px;
&::after { &::after {
display: none; display: none;
} }
...@@ -108,8 +115,9 @@ img { ...@@ -108,8 +115,9 @@ img {
color: #5F5F5F !important; color: #5F5F5F !important;
font-size: 12px; font-size: 12px;
} }
.van-dropdown-menu__title--active { .van-dropdown-menu__title--active {
color: var(--themeColor) !important; color: var(--themeColor) !important;
} }
} }
} }
\ No newline at end of file \ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 105px 90px;} .sprite-icon { background-image: url(../images/sprite.png);background-size: 133px 94px;}
.icon-down { width: 12px; height: 12px; background-position: -26px -74px;} .icon-down { width: 12px; height: 12px; background-position: -115px -54px;}
.icon-eye { width: 13px; height: 8px; background-position: -48px -74px;} .icon-eye { width: 13px; height: 8px; background-position: -115px -76px;}
.icon-gift-del { width: 18px; height: 18px; background-position: -84px -30px;} .icon-gift-del { width: 18px; height: 18px; background-position: -115px 0px;}
.icon-grctx { width: 16px; height: 16px; background-position: 0px -74px;} .icon-grctx { width: 16px; height: 16px; background-position: -115px -28px;}
.icon-link { width: 32px; height: 32px; background-position: -42px 0px;} .icon-link { width: 32px; height: 32px; background-position: -42px 0px;}
.icon-menu-active { width: 22px; height: 20px; background-position: 0px -44px;} .icon-menu-active { width: 22px; height: 20px; background-position: 0px -44px;}
.icon-menu { width: 22px; height: 20px; background-position: -32px -44px;} .icon-menu { width: 22px; height: 20px; background-position: -32px -44px;}
.icon-pdf { width: 32px; height: 34px; background-position: 0px 0px;} .icon-pdf { width: 32px; height: 34px; background-position: 0px 0px;}
.icon-PYQ { width: 21px; height: 20px; background-position: -84px 0px;} .icon-PYQ { width: 21px; height: 20px; background-position: -84px 0px;}
.icon-send { width: 10px; height: 10px; background-position: -64px -44px;}
\ No newline at end of file \ No newline at end of file
.icon-send { width: 10px; height: 10px; background-position: -64px -44px;}
.icon-profile { width: 20px; height: 20px; background-position: -84px -30px;}
.icon-ai { width: 20px; height: 20px; background-position: 0px -74px;}
.icon-close { width: 20px; height: 20px; background-position: -30px -74px;}
.icon-more { width: 20px; height: 20px; background-position: -60px -74px;}
\ No newline at end of file \ No newline at end of file

10 KB | W: | H:

17.3 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<div class="chat-gpt-box">
<div
:class="['view',{'show-tips':showTips}]"
ref="contentView"
>
<template v-for="(i,index) in contentList">
<div :key="index">
<template v-if="i.speaker == 'AI'">
<div class="content-item left">
<div class="sprite-icon icon-ai icon"></div>
<div class="content">
{{i.content}}
</div>
</div>
</template>
<template v-else>
<div class="content-item right">
<div class="content">{{i.content}}</div>
<div class="sprite-icon icon-profile icon"></div>
</div>
</template>
</div>
</template>
</div>
<template v-if="showTips">
<div class="tips-box">
<div class="tips-title flex">
您可以这样向我提问
<div
class="sprite-icon icon-close"
@click="showTips = false"
></div>
</div>
<div class="tips-view">
<template v-for="(i,index) in tipsList">
<div
:key="index"
class="tips-item flex"
@click="send(i)"
>
{{ i }}
<div class="sprite-icon icon-more"></div>
</div>
</template>
</div>
</div>
</template>
<div class="input-box flex isFullSucreen">
<van-field
v-model="issue"
:border="false"
placeholder="请输入文字向AI提问"
enterKeyhint="send"
@keydown="onkeydown"
ref="input"
></van-field>
<van-button @click="send()">发送</van-button>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ChatGpt',
data () {
return {
contentList: [{
content:'您可以向我提问公司的业务产品或销售等相关问题,我将给您组织语言并提供建议,您可以复制段落稍作润色并答复给您的客户。',
speaker:'AI'
}],
tipsList: [
'苟利国家生死岂因祸福避趋之,水电费看数据方框里圣诞节克里斯丁九龙坑水电费圣诞快乐九龙坑克里斯丁解放路卡开了机斯蒂芬库里受打击了看克里斯丁集福卡了九色鹿',
'简单介绍基础保险方案。',
'你这个保险有点贵啊,别人那里都没有那么高的价格',
'你说的那些服务我也不一定能用上啊。',
'水电费生地会考手机号',
'看守所非进口量',
'会计师的弗兰克手机打开了'
],
showTips: true,
issue: ''
}
},
mounted () {
},
methods: {
onkeydown (e) {
if (e.keyCode == 13) {
this.send()
}
},
send (val) {
const { issue } = this,
content = val || issue
if (!content) return
this.contentList.push({
speaker: 'ME',
content
})
if (!val) {
this.issue = ''
this.$refs.input.blur()
}
this.toBottom()
this.toQuestionChatGPT()
},
toBottom () {
this.$nextTick(() => {
this.$refs.contentView.scrollTop = 99999999
})
},
toQuestionChatGPT(){
const id = Date.now()
this.contentList.push({
speaker: 'AI',
content:'...',
id
})
setTimeout(()=>{
this.contentList.find(i => i.id == id).content = `${new Date().format('yyyy-MM-dd hh:mm:ss')} ${Date.now()}`
},2e3)
},
}
}
</script>
<style scoped lang='scss'>
.chat-gpt-box {
height: calc(100vh - 50px - var(--constantSafeAreaInsetBottom));
height: calc(100vh - 50px - var(--envSafeAreaInsetBottom));
.view {
height: calc(100% - 52px);
overflow-y: scroll;
position: relative;
box-sizing: border-box;
padding-bottom: 12px;
background-color: #fff;
.content-item {
margin-top: 12px;
padding: 0 12px;
display: flex;
.icon {
width: 20px;
height: 20px;
}
.content {
max-width: 290px;
background: #f8f9f9;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
color: #333333;
line-height: 22px;
word-break: break-all;
}
}
.left {
.icon {
margin-right: 6px;
}
.content {
border-radius: 0 10px 10px 10px;
transition: all 1s;
}
}
.right {
.icon {
margin-left: 6px;
}
.content {
margin-left: auto;
background: #c9e7fe;
border: 1px solid #3582ee33;
border-radius: 10px 0 10px 10px;
}
}
}
.show-tips {
height: calc(100% - 262px);
}
.tips-box {
width: 100%;
height: 210px;
background-image: linear-gradient(180deg, #d6e6fb 0%, #ffffff 14%);
position: relative;
box-sizing: border-box;
.tips-title {
padding: 14px 16px 7px;
font-weight: 600;
font-size: 16px;
color: #3582ee;
.icon-close {
margin-left: auto;
}
}
.tips-view {
height: calc(100% - 42px);
overflow-y: scroll;
padding: 0 16px;
.tips-item {
border-bottom: 1px solid #e4e6ee;
line-height: 18px;
padding: 7px 0;
.icon-more {
margin-left: auto;
flex-shrink: 0;
}
&:last-of-type {
border: none;
}
}
}
}
.input-box {
padding: 7px 11px 7px 16px;
background: #ffffff;
.van-field {
width: 278px;
padding: 9px 16px;
font-size: 14px;
color: #c8c9cc;
line-height: 20px;
background: #f7f8fa;
border-radius: 19px;
}
.van-button {
width: 60px;
height: 38px;
background: #3582ee;
border-radius: 19px;
margin-left: auto;
font-weight: 500;
font-size: 16px;
color: #ffffff;
padding: 0;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="layout"> <div class="layout">
<div class="sticky"> <div class="sticky">
<tab
:list="tabList"
@change="change"
>
</tab>
<search-box <search-box
v-show="tabIndex == 1"
@search="search" @search="search"
placeholder="输入关键词搜索" placeholder="输入关键词搜索"
:showDropdown="false" :showDropdown="false"
></search-box> ></search-box>
<template v-if="groupList.length">
<tab
:list="groupList"
@change="change"
>
</tab>
</template>
</div> </div>
<template v-if="flag"> <template v-if="tabIndex == 0">
<template v-if="list.length"> <chat-gpt></chat-gpt>
<scroll-view </template>
class="list-box" <template v-else>
@ReachBottom="onReachBottom" <template v-if="flag">
ref="scrollView" <template v-if="list.length">
> <scroll-view
<div class="box"> class="list-box"
<template v-for="(i,index) in list"> @ReachBottom="onReachBottom"
<div ref="scrollView"
class="item" >
:key="index" <div class="box">
> <template v-for="(i,index) in list">
<div <div
v-html="decodeURIComponent(i.text)" class="item"
:class="['content',{'line-clamp':i.moreState}]" :key="index"
></div> >
<div class="chat-btns flex"> <div
<template v-if="i.moreBtn"> v-html="decodeURIComponent(i.text)"
<div :class="['content',{'line-clamp':i.moreState}]"
class="more" ></div>
@click="i.moreState = !i.moreState" <div class="chat-btns flex">
>{{ i.moreState ? '展开' :'收起' }}</div> <template v-if="i.moreBtn">
</template> <div
<van-button class="more"
class="send" @click="i.moreState = !i.moreState"
block >{{ i.moreState ? '展开' :'收起' }}</div>
round </template>
color="#3975C6" <van-button
:disabled="sendChatMessageDisabled" class="send"
@click="sendChatMessage(i.scriptContent)" block
>发送</van-button> round
color="#3975C6"
:disabled="sendChatMessageDisabled"
@click="sendChatMessage(i.scriptContent)"
>发送</van-button>
</div>
</div> </div>
</div> </template>
</template> </div>
</div> </scroll-view>
</scroll-view> </template>
</template> <template v-else>
<template v-else> <nothing
<nothing class="nothing-box"
class="nothing-box" image="https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/list-nothing.png"
image="https://img01.glsx.com.cn/weapp/resource/scrm-mobile/psd/list-nothing.png" >暂无可用话术</nothing>
>暂无可用话术</nothing> </template>
</template> </template>
</template> </template>
</div> </div>
...@@ -65,11 +69,13 @@ ...@@ -65,11 +69,13 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { Notify } from 'vant' import { Notify } from 'vant'
import { wxConfig, marketingApi } from '@/api' import { wxConfig, marketingApi } from '@/api'
import ChatGPT from '../../components/ChatGPT.vue'
export default { export default {
components: { ChatGPT },
name: 'library', name: 'library',
data () { data () {
return { return {
groupList: [], tabList: ['智能AI话术', '企业话术'],
flag: false, flag: false,
list: [], list: [],
pageNum: 1, pageNum: 1,
...@@ -80,7 +86,8 @@ export default { ...@@ -80,7 +86,8 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}, },
total: 0 total: 0,
tabIndex: 0
} }
}, },
async mounted () { async mounted () {
...@@ -89,7 +96,6 @@ export default { ...@@ -89,7 +96,6 @@ export default {
} catch (error) { } catch (error) {
this.sendChatMessageDisabled = true this.sendChatMessageDisabled = true
} }
this.getChatGroupList()
this.getChatLibraryList() this.getChatLibraryList()
}, },
methods: { methods: {
...@@ -127,18 +133,19 @@ export default { ...@@ -127,18 +133,19 @@ export default {
}, },
/**切换tab */ /**切换tab */
change (index) { change (index) {
const { groupList, params: { scriptGroup } } = this this.tabIndex = index
if (scriptGroup == groupList[index] || (index == 0 && scriptGroup == '')) return // const { groupList, params: { scriptGroup } } = this
this.params.scriptGroup = index == 0 ? '' : groupList[index] // if (scriptGroup == groupList[index] || (index == 0 && scriptGroup == '')) return
this.clearData() // this.params.scriptGroup = index == 0 ? '' : groupList[index]
// this.clearData()
}, },
/**话术组 */ /**话术组 */
async getChatGroupList () { // async getChatGroupList () {
let res = await marketingApi.getChatGroupList() || [], // let res = await marketingApi.getChatGroupList() || [],
maxLength = 10 // maxLength = 10
if (res.length > maxLength) res = res.splice(0, maxLength) // if (res.length > maxLength) res = res.splice(0, maxLength)
this.groupList = ['全部', ...res] // this.groupList = ['全部', ...res]
}, // },
/**话术 */ /**话术 */
async getChatLibraryList () { async getChatLibraryList () {
const { params, list, $refs: { const { params, list, $refs: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!