Compare commits
28 Commits
20151115-z
...
20250922-c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45dfabf987 | ||
|
|
5d81f72f5f | ||
|
|
c9c34501ce | ||
|
|
1812c0901c | ||
|
|
13281d8a7d | ||
|
|
5fdf8efedb | ||
|
|
1a475c8612 | ||
|
|
01e4c676fc | ||
|
|
86e25f69f9 | ||
|
|
b8daef0983 | ||
|
|
df45c9d896 | ||
|
|
b9caf2c4ad | ||
|
|
0afd733f47 | ||
|
|
3720b5667d | ||
|
|
72472979bd | ||
| 70000e2e10 | |||
|
|
969c9f6797 | ||
|
|
33406f6964 | ||
|
|
e1f2e91648 | ||
|
|
8c023d459f | ||
|
|
47c1d29ef2 | ||
|
|
a3dab45af0 | ||
|
|
e3422d15ee | ||
|
|
3cef730e61 | ||
|
|
483b57f667 | ||
|
|
be411ec72d | ||
|
|
d7e425ce9d | ||
|
|
8b68489b25 |
22046
package-lock.json
generated
@@ -15,6 +15,7 @@
|
|||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@mermaid-js/parser": "^0.6.3",
|
||||||
"axios": "^0.21.4",
|
"axios": "^0.21.4",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"driver.js": "^0.9.8",
|
"driver.js": "^0.9.8",
|
||||||
@@ -23,9 +24,15 @@
|
|||||||
"element-ui": "^2.15.7",
|
"element-ui": "^2.15.7",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"fuse.js": "^6.4.6",
|
"fuse.js": "^6.4.6",
|
||||||
|
"highlight.js": "^11.11.1",
|
||||||
"image-conversion": "^2.1.1",
|
"image-conversion": "^2.1.1",
|
||||||
"jsencrypt": "^3.2.1",
|
"jsencrypt": "^3.2.1",
|
||||||
"json-bigint": "^1.0.0",
|
"json-bigint": "^1.0.0",
|
||||||
|
"katex": "^0.16.25",
|
||||||
|
"markdown-it": "^14.1.0",
|
||||||
|
"markdown-it-highlightjs": "^4.2.0",
|
||||||
|
"markdown-it-mermaid": "^0.2.5",
|
||||||
|
"mermaid": "^8.13.10",
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
@@ -43,6 +50,7 @@
|
|||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-awesome-swiper": "^3.1.3",
|
"vue-awesome-swiper": "^3.1.3",
|
||||||
"vue-cookies": "^1.7.4",
|
"vue-cookies": "^1.7.4",
|
||||||
|
"vue-katex": "^0.5.0",
|
||||||
"vue-pdf": "^4.2.0",
|
"vue-pdf": "^4.2.0",
|
||||||
"vue-quill-editor": "^3.0.6",
|
"vue-quill-editor": "^3.0.6",
|
||||||
"vue-router": "^3.5.2",
|
"vue-router": "^3.5.2",
|
||||||
@@ -60,6 +68,7 @@
|
|||||||
"html-webpack-plugin": "^5.5.0",
|
"html-webpack-plugin": "^5.5.0",
|
||||||
"less": "^4.1.1",
|
"less": "^4.1.1",
|
||||||
"less-loader": "^6.2.0",
|
"less-loader": "^6.2.0",
|
||||||
|
"null-loader": "^4.0.1",
|
||||||
"sass": "^1.32.13",
|
"sass": "^1.32.13",
|
||||||
"sass-loader": "^10.1.0",
|
"sass-loader": "^10.1.0",
|
||||||
"vue-template-compiler": "^2.6.11"
|
"vue-template-compiler": "^2.6.11"
|
||||||
|
|||||||
BIN
public/images/case-logo.png
Normal file
|
After Width: | Height: | Size: 438 KiB |
56
src/App.vue
@@ -1,17 +1,57 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app" style="width: 100vw">
|
||||||
<keep-alive :include="['case']">
|
<keep-alive :include="['case']">
|
||||||
<router-view />
|
<router-view />
|
||||||
|
12312
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
|
<!-- 添加AI Call组件 -->
|
||||||
|
<AICall
|
||||||
|
:dialogVisible="showAICall"
|
||||||
|
@close="onCloseAICall"
|
||||||
|
@restore="onRestoreAICall"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters, mapState } from 'vuex';
|
||||||
|
import AICall from '@/views/portal/case/AICall.vue';
|
||||||
|
|
||||||
export default{
|
export default{
|
||||||
name: 'App',
|
name: 'App',
|
||||||
|
components: {
|
||||||
|
AICall
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['userInfo'])
|
...mapGetters(['userInfo']),
|
||||||
|
...mapState('app', ['showAICall', 'showAICallMinimized'])
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onCloseAICall() {
|
||||||
|
// 通过Vuex关闭AI Call组件
|
||||||
|
this.$store.dispatch('app/setShowAICall', false);
|
||||||
|
},
|
||||||
|
|
||||||
|
onRestoreAICall() {
|
||||||
|
// 通过Vuex显示AI Call组件
|
||||||
|
this.$store.dispatch('app/setShowAICall', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 检查当前路由是否应该显示AI弹窗
|
||||||
|
checkRouteForAICall() {
|
||||||
|
const currentRoute = this.$route.name;
|
||||||
|
// 只在case或caseDetail路由显示弹窗
|
||||||
|
if (currentRoute === 'case' || currentRoute === 'caseDetail') {
|
||||||
|
// 设置最小化窗口显示状态为true
|
||||||
|
this.$store.dispatch('app/setShowAICallMinimized', true);
|
||||||
|
// 注意:这里不再强制设置showAICall为true,保留用户之前的操作状态
|
||||||
|
} else {
|
||||||
|
// 其他路由关闭弹窗
|
||||||
|
this.$store.dispatch('app/setShowAICall', false);
|
||||||
|
// 设置最小化窗口显示状态为false
|
||||||
|
this.$store.dispatch('app/setShowAICallMinimized', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//从状态值中取,因为登录处理,所以移动watch中
|
//从状态值中取,因为登录处理,所以移动watch中
|
||||||
@@ -19,7 +59,16 @@
|
|||||||
// if(this.userInfo && this.userInfo.name!=''){
|
// if(this.userInfo && this.userInfo.name!=''){
|
||||||
// this.$watermark.set(this.userInfo.name+this.userInfo.loginName);
|
// this.$watermark.set(this.userInfo.name+this.userInfo.loginName);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// 初始化检查路由
|
||||||
|
this.checkRouteForAICall();
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听路由变化
|
||||||
|
$route(to, from) {
|
||||||
|
this.checkRouteForAICall();
|
||||||
|
}
|
||||||
|
}
|
||||||
// watch:{
|
// watch:{
|
||||||
// userInfo(newVal,oldVal){
|
// userInfo(newVal,oldVal){
|
||||||
// if(newVal && newVal.name!=''){
|
// if(newVal && newVal.name!=''){
|
||||||
@@ -39,4 +88,3 @@
|
|||||||
box-shadow: 0px 1px 5px 1px rgba(92,98,111,.3);
|
box-shadow: 0px 1px 5px 1px rgba(92,98,111,.3);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
36
src/api/boe/aiChat.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import ajax from '@/utils/xajax.js'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI聊天对话接口
|
||||||
|
* @param {Object} data - 请求参数
|
||||||
|
* @param {string} data.conversationId - 会话ID,如果为空则创建新会话
|
||||||
|
* @param {string} data.query - 用户提问内容
|
||||||
|
* @returns {Promise} - 返回SSE流
|
||||||
|
*/
|
||||||
|
export function aiChat(data) {
|
||||||
|
return ajax.postJson('http://192.168.3.178/xboe/m/boe/case/ai/chat', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询会话消息记录接口
|
||||||
|
* @param {string} conversationId - 会话ID
|
||||||
|
* @returns {Promise} - 返回会话历史记录
|
||||||
|
*/
|
||||||
|
export function getChatMessages(conversationId) {
|
||||||
|
return ajax.get('/xboe/m/boe/case/ai/messages?conversationId=' + conversationId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案例专家功能入口显示权限判断接口
|
||||||
|
* 判断当前登录用户是否显示"案例专家"功能入口
|
||||||
|
* @returns {Promise} - 返回是否显示功能入口的布尔值
|
||||||
|
*/
|
||||||
|
export function showCaseAiEntrance() {
|
||||||
|
return ajax.get('/xboe/m/boe/case/ai/show-entrance')
|
||||||
|
}
|
||||||
|
export function likeMsg(data) {
|
||||||
|
return ajax.postJson('/xboe/m/boe/case/ai/likeMsg',data)
|
||||||
|
}
|
||||||
|
export function msgFeedback(data) {
|
||||||
|
return ajax.postJson('/xboe/m/boe/case/ai/msgFeedback',data)
|
||||||
|
}
|
||||||
1
src/assets/images/case/cai-yes.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1765161872024" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2317" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M256 504.021333c0 39.765333-32.213333 71.978667-72.021333 71.978667H136.021333A71.936 71.936 0 0 1 64 503.978667V136.021333c0-39.808 32.213333-72.021333 72.021333-72.021333h47.957334C223.786667 64 256 96.213333 256 136.021333v367.957334z m701.184 45.866667c-6.698667 26.112-21.077333 46.592-46.976 55.722667a131.925333 131.925333 0 0 1-41.813333 6.570666c-75.306667 0.597333-150.613333 0.213333-225.877334 0.213334-9.728 0-10.026667 0.597333-8.533333 9.898666 4.693333 27.52 8.618667 55.125333 14.037333 82.389334 7.253333 37.034667 8.192 73.813333-4.138666 109.696-11.093333 32.341333-23.68 64.213333-35.797334 96.213333-6.784 18.090667-18.176 31.317333-36.48 38.912-34.517333 14.506667-68.608 14.208-101.717333-2.986667-21.077333-11.093333-33.493333-28.714667-32.768-53.802666 0.981333-35.413333 1.194667-70.826667 2.688-106.24a58.026667 58.026667 0 0 0-7.808-32.554667c-27.306667-46.933333-47.104-83.413333-75.605333-129.621333-5.290667-8.533333-21.376-24.789333-28.288-32.085334-20.394667-21.504-30.890667-35.498667-31.018667-59.093333-0.085333-85.930667-0.298667-275.029333-0.682667-396.8a71.936 71.936 0 0 1 72.106667-72.234667c105.173333 0.128 296.277333 0.298667 389.973333 0.298667 22.4 0 44.416 1.408 66.005334 8.405333 42.794667 13.994667 69.717333 47.189333 73.088 91.989334 1.322667 17.024 0.512 33.92-5.546667 50.346666-0.938667 2.261333 0.554667 6.272 2.261333 8.576 16.896 22.613333 27.008 47.616 25.173334 76.117334-0.554667 9.813333-3.669333 19.584-6.656 29.098666-1.621333 5.12-1.621333 8.490667 1.877333 12.8 16.128 20.181333 25.898667 43.178667 25.130667 69.162667-0.426667 12.330667-4.906667 24.405333-7.253334 36.608-0.554667 2.901333-0.981333 7.210667 0.64 9.002667 13.781333 15.402667 21.504 33.621333 25.514667 53.717333a5.546667 5.546667 0 0 0 1.365333 2.005333v28.288a258.005333 258.005333 0 0 0-2.901333 9.386667z" fill="#000000" opacity=".65" p-id="2318"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
1
src/assets/images/case/cai.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1765161849864" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5624" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M960 543.573333v-43.946666l-3.882667-5.12a138.24 138.24 0 0 0-19.712-44.586667c2.816-9.6 4.394667-19.541333 4.906667-29.610667 0.768-26.794667-6.912-52.48-23.125333-76.629333 2.304-7.893333 3.84-16.085333 4.394666-24.32 1.834667-28.672-5.802667-56.576-22.698666-83.072 3.2-15.104 4.010667-30.592 2.602666-45.909333-4.181333-55.466667-38.784-99.2-92.373333-116.778667-25.728-8.405333-50.773333-9.813333-72.021333-9.813333h-93.866667c-33.237333 0-66.944 0.213333-100.693333 0.213333-53.034667 0-106.325333-0.213333-159.232-0.213333h-1.109334 0.128-247.296c-39.808 0-72.021333 32.213333-72.021333 72.021333v368c0 39.808 32.213333 71.978667 72.021333 71.978667H249.173333s55.893333 6.4 82.346667 48.512c18.346667 29.312 36.053333 60.202667 53.12 90.026666l22.016 38.058667c1.792 2.986667 2.602667 6.4 2.218667 9.898667-0.896 20.736-1.28 41.6-1.706667 61.696-0.213333 11.946667-0.512 24.234667-0.810667 36.224-0.981333 36.181333 16.810667 65.706667 49.92 83.114666a140.8 140.8 0 0 0 65.792 16.469334c19.498667 0 39.253333-4.096 58.88-12.288 25.514667-10.666667 43.52-29.781333 53.717334-56.789334l8.96-23.594666c8.234667-21.333333 16.64-43.434667 24.234666-65.621334 12.288-35.712 13.909333-74.88 5.12-119.808-2.602667-13.397333-4.906667-26.794667-7.125333-40.789333h21.589333l64.128 0.085333c29.184 0 58.666667 0 87.893334-0.170666h0.810666c16.768 0 33.493333-2.730667 49.493334-8.106667 23.594667-8.405333 54.272-28.416 66.56-76.714667l1.237333-4.010666 0.853333-2.986667 1.536-5.376z m-712.021333-39.594666H136.021333V135.978667h112.042667v368z m640 28.8c0 1.536-0.981333 3.541333-1.578667 5.632-4.608 18.090667-12.501333 23.466667-20.394667 26.368-8.405333 2.816-17.066667 4.224-25.898666 4.224h-0.426667l-0.469333-0.085334-0.512-0.128c-31.018667 0.213333-61.482667 0.298667-87.296 0.298667h-32.298667l-31.786667-0.085333h-106.24l13.653334 83.626666c2.56 15.872 4.864 29.354667 7.552 43.093334 6.314667 32.170667 5.546667 59.093333-2.474667 82.474666-6.997333 20.181333-14.421333 39.808-23.424 63.317334-3.072 7.978667-6.101333 16.085333-9.088 23.978666-3.584 9.6-8.106667 13.098667-14.08 15.701334-10.709333 4.522667-21.12 6.698667-31.146667 6.698666-11.093333 0-21.674667-2.688-32.384-8.277333a24.661333 24.661333 0 0 1-9.386666-7.68c-0.512-0.853333-2.133333-3.413333-1.92-9.642667 0.341333-11.52 0.64-22.997333 0.853333-36.778666v-1.706667c0.384-18.773333 0.768-38.314667 1.450667-57.173333a86.954667 86.954667 0 0 0-11.904-50.346667c-2.56-4.394667-5.077333-8.874667-7.68-13.269333-4.608-8.021333-9.386667-16.213333-13.909334-24.234667l-0.085333-0.085333-0.085333-0.085334-0.725334-1.109333c-17.194667-29.994667-34.986667-61.013333-53.674666-91.008l-0.128-0.213333-0.085334-0.170667c-16.64-26.325333-41.088-47.701333-71.509333-62.421333l-0.597333-387.712h63.914666c55.68 0 111.872 0.341333 159.402667 0.341333 16.981333 0 33.962667-0.128 50.773333-0.128 16.725333 0 33.28-0.213333 49.92-0.213333h93.866667c16.213333 0 33.536 0.938667 49.706667 6.229333 13.013333 4.181333 23.296 11.306667 30.634666 20.48 7.168 9.130667 11.264 20.224 12.288 33.28v0.64l0.085334 0.597333c0.810667 8.192 0.298667 16.298667-1.408 24.32l-0.768 3.413334h-8.704 8.704l-5.333334 25.173333 15.786667 25.002667c8.533333 13.397333 12.330667 26.282667 11.648 39.381333-0.213333 2.986667-0.853333 5.973333-1.621333 8.917333l-9.514667 32.298667 18.816 27.989333c7.594667 11.306667 11.093333 22.016 10.922667 33.493334-0.298667 4.266667-1.024 8.618667-2.218667 12.714666l-9.301333 32.426667 18.901333 27.861333c4.394667 6.4 7.509333 13.482667 9.301333 21.12l1.877334 7.765334v13.696z" fill="#000000" opacity=".65" p-id="5625"></path></svg>
|
||||||
|
After Width: | Height: | Size: 3.9 KiB |
1
src/assets/images/case/zan-yes.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1765161882076" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2499" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M184.021333 448H136.021333c-39.808 0-72.021333 32.213333-72.021333 72.021333v367.957334c0 39.808 32.213333 72.021333 72.021333 72.021333h47.957334C223.786667 960 256 927.786667 256 887.978667v-368c0-39.765333-32.213333-71.978667-72.021333-71.978667z m773.162667 26.112c-6.698667-26.112-21.077333-46.592-46.976-55.722667a131.925333 131.925333 0 0 0-41.813333-6.570666c-75.306667-0.597333-150.613333-0.213333-225.877334-0.213334-9.728 0-10.026667-0.597333-8.533333-9.898666 4.693333-27.52 8.618667-55.125333 14.037333-82.389334 7.253333-37.034667 8.192-73.813333-4.138666-109.738666-11.093333-32.298667-23.68-64.170667-35.797334-96.170667-6.784-18.090667-18.176-31.317333-36.48-38.912-34.517333-14.506667-68.608-14.208-101.717333 2.986667-21.077333 11.093333-33.493333 28.714667-32.768 53.802666 0.981333 35.413333 1.194667 70.826667 2.688 106.24a58.026667 58.026667 0 0 1-7.808 32.554667c-27.306667 46.933333-47.104 83.413333-75.605333 129.621333-5.290667 8.533333-21.376 24.789333-28.288 32.085334-20.394667 21.504-30.890667 35.498667-31.018667 59.093333-0.085333 85.930667-0.298667 275.029333-0.682667 396.8a71.936 71.936 0 0 0 72.106667 72.234667c105.173333-0.128 296.277333-0.298667 389.973333-0.298667 22.4 0 44.416-1.408 66.005334-8.405333 42.794667-13.994667 69.717333-47.232 73.088-92.032 1.322667-16.981333 0.512-33.877333-5.546667-50.261334-0.938667-2.304 0.554667-6.314667 2.261333-8.618666 16.896-22.613333 27.008-47.616 25.173334-76.117334-0.554667-9.813333-3.669333-19.584-6.656-29.098666-1.621333-5.12-1.621333-8.490667 1.877333-12.8 16.128-20.181333 25.898667-43.178667 25.130667-69.162667-0.426667-12.330667-4.906667-24.405333-7.253334-36.608-0.554667-2.901333-0.981333-7.210667 0.64-9.002667 13.781333-15.402667 21.504-33.621333 25.514667-53.717333a5.546667 5.546667 0 0 1 1.365333-2.005333v-28.288c-0.981333-3.114667-2.005333-6.186667-2.901333-9.386667z" fill="#000000" opacity=".65" p-id="2500"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
1
src/assets/images/case/zan.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1765161839692" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5444" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M958.378667 475.093333l-0.853334-2.986666c-0.512-1.621333-1.024-2.986667-1.237333-4.010667-12.288-48.384-43.008-68.394667-66.56-76.714667a154.666667 154.666667 0 0 0-49.493333-8.106666h-0.853334c-29.184-0.170667-58.581333-0.170667-87.893333-0.170667l-64.085333 0.085333h-21.589334c2.304-13.994667 4.48-27.392 7.082667-40.789333 8.789333-44.885333 7.210667-84.096-5.12-119.808-7.594667-22.186667-16.085333-44.288-24.192-65.578667l-8.96-23.594666c-10.112-27.008-28.245333-46.08-53.76-56.832a141.056 141.056 0 0 0-124.586667 3.882666c-33.066667 17.322667-50.858667 46.848-49.877333 83.114667 0.298667 12.032 0.597333 24.32 0.810667 36.224 0.426667 20.181333 0.768 41.088 1.706666 61.696a16.426667 16.426667 0 0 1-2.218666 9.898667c-7.296 12.714667-14.805333 25.514667-22.016 38.101333-17.066667 29.781333-34.773333 60.714667-53.077334 90.026667C305.066667 441.6 249.173333 448 249.173333 448H135.978667c-39.765333 0-71.978667 32.213333-71.978667 72.021333v367.957334c0 39.808 32.213333 72.021333 71.978667 72.021333h247.338666-0.128 1.109334c52.821333 0 106.24-0.213333 159.189333-0.213333 33.792 0 67.498667 0.213333 100.693333 0.213333H738.133333c21.205333 0 46.293333-1.408 72.021334-9.813333 53.589333-17.493333 88.192-61.184 92.373333-116.778667a157.269333 157.269333 0 0 0-2.56-45.909333c16.896-26.410667 24.490667-54.314667 22.656-83.114667a118.101333 118.101333 0 0 0-4.394667-24.32c16.128-23.978667 23.808-49.664 23.125334-76.544a135.594667 135.594667 0 0 0-4.906667-29.610667c9.216-13.610667 15.914667-28.586667 19.712-44.629333l3.882667-5.12v-43.946667l-1.621334-5.12z m-710.4 412.928H136.021333v-368h112.042667v367.957334z m640-383.232l-1.877334 7.808a64.426667 64.426667 0 0 1-9.301333 21.12l-18.901333 27.861334 9.301333 32.426666c1.194667 4.096 1.92 8.405333 2.218667 12.714667 0.170667 11.52-3.328 22.186667-10.922667 33.493333l-18.773333 27.989334 9.472 32.298666a38.698667 38.698667 0 0 1 1.621333 8.917334c0.682667 13.184-2.986667 26.069333-11.605333 39.381333l-15.786667 25.002667 5.290667 25.173333h-8.704 8.704l0.768 3.413333c1.706667 8.021333 2.218667 16.213333 1.408 24.32l-0.085334 0.597334v0.597333c-1.024 13.013333-5.12 24.192-12.288 33.28a63.018667 63.018667 0 0 1-30.634666 20.48c-16.085333 5.333333-33.365333 6.229333-49.664 6.229333H644.266667c-16.512 0-33.109333-0.213333-49.92-0.213333l-50.773334-0.085333c-47.616 0-103.68 0.298667-159.402666 0.298666H320.298667l0.810666-387.712c30.378667-14.762667 54.869333-36.096 71.509334-62.378666l0.085333-0.213334 0.085333-0.170666c18.730667-30.037333 36.522667-61.013333 53.717334-91.008l0.682666-1.109334 0.128-0.085333 0.085334-0.128c4.48-7.893333 9.301333-16.213333 13.909333-24.192 2.56-4.48 5.205333-8.917333 7.68-13.312 9.002667-15.274667 13.098667-32.682667 11.946667-50.304-0.853333-18.901333-1.237333-38.4-1.536-57.173333v-1.706667c-0.298667-13.696-0.512-25.301333-0.810667-36.821333-0.213333-6.058667 1.408-8.661333 1.92-9.6a23.253333 23.253333 0 0 1 9.386667-7.68c10.666667-5.589333 21.333333-8.32 32.426666-8.32 9.856 0 20.394667 2.304 31.061334 6.741333 5.973333 2.474667 10.496 5.973333 14.08 15.658667 3.029333 7.936 6.144 16 9.130666 24.021333 9.002667 23.466667 16.384 43.093333 23.424 63.317333 7.978667 23.381333 8.874667 50.346667 2.474667 82.474667a1376.853333 1376.853333 0 0 0-7.594667 43.093333l-13.781333 83.712h106.197333c10.496 0 21.077333 0 31.786667-0.085333h32.298667c25.813333 0 56.32 0 87.296 0.298667l0.512-0.128 0.469333-0.085334h0.426667c8.789333 0 17.493333 1.493333 25.898666 4.181334 7.893333 2.901333 15.786667 8.32 20.394667 26.453333 0.512 2.048 1.621333 3.968 1.621333 5.546667v13.653333z" fill="#000000" opacity=".65" p-id="5445"></path></svg>
|
||||||
|
After Width: | Height: | Size: 3.9 KiB |
16
src/main.js
@@ -3,6 +3,22 @@ import App from './App.vue'
|
|||||||
import router from './router'
|
import router from './router'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
|
|
||||||
|
import vueKatexEs from "vue-katex";
|
||||||
|
import "katex/dist/katex.min.css"
|
||||||
|
|
||||||
|
|
||||||
|
Vue.use(vueKatexEs,{
|
||||||
|
globalOptions:{
|
||||||
|
delimiters:[
|
||||||
|
{left:"$$",right:"$$",display:true},
|
||||||
|
{left:"$",right:"$",display:false},
|
||||||
|
{left:"\\[",right:"\\]",display:true},
|
||||||
|
{left:"\\(",right:"\\)",display:false}
|
||||||
|
],
|
||||||
|
throwOnError:true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
//import './mock/index'
|
//import './mock/index'
|
||||||
|
|
||||||
import xpage from '@/utils/xpage'
|
import xpage from '@/utils/xpage'
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ const state = {
|
|||||||
withoutAnimation: false
|
withoutAnimation: false
|
||||||
},
|
},
|
||||||
device: 'desktop',//默认是桌面,以后会有android,ios,minapp
|
device: 'desktop',//默认是桌面,以后会有android,ios,minapp
|
||||||
size: Cookies.get('size') || 'medium' //字段大小
|
size: Cookies.get('size') || 'medium', //字段大小
|
||||||
|
// 添加AI Call组件显示控制状态
|
||||||
|
showAICall: false,
|
||||||
|
// 控制AI Call最小化窗口在特定路由下显示的状态
|
||||||
|
showAICallMinimized: false
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
@@ -34,6 +38,14 @@ const mutations = {
|
|||||||
SET_SIZE: (state, size) => {
|
SET_SIZE: (state, size) => {
|
||||||
state.size = size
|
state.size = size
|
||||||
Cookies.set('size', size)
|
Cookies.set('size', size)
|
||||||
|
},
|
||||||
|
// 添加控制AI Call组件显示的mutation
|
||||||
|
SET_SHOW_AI_CALL: (state, show) => {
|
||||||
|
state.showAICall = show
|
||||||
|
},
|
||||||
|
// 控制AI Call最小化窗口显示的mutation
|
||||||
|
SET_SHOW_AI_CALL_MINIMIZED: (state, show) => {
|
||||||
|
state.showAICallMinimized = show
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +61,14 @@ const actions = {
|
|||||||
},
|
},
|
||||||
setSize({ commit }, size) {
|
setSize({ commit }, size) {
|
||||||
commit('SET_SIZE', size)
|
commit('SET_SIZE', size)
|
||||||
|
},
|
||||||
|
// 添加控制AI Call组件显示的action
|
||||||
|
setShowAICall({ commit }, show) {
|
||||||
|
commit('SET_SHOW_AI_CALL', show)
|
||||||
|
},
|
||||||
|
// 控制AI Call最小化窗口显示的action
|
||||||
|
setShowAICallMinimized({ commit }, show) {
|
||||||
|
commit('SET_SHOW_AI_CALL_MINIMIZED', show)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
83
src/utils/sseHelper.js
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/**
|
||||||
|
* SSE流式数据处理工具
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理SSE响应数据
|
||||||
|
* @param {String} data - SSE响应数据
|
||||||
|
* @param {Function} onMessage - 处理消息的回调函数
|
||||||
|
* @param {Function} onComplete - 完成时的回调函数
|
||||||
|
* @param {Function} onError - 错误处理回调函数
|
||||||
|
*/
|
||||||
|
export function processSSEData(data, onMessage, onComplete, onError) {
|
||||||
|
try {
|
||||||
|
const lines = data.split('\n')
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith('data: ')) {
|
||||||
|
const jsonData = JSON.parse(line.substring(6))
|
||||||
|
onMessage(jsonData)
|
||||||
|
|
||||||
|
// 如果状态为4,表示对话结束
|
||||||
|
if (jsonData.data && jsonData.data.status === 4) {
|
||||||
|
onComplete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('处理SSE数据时出错:', error)
|
||||||
|
if (onError) {
|
||||||
|
onError(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建SSE连接
|
||||||
|
* @param {String} url - 请求地址
|
||||||
|
* @param {Object} data - 请求数据
|
||||||
|
* @param {Function} onMessage - 消息处理回调
|
||||||
|
* @param {Function} onComplete - 完成回调
|
||||||
|
* @param {Function} onError - 错误回调
|
||||||
|
* @returns {Promise} - 返回fetch Promise
|
||||||
|
*/
|
||||||
|
export function createSSEConnection(url, data, onMessage, onComplete, onError) {
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data)
|
||||||
|
}).then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const reader = response.body.getReader()
|
||||||
|
const decoder = new TextDecoder('utf-8')
|
||||||
|
let buffer = ''
|
||||||
|
|
||||||
|
function read() {
|
||||||
|
reader.read().then(({ done, value }) => {
|
||||||
|
if (done) {
|
||||||
|
if (onComplete) onComplete()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer += decoder.decode(value, { stream: true })
|
||||||
|
processSSEData(buffer, onMessage, onComplete, onError)
|
||||||
|
|
||||||
|
// 继续读取
|
||||||
|
read()
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('SSE读取错误:', error)
|
||||||
|
if (onError) onError(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始读取数据
|
||||||
|
read()
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('SSE连接错误:', error)
|
||||||
|
if (onError) onError(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
989
src/views/portal/case/AICall.vue
Normal file
@@ -0,0 +1,989 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<!-- 最大化状态的弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-show=" windowState === 'maximized'"
|
||||||
|
v-if="dialogVisible"
|
||||||
|
:visible="true"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:show-close="true"
|
||||||
|
@close="onClose"
|
||||||
|
class="case-expert-dialog"
|
||||||
|
:modal="false"
|
||||||
|
:append-to-body="true"
|
||||||
|
:fullscreen="dialogFullscreen"
|
||||||
|
top="10vh"
|
||||||
|
v-resizeable
|
||||||
|
v-draggable
|
||||||
|
>
|
||||||
|
<!-- 标题 -->
|
||||||
|
<div slot="title" class="dialog-title">
|
||||||
|
<span>案例专家</span>
|
||||||
|
<div class="window-control-btn">
|
||||||
|
<el-button
|
||||||
|
style="color:#96999f;margin-right: 6px;"
|
||||||
|
type="text"
|
||||||
|
@click="minimizeWindow"
|
||||||
|
>
|
||||||
|
<i class="el-icon-minus"></i>
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
style="color:#96999f;"
|
||||||
|
>
|
||||||
|
<img v-if="!dialogFullscreen" @click="onbigWindowClick" :src="openImg" alt="" style="width: 17px">
|
||||||
|
<i v-else @click="onRestoreWindowClick" class="el-icon-copy-document"></i>
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 内容区域 -->
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<div
|
||||||
|
class="welcome-message"
|
||||||
|
ref="messageContainer"
|
||||||
|
@scroll="handleScroll"
|
||||||
|
>
|
||||||
|
<div class="message-text" v-for="(item, index) in messageList" :key="index">
|
||||||
|
<messages :messageData="item" :suggestions="suggestions" @getMinWindow="minimizeWindow" :isFirstMessage="item.isFirstMessage"></messages>
|
||||||
|
</div>
|
||||||
|
<div class="message-suggestions" v-if="messageList.length > 0 && messageList[messageList.length-1].textCompleted">
|
||||||
|
<div class="suggestion-item" v-for="(item, index) in suggestions" :key="index">
|
||||||
|
<a @click="sendSuggestions(item)"> {{ item }} →</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="isLoading" class="loading-message">
|
||||||
|
<div class="loading-dots">
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 输入框区域 -->
|
||||||
|
<send-message
|
||||||
|
v-model="AIContent"
|
||||||
|
:message-list="messageList"
|
||||||
|
:suggestions="suggestions"
|
||||||
|
@loading="handleLoading"
|
||||||
|
@update-message="updateMessage"
|
||||||
|
@update-suggestions="updateSuggestions"
|
||||||
|
@new-conversation="startNewConversation"
|
||||||
|
:disabled="isLoading"
|
||||||
|
class="input-area-wrapper"
|
||||||
|
ref="sendMessage"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 最小化状态的弹窗 -->
|
||||||
|
<div
|
||||||
|
class="minimized-window"
|
||||||
|
v-show="windowState === 'minimized' && showMinimizedWindow"
|
||||||
|
@click="onMinimizedWindowClick"
|
||||||
|
>
|
||||||
|
<div class="minimized-content">
|
||||||
|
<span class="window-title">案例专家</span>
|
||||||
|
<div style="display: flex;align-items: center">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
class="window-control-btn"
|
||||||
|
@click.stop="onMinimizedWindowClick"
|
||||||
|
>
|
||||||
|
<img :src="openImg" alt="" style="width: 17px">
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
style="margin-left: 1px;color:#96999f"
|
||||||
|
type="text"
|
||||||
|
class="window-control-btn"
|
||||||
|
@click.stop="closeMinimizedWindow"
|
||||||
|
>
|
||||||
|
<i class="el-icon-close"></i>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="minimized-message">
|
||||||
|
<div v-if="messageList.length <= 1 && messageList[0].isBot">
|
||||||
|
当前暂无对话内容,去创建对话吧
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
{{ getLastUserMessage() }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
import messages from './components/messages.vue'
|
||||||
|
import sendMessage from './components/sendMessage.vue'
|
||||||
|
import openImg from './components/open.png'
|
||||||
|
export default {
|
||||||
|
name: 'CaseExpertDialog',
|
||||||
|
props: {
|
||||||
|
dialogVisible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
messages,
|
||||||
|
sendMessage
|
||||||
|
},
|
||||||
|
directives: {
|
||||||
|
draggable: {
|
||||||
|
bind(el, binding, vnode) {
|
||||||
|
vnode.context.$nextTick(() => {
|
||||||
|
const dialogEl = el.querySelector('.el-dialog');
|
||||||
|
if (!dialogEl) return;
|
||||||
|
|
||||||
|
const headerEl = dialogEl.querySelector('.dialog-title');
|
||||||
|
if (!headerEl) return;
|
||||||
|
|
||||||
|
// 检查是否有保存的位置状态
|
||||||
|
const savedPosition = sessionStorage.getItem('aiCallDialogPosition');
|
||||||
|
if (savedPosition) {
|
||||||
|
const { left, top } = JSON.parse(savedPosition);
|
||||||
|
dialogEl.style.left = left + 'px';
|
||||||
|
dialogEl.style.top = top + 'px';
|
||||||
|
} else {
|
||||||
|
// 设置初始样式
|
||||||
|
dialogEl.style.position = 'fixed';
|
||||||
|
dialogEl.style.top = '100px';
|
||||||
|
dialogEl.style.left = (window.innerWidth - dialogEl.offsetWidth) / 2 + 'px';
|
||||||
|
}
|
||||||
|
dialogEl.style.margin = '0';
|
||||||
|
|
||||||
|
let isDragging = false;
|
||||||
|
let startX = 0;
|
||||||
|
let startY = 0;
|
||||||
|
let startLeft = 0;
|
||||||
|
let startTop = 0;
|
||||||
|
const startDrag = (event) => {
|
||||||
|
// 只有在标题栏上按下鼠标才开始拖动
|
||||||
|
if (event.target.closest('.resize-handle')) {
|
||||||
|
return; // 如果点击的是resize-handle,则不触发拖动
|
||||||
|
}
|
||||||
|
if (event.target.closest('.window-control-btn')) {
|
||||||
|
return; // 如果点击的是控制按钮,则不触发拖动
|
||||||
|
}
|
||||||
|
// 全屏状态下拖动为正常弹窗大小
|
||||||
|
if (vnode.context.dialogFullscreen) {
|
||||||
|
vnode.context.onRestoreWindowClick();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isDragging = true;
|
||||||
|
startX = event.clientX;
|
||||||
|
startY = event.clientY;
|
||||||
|
startLeft = parseInt(dialogEl.style.left) || dialogEl.offsetLeft;
|
||||||
|
startTop = parseInt(dialogEl.style.top) || dialogEl.offsetTop;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
// 添加全局事件监听
|
||||||
|
document.addEventListener('mousemove', handleMouseMove);
|
||||||
|
document.addEventListener('mouseup', stopDrag);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMouseMove = (event) => {
|
||||||
|
if (!isDragging) return;
|
||||||
|
|
||||||
|
const deltaX = event.clientX - startX;
|
||||||
|
const deltaY = event.clientY - startY;
|
||||||
|
|
||||||
|
dialogEl.style.left = (startLeft + deltaX) + 'px';
|
||||||
|
dialogEl.style.top = (startTop + deltaY) + 'px';
|
||||||
|
};
|
||||||
|
|
||||||
|
const stopDrag = () => {
|
||||||
|
isDragging = false;
|
||||||
|
// 保存当前位置到 sessionStorage
|
||||||
|
const currentPosition = {
|
||||||
|
left: parseInt(dialogEl.style.left),
|
||||||
|
top: parseInt(dialogEl.style.top)
|
||||||
|
};
|
||||||
|
sessionStorage.setItem('aiCallDialogPosition', JSON.stringify(currentPosition));
|
||||||
|
// 移除全局事件监听
|
||||||
|
document.removeEventListener('mousemove', handleMouseMove);
|
||||||
|
document.removeEventListener('mouseup', stopDrag);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 为标题栏绑定拖动事件
|
||||||
|
headerEl.addEventListener('mousedown', startDrag);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
resizeable: {
|
||||||
|
bind(el, binding, vnode) {
|
||||||
|
// 确保元素已插入DOM
|
||||||
|
vnode.context.$nextTick(() => {
|
||||||
|
const dialogEl = el.querySelector('.el-dialog');
|
||||||
|
if (!dialogEl) return;
|
||||||
|
|
||||||
|
// 检查是否有保存的尺寸状态
|
||||||
|
const savedSize = sessionStorage.getItem('aiCallDialogSize');
|
||||||
|
if (savedSize) {
|
||||||
|
const { width, height, left, top } = JSON.parse(savedSize);
|
||||||
|
dialogEl.style.width = width + 'px';
|
||||||
|
dialogEl.style.height = height + 'px';
|
||||||
|
dialogEl.style.left = left + 'px';
|
||||||
|
dialogEl.style.top = top + 'px';
|
||||||
|
} else {
|
||||||
|
// 设置初始样式
|
||||||
|
dialogEl.style.position = 'fixed';
|
||||||
|
dialogEl.style.top = '100px';
|
||||||
|
dialogEl.style.left = (window.innerWidth - dialogEl.offsetWidth) / 2 + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建拖拽手柄
|
||||||
|
const createHandle = (direction) => {
|
||||||
|
const handle = document.createElement('div');
|
||||||
|
handle.className = `resize-handle ${direction}`;
|
||||||
|
handle.style.position = 'absolute';
|
||||||
|
handle.style.zIndex = '10';
|
||||||
|
|
||||||
|
switch (direction) {
|
||||||
|
case 'left':
|
||||||
|
case 'right':
|
||||||
|
handle.style.width = '6px';
|
||||||
|
handle.style.height = '100%';
|
||||||
|
handle.style.top = '0';
|
||||||
|
handle.style.cursor = 'ew-resize';
|
||||||
|
break;
|
||||||
|
case 'top':
|
||||||
|
case 'bottom':
|
||||||
|
handle.style.width = '100%';
|
||||||
|
handle.style.height = '6px';
|
||||||
|
handle.style.left = '0';
|
||||||
|
handle.style.cursor = 'ns-resize';
|
||||||
|
break;
|
||||||
|
case 'top-left':
|
||||||
|
case 'top-right':
|
||||||
|
case 'bottom-left':
|
||||||
|
case 'bottom-right':
|
||||||
|
handle.style.width = '10px';
|
||||||
|
handle.style.height = '10px';
|
||||||
|
handle.style.zIndex = '20';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (direction) {
|
||||||
|
case 'left':
|
||||||
|
handle.style.left = '0';
|
||||||
|
break;
|
||||||
|
case 'right':
|
||||||
|
handle.style.right = '0';
|
||||||
|
break;
|
||||||
|
case 'top':
|
||||||
|
handle.style.top = '0';
|
||||||
|
break;
|
||||||
|
case 'bottom':
|
||||||
|
handle.style.bottom = '0';
|
||||||
|
break;
|
||||||
|
case 'top-left':
|
||||||
|
handle.style.top = '0';
|
||||||
|
handle.style.left = '0';
|
||||||
|
handle.style.cursor = 'nw-resize';
|
||||||
|
break;
|
||||||
|
case 'top-right':
|
||||||
|
handle.style.top = '0';
|
||||||
|
handle.style.right = '0';
|
||||||
|
handle.style.cursor = 'ne-resize';
|
||||||
|
break;
|
||||||
|
case 'bottom-left':
|
||||||
|
handle.style.bottom = '0';
|
||||||
|
handle.style.left = '0';
|
||||||
|
handle.style.cursor = 'sw-resize';
|
||||||
|
break;
|
||||||
|
case 'bottom-right':
|
||||||
|
handle.style.bottom = '0';
|
||||||
|
handle.style.right = '0';
|
||||||
|
handle.style.cursor = 'se-resize';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 防止拖拽手柄的事件冒泡到标题栏
|
||||||
|
handle.addEventListener('mousedown', (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogEl.appendChild(handle);
|
||||||
|
return handle;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 创建8个拖拽手柄
|
||||||
|
const handles = {
|
||||||
|
left: createHandle('left'),
|
||||||
|
right: createHandle('right'),
|
||||||
|
top: createHandle('top'),
|
||||||
|
bottom: createHandle('bottom'),
|
||||||
|
topLeft: createHandle('top-left'),
|
||||||
|
topRight: createHandle('top-right'),
|
||||||
|
bottomLeft: createHandle('bottom-left'),
|
||||||
|
bottomRight: createHandle('bottom-right')
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加拖拽事件处理
|
||||||
|
let isResizing = false;
|
||||||
|
let resizeDirection = '';
|
||||||
|
let startX = 0;
|
||||||
|
let startY = 0;
|
||||||
|
let startWidth = 0;
|
||||||
|
let startHeight = 0;
|
||||||
|
let startLeft = 0;
|
||||||
|
let startTop = 0;
|
||||||
|
|
||||||
|
const startResize = (direction, event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
isResizing = true;
|
||||||
|
resizeDirection = direction;
|
||||||
|
|
||||||
|
startX = event.clientX;
|
||||||
|
startY = event.clientY;
|
||||||
|
startWidth = dialogEl.offsetWidth;
|
||||||
|
startHeight = dialogEl.offsetHeight;
|
||||||
|
|
||||||
|
// 统一使用计算后的样式值
|
||||||
|
startLeft = parseInt(dialogEl.style.left) || 0;
|
||||||
|
startTop = parseInt(dialogEl.style.top) || 0;
|
||||||
|
|
||||||
|
// 添加全局事件监听
|
||||||
|
document.addEventListener('mousemove', handleMouseMove);
|
||||||
|
document.addEventListener('mouseup', stopResize);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMouseMove = (event) => {
|
||||||
|
if (!isResizing) return;
|
||||||
|
|
||||||
|
const deltaX = event.clientX - startX;
|
||||||
|
const deltaY = event.clientY - startY;
|
||||||
|
|
||||||
|
let newWidth, newHeight, newLeft, newTop;
|
||||||
|
|
||||||
|
switch (resizeDirection) {
|
||||||
|
case 'right':
|
||||||
|
newWidth = Math.max(400, startWidth + deltaX);
|
||||||
|
dialogEl.style.width = newWidth + 'px';
|
||||||
|
break;
|
||||||
|
case 'left':
|
||||||
|
newWidth = Math.max(400, startWidth - deltaX);
|
||||||
|
newLeft = startLeft + startWidth - newWidth;
|
||||||
|
dialogEl.style.width = newWidth + 'px';
|
||||||
|
dialogEl.style.left = newLeft + 'px';
|
||||||
|
break;
|
||||||
|
case 'bottom':
|
||||||
|
newHeight = Math.max(600, startHeight + deltaY);
|
||||||
|
dialogEl.style.height = newHeight + 'px';
|
||||||
|
break;
|
||||||
|
case 'top':
|
||||||
|
// 当窗口高度达到最小值时,不再调整高度和位置
|
||||||
|
if (startHeight - deltaY >= 600) {
|
||||||
|
newHeight = startHeight - deltaY;
|
||||||
|
newTop = startTop + deltaY;
|
||||||
|
dialogEl.style.height = newHeight + 'px';
|
||||||
|
dialogEl.style.top = newTop + 'px';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'bottom-right':
|
||||||
|
newWidth = Math.max(400, startWidth + deltaX);
|
||||||
|
newHeight = Math.max(600, startHeight + deltaY);
|
||||||
|
dialogEl.style.width = newWidth + 'px';
|
||||||
|
dialogEl.style.height = newHeight + 'px';
|
||||||
|
break;
|
||||||
|
case 'bottom-left':
|
||||||
|
newWidth = Math.max(400, startWidth - deltaX);
|
||||||
|
newHeight = Math.max(600, startHeight + deltaY);
|
||||||
|
newLeft = startLeft + startWidth - newWidth;
|
||||||
|
dialogEl.style.width = newWidth + 'px';
|
||||||
|
dialogEl.style.left = newLeft + 'px';
|
||||||
|
dialogEl.style.height = newHeight + 'px';
|
||||||
|
break;
|
||||||
|
case 'top-right':
|
||||||
|
// 当窗口高度达到最小值时,不再调整高度和位置
|
||||||
|
if (startHeight - deltaY >= 600) {
|
||||||
|
newHeight = startHeight - deltaY;
|
||||||
|
newTop = startTop + deltaY;
|
||||||
|
newWidth = Math.max(400, startWidth + deltaX);
|
||||||
|
dialogEl.style.height = newHeight + 'px';
|
||||||
|
dialogEl.style.top = newTop + 'px';
|
||||||
|
dialogEl.style.width = newWidth + 'px';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'top-left':
|
||||||
|
// 当窗口高度达到最小值时,不再调整高度和位置
|
||||||
|
if (startHeight - deltaY >= 600) {
|
||||||
|
newHeight = startHeight - deltaY;
|
||||||
|
newTop = startTop + deltaY;
|
||||||
|
newWidth = Math.max(400, startWidth - deltaX);
|
||||||
|
newLeft = startLeft + startWidth - newWidth;
|
||||||
|
dialogEl.style.height = newHeight + 'px';
|
||||||
|
dialogEl.style.top = newTop + 'px';
|
||||||
|
dialogEl.style.width = newWidth + 'px';
|
||||||
|
dialogEl.style.left = newLeft + 'px';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let doc = document.querySelector('.welcome-message')
|
||||||
|
let sendBox = document.querySelector('.input-area-wrapper');
|
||||||
|
// sendBox 的高度
|
||||||
|
if (doc && sendBox) {
|
||||||
|
doc.style.height = `calc(${dialogEl.style.height} - ${sendBox.offsetHeight}px - 120px)`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const stopResize = () => {
|
||||||
|
isResizing = false;
|
||||||
|
resizeDirection = '';
|
||||||
|
|
||||||
|
// 保存当前尺寸和位置到 sessionStorage
|
||||||
|
const currentSize = {
|
||||||
|
width: parseInt(dialogEl.style.width),
|
||||||
|
height: parseInt(dialogEl.style.height),
|
||||||
|
left: parseInt(dialogEl.style.left),
|
||||||
|
top: parseInt(dialogEl.style.top)
|
||||||
|
};
|
||||||
|
sessionStorage.setItem('aiCallDialogSize', JSON.stringify(currentSize));
|
||||||
|
|
||||||
|
// 移除全局事件监听
|
||||||
|
document.removeEventListener('mousemove', handleMouseMove);
|
||||||
|
document.removeEventListener('mouseup', stopResize);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 为每个手柄绑定事件
|
||||||
|
handles.left.addEventListener('mousedown', (e) => startResize('left', e));
|
||||||
|
handles.right.addEventListener('mousedown', (e) => startResize('right', e));
|
||||||
|
handles.top.addEventListener('mousedown', (e) => startResize('top', e));
|
||||||
|
handles.bottom.addEventListener('mousedown', (e) => startResize('bottom', e));
|
||||||
|
handles.topLeft.addEventListener('mousedown', (e) => startResize('top-left', e));
|
||||||
|
handles.topRight.addEventListener('mousedown', (e) => startResize('top-right', e));
|
||||||
|
handles.bottomLeft.addEventListener('mousedown', (e) => startResize('bottom-left', e));
|
||||||
|
handles.bottomRight.addEventListener('mousedown', (e) => startResize('bottom-right', e));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState('app', ['showAICallMinimized']),
|
||||||
|
showMinimizedWindow() {
|
||||||
|
// 只有在Vuex状态为true时才显示最小化窗口
|
||||||
|
return this.showAICallMinimized;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogFullscreen:false,
|
||||||
|
openImg,
|
||||||
|
AIContent: '',
|
||||||
|
isLoading: false,
|
||||||
|
windowState: 'maximized', // 'maximized' 或 'minimized'
|
||||||
|
messageList: [
|
||||||
|
{
|
||||||
|
typing:true,
|
||||||
|
isFirstMessage: true, // 添加 isFirstMessage 属性不展示赞 踩
|
||||||
|
isBot: true, // 是否为机器人
|
||||||
|
text: `<p><b>您好!我是京东方案例智能问答助手,随时为您服务。</b></p>
|
||||||
|
<p>我可以帮您快速查找和解读平台内的各类案例内容。只需输入您想了解的问题或关键词,我会从案例库中精准匹配相关信息,并提供清晰的解答。每条回答都会附上来源链接,方便您随时查阅原始案例全文。</p>
|
||||||
|
<p>我还会根据您的提问,智能推荐相关延伸问题,助您更高效地探索知识、解决问题。</p>
|
||||||
|
<p>现在,欢迎随时向我提问,开启高效的知识查询体验吧!</p>`
|
||||||
|
}
|
||||||
|
],
|
||||||
|
suggestions:[],
|
||||||
|
isAutoScroll: true, // 是否自动滚动
|
||||||
|
// 添加一个标志位,用于标识组件是否已经初始化完成
|
||||||
|
isComponentReady: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// 组件挂载完成后,标记为已准备就绪
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isComponentReady = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
dialogVisible: {
|
||||||
|
handler(newVal) {
|
||||||
|
if (newVal) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// 获取对话框元素
|
||||||
|
const dialogEl = document.querySelector('.case-expert-dialog .el-dialog');
|
||||||
|
if (dialogEl) {
|
||||||
|
// 检查是否有保存的尺寸状态
|
||||||
|
const savedSize = sessionStorage.getItem('aiCallDialogSize');
|
||||||
|
if (savedSize) {
|
||||||
|
const { width, height, left, top } = JSON.parse(savedSize);
|
||||||
|
dialogEl.style.width = width + 'px';
|
||||||
|
dialogEl.style.height = height + 'px';
|
||||||
|
dialogEl.style.left = left + 'px';
|
||||||
|
dialogEl.style.top = top + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有保存的位置状态
|
||||||
|
const savedPosition = sessionStorage.getItem('aiCallDialogPosition');
|
||||||
|
if (savedPosition) {
|
||||||
|
const { left, top } = JSON.parse(savedPosition);
|
||||||
|
dialogEl.style.left = left + 'px';
|
||||||
|
dialogEl.style.top = top + 'px';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let doc = document.querySelector('.welcome-message')
|
||||||
|
let sendBox = document.querySelector('.input-area-wrapper');
|
||||||
|
// 只有在没有保存的尺寸状态时才使用默认值
|
||||||
|
if (doc && sendBox) {
|
||||||
|
const savedSize = sessionStorage.getItem('aiCallDialogSize');
|
||||||
|
if (!savedSize) {
|
||||||
|
doc.style.height = `calc(600px - ${sendBox.offsetHeight}px - 120px)`;
|
||||||
|
} else {
|
||||||
|
const { height } = JSON.parse(savedSize);
|
||||||
|
doc.style.height = `calc(${height}px - ${sendBox.offsetHeight}px - 120px)`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
},
|
||||||
|
messageList: {
|
||||||
|
handler() {
|
||||||
|
// 只有在组件准备就绪后才执行滚动操作
|
||||||
|
if (this.isComponentReady) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.scrollToBottom();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onbigWindowClick() {
|
||||||
|
console.log('放大');
|
||||||
|
// 保存当前非全屏状态的尺寸和位置(仅当当前不是全屏状态时)
|
||||||
|
if (!this.dialogFullscreen) {
|
||||||
|
const dialogEl = document.querySelector('.case-expert-dialog .el-dialog');
|
||||||
|
if (dialogEl) {
|
||||||
|
const normalSize = {
|
||||||
|
width: parseInt(dialogEl.style.width) || dialogEl.offsetWidth,
|
||||||
|
height: parseInt(dialogEl.style.height) || dialogEl.offsetHeight,
|
||||||
|
left: parseInt(dialogEl.style.left) || dialogEl.offsetLeft,
|
||||||
|
top: parseInt(dialogEl.style.top) || dialogEl.offsetTop
|
||||||
|
};
|
||||||
|
sessionStorage.setItem('aiCallDialogNormalSize', JSON.stringify(normalSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置全屏状态
|
||||||
|
this.dialogFullscreen = true;
|
||||||
|
|
||||||
|
// 设置全屏尺寸和位置
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const dialogEl = document.querySelector('.case-expert-dialog .el-dialog');
|
||||||
|
if (dialogEl) {
|
||||||
|
dialogEl.style.width = '100vw';
|
||||||
|
dialogEl.style.height = '100vh';
|
||||||
|
dialogEl.style.left = '0px';
|
||||||
|
dialogEl.style.top = '0px';
|
||||||
|
|
||||||
|
// 更新消息容器高度
|
||||||
|
const messageContainer = document.querySelector('.welcome-message');
|
||||||
|
const inputArea = document.querySelector('.input-area-wrapper');
|
||||||
|
if (messageContainer && inputArea) {
|
||||||
|
messageContainer.style.height = `calc(100vh - ${inputArea.offsetHeight}px - 120px)`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onRestoreWindowClick(){
|
||||||
|
console.log('缩小');
|
||||||
|
this.dialogFullscreen = false;
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const dialogEl = document.querySelector('.case-expert-dialog .el-dialog');
|
||||||
|
if (dialogEl) {
|
||||||
|
// 从 sessionStorage 中获取保存的正常窗口尺寸和位置
|
||||||
|
const savedNormalSize = sessionStorage.getItem('aiCallDialogNormalSize');
|
||||||
|
const savedSize = sessionStorage.getItem('aiCallDialogSize');
|
||||||
|
const savedPosition = sessionStorage.getItem('aiCallDialogPosition');
|
||||||
|
|
||||||
|
if (savedNormalSize) {
|
||||||
|
// 使用之前保存的正常尺寸
|
||||||
|
const { width, height, left, top } = JSON.parse(savedNormalSize);
|
||||||
|
dialogEl.style.width = width + 'px';
|
||||||
|
dialogEl.style.height = height + 'px';
|
||||||
|
dialogEl.style.left = left + 'px';
|
||||||
|
dialogEl.style.top = top + 'px';
|
||||||
|
} else if (savedSize) {
|
||||||
|
// 回退到通用保存的尺寸
|
||||||
|
const { width, height, left, top } = JSON.parse(savedSize);
|
||||||
|
dialogEl.style.width = width + 'px';
|
||||||
|
dialogEl.style.height = height + 'px';
|
||||||
|
dialogEl.style.left = left + 'px';
|
||||||
|
dialogEl.style.top = top + 'px';
|
||||||
|
} else {
|
||||||
|
// 如果没有保存的尺寸,则使用默认值
|
||||||
|
dialogEl.style.width = '800px';
|
||||||
|
dialogEl.style.height = '600px';
|
||||||
|
dialogEl.style.left = (window.innerWidth - 800) / 2 + 'px';
|
||||||
|
dialogEl.style.top = '100px';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 应用相应的消息容器高度
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const messageContainer = document.querySelector('.welcome-message');
|
||||||
|
const inputArea = document.querySelector('.input-area-wrapper');
|
||||||
|
if (messageContainer && inputArea) {
|
||||||
|
const dialogHeight = dialogEl.style.height || '600px';
|
||||||
|
messageContainer.style.height = `calc(${dialogHeight} - ${inputArea.offsetHeight}px - 120px)`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// / 关闭最小化窗口
|
||||||
|
closeMinimizedWindow() {
|
||||||
|
this.$store.commit('app/SET_SHOW_AI_CALL_MINIMIZED', false);
|
||||||
|
this.$store.commit('app/SET_SHOW_AI_CALL', false);
|
||||||
|
this.windowState = 'maximized';
|
||||||
|
},
|
||||||
|
getMinWidow(vis){
|
||||||
|
// this.showAICallMinimized = vis
|
||||||
|
this.windowState = 'minimized';
|
||||||
|
},
|
||||||
|
onClose() {
|
||||||
|
console.log('关闭弹窗')
|
||||||
|
// 清除保存的状态
|
||||||
|
sessionStorage.removeItem('aiCallDialogSize');
|
||||||
|
sessionStorage.removeItem('aiCallDialogPosition');
|
||||||
|
this.$emit('close')
|
||||||
|
this.dialogFullscreen=false
|
||||||
|
// 可以在这里执行其他逻辑
|
||||||
|
},
|
||||||
|
|
||||||
|
minimizeWindow() {
|
||||||
|
console.log(131);
|
||||||
|
|
||||||
|
this.windowState = 'minimized';
|
||||||
|
this.$store.commit('app/SET_SHOW_AI_CALL_MINIMIZED', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
maximizeWindow() {
|
||||||
|
this.windowState = 'maximized';
|
||||||
|
},
|
||||||
|
|
||||||
|
getLastUserMessage() {
|
||||||
|
// 从后往前找用户消息
|
||||||
|
for (let i = this.messageList.length - 1; i >= 0; i--) {
|
||||||
|
if (!this.messageList[i].isBot) {
|
||||||
|
// 移除HTML标签只返回纯文本
|
||||||
|
const tempDiv = document.createElement('div');
|
||||||
|
tempDiv.innerHTML = this.messageList[i].text;
|
||||||
|
return tempDiv.textContent || tempDiv.innerText || '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理加载状态
|
||||||
|
handleLoading(status) {
|
||||||
|
this.isLoading = status;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 更新消息
|
||||||
|
updateMessage(message) {
|
||||||
|
// 由于Vue的响应式系统,message对象的更改会自动更新视图
|
||||||
|
// 这里不需要额外的操作
|
||||||
|
},
|
||||||
|
updateSuggestions(arr){
|
||||||
|
this.suggestions = arr
|
||||||
|
},
|
||||||
|
// 处理建议
|
||||||
|
sendSuggestions(item){
|
||||||
|
// this.suggestions = []
|
||||||
|
this.AIContent = item
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.$refs.sendMessage.handleSend()
|
||||||
|
this.AIContent = ''
|
||||||
|
},500)
|
||||||
|
},
|
||||||
|
startNewConversation() {
|
||||||
|
// 重置对话时,先标记组件为未准备就绪状态
|
||||||
|
this.isComponentReady = false;
|
||||||
|
|
||||||
|
this.messageList = [
|
||||||
|
{
|
||||||
|
isBot: true,
|
||||||
|
isFirstMessage: true,
|
||||||
|
text: `<p><b>您好!我是京东方案例智能问答助手,随时为您服务。</b></p>
|
||||||
|
<p>我可以帮您快速查找和解读平台内的各类案例内容。只需输入您想了解的问题或关键词,我会从案例库中精准匹配相关信息,并提供清晰的解答。每条回答都会附上来源链接,方便您随时查阅原始案例全文。</p>
|
||||||
|
<p>我还会根据您的提问,智能推荐相关延伸问题,助您更高效地探索知识、解决问题。</p>
|
||||||
|
<p>现在,欢迎随时向我提问,开启高效的知识查询体验吧!</p>`
|
||||||
|
}
|
||||||
|
];
|
||||||
|
this.AIContent = '';
|
||||||
|
this.isLoading = false;
|
||||||
|
|
||||||
|
// 在下一个 tick 中重新标记为准备就绪
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isComponentReady = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理滚动事件
|
||||||
|
handleScroll(event) {
|
||||||
|
const element = event.target;
|
||||||
|
// 判断是否滚动到底部
|
||||||
|
const isAtBottom = element.scrollHeight - element.scrollTop <= element.clientHeight + 1;
|
||||||
|
|
||||||
|
// 如果滚动到底部,则开启自动滚动
|
||||||
|
// 如果离开底部,则关闭自动滚动
|
||||||
|
this.isAutoScroll = isAtBottom;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 滚动到底部
|
||||||
|
scrollToBottom() {
|
||||||
|
if (this.isAutoScroll && this.$refs.messageContainer) {
|
||||||
|
this.$refs.messageContainer.scrollTop = this.$refs.messageContainer.scrollHeight;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 最小化窗口的点击事件处理方法
|
||||||
|
onMinimizedWindowClick() {
|
||||||
|
// 当点击最小化窗口时,如果dialogVisible为false,则通过事件通知父组件显示对话框
|
||||||
|
if (!this.dialogVisible) {
|
||||||
|
this.$emit('restore');
|
||||||
|
}
|
||||||
|
// 然后将窗口状态设置为最大化
|
||||||
|
this.windowState = 'maximized';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.case-expert-dialog {
|
||||||
|
::v-deep .el-dialog{
|
||||||
|
background: url("./components/u762.svg") no-repeat ;
|
||||||
|
background-size: cover;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
//background-color: rgba(255, 255, 255, 0.8);
|
||||||
|
}
|
||||||
|
::v-deep .el-dialog__body{
|
||||||
|
padding: 10px;
|
||||||
|
flex:1;
|
||||||
|
//font-size: 12px;
|
||||||
|
*{
|
||||||
|
font-size:unset ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-title {
|
||||||
|
background: transparent;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
padding-right: 20px;
|
||||||
|
cursor: move; /* 添加拖动样式 */
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.window-control-btn {
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
color: #333; /* 黑色图标 */
|
||||||
|
margin-top: -13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.message-suggestions{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.suggestion-item{
|
||||||
|
cursor: pointer;
|
||||||
|
float: right;
|
||||||
|
padding: 5px 15px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: rgba(228, 231, 237, 1);
|
||||||
|
border-radius: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.content-wrapper {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: transparent;
|
||||||
|
border-radius: 8px;
|
||||||
|
min-height: 500px;
|
||||||
|
height:100%;
|
||||||
|
position: relative;
|
||||||
|
//margin-bottom: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
.welcome-message {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
height: 400px;
|
||||||
|
//flex:1;
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
margin-right: 12px;
|
||||||
|
img {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #007aff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: white;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-text {
|
||||||
|
width: 100%;
|
||||||
|
//margin-bottom: 15px;
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: #333;
|
||||||
|
//font-size: 14px;
|
||||||
|
line-height: 1.6;
|
||||||
|
margin: 8px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-message {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #007aff;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-dots {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #999;
|
||||||
|
margin-right: 5px;
|
||||||
|
animation: loading 1.4s infinite ease-in-out both;
|
||||||
|
|
||||||
|
&:nth-child(1) {
|
||||||
|
animation-delay: -0.32s;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(2) {
|
||||||
|
animation-delay: -0.16s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-area-wrapper {
|
||||||
|
//position: absolute;
|
||||||
|
//bottom: 10px;
|
||||||
|
//width: calc(100% - 40px);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes loading {
|
||||||
|
0%, 80%, 100% {
|
||||||
|
transform: scale(0);
|
||||||
|
}
|
||||||
|
40% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.minimized-window {
|
||||||
|
position: fixed;
|
||||||
|
right: 20px;
|
||||||
|
bottom: 20px;
|
||||||
|
width: 300px;
|
||||||
|
background: url("./components/u762.svg") no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
z-index: 2000;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.minimized-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px 15px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
|
||||||
|
.window-title {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.window-control-btn {
|
||||||
|
font-size: 16px;
|
||||||
|
padding: 3px 8px;
|
||||||
|
color: #000000; /* 黑色图标 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.minimized-message {
|
||||||
|
padding: 15px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
min-height: 60px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.case-expert-dialog {
|
||||||
|
::v-deep .el-dialog.fullscreen {
|
||||||
|
border-radius: 0;
|
||||||
|
|
||||||
|
.el-dialog__body {
|
||||||
|
height: calc(100vh - 120px); // 减去标题栏高度
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="case-list-content">
|
<div id="case-list-content">
|
||||||
<div style="margin-bottom:30px" class="case-banner">
|
<div style="margin-bottom:30px" class="case-banner">
|
||||||
<portal-header current="case" textColor="#fff" :goSearch="2"></portal-header>
|
<portal-header current="case" textColor="#fff" :goSearch="2">
|
||||||
|
|
||||||
|
</portal-header>
|
||||||
</div>
|
</div>
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="xcontent2">
|
<div class="xcontent2">
|
||||||
@@ -109,6 +111,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="xcontent2-minor" :style="{ display: zoomShow ? '' : 'none' }">
|
<div class="xcontent2-minor" :style="{ display: zoomShow ? '' : 'none' }">
|
||||||
|
<AICaseConsult />
|
||||||
<div id="fixd-box">
|
<div id="fixd-box">
|
||||||
<router-link class="the_charts" to="/case/charts">
|
<router-link class="the_charts" to="/case/charts">
|
||||||
<div class="text">排行榜</div>
|
<div class="text">排行榜</div>
|
||||||
@@ -237,9 +240,10 @@ import { formatDate } from "@/utils/datetime.js"
|
|||||||
import { cutFullName } from "@/utils/tools.js";
|
import { cutFullName } from "@/utils/tools.js";
|
||||||
import apiPlace from "@/api/phase2/place.js"
|
import apiPlace from "@/api/phase2/place.js"
|
||||||
import portalFloatTools from "@/components/PortalFloatTools.vue";
|
import portalFloatTools from "@/components/PortalFloatTools.vue";
|
||||||
|
import AICaseConsult from "@/views/portal/case/components/AICaseConsult.vue";
|
||||||
export default {
|
export default {
|
||||||
name: 'atticle',
|
name: 'atticle',
|
||||||
components: { portalHeader, portalFloatTools, portalFooter, interactBar, author, comments, pdfPreview },
|
components: {AICaseConsult, portalHeader, portalFloatTools, portalFooter, interactBar, author, comments, pdfPreview },
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['userInfo'])
|
...mapGetters(['userInfo'])
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="case-list-content">
|
<div id="case-list-content">
|
||||||
<div style="margin-bottom:30px" class="case-banner">
|
<div style="margin-bottom:30px;position: relative" class="case-banner">
|
||||||
<portal-header @type1="handleType" :type="queryCondition" current="case" textColor="#fff" @emitInput="emitInput" @showClass="showClass"></portal-header>
|
<portal-header @type1="handleType" :type="queryCondition" current="case" textColor="#fff" @emitInput="emitInput"
|
||||||
|
@showClass="showClass"></portal-header>
|
||||||
|
|
||||||
|
<p style="position: absolute;z-index: 10;bottom:20px;left:220px;color:#fff">案例专区隆重推出“AI案例专家”助力高效案例应用</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="xcontent2">
|
<div class="xcontent2">
|
||||||
<!-- 新增的案例分类 -->
|
<!-- 新增的案例分类 -->
|
||||||
@@ -115,7 +118,8 @@
|
|||||||
<div style="padding:0;" :class="speciAll ? 'fieldactive' : ''" @click="majorall()">全部</div>
|
<div style="padding:0;" :class="speciAll ? 'fieldactive' : ''" @click="majorall()">全部</div>
|
||||||
<div class="fieldbox">
|
<div class="fieldbox">
|
||||||
<div :class="item.fielclass ? 'fieldactive' : ''" @click="fieldmajor(item)"
|
<div :class="item.fielclass ? 'fieldactive' : ''" @click="fieldmajor(item)"
|
||||||
v-for="(item, idx) in speciData" :key="'d' + idx">{{ item.name }}({{ item.explanation }})</div>
|
v-for="(item, idx) in speciData" :key="'d' + idx">{{ item.name }}({{ item.explanation }})
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <el-radio-group style="display:flex;" v-model="queryCondition.majorType" size="mini" @change="search()">
|
<!-- <el-radio-group style="display:flex;" v-model="queryCondition.majorType" size="mini" @change="search()">
|
||||||
@@ -156,15 +160,19 @@
|
|||||||
<div v-if="caseTimeShow" class="pub_time" @click="searchTime">
|
<div v-if="caseTimeShow" class="pub_time" @click="searchTime">
|
||||||
<div class="text">发布时间</div>
|
<div class="text">发布时间</div>
|
||||||
<div class="triangle">
|
<div class="triangle">
|
||||||
<div :style="{borderBottomColor:pubTimeNum===2?'#387DF7':'#DCDFE6'}" class="up-triangle"></div>
|
<div :style="{ borderBottomColor: pubTimeNum === 2 ? '#387DF7' : '#DCDFE6' }" class="up-triangle">
|
||||||
<div :style="{borderTopColor:pubTimeNum===1?'#387DF7':'#DCDFE6'}" class="down-triangle"></div>
|
</div>
|
||||||
|
<div :style="{ borderTopColor: pubTimeNum === 1 ? '#387DF7' : '#DCDFE6' }" class="down-triangle">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="caseTimeShow" class="pub_time" @click="searchPageView">
|
<div v-if="caseTimeShow" class="pub_time" @click="searchPageView">
|
||||||
<div class="text">浏览量</div>
|
<div class="text">浏览量</div>
|
||||||
<div class="triangle">
|
<div class="triangle">
|
||||||
<div :style="{borderBottomColor:pageViewNum===2?'#387DF7':'#DCDFE6'}" class="up-triangle"></div>
|
<div :style="{ borderBottomColor: pageViewNum === 2 ? '#387DF7' : '#DCDFE6' }" class="up-triangle">
|
||||||
<div :style="{borderTopColor:pageViewNum===1?'#387DF7':'#DCDFE6'}" class="down-triangle"></div>
|
</div>
|
||||||
|
<div :style="{ borderTopColor: pageViewNum === 1 ? '#387DF7' : '#DCDFE6' }" class="down-triangle">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-select v-if="caseTimeShow" @change="yearsChange" v-model="years" multiple collapse-tags
|
<el-select v-if="caseTimeShow" @change="yearsChange" v-model="years" multiple collapse-tags
|
||||||
@@ -172,11 +180,12 @@
|
|||||||
<el-option v-for="item in caseYears" :key="item.value" :label="item.label" :value="item.value">
|
<el-option v-for="item in caseYears" :key="item.value" :label="item.label" :value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<div :class="queryCondition.type == 'collect' ? 'collect_active': 'collect'" @click="searchexcellent('collect')">
|
<div :class="queryCondition.type == 'collect' ? 'collect_active' : 'collect'"
|
||||||
|
@click="searchexcellent('collect')">
|
||||||
<div class="png"></div>
|
<div class="png"></div>
|
||||||
<div class="text">收藏案例</div>
|
<div class="text">收藏案例</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="queryCondition.type == 'time' ? 'time_active': 'time'" @click="searchexcellent('time')">
|
<div :class="queryCondition.type == 'time' ? 'time_active' : 'time'" @click="searchexcellent('time')">
|
||||||
<div class="png"></div>
|
<div class="png"></div>
|
||||||
<div class="text">浏览记录</div>
|
<div class="text">浏览记录</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -189,7 +198,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="data-content">
|
<div class="data-content">
|
||||||
<div v-for="item in this.caseList.list" :key="isTimeData?item.browsingHistoryId : item.id" class="case-list">
|
<div v-for="item in this.caseList.list" :key="isTimeData ? item.browsingHistoryId : item.id"
|
||||||
|
class="case-list">
|
||||||
<div class="case-info">
|
<div class="case-info">
|
||||||
<div class="case-info-cont">
|
<div class="case-info-cont">
|
||||||
<!-- <router-link :to="'/case/detail?id=' + item.id"> -->
|
<!-- <router-link :to="'/case/detail?id=' + item.id"> -->
|
||||||
@@ -201,17 +211,22 @@
|
|||||||
<div class="case-info-title">
|
<div class="case-info-title">
|
||||||
<div class="case-titdiv">
|
<div class="case-titdiv">
|
||||||
<div class="case-tittext">
|
<div class="case-tittext">
|
||||||
<span :style="{maxWidth:item.excellentTag&&item.viewRankTags.length != 0?'400px':item.viewRankTags.length != 0?'500px':''}" class="title-line-ellipsis" :title="item.title">{{ item.title || item.contentInfo }}</span>
|
<span
|
||||||
|
:style="{ maxWidth: item.excellentTag && item.viewRankTags.length != 0 ? '400px' : item.viewRankTags.length != 0 ? '500px' : '' }"
|
||||||
|
class="title-line-ellipsis" :title="item.title">{{ item.title || item.contentInfo }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="case-activeText">
|
<div class="case-activeText">
|
||||||
<!-- <span v-if="item.breCommend" class="comWords"
|
<!-- <span v-if="item.breCommend" class="comWords"
|
||||||
style="background-color:rgba(232, 139, 72);">荐</span>
|
style="background-color:rgba(232, 139, 72);">荐</span>
|
||||||
<span v-if="item.excellent" class="comWords" style="background-color:red;">最佳</span> -->
|
<span v-if="item.excellent" class="comWords" style="background-color:red;">最佳</span> -->
|
||||||
<span @click.stop="()=>{}" v-if="item.excellentTag" class="comWords" style="width: 98px;height: 24px;background: #F99000;border-radius: 2px;font-weight: 400;font-size: 12px;color: #FFFFFF;padding: 4px 10px;cursor: auto;">
|
<span @click.stop="() => { }" v-if="item.excellentTag" class="comWords"
|
||||||
{{item.excellentTag}}
|
style="width: 98px;height: 24px;background: #F99000;border-radius: 2px;font-weight: 400;font-size: 12px;color: #FFFFFF;padding: 4px 10px;cursor: auto;">
|
||||||
|
{{ item.excellentTag }}
|
||||||
</span>
|
</span>
|
||||||
<span @click.stop="toExcellent(tag)" v-if="item.viewRankTags.length != 0" v-for="tag in item.viewRankTags" class="comWords" style="width: 98px;height: 24px;background: #F99000;border-radius: 2px;font-weight: 400;font-size: 12px;color: #FFFFFF;padding: 4px 10px;">
|
<span @click.stop="toExcellent(tag)" v-if="item.viewRankTags.length != 0"
|
||||||
{{tag.tagName}}
|
v-for="tag in item.viewRankTags" class="comWords"
|
||||||
|
style="width: 98px;height: 24px;background: #F99000;border-radius: 2px;font-weight: 400;font-size: 12px;color: #FFFFFF;padding: 4px 10px;">
|
||||||
|
{{ tag.tagName }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="case-info-date portal-time">
|
<div class="case-info-date portal-time">
|
||||||
@@ -225,8 +240,9 @@
|
|||||||
<!-- </router-link> -->
|
<!-- </router-link> -->
|
||||||
<div v-if="!item.id" style="height:25px;padding-top:14px "></div>
|
<div v-if="!item.id" style="height:25px;padding-top:14px "></div>
|
||||||
<div v-if="item.id" style="height:58px;padding-top:14px ">
|
<div v-if="item.id" style="height:58px;padding-top:14px ">
|
||||||
<author :avatar="item.authorInfo.avatar" :name="item.authorInfo.name" :info="item.authorInfo.orgInfo"
|
<author :avatar="item.authorInfo.avatar" :name="item.authorInfo.name"
|
||||||
:sex="item.authorInfo.sex" :authorTags="item.authorTags" :aid="item.authorInfo.aid">
|
:info="item.authorInfo.orgInfo" :sex="item.authorInfo.sex" :authorTags="item.authorTags"
|
||||||
|
:aid="item.authorInfo.aid">
|
||||||
<template>
|
<template>
|
||||||
<div v-if="item.breCommend"
|
<div v-if="item.breCommend"
|
||||||
style="padding-top: 6px;flex: 1;display: flex;justify-content: flex-end;color: #999;font-size: 12px;">
|
style="padding-top: 6px;flex: 1;display: flex;justify-content: flex-end;color: #999;font-size: 12px;">
|
||||||
@@ -253,7 +269,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- </router-link> -->
|
<!-- </router-link> -->
|
||||||
<div v-if="item.id" class="case-info-summary two-line-ellipsis" @click="toCaseDetail(item.id, item.refId)">
|
<div v-if="item.id" class="case-info-summary two-line-ellipsis"
|
||||||
|
@click="toCaseDetail(item.id, item.refId)">
|
||||||
{{ item.summary }}
|
{{ item.summary }}
|
||||||
<!-- <router-link :to="'/case/detail?id='+item.id"> -->
|
<!-- <router-link :to="'/case/detail?id='+item.id"> -->
|
||||||
<!-- {{displayAll(item)}} -->
|
<!-- {{displayAll(item)}} -->
|
||||||
@@ -264,7 +281,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="item.id" style="display: flex;justify-content: flex-end;">
|
<div v-if="item.id" style="display: flex;justify-content: flex-end;">
|
||||||
<div style="margin:8px 0;">
|
<div style="margin:8px 0;">
|
||||||
<interactBar @deleteFavorite="deleteFavorite" :type="3" :data="item" :comments="false" :shares="true"></interactBar>
|
<interactBar @deleteFavorite="deleteFavorite" :type="3" :data="item" :comments="false"
|
||||||
|
:shares="true"></interactBar>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -292,7 +310,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 打开排行榜 -->
|
<!-- 打开排行榜 -->
|
||||||
<div class="xcontent2-minor">
|
<div class="xcontent2-minor">
|
||||||
|
|
||||||
<div id="fixd-box">
|
<div id="fixd-box">
|
||||||
|
<AICaseConsult />
|
||||||
<router-link class="the_charts" to="/case/charts">
|
<router-link class="the_charts" to="/case/charts">
|
||||||
<div class="text">排行榜</div>
|
<div class="text">排行榜</div>
|
||||||
<div class="icon">></div>
|
<div class="icon">></div>
|
||||||
@@ -303,7 +323,7 @@
|
|||||||
<p class="ranking-title">好评榜</p>
|
<p class="ranking-title">好评榜</p>
|
||||||
<el-dropdown trigger="click" @command="positiveReview">
|
<el-dropdown trigger="click" @command="positiveReview">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
{{favorableName}}<i class="el-icon-arrow-down el-icon--right"></i>
|
{{ favorableName }}<i class="el-icon-arrow-down el-icon--right"></i>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="total">总</el-dropdown-item>
|
<el-dropdown-item command="total">总</el-dropdown-item>
|
||||||
@@ -340,7 +360,7 @@
|
|||||||
<p class="ranking-title">人气榜</p>
|
<p class="ranking-title">人气榜</p>
|
||||||
<el-dropdown trigger="click" @command="popularityReview">
|
<el-dropdown trigger="click" @command="popularityReview">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
{{popularityName}}<i class="el-icon-arrow-down el-icon--right"></i>
|
{{ popularityName }}<i class="el-icon-arrow-down el-icon--right"></i>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="total">总</el-dropdown-item>
|
<el-dropdown-item command="total">总</el-dropdown-item>
|
||||||
@@ -372,7 +392,8 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="recommendRank.length > 0" class="portal-ranking ranking-bg2" style="margin-top:20px;padding: 20px 15px;max-height: 222px;">
|
<div v-if="recommendRank.length > 0" class="portal-ranking ranking-bg2"
|
||||||
|
style="margin-top:20px;padding: 20px 15px;max-height: 222px;">
|
||||||
<p class="ranking-title">推荐榜</p>
|
<p class="ranking-title">推荐榜</p>
|
||||||
<ul class="ranking-data">
|
<ul class="ranking-data">
|
||||||
<li v-for="(item, index) in recommendRank" :key="index" class="title-line-ellipsis"
|
<li v-for="(item, index) in recommendRank" :key="index" class="title-line-ellipsis"
|
||||||
@@ -458,6 +479,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <AICall :dialogVisible="showAICall" @close="onClose" />-->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -477,6 +499,8 @@ import apiDict from "@/api/modules/dict.js";
|
|||||||
import apiType from "@/api/modules/type.js";
|
import apiType from "@/api/modules/type.js";
|
||||||
import { cutFullName } from "@/utils/tools.js";
|
import { cutFullName } from "@/utils/tools.js";
|
||||||
import apiPlace from "@/api/phase2/place.js"
|
import apiPlace from "@/api/phase2/place.js"
|
||||||
|
import AICall from '@/views/portal/case/AICall.vue'
|
||||||
|
import AICaseConsult from '@/views/portal/case/components/AICaseConsult.vue'
|
||||||
export default {
|
export default {
|
||||||
name: "case",
|
name: "case",
|
||||||
components: {
|
components: {
|
||||||
@@ -486,9 +510,12 @@ export default {
|
|||||||
interactBar,
|
interactBar,
|
||||||
timeShow,
|
timeShow,
|
||||||
author,
|
author,
|
||||||
|
AICall,
|
||||||
|
AICaseConsult
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
timeoutId: null,
|
timeoutId: null,
|
||||||
isTimeData: false,
|
isTimeData: false,
|
||||||
articlePageList: [],
|
articlePageList: [],
|
||||||
@@ -503,10 +530,10 @@ export default {
|
|||||||
popularityName: '季度',
|
popularityName: '季度',
|
||||||
pubTimeNum: 1,
|
pubTimeNum: 1,
|
||||||
pageViewNum: 0,
|
pageViewNum: 0,
|
||||||
twoId:'',
|
twoId: '',
|
||||||
treeList:[],
|
treeList: [],
|
||||||
caseType:process.env.VUE_APP_CASE_TYPE,//类型
|
caseType: process.env.VUE_APP_CASE_TYPE,//类型
|
||||||
caseYears:[],
|
caseYears: [],
|
||||||
refId: '',//消息跳转案例的id
|
refId: '',//消息跳转案例的id
|
||||||
selectList: [],//点击选中的list
|
selectList: [],//点击选中的list
|
||||||
twoList: [], //二级分类{type:12}
|
twoList: [], //二级分类{type:12}
|
||||||
@@ -558,9 +585,9 @@ export default {
|
|||||||
// notInIds: [],//重复的id
|
// notInIds: [],//重复的id
|
||||||
orderField: "id",
|
orderField: "id",
|
||||||
orderAsc: false,//排序
|
orderAsc: false,//排序
|
||||||
sysType1:'',
|
sysType1: '',
|
||||||
sysType2:'',
|
sysType2: '',
|
||||||
sysType3:''
|
sysType3: ''
|
||||||
},
|
},
|
||||||
keyWord: "",
|
keyWord: "",
|
||||||
anking: 2,
|
anking: 2,
|
||||||
@@ -664,25 +691,25 @@ export default {
|
|||||||
return !this.speciData.some(item => item.fielclass);
|
return !this.speciData.some(item => item.fielclass);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeRouteLeave (to, from, next) {
|
beforeRouteLeave(to, from, next) {
|
||||||
const isScroll = 'caseDetail,caseCharts,caseExcellent'
|
const isScroll = 'caseDetail,caseCharts,caseExcellent'
|
||||||
if(!isScroll.includes(to.name)){
|
if (!isScroll.includes(to.name)) {
|
||||||
// console.log('我是外')
|
// console.log('我是外')
|
||||||
this.queryCondition.pageIndex = 1
|
this.queryCondition.pageIndex = 1
|
||||||
this.search()
|
this.search()
|
||||||
// window.location.reload()
|
// window.location.reload()
|
||||||
// this.$destroy()
|
// this.$destroy()
|
||||||
}else{
|
} else {
|
||||||
sessionStorage.setItem('pagesScroll', JSON.stringify(window.pageYOffset))
|
sessionStorage.setItem('pagesScroll', JSON.stringify(window.pageYOffset))
|
||||||
}
|
}
|
||||||
window.removeEventListener("scroll", this.handleScroll);
|
window.removeEventListener("scroll", this.handleScroll);
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
beforeRouteEnter(to, from, next) {
|
beforeRouteEnter(to, from, next) {
|
||||||
if(from.name !== 'caseDetail'){
|
if (from.name !== 'caseDetail') {
|
||||||
// console.log('我是内')
|
// console.log('我是内')
|
||||||
}
|
}
|
||||||
next(vm=>{
|
next(vm => {
|
||||||
vm.$nextTick(() => {
|
vm.$nextTick(() => {
|
||||||
window.scrollTo({
|
window.scrollTo({
|
||||||
left: 0,
|
left: 0,
|
||||||
@@ -777,9 +804,9 @@ export default {
|
|||||||
// 90是测试环境,155是生产环境
|
// 90是测试环境,155是生产环境
|
||||||
// console.log(this.caseType);
|
// console.log(this.caseType);
|
||||||
|
|
||||||
Promise.all([apiType.treeList(1,Number(this.caseType ?? 155),1), apiCase.majorTypes()]).then(rs => {
|
Promise.all([apiType.treeList(1, Number(this.caseType ?? 155), 1), apiCase.majorTypes()]).then(rs => {
|
||||||
if (rs[0].code == 200) {
|
if (rs[0].code == 200) {
|
||||||
const {records} = rs[0].data
|
const { records } = rs[0].data
|
||||||
records.forEach(item => {
|
records.forEach(item => {
|
||||||
item.fielclass = false;
|
item.fielclass = false;
|
||||||
item.type = 'org_domain';
|
item.type = 'org_domain';
|
||||||
@@ -845,27 +872,28 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
allRequests(){
|
// 是否展示入口
|
||||||
|
allRequests() {
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
"scroll",
|
"scroll",
|
||||||
this.handleScroll
|
this.handleScroll
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
deleteFavorite(e){
|
deleteFavorite(e) {
|
||||||
this.search()
|
this.search()
|
||||||
},
|
},
|
||||||
positiveReview(e){
|
positiveReview(e) {
|
||||||
this.favorableName = this.switch[e]
|
this.favorableName = this.switch[e]
|
||||||
this.getPositive()
|
this.getPositive()
|
||||||
},
|
},
|
||||||
popularityReview(e){
|
popularityReview(e) {
|
||||||
this.popularityName = this.switch[e]
|
this.popularityName = this.switch[e]
|
||||||
this.getPopularity()
|
this.getPopularity()
|
||||||
},
|
},
|
||||||
handleType(msg){
|
handleType(msg) {
|
||||||
// this.queryCondition.type = msg
|
// this.queryCondition.type = msg
|
||||||
},
|
},
|
||||||
handleOptionClick(treeItem){
|
handleOptionClick(treeItem) {
|
||||||
this.treeList.forEach(one => {
|
this.treeList.forEach(one => {
|
||||||
one.checked = false;
|
one.checked = false;
|
||||||
if (one.id == treeItem.id) {
|
if (one.id == treeItem.id) {
|
||||||
@@ -910,13 +938,13 @@ export default {
|
|||||||
if (status === 200) {
|
if (status === 200) {
|
||||||
result.forEach(one => {
|
result.forEach(one => {
|
||||||
one.checked = false;
|
one.checked = false;
|
||||||
if(!one.children) one.children = []
|
if (!one.children) one.children = []
|
||||||
one.children && one.children.forEach(two => {
|
one.children && one.children.forEach(two => {
|
||||||
two.checked = false;
|
two.checked = false;
|
||||||
if(!two.children) two.children = []
|
if (!two.children) two.children = []
|
||||||
two.children && two.children.forEach(three => {
|
two.children && two.children.forEach(three => {
|
||||||
three.checked = false;
|
three.checked = false;
|
||||||
if(!three.children) three.children = []
|
if (!three.children) three.children = []
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -940,23 +968,23 @@ export default {
|
|||||||
},
|
},
|
||||||
// 查看率的时间
|
// 查看率的时间
|
||||||
toCaseDetail(id, refId) {
|
toCaseDetail(id, refId) {
|
||||||
if(!id){
|
if (!id) {
|
||||||
this.$message.error('该案例已被删除')
|
this.$message.error('该案例已被删除')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
apiCase.details(id,true).then(res=>{
|
apiCase.details(id, true).then(res => {
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
if (refId) {
|
if (refId) {
|
||||||
apiCase.startReadTimer(refId)
|
apiCase.startReadTimer(refId)
|
||||||
}
|
}
|
||||||
this.$router.push({ path: '/case/detail', query: { id } });
|
this.$router.push({ path: '/case/detail', query: { id } });
|
||||||
}else{
|
} else {
|
||||||
this.$message.error(res.message);
|
this.$message.error(res.message);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toExcellent(item){
|
toExcellent(item) {
|
||||||
this.$router.push({path:'/case/excellent',query:{majorId:item.majorId,majorName:item.majorName,riseRankTime:item.riseRankTime.split(' ')[0]}})
|
this.$router.push({ path: '/case/excellent', query: { majorId: item.majorId, majorName: item.majorName, riseRankTime: item.riseRankTime.split(' ')[0] } })
|
||||||
},
|
},
|
||||||
tylClick() {
|
tylClick() {
|
||||||
window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130");
|
window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130");
|
||||||
@@ -1259,31 +1287,31 @@ export default {
|
|||||||
this.isSeach = true;
|
this.isSeach = true;
|
||||||
this.search(true);
|
this.search(true);
|
||||||
},
|
},
|
||||||
searchTime(){
|
searchTime() {
|
||||||
this.pubTimeNum++
|
this.pubTimeNum++
|
||||||
if(this.pubTimeNum>2){
|
if (this.pubTimeNum > 2) {
|
||||||
this.pubTimeNum = 0;
|
this.pubTimeNum = 0;
|
||||||
}
|
}
|
||||||
if(this.pubTimeNum != 0){
|
if (this.pubTimeNum != 0) {
|
||||||
this.pageViewNum = 0;
|
this.pageViewNum = 0;
|
||||||
}
|
}
|
||||||
this.queryCondition.orderField = 'sysCreateTime'
|
this.queryCondition.orderField = 'sysCreateTime'
|
||||||
this.queryCondition.orderAsc = this.pubTimeNum == 2 ? true : this.pubTimeNum == 1 ? false : ''
|
this.queryCondition.orderAsc = this.pubTimeNum == 2 ? true : this.pubTimeNum == 1 ? false : ''
|
||||||
this.search(true);
|
this.search(true);
|
||||||
},
|
},
|
||||||
searchPageView(){
|
searchPageView() {
|
||||||
this.pageViewNum++
|
this.pageViewNum++
|
||||||
if(this.pageViewNum>2){
|
if (this.pageViewNum > 2) {
|
||||||
this.pageViewNum = 0;
|
this.pageViewNum = 0;
|
||||||
}
|
}
|
||||||
if(this.pageViewNum != 0){
|
if (this.pageViewNum != 0) {
|
||||||
this.pubTimeNum = 0;
|
this.pubTimeNum = 0;
|
||||||
}
|
}
|
||||||
this.queryCondition.orderField = 'views'
|
this.queryCondition.orderField = 'views'
|
||||||
this.queryCondition.orderAsc = this.pageViewNum == 2 ? true : this.pageViewNum == 1 ? false : ''
|
this.queryCondition.orderAsc = this.pageViewNum == 2 ? true : this.pageViewNum == 1 ? false : ''
|
||||||
this.search(true);
|
this.search(true);
|
||||||
},
|
},
|
||||||
yearsChange(e){
|
yearsChange(e) {
|
||||||
this.search(true)
|
this.search(true)
|
||||||
},
|
},
|
||||||
searchexcellent(num) {
|
searchexcellent(num) {
|
||||||
@@ -1300,24 +1328,24 @@ export default {
|
|||||||
// this.search(true)
|
// this.search(true)
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
this.queryCondition.excellent =false;
|
this.queryCondition.excellent = false;
|
||||||
this.queryCondition.type = num;
|
this.queryCondition.type = num;
|
||||||
this.years = []
|
this.years = []
|
||||||
if(num == 'excellent'){
|
if (num == 'excellent') {
|
||||||
this.queryCondition.excellent =true;
|
this.queryCondition.excellent = true;
|
||||||
this.queryCondition.type = num;
|
this.queryCondition.type = num;
|
||||||
}
|
}
|
||||||
if(num == 'all' || num == 'recommend'){
|
if (num == 'all' || num == 'recommend') {
|
||||||
this.pubTimeNum = 1
|
this.pubTimeNum = 1
|
||||||
this.queryCondition.orderField = 'sysCreateTime'
|
this.queryCondition.orderField = 'sysCreateTime'
|
||||||
this.queryCondition.orderAsc = false
|
this.queryCondition.orderAsc = false
|
||||||
}
|
}
|
||||||
if(num == 'time'){
|
if (num == 'time') {
|
||||||
this.isTime = true
|
this.isTime = true
|
||||||
this.caseTimeShow = false
|
this.caseTimeShow = false
|
||||||
this.isTimeData = true
|
this.isTimeData = true
|
||||||
}
|
}
|
||||||
if(num == 'collect'){
|
if (num == 'collect') {
|
||||||
this.caseTimeShow = false
|
this.caseTimeShow = false
|
||||||
}
|
}
|
||||||
if (this.timeoutId) {
|
if (this.timeoutId) {
|
||||||
@@ -1484,16 +1512,16 @@ export default {
|
|||||||
// this.queryCondition.pubTimeNum = this.pubTimeNum
|
// this.queryCondition.pubTimeNum = this.pubTimeNum
|
||||||
// this.queryCondition.pageViewNum = this.pageViewNum
|
// this.queryCondition.pageViewNum = this.pageViewNum
|
||||||
this.numIsFalse = true
|
this.numIsFalse = true
|
||||||
if(this.queryCondition.type == 'collect'){
|
if (this.queryCondition.type == 'collect') {
|
||||||
const params = {
|
const params = {
|
||||||
pageIndex:this.queryCondition.pageIndex,
|
pageIndex: this.queryCondition.pageIndex,
|
||||||
pageSize:5,
|
pageSize: 5,
|
||||||
orderField:this.queryCondition.orderField,
|
orderField: this.queryCondition.orderField,
|
||||||
orderAsc:this.queryCondition.orderAsc
|
orderAsc: this.queryCondition.orderAsc
|
||||||
}
|
}
|
||||||
await apiCase.queryFavoriteCaseOfIndex(params).then(res=>{
|
await apiCase.queryFavoriteCaseOfIndex(params).then(res => {
|
||||||
if(res.status == 200){
|
if (res.status == 200) {
|
||||||
if(res.result.list.length > 0){
|
if (res.result.list.length > 0) {
|
||||||
this.isSeach = false;
|
this.isSeach = false;
|
||||||
res.result.list.forEach(item => {
|
res.result.list.forEach(item => {
|
||||||
item.majorType = item.majorType ? item.majorType.split(",") : [];
|
item.majorType = item.majorType ? item.majorType.split(",") : [];
|
||||||
@@ -1506,8 +1534,8 @@ export default {
|
|||||||
sex: null
|
sex: null
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
res.result.list.forEach(item=>{
|
res.result.list.forEach(item => {
|
||||||
item.viewRankTags = item.viewRankTags?.slice(0,2)||[]
|
item.viewRankTags = item.viewRankTags?.slice(0, 2) || []
|
||||||
})
|
})
|
||||||
this.caseList.list = res.result.list
|
this.caseList.list = res.result.list
|
||||||
this.getCaseUserData(res.result.list);
|
this.getCaseUserData(res.result.list);
|
||||||
@@ -1522,7 +1550,7 @@ export default {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(this.queryCondition.type=='time'){
|
if (this.queryCondition.type == 'time') {
|
||||||
// const data = {
|
// const data = {
|
||||||
// pageIndex: this.queryCondition.pageIndex,
|
// pageIndex: this.queryCondition.pageIndex,
|
||||||
// pageSize: 5,
|
// pageSize: 5,
|
||||||
@@ -1546,9 +1574,9 @@ export default {
|
|||||||
const params = {
|
const params = {
|
||||||
pageIndex: this.queryCondition.pageIndex,
|
pageIndex: this.queryCondition.pageIndex,
|
||||||
}
|
}
|
||||||
await apiCase.browsingHistory(params).then(res=>{
|
await apiCase.browsingHistory(params).then(res => {
|
||||||
if(res.status == 200){
|
if (res.status == 200) {
|
||||||
if(res.result.list.length > 0){
|
if (res.result.list.length > 0) {
|
||||||
this.isSeach = false;
|
this.isSeach = false;
|
||||||
res.result.list.forEach(item => {
|
res.result.list.forEach(item => {
|
||||||
item.majorType = item.majorType ? item.majorType.split(",") : [];
|
item.majorType = item.majorType ? item.majorType.split(",") : [];
|
||||||
@@ -1561,8 +1589,8 @@ export default {
|
|||||||
sex: null
|
sex: null
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
res.result.list.forEach(item=>{
|
res.result.list.forEach(item => {
|
||||||
item.viewRankTags = item.viewRankTags?.slice(0,2)||[]
|
item.viewRankTags = item.viewRankTags?.slice(0, 2) || []
|
||||||
})
|
})
|
||||||
this.caseList.list = res.result.list
|
this.caseList.list = res.result.list
|
||||||
this.getCaseUserData(res.result.list);
|
this.getCaseUserData(res.result.list);
|
||||||
@@ -1599,15 +1627,15 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.moreState = 3;
|
this.moreState = 3;
|
||||||
}
|
}
|
||||||
if(res.result.list.length ===0){
|
if (res.result.list.length === 0) {
|
||||||
this.moreState = 3;
|
this.moreState = 3;
|
||||||
this.isSeach = false;
|
this.isSeach = false;
|
||||||
}
|
}
|
||||||
console.log(res?.result?.list ,'有没有数据1');
|
console.log(res?.result?.list, '有没有数据1');
|
||||||
res.result.list.forEach(item=>{
|
res.result.list.forEach(item => {
|
||||||
item.viewRankTags = item.viewRankTags?.slice(0,2)||[]
|
item.viewRankTags = item.viewRankTags?.slice(0, 2) || []
|
||||||
})
|
})
|
||||||
console.log(res?.result?.list ,'有没有数据2');
|
console.log(res?.result?.list, '有没有数据2');
|
||||||
this.caseList.list = res.result.list
|
this.caseList.list = res.result.list
|
||||||
this.getCaseUserData(res.result.list);
|
this.getCaseUserData(res.result.list);
|
||||||
// 给所有的赋值
|
// 给所有的赋值
|
||||||
@@ -1659,9 +1687,9 @@ export default {
|
|||||||
// console.log(err);
|
// console.log(err);
|
||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
getCase(ids,list){
|
getCase(ids, list) {
|
||||||
apiCase.ids(ids).then(res=>{
|
apiCase.ids(ids).then(res => {
|
||||||
if(res.status == 200) {
|
if (res.status == 200) {
|
||||||
this.isSeach = false;
|
this.isSeach = false;
|
||||||
const listData = []
|
const listData = []
|
||||||
list.forEach((item, index) => {
|
list.forEach((item, index) => {
|
||||||
@@ -1670,7 +1698,7 @@ export default {
|
|||||||
item.info = con;
|
item.info = con;
|
||||||
con.eventTime = item.eventTime
|
con.eventTime = item.eventTime
|
||||||
listData.push(con)
|
listData.push(con)
|
||||||
if(typeof item.info.majorType == 'string') {
|
if (typeof item.info.majorType == 'string') {
|
||||||
item.info.majorType = item.info.majorType.split(',');
|
item.info.majorType = item.info.majorType.split(',');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -1679,9 +1707,9 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
listData.forEach(item=>{
|
listData.forEach(item => {
|
||||||
item.info = {};
|
item.info = {};
|
||||||
item.deleted=false;
|
item.deleted = false;
|
||||||
item.authorInfo = {
|
item.authorInfo = {
|
||||||
aid: "",
|
aid: "",
|
||||||
name: "",
|
name: "",
|
||||||
@@ -1696,7 +1724,7 @@ export default {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
this.getCaseUserData(listData);
|
this.getCaseUserData(listData);
|
||||||
this.caseList.list = listData
|
this.caseList.list = listData
|
||||||
console.log(listData,'this.caseList.list')
|
console.log(listData, 'this.caseList.list')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -1742,12 +1770,12 @@ export default {
|
|||||||
// },
|
// },
|
||||||
tagsClose(tag, index) {
|
tagsClose(tag, index) {
|
||||||
// 课程分类
|
// 课程分类
|
||||||
if(tag.hasOwnProperty('checked')){
|
if (tag.hasOwnProperty('checked')) {
|
||||||
tag.checked = false;
|
tag.checked = false;
|
||||||
this.queryCondition.sysType1 =''
|
this.queryCondition.sysType1 = ''
|
||||||
this.queryCondition.sysType2 =''
|
this.queryCondition.sysType2 = ''
|
||||||
this.queryCondition.sysType3 =''
|
this.queryCondition.sysType3 = ''
|
||||||
}else{
|
} else {
|
||||||
// 案例分类
|
// 案例分类
|
||||||
tag.fielclass = false;
|
tag.fielclass = false;
|
||||||
}
|
}
|
||||||
@@ -1823,8 +1851,8 @@ export default {
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
apiCase.queryPraisesNew(3,this.popularityName == '季度' ? 1 : 2).then(res => {
|
apiCase.queryPraisesNew(3, this.popularityName == '季度' ? 1 : 2).then(res => {
|
||||||
if(res.status == 200) {
|
if (res.status == 200) {
|
||||||
this.Popularity = res.result
|
this.Popularity = res.result
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1846,16 +1874,16 @@ export default {
|
|||||||
// // }
|
// // }
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
apiCase.queryCommentsNew(3,this.favorableName == '季度' ? 3 : 4).then(res => {
|
apiCase.queryCommentsNew(3, this.favorableName == '季度' ? 3 : 4).then(res => {
|
||||||
if(res.status == 200) {
|
if (res.status == 200) {
|
||||||
this.Positive = res.result
|
this.Positive = res.result
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getQueryRecommendRank(){
|
getQueryRecommendRank() {
|
||||||
apiCase.queryRecommendRank(3).then(res => {
|
apiCase.queryRecommendRank(3).then(res => {
|
||||||
if(res.status == 200) {
|
if (res.status == 200) {
|
||||||
this.recommendRank = res.result
|
this.recommendRank = res.result
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1864,7 +1892,9 @@ export default {
|
|||||||
jumpRouter(item) {
|
jumpRouter(item) {
|
||||||
// console.log(item)
|
// console.log(item)
|
||||||
this.$router.push(`/case/detail?id=${item.id}`);
|
this.$router.push(`/case/detail?id=${item.id}`);
|
||||||
}
|
},
|
||||||
|
// 案例立即咨询
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -1874,12 +1904,14 @@ export default {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: rgba(51,51,51,0.9);
|
color: rgba(51, 51, 51, 0.9);
|
||||||
}
|
}
|
||||||
.el-icon--right{
|
|
||||||
|
.el-icon--right {
|
||||||
margin-left: 14px !important;
|
margin-left: 14px !important;
|
||||||
}
|
}
|
||||||
.the_charts{
|
|
||||||
|
.the_charts {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -1891,11 +1923,13 @@ export default {
|
|||||||
height: 47px;
|
height: 47px;
|
||||||
background: #DDEDFF;
|
background: #DDEDFF;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
color: #387DF7;
|
color: #387DF7;
|
||||||
}
|
}
|
||||||
.icon{
|
|
||||||
|
.icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
color: #387DF7;
|
color: #387DF7;
|
||||||
@@ -1904,7 +1938,8 @@ export default {
|
|||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 课程分类
|
// 课程分类
|
||||||
.course-title-style {
|
.course-title-style {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -1976,6 +2011,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-class {
|
.u-class {
|
||||||
::v-deep .el-dialog {
|
::v-deep .el-dialog {
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
@@ -2106,7 +2142,8 @@ export default {
|
|||||||
border: 0.96px solid rgba(140, 105, 242, 1);
|
border: 0.96px solid rgba(140, 105, 242, 1);
|
||||||
box-shadow: 7px 5px 6px 0px rgba(76, 31, 221, 0.3);
|
box-shadow: 7px 5px 6px 0px rgba(76, 31, 221, 0.3);
|
||||||
}
|
}
|
||||||
.text_msg{
|
|
||||||
|
.text_msg {
|
||||||
margin: 43px 0 0 222px;
|
margin: 43px 0 0 222px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #000;
|
color: #000;
|
||||||
@@ -2489,19 +2526,23 @@ export default {
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
// margin-bottom: ;
|
// margin-bottom: ;
|
||||||
.pub_time{
|
.pub_time {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-right: 25px;
|
margin-right: 25px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
.triangle{
|
|
||||||
|
.triangle {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
.up-triangle{
|
|
||||||
|
.up-triangle {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
border-left: 4px solid transparent;
|
border-left: 4px solid transparent;
|
||||||
@@ -2509,7 +2550,8 @@ export default {
|
|||||||
border-bottom: 6px solid #DCDFE6;
|
border-bottom: 6px solid #DCDFE6;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
.down-triangle{
|
|
||||||
|
.down-triangle {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
border-left: 4px solid transparent;
|
border-left: 4px solid transparent;
|
||||||
@@ -2518,7 +2560,8 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.time{
|
|
||||||
|
.time {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -2527,29 +2570,35 @@ export default {
|
|||||||
width: 116px;
|
width: 116px;
|
||||||
height: 38px;
|
height: 38px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|
||||||
// background: #04243C;
|
// background: #04243C;
|
||||||
&:hover{
|
&:hover {
|
||||||
// background: #387DF7;
|
// background: #387DF7;
|
||||||
border: 1px solid #387DF7;
|
border: 1px solid #387DF7;
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
// color: #fff;
|
// color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .png{
|
// .png{
|
||||||
// background: url('../../../assets/images/case/wighttime.png') no-repeat;
|
// background: url('../../../assets/images/case/wighttime.png') no-repeat;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
.png{
|
|
||||||
|
.png {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
background: url('../../../../public/images/browse.png') no-repeat;
|
background: url('../../../../public/images/browse.png') no-repeat;
|
||||||
background-size: 100%;
|
background-size: 100%;
|
||||||
margin-right: 9px;
|
margin-right: 9px;
|
||||||
}
|
}
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.time::before {
|
.time::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -2562,7 +2611,8 @@ export default {
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
.time_active{
|
|
||||||
|
.time_active {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -2571,19 +2621,22 @@ export default {
|
|||||||
height: 38px;
|
height: 38px;
|
||||||
background: #387DF7;
|
background: #387DF7;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
.png{
|
|
||||||
|
.png {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background: url('../../../assets/images/case/wighttime.png') no-repeat;
|
background: url('../../../assets/images/case/wighttime.png') no-repeat;
|
||||||
background-size: 100%;
|
background-size: 100%;
|
||||||
margin-right: 9px;
|
margin-right: 9px;
|
||||||
}
|
}
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.collect{
|
|
||||||
|
.collect {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -2592,29 +2645,35 @@ export default {
|
|||||||
width: 116px;
|
width: 116px;
|
||||||
height: 38px;
|
height: 38px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|
||||||
// background: #04243C;
|
// background: #04243C;
|
||||||
&:hover{
|
&:hover {
|
||||||
// background: #387DF7;
|
// background: #387DF7;
|
||||||
border: 1px solid #387DF7;
|
border: 1px solid #387DF7;
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
// color: #fff;
|
// color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .png{
|
// .png{
|
||||||
// background: url('../../../assets/images/case/wight.png') no-repeat;
|
// background: url('../../../assets/images/case/wight.png') no-repeat;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
.png{
|
|
||||||
|
.png {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
background: url('../../../../public/images/collect.png') no-repeat;
|
background: url('../../../../public/images/collect.png') no-repeat;
|
||||||
background-size: 100%;
|
background-size: 100%;
|
||||||
margin-right: 9px;
|
margin-right: 9px;
|
||||||
}
|
}
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.collect::before {
|
.collect::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -2627,7 +2686,8 @@ export default {
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
.collect_active{
|
|
||||||
|
.collect_active {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -2636,26 +2696,29 @@ export default {
|
|||||||
height: 38px;
|
height: 38px;
|
||||||
background: #387DF7;
|
background: #387DF7;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
.png{
|
|
||||||
|
.png {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
background: url('../../../assets/images/case/wight.png') no-repeat;
|
background: url('../../../assets/images/case/wight.png') no-repeat;
|
||||||
background-size: 100%;
|
background-size: 100%;
|
||||||
margin-right: 9px;
|
margin-right: 9px;
|
||||||
}
|
}
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.back_num{
|
.back_num {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 0 40px;
|
padding: 0 40px;
|
||||||
.search_div_num{
|
|
||||||
|
.search_div_num {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -2667,6 +2730,7 @@ export default {
|
|||||||
color: #387DF7;
|
color: #387DF7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-content {
|
.data-content {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 5px 50px;
|
padding: 5px 50px;
|
||||||
@@ -2700,12 +2764,13 @@ export default {
|
|||||||
|
|
||||||
.case-info {
|
.case-info {
|
||||||
.case-info-cont {
|
.case-info-cont {
|
||||||
.case_text{
|
.case_text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.case-info-title {
|
.case-info-title {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
|||||||
63
src/views/portal/case/components/AICaseConsult.vue
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="AI-case" style="position: relative; margin-bottom: 10px;" v-if="showAiCase" @click.stop="getAICase()">
|
||||||
|
<img src="../../../../../public/images/case-logo.png" alt="">
|
||||||
|
<span @click="getAICase()" style="position: absolute; bottom: 65px;left: 15px;z-index: 1;width: 40%;height: 30px;"></span>
|
||||||
|
</div>
|
||||||
|
<!-- 移除直接使用的AICall组件 -->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { showCaseAiEntrance } from '@/api/boe/aiChat.js'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AICaseConsult',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showAiCase: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 从Vuex中获取showAICall状态(虽然当前组件不使用,但保持连接)
|
||||||
|
...mapState('app', ['showAICall'])
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getShowAiCase()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 是否展示入口
|
||||||
|
getShowAiCase() {
|
||||||
|
showCaseAiEntrance().then(res => {
|
||||||
|
this.showAiCase = res.result
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 案例立即咨询
|
||||||
|
getAICase() {
|
||||||
|
// 通过Vuex控制AICall组件显示
|
||||||
|
this.$store.dispatch('app/setShowAICall', true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.AI-case {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
width: 160px;
|
||||||
|
height: 40px;
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
top: 105px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1
src/views/portal/case/components/map.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1759024984858" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4686" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="25"><path d="M451.673935 994.395699C478.883834 1025.019147 524.254807 1024.808979 551.400292 993.928851 553.755808 991.387908 558.821323 985.796762 565.872444 977.84835 577.572838 964.659017 590.597131 949.62432 604.615947 932.998315 644.662065 885.504506 684.708678 834.717818 722.129538 782.646447 759.658524 730.424619 792.492213 679.709274 819.314991 631.458462 868.685946 542.646317 896 465.543426 896 402.285715 896 180.109449 719.301715 0 501.333333 0 283.364952 0 106.666667 180.109449 106.666667 402.285715 106.666667 465.598716 134.05152 542.80573 183.54613 631.762622 210.371803 679.976529 243.193308 730.651876 280.699364 782.833154 318.155192 834.94455 358.239268 885.77421 398.322835 933.311031 412.354743 949.952073 425.391185 965.00073 437.102468 978.202579 444.160087 986.158466 449.230214 991.754921 451.982775 994.736706L451.673935 994.395699ZM486.822684 961.321348C484.281231 958.568254 479.425084 953.207989 472.585916 945.498359 461.135889 932.591017 448.364015 917.847761 434.602351 901.527215 395.275714 854.888073 355.949587 805.019548 319.289224 754.014863 282.808749 703.260452 250.983685 654.123578 225.158316 607.707522 179.388826 525.445805 154.50505 455.290161 154.50505 402.285715 154.50505 207.039905 309.785362 48.761905 501.333333 48.761905 692.881306 48.761905 848.161617 207.039905 848.161617 402.285715 848.161617 455.246022 823.345286 525.298263 777.693969 607.419251 751.873483 653.867066 720.038415 703.039925 683.537446 753.831262 646.912604 804.794967 607.624538 854.619674 568.335977 901.215038 554.587654 917.520243 541.828177 932.24925 530.389289 945.143797 523.556841 952.845711 518.705521 958.200435 516.166694 960.950526 507.543772 970.748911 495.255793 970.80583 487.131524 961.662353L486.822684 961.321348Z" fill="#979797" p-id="4687"></path><path d="M714.955981 467.028806C723.919106 442.627955 728.565658 416.668998 728.565658 390.095238 728.565658 268.908183 632.184774 170.666667 513.29293 170.666667 394.401086 170.666667 298.020202 268.908183 298.020202 390.095238 298.020202 511.282291 394.401086 609.52381 513.29293 609.52381 549.003859 609.52381 583.510052 600.631947 614.373097 583.874409 626.032316 577.543868 630.449257 562.77782 624.238611 550.893519 618.027966 539.009218 603.541579 534.507006 591.882359 540.837549 567.900883 553.858639 541.111735 560.761905 513.29293 560.761905 420.821495 560.761905 345.858586 484.351836 345.858586 390.095238 345.858586 295.838641 420.821495 219.428572 513.29293 219.428572 605.764365 219.428572 680.727273 295.838641 680.727273 390.095238 680.727273 410.807981 677.117041 430.977316 670.154965 449.930592 665.522846 462.540883 671.796821 476.591108 684.168282 481.312651 696.53974 486.034191 710.323861 479.639095 714.955981 467.028806L714.955981 467.028806Z" fill="#979797" p-id="4688"></path></svg>
|
||||||
|
After Width: | Height: | Size: 3.0 KiB |
550
src/views/portal/case/components/messages.vue
Normal file
@@ -0,0 +1,550 @@
|
|||||||
|
<template>
|
||||||
|
<div class="messages">
|
||||||
|
<!-- 机器人消息 -->
|
||||||
|
<div v-if="messageData.isBot" class="bot-message">
|
||||||
|
<!-- 思考中提示 -->
|
||||||
|
<div v-if="messageData.thinkText" class="bot-think" v-katex:auto v-html="md.render(messageData.thinkText)"></div>
|
||||||
|
|
||||||
|
<!-- 主要回复内容 -->
|
||||||
|
<div ref="contentContainer" class="message-content" v-katex:auto v-html="md.render(displayText)">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 引用案例 -->
|
||||||
|
<div v-if="messageData.caseRefers && messageData.caseRefers.length > 0 && messageData.textCompleted"
|
||||||
|
class="case-refers">
|
||||||
|
<div class="case-refers-title">
|
||||||
|
<span><i class="iconfont icon-think"></i> 引用案例</span>
|
||||||
|
<span v-if="shouldShowMoreButton" class="more" @click="toggleShowAllCaseRefers">
|
||||||
|
{{ showAllCaseRefers ? '收起' : '查看更多' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="case-refers-list">
|
||||||
|
<div v-for="item in displayedCaseRefers" :key="item.caseId" class="case-refers-item">
|
||||||
|
<div class="case-refers-item-title">
|
||||||
|
<a @click="toUrl(item)" class="title">{{ item.title }}</a>
|
||||||
|
<span class="case-refers-item-timer">{{ item.uploadTime }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="case-refers-item-author">
|
||||||
|
<span class="user"></span>
|
||||||
|
<span>{{ item.authorName }}</span>
|
||||||
|
<span class="case-inter-orginInfo">{{ item.orgInfo }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="case-refers-item-keywords">
|
||||||
|
<span v-for="keyword in item.keywords" :key="keyword">{{ keyword }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="message-content case-content" v-html="md.render(item.content)"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 赞/踩图标区域 - 仅在文本加载完成后显示 -->
|
||||||
|
<div v-if="showFeedbackIcons && !isFirstMessage" style="margin-top: 8px;">
|
||||||
|
<el-tooltip class="item" effect="dark" content="点赞" placement="bottom">
|
||||||
|
<img :src="isLike ? require('@/assets/images/case/zan-yes.svg') : require('@/assets/images/case/zan.svg')"
|
||||||
|
@click="toggleStar" alt="zan" class="zan_img">
|
||||||
|
</el-tooltip>
|
||||||
|
<el-popover placement="bottom" trigger="manual" v-model="caiDialogShow">
|
||||||
|
<div class="feedback-class">
|
||||||
|
<span>反馈</span>
|
||||||
|
<i class="el-icon-close" @click="caiDialogShow = false"></i>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 15px;">
|
||||||
|
<span class="tag-class" v-for="(item, index) in tagList" :key="index" @click="handleTag(item)">{{
|
||||||
|
item.name}}</span>
|
||||||
|
</div>
|
||||||
|
<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="feedbackText" style="margin-top: 10px;">
|
||||||
|
</el-input>
|
||||||
|
<div style="text-align: right; margin: 0">
|
||||||
|
<el-button style="margin-top: 10px;" type="primary" size="mini" @click="handleSure">确定</el-button>
|
||||||
|
</div>
|
||||||
|
<img slot="reference"
|
||||||
|
:src="isDislike ? require('@/assets/images/case/cai-yes.svg') : require('@/assets/images/case/cai.svg')"
|
||||||
|
@click="toggleSecondIcon" alt="cai" class="zan_img" style="margin-left:10px">
|
||||||
|
</el-popover>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 用户消息 -->
|
||||||
|
<div v-else class="user-message">
|
||||||
|
<div class="message-text" v-html="messageData.text"></div>
|
||||||
|
</div>
|
||||||
|
<!-- 推荐问题 -->
|
||||||
|
<!-- <div v-if="suggestions && suggestions.length > 0" class="suggestions">-->
|
||||||
|
<!-- <div class="suggestions-title">💡 推荐问题</div>-->
|
||||||
|
<!-- <div class="suggestions-list">-->
|
||||||
|
<!-- <button-->
|
||||||
|
<!-- v-for="(item, index) in suggestions"-->
|
||||||
|
<!-- :key="index"-->
|
||||||
|
<!-- class="suggestions-item"-->
|
||||||
|
<!-- @click="$emit('suggestion-click', item)"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- {{ item }}-->
|
||||||
|
<!-- </button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MarkdownIt from 'markdown-it';
|
||||||
|
import highlight from 'markdown-it-highlightjs';
|
||||||
|
import 'highlight.js/styles/a11y-dark.css';
|
||||||
|
import markdownItMermaid from 'markdown-it-mermaid';
|
||||||
|
import mermaid from 'mermaid';
|
||||||
|
import { likeMsg, msgFeedback } from '@/api/boe/aiChat.js'
|
||||||
|
|
||||||
|
// 初始化 Mermaid
|
||||||
|
mermaid.initialize({ startOnLoad: false });
|
||||||
|
|
||||||
|
const md = new MarkdownIt({
|
||||||
|
html: true,
|
||||||
|
linkify: true,
|
||||||
|
typographer: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
md.use(highlight).use(markdownItMermaid);
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Message',
|
||||||
|
props: {
|
||||||
|
messageData: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
suggestions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
// 添加 isFirstMessage 属性来标识是否为第一条消息
|
||||||
|
isFirstMessage: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
md,
|
||||||
|
displayText: '',
|
||||||
|
typingTimer: null,
|
||||||
|
typingSpeed: 30, // 毫秒/字符
|
||||||
|
showAllCaseRefers: false,
|
||||||
|
isLike: false, // 添加赞状态
|
||||||
|
isDislike: false, // 控制踩状态
|
||||||
|
caiDialogShow: false,
|
||||||
|
tagList: [
|
||||||
|
{ name: '回答不准确' },
|
||||||
|
{ name: '逻辑不清晰' },
|
||||||
|
{ name: '内容不完整' },
|
||||||
|
{ name: '其他' },
|
||||||
|
],
|
||||||
|
feedbackText: '',
|
||||||
|
showFeedbackIcons: false // 新增:控制赞/踩图标显示
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
displayedCaseRefers() {
|
||||||
|
if (this.showAllCaseRefers || !this.messageData.caseRefers) {
|
||||||
|
return this.messageData.caseRefers || [];
|
||||||
|
}
|
||||||
|
return this.messageData.caseRefers.slice(0, 3);
|
||||||
|
},
|
||||||
|
shouldShowMoreButton() {
|
||||||
|
return this.messageData.caseRefers && this.messageData.caseRefers.length > 3;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'messageData.text': {
|
||||||
|
handler(newVal) {
|
||||||
|
if (!newVal) {
|
||||||
|
this.displayText = '';
|
||||||
|
this.showFeedbackIcons = false; // 隐藏图标
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.messageData.isBot && !this.messageData.typing) {
|
||||||
|
// this.startTyping(newVal); // 启动打字机效果/**/
|
||||||
|
|
||||||
|
this.displayText = newVal || ''
|
||||||
|
// 文本加载完成后显示图标
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.showFeedbackIcons = true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.displayText = this.md.render(newVal);
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.showFeedbackIcons = true; // 显示图标
|
||||||
|
this.renderMermaid();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 赞
|
||||||
|
toggleStar() {
|
||||||
|
// 点击第一个图标时,激活它并取消第二个图标的激活状态
|
||||||
|
this.isLike = !this.isLike;
|
||||||
|
this.isDislike = false;
|
||||||
|
let params = {
|
||||||
|
docId: this.messageData.docId,
|
||||||
|
likeStatus: this.isLike ? "1" : "",
|
||||||
|
}
|
||||||
|
likeMsg(params).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 踩
|
||||||
|
toggleSecondIcon() {
|
||||||
|
this.feedbackText = null
|
||||||
|
let params = {
|
||||||
|
docId: this.messageData.docId,
|
||||||
|
likeStatus: !this.isDislike ? "-1" : ''
|
||||||
|
}
|
||||||
|
likeMsg(params).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
// 点击第二个图标时,激活它并取消第一个图标的激活状态
|
||||||
|
this.isDislike = !this.isDislike;
|
||||||
|
this.isLike = false;
|
||||||
|
if (this.isDislike) {
|
||||||
|
this.caiDialogShow = true
|
||||||
|
} else {
|
||||||
|
this.caiDialogShow = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 标签选择
|
||||||
|
handleTag(item) {
|
||||||
|
this.feedbackText = item.name
|
||||||
|
},
|
||||||
|
// 确定
|
||||||
|
handleSure() {
|
||||||
|
let params = {
|
||||||
|
docId: this.messageData.docId,
|
||||||
|
feedback: this.feedbackText
|
||||||
|
}
|
||||||
|
msgFeedback(params).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
if(res.status ==200){
|
||||||
|
this.$message.success('反馈成功')
|
||||||
|
this.caiDialogShow = false
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toUrl(item) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/case/detail',
|
||||||
|
query: { id: item.caseId },
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
this.$emit('getMinWindow')
|
||||||
|
},
|
||||||
|
|
||||||
|
// 正确的打字机效果:先整体渲染 Markdown,再逐字显示 HTML
|
||||||
|
startTyping(fullText) {
|
||||||
|
const renderedText = this.md.render(fullText);
|
||||||
|
this.displayText = '';
|
||||||
|
let index = 0;
|
||||||
|
|
||||||
|
if (this.typingTimer) {
|
||||||
|
clearInterval(this.typingTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.typingTimer = setInterval(() => {
|
||||||
|
if (index < renderedText.length) {
|
||||||
|
this.displayText += renderedText[index];
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
clearInterval(this.typingTimer);
|
||||||
|
this.typingTimer = null;
|
||||||
|
this.showFeedbackIcons = true; // 打字完成后显示图标
|
||||||
|
this.$nextTick(this.renderMermaid); // 渲染 Mermaid 图表
|
||||||
|
}
|
||||||
|
}, this.typingSpeed);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 触发 Mermaid 渲染
|
||||||
|
renderMermaid() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const mermaidEls = this.$el.querySelectorAll('.mermaid');
|
||||||
|
if (mermaidEls.length > 0) {
|
||||||
|
try {
|
||||||
|
// mermaid 8.x 版本使用 init 方法而不是 run
|
||||||
|
if (typeof mermaid.init === 'function') {
|
||||||
|
mermaid.init(undefined, '.mermaid');
|
||||||
|
} else if (mermaid.default && typeof mermaid.default.init === 'function') {
|
||||||
|
mermaid.default.init(undefined, '.mermaid');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Mermaid 渲染失败:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 切换案例引用显示数量
|
||||||
|
toggleShowAllCaseRefers() {
|
||||||
|
this.showAllCaseRefers = !this.showAllCaseRefers;
|
||||||
|
// 切换后重新渲染 Mermaid(如果内容中有图表)
|
||||||
|
this.$nextTick(this.renderMermaid);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (this.typingTimer) {
|
||||||
|
clearInterval(this.typingTimer);
|
||||||
|
this.typingTimer = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
::v-deep .mermaid {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep svg[id^="mermaid-"] {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.messages {
|
||||||
|
width: 100%;
|
||||||
|
word-wrap: break-word;
|
||||||
|
|
||||||
|
.bot-message {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.bot-think {
|
||||||
|
color: #909399;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
position: relative;
|
||||||
|
padding-left: 10px;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
content: ' ';
|
||||||
|
border-left: 0.5px solid #909399;
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
left: 0;
|
||||||
|
top: -3px;
|
||||||
|
transform: scaleX(0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.case-content {
|
||||||
|
font-size: 12px !important;
|
||||||
|
margin-top: 8px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
//background-color: #f9f9f9;
|
||||||
|
border-radius: 4px;
|
||||||
|
//border: 1px solid #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-message {
|
||||||
|
float: right;
|
||||||
|
padding: 8px 15px;
|
||||||
|
max-width: 80%;
|
||||||
|
background-color: #e4e7ed;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========== 案例引用样式 ========== */
|
||||||
|
.case-refers {
|
||||||
|
margin-top: 12px;
|
||||||
|
|
||||||
|
.case-refers-title {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
.icon-think {
|
||||||
|
background-image: url('./map.svg');
|
||||||
|
width: 15px;
|
||||||
|
height: 13px;
|
||||||
|
display: inline-block;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more {
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 2px 8px;
|
||||||
|
background-color: #f4f7fd;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: #577ee1;
|
||||||
|
font-weight: normal;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.case-refers-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
.case-refers-item {
|
||||||
|
border: 1px solid rgba(144, 147, 153, 0.44);
|
||||||
|
padding: 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||||
|
|
||||||
|
.case-refers-item-title {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
max-width: 70%;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: #000;
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.case-refers-item-timer {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #aaa;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.case-refers-item-author {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #555;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
|
||||||
|
.user {
|
||||||
|
background-image: url('./user.svg');
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
display: inline-block;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.case-inter-orginInfo {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #999;
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.case-refers-item-keywords {
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
padding: 2px 6px;
|
||||||
|
background-color: #f4f7fd;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 11px !important;
|
||||||
|
color: #577ee1;
|
||||||
|
}
|
||||||
|
|
||||||
|
span+span {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========== 推荐问题 ========== */
|
||||||
|
.suggestions {
|
||||||
|
margin-top: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
|
.suggestions-title {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggestions-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
.suggestions-item {
|
||||||
|
padding: 6px 10px;
|
||||||
|
background-color: #f0f4fc;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
text-align: left;
|
||||||
|
color: #1a73e8;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 13px;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #e1e8f5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.zan_img {
|
||||||
|
width: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedback-class {
|
||||||
|
font-weight: 600;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
i {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-class {
|
||||||
|
background: #f2f2f2;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 3px 6px;
|
||||||
|
color: #555;
|
||||||
|
margin-left: 13px;
|
||||||
|
font-size: 13px !important;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-class:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
src/views/portal/case/components/open.png
Normal file
|
After Width: | Height: | Size: 283 B |
402
src/views/portal/case/components/sendMessage.vue
Normal file
@@ -0,0 +1,402 @@
|
|||||||
|
<template>
|
||||||
|
<div class="input-area">
|
||||||
|
<el-input v-model="inputContent" type="textarea" class="input-placeholder" placeholder="有问题,尽管问"
|
||||||
|
@keyup.enter.native="handleSend" :disabled="disabled" :autosize="{ minRows: 2, maxRows: 4 }"
|
||||||
|
resize="none"></el-input>
|
||||||
|
<div class="action-buttons">
|
||||||
|
<el-button type="primary" size="small" class="start-btn" @click="handleNewConversation">
|
||||||
|
+ 开启新对话
|
||||||
|
</el-button>
|
||||||
|
<el-button type="text" class="send-btn" @click="handleSend" :disabled="disabled">
|
||||||
|
<i class="el-icon-s-promotion"></i>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { aiChat } from '@/api/boe/aiChat.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SendMessage',
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
messageList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
suggestions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
inputContent: this.value,
|
||||||
|
conversationId: '' // 会话ID
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(newVal) {
|
||||||
|
this.inputContent = newVal
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSend() {
|
||||||
|
if (!this.inputContent.trim() || this.disabled) return
|
||||||
|
// 添加用户消息到列表
|
||||||
|
const userMessage = {
|
||||||
|
isBot: false,
|
||||||
|
text: this.inputContent
|
||||||
|
};
|
||||||
|
this.messageList.push(userMessage);
|
||||||
|
|
||||||
|
// 显示加载状态
|
||||||
|
this.$emit('loading', true);
|
||||||
|
|
||||||
|
// 调用AI聊天接口 (暂时注释掉SSE,使用模拟数据)
|
||||||
|
this.callAIChat(this.inputContent);
|
||||||
|
|
||||||
|
// 清空输入框
|
||||||
|
this.inputContent = ''
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// 真实的SSE实现(暂时注释掉)
|
||||||
|
callAIChat(question) {
|
||||||
|
// 创建新的AI消息对象
|
||||||
|
const aiMessage = {
|
||||||
|
docId: '',
|
||||||
|
isBot: true,
|
||||||
|
text: '',
|
||||||
|
status: null,
|
||||||
|
thinkText: '',
|
||||||
|
caseRefers: [], // 添加caseRefers字段
|
||||||
|
textCompleted: false // 添加文字处理完成状态,默认为false
|
||||||
|
};
|
||||||
|
this.messageList.push(aiMessage);
|
||||||
|
|
||||||
|
// 构造请求参数
|
||||||
|
const requestData = {
|
||||||
|
conversationId: this.conversationId,
|
||||||
|
query: question
|
||||||
|
};
|
||||||
|
// 创建POST请求
|
||||||
|
fetch('/systemapi/xboe/m/boe/case/ai/chat', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
"accept": "text/event-stream",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(requestData)
|
||||||
|
}).then(r => {
|
||||||
|
return r
|
||||||
|
}).then(response => {
|
||||||
|
// 处理流式响应
|
||||||
|
const reader = response.body.getReader();
|
||||||
|
const decoder = new TextDecoder('utf-8');
|
||||||
|
let buffer = '';
|
||||||
|
let accumulatedContent = ''; // 累积的内容用于打字机效果
|
||||||
|
let accumulatedThinkContent = ''; // 累积的思考内容
|
||||||
|
let inThinkSection = false; // 是否在思考部分
|
||||||
|
let typingTimer = null; // 打字机定时器
|
||||||
|
let thinkTypingTimer = null; // 思考内容打字机定时器
|
||||||
|
|
||||||
|
// 逐字显示文本的函数
|
||||||
|
const typeText = (message, fullContent) => {
|
||||||
|
// 如果已有定时器在运行,先清除它
|
||||||
|
if (typingTimer) {
|
||||||
|
clearInterval(typingTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前已显示的文本长度
|
||||||
|
const currentLength = message.text.length;
|
||||||
|
// 获取完整文本
|
||||||
|
const targetLength = fullContent.length;
|
||||||
|
|
||||||
|
// 如果已经显示完整文本,不需要继续
|
||||||
|
if (currentLength >= targetLength) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const typingSpeed = 30; // 每个字符的间隔时间(毫秒)
|
||||||
|
|
||||||
|
typingTimer = setInterval(() => {
|
||||||
|
// 计算下一个要显示的字符索引
|
||||||
|
const nextIndex = message.text.length + 1;
|
||||||
|
if (nextIndex <= targetLength) {
|
||||||
|
message.text = fullContent.substring(0, nextIndex);
|
||||||
|
this.$emit('update-message', message);
|
||||||
|
} else {
|
||||||
|
clearInterval(typingTimer);
|
||||||
|
typingTimer = null;
|
||||||
|
// 当打字机效果完成时,检查是否应该设置textCompleted为true
|
||||||
|
// 这应该在status 4(交互完成)时才设置
|
||||||
|
if (message.status === 4) {
|
||||||
|
if (nextIndex >= targetLength) {
|
||||||
|
message.textCompleted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, typingSpeed);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 逐字显示思考内容的函数
|
||||||
|
const typeThinkText = (message, fullThinkContent) => {
|
||||||
|
// 如果已有定时器在运行,先清除它
|
||||||
|
if (thinkTypingTimer) {
|
||||||
|
clearInterval(thinkTypingTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前已显示的文本长度
|
||||||
|
const currentLength = message.thinkText.length;
|
||||||
|
// 获取完整文本
|
||||||
|
const targetLength = fullThinkContent.length;
|
||||||
|
|
||||||
|
// 如果已经显示完整文本,不需要继续
|
||||||
|
if (currentLength >= targetLength) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从当前显示位置开始继续显示(避免清空重显)
|
||||||
|
const startIndex = currentLength;
|
||||||
|
|
||||||
|
const typingSpeed = 20; // 每个字符的间隔时间(毫秒)
|
||||||
|
|
||||||
|
thinkTypingTimer = setInterval(() => {
|
||||||
|
// 计算下一个要显示的字符索引
|
||||||
|
const nextIndex = message.thinkText.length + 1;
|
||||||
|
if (nextIndex <= targetLength) {
|
||||||
|
message.thinkText = fullThinkContent.substring(0, nextIndex);
|
||||||
|
this.$emit('update-message', message);
|
||||||
|
} else {
|
||||||
|
clearInterval(thinkTypingTimer);
|
||||||
|
thinkTypingTimer = null;
|
||||||
|
}
|
||||||
|
}, typingSpeed);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加一个检查是否所有文本都已完成显示的函数
|
||||||
|
const isTextDisplayCompleted = (message, fullContent) => {
|
||||||
|
return message.text.length >= fullContent.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 读取流数据
|
||||||
|
const read = () => {
|
||||||
|
reader.read().then(({ done, value }) => {
|
||||||
|
if (done) {
|
||||||
|
// 当流结束时,等待打字机效果完成
|
||||||
|
const waitForTyping = () => {
|
||||||
|
if (!typingTimer) {
|
||||||
|
this.$emit('loading', false);
|
||||||
|
} else {
|
||||||
|
setTimeout(waitForTyping, 100);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
waitForTyping();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解码数据
|
||||||
|
buffer += decoder.decode(value, { stream: true });
|
||||||
|
|
||||||
|
// 按行分割数据
|
||||||
|
const lines = buffer.split('\n');
|
||||||
|
buffer = lines.pop(); // 保留不完整的行
|
||||||
|
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith('data:')) {
|
||||||
|
try {
|
||||||
|
const jsonData = JSON.parse(line.substring(5));
|
||||||
|
// 根据status处理不同类型的数据
|
||||||
|
switch (jsonData.status) {
|
||||||
|
case 0: // 引用文件
|
||||||
|
// 处理引用文件信息
|
||||||
|
if (jsonData.fileRefer && jsonData.fileRefer.caseRefers) {
|
||||||
|
aiMessage.caseRefers = jsonData.fileRefer.caseRefers;
|
||||||
|
// 更新父组件的messageList
|
||||||
|
this.$emit('update-message', aiMessage);
|
||||||
|
}
|
||||||
|
// 从响应中获取并保存conversationId
|
||||||
|
if (jsonData.conversationId) {
|
||||||
|
this.conversationId = jsonData.conversationId;
|
||||||
|
sessionStorage.setItem('conversationId', jsonData.conversationId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // 流式对话内容
|
||||||
|
// 处理
|
||||||
|
const content = jsonData.content;
|
||||||
|
aiMessage.hasThink = false;
|
||||||
|
if (content.startsWith('<think>')) {
|
||||||
|
aiMessage.hasThink = true
|
||||||
|
inThinkSection = true;
|
||||||
|
accumulatedThinkContent = content.replace('<think>', '');
|
||||||
|
// 使用打字机效果显示think内容
|
||||||
|
typeThinkText(aiMessage, accumulatedThinkContent);
|
||||||
|
} else if (content.startsWith('</think>')) {
|
||||||
|
inThinkSection = false;
|
||||||
|
accumulatedThinkContent += content.replace('</think>', '');
|
||||||
|
// 使用打字机效果显示think内容
|
||||||
|
typeThinkText(aiMessage, accumulatedThinkContent);
|
||||||
|
} else if (inThinkSection) {
|
||||||
|
accumulatedThinkContent += content;
|
||||||
|
// 使用打字机效果显示think内容
|
||||||
|
typeThinkText(aiMessage, accumulatedThinkContent);
|
||||||
|
} else {
|
||||||
|
// 累积内容并使用打字机效果更新显示
|
||||||
|
accumulatedContent += content;
|
||||||
|
// 如果thinkText已经显示完整,则继续使用打字机效果显示内容
|
||||||
|
if (aiMessage.hasThink) {
|
||||||
|
if (aiMessage.thinkText.length >= accumulatedThinkContent.length) {
|
||||||
|
typeText(aiMessage, accumulatedContent);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
typeText(aiMessage, accumulatedContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 不在这里直接更新,让打字机效果处理更新
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // 回答完成
|
||||||
|
// 不再在这里设置textCompleted状态
|
||||||
|
// 更新父组件的messageList
|
||||||
|
this.$emit('update-message', aiMessage);
|
||||||
|
// 从响应中获取并保存conversationId
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // 返回建议
|
||||||
|
// 这里可以处理建议问题
|
||||||
|
this.$emit('update-suggestions', jsonData.suggestions);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: // 交互完成
|
||||||
|
aiMessage.status = 4
|
||||||
|
|
||||||
|
// 从响应中获取并保存conversationId
|
||||||
|
this.$emit('loading', false);
|
||||||
|
// 检查文本是否已经完全显示,如果是则设置textCompleted为true
|
||||||
|
if (isTextDisplayCompleted(aiMessage, accumulatedContent)) {
|
||||||
|
// aiMessage.textCompleted = true;
|
||||||
|
this.$emit('update-message', aiMessage);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
if (jsonData.docId) {
|
||||||
|
aiMessage.docId = jsonData.docId
|
||||||
|
this.$emit('update-message', aiMessage);
|
||||||
|
}
|
||||||
|
console.log(jsonData)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
if (jsonData.docId) {
|
||||||
|
aiMessage.docId = jsonData.docId
|
||||||
|
this.$emit('update-message', aiMessage);
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('解析SSE数据错误:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 继续读取
|
||||||
|
read();
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('SSE连接错误:', error);
|
||||||
|
// 出错时也设置文字处理完成状态
|
||||||
|
if (typingTimer) {
|
||||||
|
clearInterval(typingTimer);
|
||||||
|
typingTimer = null;
|
||||||
|
}
|
||||||
|
aiMessage.textCompleted = true;
|
||||||
|
this.$emit('loading', false);
|
||||||
|
aiMessage.text = '当前无法获取回答,请稍后重试';
|
||||||
|
// 更新父组件的messageList
|
||||||
|
this.$emit('update-message', aiMessage);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 开始读取数据
|
||||||
|
read();
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('请求失败:', error);
|
||||||
|
// 出错时也设置文字处理完成状态
|
||||||
|
aiMessage.textCompleted = true;
|
||||||
|
this.$emit('loading', false);
|
||||||
|
aiMessage.text = '当前无法获取回答,请稍后重试';
|
||||||
|
// 更新父组件的messageList
|
||||||
|
this.$emit('update-message', aiMessage);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleNewConversation() {
|
||||||
|
this.conversationId = ''
|
||||||
|
this.$emit('new-conversation')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.input-area {
|
||||||
|
background-color: white;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 5px 16px 10px 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.input-placeholder {
|
||||||
|
color: #999;
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 0;
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
::v-deep .el-input__inner {
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-buttons {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
|
.start-btn {
|
||||||
|
padding: 6px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: #409eff;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-btn {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #409eff;
|
||||||
|
padding: 6px;
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
color: #c0c4cc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
12
src/views/portal/case/components/u762.svg
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<svg version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="750px" height="850px" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<defs>
|
||||||
|
<radialGradient cx="362.789473684209" cy="413.96491228069874" r="1153.015055438179" gradientTransform="matrix(0.023310357358899587 0.999728276703125 -0.9997282767031253 0.02331035735889959 768.1851497765263 41.62434690904212 )" gradientUnits="userSpaceOnUse" id="RadialGradient4">
|
||||||
|
<stop id="Stop5" stop-color="#ffffff" offset="0" />
|
||||||
|
<stop id="Stop6" stop-color="#d4def7" offset="1" />
|
||||||
|
</radialGradient>
|
||||||
|
</defs>
|
||||||
|
<g>
|
||||||
|
<path d="M 0 5.000000000000001 A 5 5 0 0 1 4.999999999999999 0 L 745 0 A 5 5 0 0 1 750 5 L 750 845 A 5 5 0 0 1 745 850 L 5 850 A 5 5 0 0 1 0 845 L 0 5 Z " fill-rule="nonzero" fill="url(#RadialGradient4)" stroke="none" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 858 B |
1
src/views/portal/case/components/user.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1759026139840" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5676" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="25"><path d="M512 74.666667C270.933333 74.666667 74.666667 270.933333 74.666667 512S270.933333 949.333333 512 949.333333 949.333333 753.066667 949.333333 512 753.066667 74.666667 512 74.666667zM288 810.666667c0-123.733333 100.266667-224 224-224S736 686.933333 736 810.666667c-61.866667 46.933333-140.8 74.666667-224 74.666666s-162.133333-27.733333-224-74.666666z m128-384c0-53.333333 42.666667-96 96-96s96 42.666667 96 96-42.666667 96-96 96-96-42.666667-96-96z m377.6 328.533333c-19.2-96-85.333333-174.933333-174.933333-211.2 32-29.866667 51.2-70.4 51.2-117.333333 0-87.466667-72.533333-160-160-160s-160 72.533333-160 160c0 46.933333 19.2 87.466667 51.2 117.333333-89.6 36.266667-155.733333 115.2-174.933334 211.2-55.466667-66.133333-91.733333-149.333333-91.733333-243.2 0-204.8 168.533333-373.333333 373.333333-373.333333S885.333333 307.2 885.333333 512c0 93.866667-34.133333 177.066667-91.733333 243.2z" fill="#666666" p-id="5677"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -57,6 +57,13 @@ module.exports = {
|
|||||||
// set svg-sprite-loader
|
// set svg-sprite-loader
|
||||||
config.plugins.delete('preload')
|
config.plugins.delete('preload')
|
||||||
config.plugins.delete('prefetch')
|
config.plugins.delete('prefetch')
|
||||||
|
// 添加对 mathxyjax3 的处理规则
|
||||||
|
config.module
|
||||||
|
.rule('mathxyjax3')
|
||||||
|
.test(/node_modules[\/\\]mathxyjax3[\/\\].*\.js$/)
|
||||||
|
.use('null-loader')
|
||||||
|
.loader('null-loader')
|
||||||
|
.end()
|
||||||
config.module
|
config.module
|
||||||
.rule('svg')
|
.rule('svg')
|
||||||
.exclude.add(resolve('src/icons'))
|
.exclude.add(resolve('src/icons'))
|
||||||
|
|||||||