mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 10:56:44 +08:00
Compare commits
79 Commits
test1024
...
20251124-f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da72c156e9 | ||
|
|
8c2f128578 | ||
|
|
0b3b9ad082 | ||
|
|
38fe538e4e | ||
|
|
bf20eced9b | ||
|
|
8f2da1c736 | ||
|
|
322172edec | ||
|
|
c801dc8a3d | ||
|
|
838e704ab0 | ||
|
|
d3e891e5cc | ||
|
|
40ac85f1fe | ||
|
|
6ee8eaca00 | ||
|
|
d78cc1f97c | ||
|
|
2576174e95 | ||
|
|
7316215809 | ||
|
|
c5e794ef45 | ||
|
|
720cff1d1e | ||
| f3cc59d313 | |||
|
|
dc57becb0d | ||
|
|
a94d101853 | ||
|
|
426ed75bc3 | ||
|
|
7e8b807825 | ||
|
|
bf13c953be | ||
|
|
8d07122420 | ||
|
|
471a790010 | ||
|
|
d39e1e98ef | ||
|
|
a82a65da8e | ||
|
|
2070466786 | ||
|
|
57d9f9b483 | ||
|
|
1710e34f89 | ||
|
|
e292a57b20 | ||
|
|
88c83af460 | ||
|
|
a78bac9368 | ||
|
|
f121a2aaf9 | ||
|
|
8228b33cb0 | ||
|
|
702255d9d0 | ||
|
|
df3e246d25 | ||
|
|
1d20f11861 | ||
|
|
d5ec4c1833 | ||
|
|
89a9be76d4 | ||
|
|
73026b0ab5 | ||
|
|
9b11cc3f92 | ||
|
|
372a7c22ed | ||
|
|
2678d22302 | ||
| 914b80c374 | |||
|
|
5d81f72f5f | ||
|
|
c9c34501ce | ||
|
|
1812c0901c | ||
|
|
13281d8a7d | ||
|
|
5fdf8efedb | ||
| 58f517d2fb | |||
|
|
1a475c8612 | ||
|
|
782bcc31e5 | ||
|
|
1a95852912 | ||
|
|
01e4c676fc | ||
|
|
f5d865ccc3 | ||
|
|
65673561d8 | ||
|
|
2cbb379fa6 | ||
|
|
86e25f69f9 | ||
|
|
b8daef0983 | ||
|
|
df45c9d896 | ||
|
|
b9caf2c4ad | ||
|
|
0afd733f47 | ||
|
|
3720b5667d | ||
|
|
72472979bd | ||
| 70000e2e10 | |||
|
|
969c9f6797 | ||
|
|
33406f6964 | ||
|
|
e1f2e91648 | ||
|
|
8c023d459f | ||
|
|
47c1d29ef2 | ||
|
|
a3dab45af0 | ||
|
|
e3422d15ee | ||
|
|
2c630eac70 | ||
|
|
3cef730e61 | ||
|
|
483b57f667 | ||
|
|
be411ec72d | ||
|
|
d7e425ce9d | ||
|
|
8b68489b25 |
22046
package-lock.json
generated
22046
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mermaid-js/parser": "^0.6.3",
|
||||
"axios": "^0.21.4",
|
||||
"core-js": "^3.6.5",
|
||||
"driver.js": "^0.9.8",
|
||||
@@ -23,9 +24,15 @@
|
||||
"element-ui": "^2.15.7",
|
||||
"file-saver": "^2.0.5",
|
||||
"fuse.js": "^6.4.6",
|
||||
"highlight.js": "^11.11.1",
|
||||
"image-conversion": "^2.1.1",
|
||||
"jsencrypt": "^3.2.1",
|
||||
"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",
|
||||
"moment": "^2.29.1",
|
||||
"nprogress": "^0.2.0",
|
||||
@@ -43,6 +50,7 @@
|
||||
"vue": "^2.6.11",
|
||||
"vue-awesome-swiper": "^3.1.3",
|
||||
"vue-cookies": "^1.7.4",
|
||||
"vue-katex": "^0.5.0",
|
||||
"vue-pdf": "^4.2.0",
|
||||
"vue-quill-editor": "^3.0.6",
|
||||
"vue-router": "^3.5.2",
|
||||
@@ -60,6 +68,7 @@
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"less": "^4.1.1",
|
||||
"less-loader": "^6.2.0",
|
||||
"null-loader": "^4.0.1",
|
||||
"sass": "^1.32.13",
|
||||
"sass-loader": "^10.1.0",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
|
||||
BIN
public/images/case-logo.png
Normal file
BIN
public/images/case-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 438 KiB |
60
src/App.vue
60
src/App.vue
@@ -1,25 +1,74 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<div id="app" style="width: 100vw">
|
||||
<keep-alive :include="['case']">
|
||||
<router-view />
|
||||
12312
|
||||
</keep-alive>
|
||||
<!-- 添加AI Call组件 -->
|
||||
<AICall
|
||||
:dialogVisible="showAICall"
|
||||
@close="onCloseAICall"
|
||||
@restore="onRestoreAICall"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { mapGetters, mapState } from 'vuex';
|
||||
import AICall from '@/views/portal/case/AICall.vue';
|
||||
|
||||
export default{
|
||||
name: 'App',
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
components: {
|
||||
AICall
|
||||
},
|
||||
mounted() {
|
||||
computed: {
|
||||
...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() {
|
||||
//从状态值中取,因为登录处理,所以移动watch中
|
||||
// console.log(this.userInfo);
|
||||
// if(this.userInfo && this.userInfo.name!=''){
|
||||
// this.$watermark.set(this.userInfo.name+this.userInfo.loginName);
|
||||
// }
|
||||
|
||||
// 初始化检查路由
|
||||
this.checkRouteForAICall();
|
||||
},
|
||||
watch: {
|
||||
// 监听路由变化
|
||||
$route(to, from) {
|
||||
this.checkRouteForAICall();
|
||||
}
|
||||
}
|
||||
// watch:{
|
||||
// userInfo(newVal,oldVal){
|
||||
// if(newVal && newVal.name!=''){
|
||||
@@ -39,4 +88,3 @@
|
||||
box-shadow: 0px 1px 5px 1px rgba(92,98,111,.3);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
30
src/api/boe/aiChat.js
Normal file
30
src/api/boe/aiChat.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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')
|
||||
}
|
||||
@@ -440,6 +440,12 @@ const queryCrowd=function(query){
|
||||
const ids=function (data){
|
||||
return ajax.postJson('/xboe/m/course/manage/ids',data);
|
||||
}
|
||||
|
||||
const saveTip = function() {
|
||||
return ajax.postJson('/xboe/m/course/manage/saveTip');
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
saveBase,
|
||||
submitCourse,
|
||||
@@ -482,6 +488,7 @@ export default {
|
||||
exportCourseAudit,
|
||||
exportCourse,
|
||||
queryCrowd,
|
||||
ids
|
||||
ids,
|
||||
saveTip
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ const pageList = function(data) {
|
||||
|
||||
/**
|
||||
* 选择课件的查询,这里也是分页查询,只是返回的内容,字段会很少,用于课件制作那选择已有课件内容。
|
||||
*
|
||||
*
|
||||
* @param {Object} data
|
||||
* 查询参数如上面pageList方法
|
||||
*/
|
||||
@@ -47,7 +47,9 @@ const findList = function(data) {
|
||||
}
|
||||
*/
|
||||
const saveUpload = function(data) {
|
||||
return ajax.post('/xboe/m/course/file/upload/save', data);
|
||||
return ajax.post('/xboe/m/course/file/upload/save', data, {
|
||||
timeout: 60000
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,4 +90,4 @@ export default {
|
||||
batchUpdate,
|
||||
detail,
|
||||
delFile
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<el-input-number v-model="duration" size="mini" :min="1" :max="100"></el-input-number>
|
||||
</span>
|
||||
</div>
|
||||
<el-upload class="upload-demo" :headers="headers" :data="data" drag :action="uploadFileUrl" :on-success="handleUploadSuccess" :before-upload="handleBeforeUpload">
|
||||
<el-upload ref="uploadRef" class="upload-demo" :headers="headers" :data="data" drag :action="uploadFileUrl" :on-success="handleUploadSuccess" :before-upload="handleBeforeUpload">
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip" slot="tip">文件大小限制:{{curComType.maxSizeName}},支持的文件类型:{{curComType.fileTypes.join(',')}}</div>
|
||||
@@ -195,6 +195,7 @@
|
||||
// this.cware.content.content=result.filePath;
|
||||
}else{
|
||||
this.$message.error(rs.message);
|
||||
this.$refs.uploadRef.clearFiles();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
<el-form label-width="120px" label-position="left" >
|
||||
<el-form-item label="课程名称" required><el-input maxlength="90" v-model="courseInfo.name" show-word-limit placeholder="课程名称(限90字以内)"></el-input></el-form-item>
|
||||
<el-form-item label="是否设置目录" required>
|
||||
<div>
|
||||
<el-radio v-model="courseInfo.type" :label="20">是</el-radio>
|
||||
<el-radio v-model="courseInfo.type" :label="10">否</el-radio>
|
||||
</div>
|
||||
<div>
|
||||
<el-radio v-model="courseInfo.type" :label="20">是</el-radio>
|
||||
<el-radio v-model="courseInfo.type" :label="10">否</el-radio>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- <div style="margin-top:40px">适合您<span style="color:#e83d3a;font-size: 16px;">快速</span>分享<span style="color:#e83d3a;font-size: 16px;">单一</span>的视频、音频或者文档制作说明</div> -->
|
||||
<!-- <div v-show="courseExample == 1">适合您<span class="tip">快速</span>分享<span class="tip">单一</span>的视频、音频或者文档制作说明</div>
|
||||
<div v-show="courseExample == 2">适合您分享<span class="tip">体系化</span>、<span class="tip">结构化</span>的课程内容制作说明</div>
|
||||
-->
|
||||
<!-- <div style="margin-top:40px">适合您<span style="color:#e83d3a;font-size: 16px;">快速</span>分享<span style="color:#e83d3a;font-size: 16px;">单一</span>的视频、音频或者文档制作说明</div> -->
|
||||
<!-- <div v-show="courseExample == 1">适合您<span class="tip">快速</span>分享<span class="tip">单一</span>的视频、音频或者文档制作说明</div>
|
||||
<div v-show="courseExample == 2">适合您分享<span class="tip">体系化</span>、<span class="tip">结构化</span>的课程内容制作说明</div>
|
||||
-->
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- <div style="height:100px"></div> -->
|
||||
@@ -41,6 +41,43 @@
|
||||
<el-button @click="toInputCourse()" type="primary">确定</el-button>
|
||||
</span> -->
|
||||
</el-dialog>
|
||||
|
||||
<!-- 蒙层引导组件 -->
|
||||
<div v-if="showGuidance" class="guidance-overlay" @click="closeGuidance">
|
||||
<div class="guidance-content">
|
||||
<div class="guidance-title"></div> <!--新功能引导-->
|
||||
<div class="guidance-steps">
|
||||
<div class="guidance-step" :class="{ active: currentStep === 1 }">
|
||||
<div class="step-number"></div>
|
||||
<div class="step-content">
|
||||
<div class="step-title">用标签为课程精准定位,吸引更多学员!可从以下维度构思:</div>
|
||||
<div class="step-desc" style="padding-left: 20px;">✨ 讲领域(如:品质管理)</div>
|
||||
<div class="step-desc" style="padding-left: 20px;">✨ 教技能(如:沟通技巧)</div>
|
||||
<div class="step-desc" style="padding-left: 20px;">✨ 涉内容(如:5W1H分析法)</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="guidance-step" :class="{ active: currentStep === 2 }">
|
||||
<div class="step-number">2</div>
|
||||
<div class="step-content">
|
||||
<div class="step-title">添加课程标签</div>
|
||||
<div class="step-desc">为课程添加相关标签,最多5个,便于搜索和分类,可回车创建新标签</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<!-- <div class="guidance-actions">
|
||||
<el-button @click="previousStep1" v-if="currentStep > 1">上一步</el-button>
|
||||
<el-button type="primary" @click="nextStep">
|
||||
{{ currentStep === 2 ? '完成' : '下一步' }}
|
||||
</el-button>
|
||||
<el-button @click="closeGuidance">跳过引导</el-button>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 高亮指引元素 -->
|
||||
<!-- <div v-if="showGuidance" class="highlight-element" :style="highlightStyle"></div>-->
|
||||
|
||||
|
||||
<!--微课-->
|
||||
<el-dialog v-if="weike.dlgShow" width="980px" :title="curCourseId == '' ? '新建课程' : '编辑课程'" :visible.sync="weike.dlgShow" :close-on-click-modal="false" custom-class="g-dialog" top="8vh">
|
||||
<el-form label-width="100px" size="small" class="wei-from" style="min-height: 600px;">
|
||||
@@ -64,22 +101,33 @@
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="内容分类" required>
|
||||
<el-form-item label="内容分类" required >
|
||||
<el-cascader
|
||||
placeholder="选择内容分类"
|
||||
style="width: 100%;"
|
||||
clearable
|
||||
v-model="sysTypeList"
|
||||
:props="{ value: 'id', label: 'name' }"
|
||||
:options="sysTypeListMap"></el-cascader>
|
||||
:options="sysTypeListMap"
|
||||
@focus="onContentTypeFocus"
|
||||
@change="onContentTypeChange">
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签" required>
|
||||
<courseTag ref="courseTag" :courseId="curCourseId" :sysTypeList="sysTypeList" :initialTags="courseTags" @change="handleTagsChange"></courseTag>
|
||||
|
||||
<el-form-item label="标签" required class="guidance-highlight" data-step="1" style="display: flex" >
|
||||
<courseTag ref="courseTag" :courseId="curCourseId" :sysTypeList="sysTypeList"
|
||||
:initialTags="courseTags" @change="handleTagsChange"
|
||||
@focus="onTagFocus" style="width: 95%;">
|
||||
</courseTag>
|
||||
<el-tooltip content="点击查看标签新功能引导" placement="top">
|
||||
<i class="el-icon-question" style="color: #409EFF; cursor: pointer;" @click="handleTagHelp"></i>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="资源归属" required>
|
||||
<el-input placeholder="请选择" v-model="orgName" >
|
||||
<el-button v-if="identity==3 || identity==5" @click="showChooseOrg()" slot="append" icon="el-icon-search">选择</el-button>
|
||||
</el-input>
|
||||
<el-input placeholder="请选择" v-model="orgName" >
|
||||
<el-button v-if="identity==3 || identity==5" @click="showChooseOrg()" slot="append" icon="el-icon-search">选择</el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="场景" v-show="!weike.onlyRequired">
|
||||
<el-col :span="18">
|
||||
@@ -112,11 +160,11 @@
|
||||
<el-input maxlength="50" v-model="courseInfo.forUsers" show-word-limit placeholder="目标人群(限50字以内)"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="visibleShow" label="学员可见">
|
||||
<el-checkbox v-model="courseInfo.visible"></el-checkbox>
|
||||
<el-checkbox v-model="courseInfo.visible"></el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item label="受众" v-if="!weike.onlyRequired">
|
||||
<el-select value-key="id" style="width: 100%;" v-model="courseCrowds" filterable multiple :clearable="false" @remove-tag="removeCrowd" placeholder="请选择">
|
||||
<el-option v-for="item in userGroupList" :key="item.id" :disabled="item.disabled" :label="item.name" :value="item"></el-option>
|
||||
<el-option v-for="item in userGroupList" :key="item.id" :disabled="item.disabled" :label="item.name" :value="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="课程价值" v-if="!weike.onlyRequired">
|
||||
@@ -153,11 +201,11 @@
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!weike.onlyRequired" label="课程简介">
|
||||
<el-input type="textarea"
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
:rows="3"
|
||||
v-model="courseInfo.summary"
|
||||
placeholder="请尽量填写课程简介,用于列表中显示,可以让用户更容易了解课程信息">
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
:rows="3"
|
||||
v-model="courseInfo.summary"
|
||||
placeholder="请尽量填写课程简介,用于列表中显示,可以让用户更容易了解课程信息">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -221,14 +269,16 @@
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="内容分类" required>
|
||||
<el-form-item label="内容分类" required >
|
||||
<el-cascader
|
||||
placeholder="选择内容分类"
|
||||
style="width: 100%;"
|
||||
clearable
|
||||
v-model="sysTypeList"
|
||||
:props="{ value: 'id', label: 'name' }"
|
||||
:options="sysTypeListMap">
|
||||
:options="sysTypeListMap"
|
||||
@focus="onContentTypeFocus"
|
||||
@change="onContentTypeChange">
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
|
||||
@@ -256,21 +306,28 @@
|
||||
</el-select> -->
|
||||
<choice :teacherValue="teacherValues" @getTeacherList="getTeacherList"></choice>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签" required>
|
||||
<courseTag ref="courseTag" :courseId="curCourseId" :sysTypeList="sysTypeList" :initialTags="courseTags" @change="handleTagsChange"></courseTag>
|
||||
<el-form-item label="标签" required class="tag-from-item" data-step="1" >
|
||||
<courseTag ref="courseTag" :courseId="curCourseId" :sysTypeList="sysTypeList"
|
||||
:initialTags="courseTags" @change="handleTagsChange"
|
||||
@focus="onTagFocus" >
|
||||
</courseTag>
|
||||
<el-tooltip content="点击查看标签新功能引导" placement="top">
|
||||
<i class="el-icon-question" style="color: #409EFF; cursor: pointer;" @click="handleTagHelp"></i>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关键字">
|
||||
<el-input v-model.trim="keywords" maxlength="100" @keyup.enter.native="changeKeywords" placeholder="请输入关键字"></el-input>
|
||||
<el-tag v-for="(tag,index) in tips" size="small" :key="index" closable type="info" @close="closeKeywordsTag(tag,index)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-tag v-for="(tag,index) in tips" size="small" :key="index" closable type="info" @close="closeKeywordsTag(tag,index)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="资源归属" required>
|
||||
<el-input placeholder="请选择" v-model="orgName" >
|
||||
<el-button v-if="identity==3 || identity==5" @click="showChooseOrg()" slot="append" icon="el-icon-search">选择</el-button>
|
||||
</el-input>
|
||||
<el-input placeholder="请选择" v-model="orgName" >
|
||||
<el-button v-if="identity==3 || identity==5" @click="showChooseOrg()" slot="append" icon="el-icon-search">选择</el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="目标人群" required>
|
||||
<el-col :span="14">
|
||||
@@ -278,13 +335,13 @@
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item v-if="visibleShow" label="学员可见">
|
||||
<el-checkbox v-model="courseInfo.visible"></el-checkbox>
|
||||
<el-checkbox v-model="courseInfo.visible"></el-checkbox>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item label="受众"><!--:disabled="item.disabled"-->
|
||||
<el-select value-key="id" style="width: 100%;" v-model="courseCrowds" filterable multiple :clearable="false" @remove-tag="removeCrowd" placeholder="请选择">
|
||||
<el-option v-for="item in userGroupList" :key="item.id" :label="item.name" :value="item"></el-option>
|
||||
<el-option v-for="item in userGroupList" :key="item.id" :label="item.name" :value="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="课程价值"><el-input maxlength="200" v-model="courseInfo.value" show-word-limit placeholder="课程价值(限200字以内)"></el-input></el-form-item>
|
||||
@@ -397,8 +454,8 @@
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog class="checked-show" :visible.sync="courseInfoFormCheckedShow" top="14vh" width="800px" :show-close="false" :modal="false">
|
||||
<agreement></agreement>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<agreement></agreement>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button style="margin-right:10px" type="primary" @click="courseInfoFormCheckedShow = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@@ -536,7 +593,13 @@ export default {
|
||||
dlgShow: false
|
||||
},
|
||||
rightTypeId: {},
|
||||
catalogSortDialogShow: false
|
||||
catalogSortDialogShow: false,
|
||||
// 蒙层引导相关数据
|
||||
showGuidance: false,
|
||||
currentStep: 1,
|
||||
highlightStyle: {},
|
||||
guidanceElements: [],
|
||||
isFirstCreate: false, // 标记是否为首次创建
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -590,6 +653,9 @@ export default {
|
||||
this.loadUserGroup();
|
||||
},
|
||||
methods: {
|
||||
handleTagHelp(){
|
||||
this.checkAndShowGuidance();
|
||||
},
|
||||
// 关键字的更改
|
||||
changeKeywords(option){
|
||||
if(option.target.value){
|
||||
@@ -620,14 +686,14 @@ export default {
|
||||
this.$emit('change', tags.slice(0, 5)); // 确保传出数据也不超过5个
|
||||
},
|
||||
showChooseOrg(){
|
||||
this.$refs.refChooseOrg.dlgShow = true;
|
||||
this.$refs.refChooseOrg.dlgShow = true;
|
||||
},
|
||||
removeCrowd(e){
|
||||
//console.log(e);
|
||||
if(e.disabled){
|
||||
this.$message.error("您不能移除创建人加的受众");
|
||||
this.courseCrowds.push(e);
|
||||
return false;
|
||||
this.$message.error("您不能移除创建人加的受众");
|
||||
this.courseCrowds.push(e);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
confirmChooseOrg(orgInfo,parentInfo){
|
||||
@@ -696,17 +762,17 @@ export default {
|
||||
// }
|
||||
// });
|
||||
apiUserBasic.getUserAudiences(params).then(rs=>{
|
||||
if(rs.status==200){
|
||||
let crowdList=[];
|
||||
rs.result.list.forEach(item=>{
|
||||
crowdList.push({
|
||||
id:item.id,
|
||||
name:item.audienceName,
|
||||
disabled:false
|
||||
})
|
||||
});
|
||||
this.userGroupList=crowdList;
|
||||
}
|
||||
if(rs.status==200){
|
||||
let crowdList=[];
|
||||
rs.result.list.forEach(item=>{
|
||||
crowdList.push({
|
||||
id:item.id,
|
||||
name:item.audienceName,
|
||||
disabled:false
|
||||
})
|
||||
});
|
||||
this.userGroupList=crowdList;
|
||||
}
|
||||
})
|
||||
},
|
||||
resOwnerName(code) {
|
||||
@@ -799,9 +865,9 @@ export default {
|
||||
if (!editData) {
|
||||
this.tips=[];
|
||||
this.courseTags=[],
|
||||
//console.log("新建课程?");
|
||||
//以下为了保证初始化处理
|
||||
this.weikeReset = Math.round(Math.random()) + '';
|
||||
//console.log("新建课程?");
|
||||
//以下为了保证初始化处理
|
||||
this.weikeReset = Math.round(Math.random()) + '';
|
||||
this.onlineReset = Math.round(Math.random()) + '';
|
||||
this.courseChooseShow = true;
|
||||
this.biaoke.tabIndex = 'base';
|
||||
@@ -822,11 +888,11 @@ export default {
|
||||
// });
|
||||
apiUserBasic.getOrgInfo(this.courseInfo.orgId).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.orgName=rs.result.name;
|
||||
this.courseInfo.orgName=rs.result.name;
|
||||
//this.orgKid=rs.result.kid;
|
||||
this.orgNamePath=rs.result.namePath;
|
||||
}
|
||||
this.orgName=rs.result.name;
|
||||
this.courseInfo.orgName=rs.result.name;
|
||||
//this.orgKid=rs.result.kid;
|
||||
this.orgNamePath=rs.result.namePath;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -849,7 +915,7 @@ export default {
|
||||
|
||||
},
|
||||
resetCurCourseContent() {
|
||||
this.curContent = { id: '', contentType: 0, contentName: '', content: '', csectionId: '', contentName: '', contentRefId: '', courseId: this.courseInfo.id };
|
||||
this.curContent = { id: '', contentType: 0, contentName: '', content: '', csectionId: '', contentRefId: '', courseId: this.courseInfo.id };
|
||||
},
|
||||
// chooseCourseType(item, idx, open) {
|
||||
// this.courseChooseId = item.id;
|
||||
@@ -897,19 +963,106 @@ export default {
|
||||
this.courseInfo = rs.result;
|
||||
this.curCourseId = this.courseInfo.id
|
||||
console.log('保存课程成功',this.curCourseId)
|
||||
console.log('isTip ',this.courseInfo.isTip)
|
||||
// if(this.courseInfo.isTip){
|
||||
// // 检查是否为首次创建,显示引导
|
||||
// this.checkAndShowGuidance();
|
||||
// }
|
||||
|
||||
if (this.courseChooseId == 1) {
|
||||
this.weike.dlgShow = true;
|
||||
} else {
|
||||
this.biaoke.dlgShow = true;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.initTagComponent();
|
||||
});
|
||||
// this.$nextTick(() => {
|
||||
// this.initTagComponent();
|
||||
// // 如果显示引导,初始化高亮元素
|
||||
// if (this.showGuidance) {
|
||||
// this.$nextTick(() => {
|
||||
// this.initGuidanceElements();
|
||||
// this.highlightCurrentStep();
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
} else {
|
||||
this.$message.error(rs.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 检查并显示引导
|
||||
checkAndShowGuidance() {
|
||||
// 检查本地存储,判断是否为首次创建
|
||||
// const hasShownGuidance = localStorage.getItem('course_creation_guidance_shown');
|
||||
// if (!hasShownGuidance) {
|
||||
this.showGuidance = true;
|
||||
this.currentStep = 1;
|
||||
this.isFirstCreate = true;
|
||||
// 标记引导已显示
|
||||
localStorage.setItem('course_creation_guidance_shown', 'true');
|
||||
// apiCourse.saveTip();
|
||||
// }
|
||||
},
|
||||
// 初始化引导元素
|
||||
initGuidanceElements() {
|
||||
this.guidanceElements = Array.from(document.querySelectorAll('.guidance-highlight'));
|
||||
},
|
||||
|
||||
// 高亮当前步骤对应的元素
|
||||
highlightCurrentStep() {
|
||||
if (this.guidanceElements.length === 0) return;
|
||||
|
||||
const currentElement = this.guidanceElements[this.currentStep - 1];
|
||||
if (currentElement) {
|
||||
currentElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
},
|
||||
// 下一步
|
||||
nextStep() {
|
||||
if (this.currentStep < 2) {
|
||||
this.currentStep++;
|
||||
this.highlightCurrentStep();
|
||||
} else {
|
||||
this.closeGuidance();
|
||||
}
|
||||
},
|
||||
|
||||
// 上一步
|
||||
previousStep1() {
|
||||
if (this.currentStep > 1) {
|
||||
this.currentStep--;
|
||||
this.highlightCurrentStep();
|
||||
}
|
||||
},
|
||||
|
||||
// 关闭引导
|
||||
closeGuidance() {
|
||||
this.showGuidance = false;
|
||||
this.currentStep = 1;
|
||||
this.highlightStyle = {};
|
||||
},
|
||||
// 内容分类获得焦点时的处理
|
||||
onContentTypeFocus() {
|
||||
if (this.showGuidance && this.currentStep === 1) {
|
||||
this.currentStep = 2;
|
||||
this.highlightCurrentStep();
|
||||
}
|
||||
},
|
||||
|
||||
// 内容分类改变时的处理
|
||||
onContentTypeChange() {
|
||||
if (this.showGuidance && this.currentStep === 1) {
|
||||
this.currentStep = 2;
|
||||
this.highlightCurrentStep();
|
||||
}
|
||||
},
|
||||
|
||||
// 标签获得焦点时的处理
|
||||
onTagFocus() {
|
||||
if (this.showGuidance && this.currentStep === 2) {
|
||||
this.closeGuidance();
|
||||
}
|
||||
},
|
||||
|
||||
// 新增初始化标签方法
|
||||
initTagComponent() {
|
||||
if (this.$refs.courseTag) {
|
||||
@@ -956,29 +1109,29 @@ export default {
|
||||
if(!this.courseInfo.orgId){
|
||||
//根据课程创建者获取机构id
|
||||
apiUser.getOrgSimpleByUserId(result.course.sysCreateAid).then(ors=>{
|
||||
if(ors.status==200){
|
||||
$this.courseInfo.orgId=ors.result.id;
|
||||
// apiOrg.getSimple(ors.result.id).then(rrs=>{
|
||||
// if(rrs.status==200){
|
||||
// $this.orgName=rrs.result.name;
|
||||
// $this.orgKid=rrs.result.kid;
|
||||
// $this.orgNamePath=rrs.result.namePath;
|
||||
// }
|
||||
// })
|
||||
apiUserBasic.getOrgInfo(ors.result.id).then(rrs=>{
|
||||
if(rrs.status==200){
|
||||
$this.orgName=rrs.result.name;
|
||||
this.courseInfo.orgName=rrs.result.name;
|
||||
//$this.orgKid=rrs.result.kid;
|
||||
$this.orgNamePath=rrs.result.namePath;
|
||||
}else{
|
||||
this.courseInfo.orgId='';
|
||||
//this.$message.error('资源归属已变更,请重新选择');
|
||||
}
|
||||
})
|
||||
}else{
|
||||
//this.$message.error('无机构关联,不需要提示');
|
||||
}
|
||||
if(ors.status==200){
|
||||
$this.courseInfo.orgId=ors.result.id;
|
||||
// apiOrg.getSimple(ors.result.id).then(rrs=>{
|
||||
// if(rrs.status==200){
|
||||
// $this.orgName=rrs.result.name;
|
||||
// $this.orgKid=rrs.result.kid;
|
||||
// $this.orgNamePath=rrs.result.namePath;
|
||||
// }
|
||||
// })
|
||||
apiUserBasic.getOrgInfo(ors.result.id).then(rrs=>{
|
||||
if(rrs.status==200){
|
||||
$this.orgName=rrs.result.name;
|
||||
this.courseInfo.orgName=rrs.result.name;
|
||||
//$this.orgKid=rrs.result.kid;
|
||||
$this.orgNamePath=rrs.result.namePath;
|
||||
}else{
|
||||
this.courseInfo.orgId='';
|
||||
//this.$message.error('资源归属已变更,请重新选择');
|
||||
}
|
||||
})
|
||||
}else{
|
||||
//this.$message.error('无机构关联,不需要提示');
|
||||
}
|
||||
})
|
||||
|
||||
}else{
|
||||
@@ -994,14 +1147,14 @@ export default {
|
||||
// });
|
||||
apiUserBasic.getOrgInfo(this.courseInfo.orgId).then(rs=>{
|
||||
if(rs.status==200){
|
||||
$this.orgName=rs.result.name;
|
||||
$this.courseInfo.orgName=rs.result.name;
|
||||
//$this.orgKid=rs.result.kid;
|
||||
$this.orgNamePath=rs.result.namePath;
|
||||
}else{
|
||||
$this.courseInfo.orgId='';
|
||||
$this.$message.error('资源归属已变更,请重新选择');
|
||||
}
|
||||
$this.orgName=rs.result.name;
|
||||
$this.courseInfo.orgName=rs.result.name;
|
||||
//$this.orgKid=rs.result.kid;
|
||||
$this.orgNamePath=rs.result.namePath;
|
||||
}else{
|
||||
$this.courseInfo.orgId='';
|
||||
$this.$message.error('资源归属已变更,请重新选择');
|
||||
}
|
||||
});
|
||||
}
|
||||
this.resOwnerArray=[];
|
||||
@@ -1016,33 +1169,33 @@ export default {
|
||||
}
|
||||
this.sysTypeList=[];
|
||||
if(result.course.sysType1!='' && result.course.sysType1!='0'){
|
||||
this.sysTypeList.push(result.course.sysType1);
|
||||
this.sysTypeList.push(result.course.sysType1);
|
||||
}
|
||||
if(result.course.sysType2!='' && result.course.sysType2!='0'){
|
||||
this.sysTypeList.push(result.course.sysType2);
|
||||
this.sysTypeList.push(result.course.sysType2);
|
||||
}
|
||||
if(result.course.sysType3!='' && result.course.sysType3!='0'){
|
||||
this.sysTypeList.push(result.course.sysType3);
|
||||
this.sysTypeList.push(result.course.sysType3);
|
||||
}
|
||||
//console.log(this.sysTypeList,'this.sysTypeList');
|
||||
//受众处理,crowds
|
||||
let crowdList=[];
|
||||
if(result.crowds && result.crowds.length>0){
|
||||
result.crowds.forEach(crowd=>{
|
||||
let newCrowd={
|
||||
id:crowd.groupId,
|
||||
name:crowd.groupName,
|
||||
disabled:false
|
||||
}
|
||||
crowdList.push(newCrowd);
|
||||
let hasUG=$this.userGroupList.some(ug=>{
|
||||
return ug.id==crowd.groupId;
|
||||
});
|
||||
if(!hasUG){
|
||||
newCrowd.disabled=true;
|
||||
$this.userGroupList.push(newCrowd);
|
||||
}
|
||||
result.crowds.forEach(crowd=>{
|
||||
let newCrowd={
|
||||
id:crowd.groupId,
|
||||
name:crowd.groupName,
|
||||
disabled:false
|
||||
}
|
||||
crowdList.push(newCrowd);
|
||||
let hasUG=$this.userGroupList.some(ug=>{
|
||||
return ug.id==crowd.groupId;
|
||||
});
|
||||
if(!hasUG){
|
||||
newCrowd.disabled=true;
|
||||
$this.userGroupList.push(newCrowd);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.courseCrowds=crowdList;
|
||||
//反向看userGroupList是否有
|
||||
@@ -1110,7 +1263,7 @@ export default {
|
||||
inputValue: sec.name,
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPattern:/^(a-z|A-Z|0-9)*[^$%^&*;:,<>?()\""\']{1,20}$/,
|
||||
inputPattern:/^(a-z|A-Z|0-9)*[^$%^&*;:,<>?()\""\']{1,20}$/,
|
||||
inputErrorMessage:'不要超过20个字'
|
||||
})
|
||||
.then(({ value }) => {
|
||||
@@ -1171,7 +1324,7 @@ export default {
|
||||
let order = [];
|
||||
if(cha.contents.length > 0) {
|
||||
cha.contents.forEach(con=>{
|
||||
order.push(con.sortIndex);
|
||||
order.push(con.sortIndex);
|
||||
})
|
||||
let addOrder = order.sort(function(a,b) {return b-a;})
|
||||
this.addOrder = addOrder[0] + 1;
|
||||
@@ -1339,9 +1492,9 @@ export default {
|
||||
|
||||
if(this.curContent.id == '') {// 新增
|
||||
if(this.curContent.contentType == 60) { // 判断作业是否保存
|
||||
if(courseware.homework.content || courseware.homework.name || courseware.homework.deadTime){
|
||||
pass = false;
|
||||
}
|
||||
if(courseware.homework.content || courseware.homework.name || courseware.homework.deadTime){
|
||||
pass = false;
|
||||
}
|
||||
} else if(this.curContent.contentType == 61) { //考试
|
||||
|
||||
// if(courseware.exam.paperContent != '') {
|
||||
@@ -1352,11 +1505,11 @@ export default {
|
||||
// }
|
||||
}else if(this.curContent.contentType == 41) { //图文
|
||||
if(courseware.htmlContent.length > 7){
|
||||
pass = false;
|
||||
pass = false;
|
||||
}
|
||||
}else if(this.curContent.contentType == 52) { //外部链接
|
||||
if(courseware.linkInfo.url != '') {
|
||||
pass = false;
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
} else {// 编辑
|
||||
@@ -1371,15 +1524,15 @@ export default {
|
||||
// }
|
||||
} else if(this.curContent.contentType == 41) { //图文
|
||||
if(this.curContent.content !== courseware.htmlContent) {
|
||||
pass = false;
|
||||
pass = false;
|
||||
}
|
||||
} else if(this.curContent.contentType == 52) { //外部链接
|
||||
if(this.curContent.content !== JSON.stringify(courseware.linkInfo)) {
|
||||
pass = false;
|
||||
pass = false;
|
||||
}
|
||||
} else if(this.curContent.contentType == 10 || this.curContent.contentType == 20) {// 视频
|
||||
if(this.curContent.content !== JSON.stringify(courseware.curriculumData)) {
|
||||
pass = false;
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1541,61 +1694,61 @@ export default {
|
||||
//2023-1-5 对于默认管理员,不需要提交hrbp。直接提交并发布
|
||||
let adminType=this.userInfo.adminType;
|
||||
if(adminType==1){ //默认管理员,直接审核通过
|
||||
apiCourseAudit.submitAndPublish(postData).then(res=>{
|
||||
setTimeout(function() {
|
||||
$this.btnLoading = false;
|
||||
}, 1000);
|
||||
if (res.status === 200) {
|
||||
//提交成功,直接关闭当前窗口
|
||||
this.$message.success('提交成功!!!');
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
this.biaoke.dlgShow = false;
|
||||
this.weike.dlgShow = false;
|
||||
this.$emit('submitSuccess');
|
||||
});
|
||||
apiCourseAudit.submitAndPublish(postData).then(res=>{
|
||||
setTimeout(function() {
|
||||
$this.btnLoading = false;
|
||||
}, 1000);
|
||||
if (res.status === 200) {
|
||||
//提交成功,直接关闭当前窗口
|
||||
this.$message.success('提交成功!!!');
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
this.biaoke.dlgShow = false;
|
||||
this.weike.dlgShow = false;
|
||||
this.$emit('submitSuccess');
|
||||
});
|
||||
}else{
|
||||
//先获取HRBP审核 人员信息,姓名,机构路径,工号,用于邮件中的信息
|
||||
apiUserBasic.getOrgHrbpInfo(this.courseInfo.orgId).then(rs=>{
|
||||
if(rs.status==200 && rs.result){
|
||||
postData.auditUser={
|
||||
email:rs.result.email,
|
||||
code:rs.result.userNo,
|
||||
name:rs.result.name,
|
||||
aid:rs.result.id,
|
||||
orgId:rs.result.orgId
|
||||
}
|
||||
//下面的机构名称,路径不对,应该取课程的资源归属(机构)的路径
|
||||
postData.course.orgName=rs.result.orgNamePath+'/'+rs.result.orgName;
|
||||
apiCourse.submitCourse(postData).then(res => {
|
||||
//this.btnLoading=false;
|
||||
setTimeout(function() {
|
||||
$this.btnLoading = false;
|
||||
}, 1000);
|
||||
if (res.status === 200) {
|
||||
//提交成功,直接关闭当前窗口
|
||||
this.$message.success('提交成功!!!');
|
||||
this.biaoke.dlgShow = false;
|
||||
this.weike.dlgShow = false;
|
||||
//提交成功回调处理
|
||||
this.$emit('submitSuccess');
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
this.biaoke.dlgShow = false;
|
||||
this.weike.dlgShow = false;
|
||||
this.$emit('submitSuccess');
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$this.btnLoading = false;
|
||||
this.$message.error('获取审核HRBP失败:'+rs.message);
|
||||
//先获取HRBP审核 人员信息,姓名,机构路径,工号,用于邮件中的信息
|
||||
apiUserBasic.getOrgHrbpInfo(this.courseInfo.orgId).then(rs=>{
|
||||
if(rs.status==200 && rs.result){
|
||||
postData.auditUser={
|
||||
email:rs.result.email,
|
||||
code:rs.result.userNo,
|
||||
name:rs.result.name,
|
||||
aid:rs.result.id,
|
||||
orgId:rs.result.orgId
|
||||
}
|
||||
}).catch(err=>{
|
||||
//this.$message.error('获取审核HRBP失败:'+err);
|
||||
this.$message.error('获取审核HRBP失败,请检查资源归属下是否有HRBP审核人员');
|
||||
$this.btnLoading = false;
|
||||
})
|
||||
//下面的机构名称,路径不对,应该取课程的资源归属(机构)的路径
|
||||
postData.course.orgName=rs.result.orgNamePath+'/'+rs.result.orgName;
|
||||
apiCourse.submitCourse(postData).then(res => {
|
||||
//this.btnLoading=false;
|
||||
setTimeout(function() {
|
||||
$this.btnLoading = false;
|
||||
}, 1000);
|
||||
if (res.status === 200) {
|
||||
//提交成功,直接关闭当前窗口
|
||||
this.$message.success('提交成功!!!');
|
||||
this.biaoke.dlgShow = false;
|
||||
this.weike.dlgShow = false;
|
||||
//提交成功回调处理
|
||||
this.$emit('submitSuccess');
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
this.biaoke.dlgShow = false;
|
||||
this.weike.dlgShow = false;
|
||||
this.$emit('submitSuccess');
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$this.btnLoading = false;
|
||||
this.$message.error('获取审核HRBP失败:'+rs.message);
|
||||
}
|
||||
}).catch(err=>{
|
||||
//this.$message.error('获取审核HRBP失败:'+err);
|
||||
this.$message.error('获取审核HRBP失败,请检查资源归属下是否有HRBP审核人员');
|
||||
$this.btnLoading = false;
|
||||
})
|
||||
}
|
||||
},
|
||||
// 教师列标,远程查询
|
||||
@@ -1704,19 +1857,19 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.red-tip{
|
||||
margin-top: 8px;
|
||||
color: red;
|
||||
font-size: 14px;
|
||||
float: left;
|
||||
font-weight: 600;
|
||||
}
|
||||
.red-tip{
|
||||
margin-top: 8px;
|
||||
color: red;
|
||||
font-size: 14px;
|
||||
float: left;
|
||||
font-weight: 600;
|
||||
}
|
||||
::v-deep .wei-from{
|
||||
.el-form-item{
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.el-textarea__inner{
|
||||
padding-right: 40px;
|
||||
padding-right: 40px;
|
||||
}
|
||||
}
|
||||
::v-deep .checked-show{
|
||||
@@ -1725,9 +1878,9 @@ export default {
|
||||
}
|
||||
}
|
||||
.el-dialog__body {
|
||||
padding: 10px 10px;
|
||||
// overflow-y: auto;
|
||||
max-height: calc(70vh - 140px);
|
||||
padding: 10px 10px;
|
||||
// overflow-y: auto;
|
||||
max-height: calc(70vh - 140px);
|
||||
}
|
||||
.example {
|
||||
height: 100%;
|
||||
@@ -1780,8 +1933,8 @@ export default {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.tip{
|
||||
font-size: 16px;
|
||||
color:#ffb30f;
|
||||
font-size: 16px;
|
||||
color:#ffb30f;
|
||||
}
|
||||
.cctree {
|
||||
.cctree-chapter {
|
||||
@@ -1807,13 +1960,135 @@ export default {
|
||||
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.cusprompt{
|
||||
padding: 20px 30px;
|
||||
.el-message-box__content{
|
||||
margin-top: 30px;
|
||||
.el-message-box__input{
|
||||
.cusprompt{
|
||||
padding: 20px 30px;
|
||||
.el-message-box__content{
|
||||
margin-top: 30px;
|
||||
.el-message-box__input{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 蒙层样式 */
|
||||
.guidance-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.guidance-content {
|
||||
position: fixed;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 24px;
|
||||
max-width: 500px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
||||
z-index: 10000;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.guidance-title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.guidance-steps {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.guidance-step {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 16px;
|
||||
opacity: 0.5;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.guidance-step.active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.step-number {
|
||||
//width: 24px;
|
||||
height: 24px;
|
||||
//background: #409EFF;
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 12px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.step-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.step-title {
|
||||
font-weight: bold;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.step-desc {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.guidance-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
/* 高亮元素样式 */
|
||||
.highlight-element {
|
||||
position: fixed;
|
||||
border: 2px solid #409EFF;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4), 0 0 15px rgba(64, 158, 255, 0.5);
|
||||
z-index: 9998;
|
||||
pointer-events: none;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
/* 被高亮元素的样式 */
|
||||
.guidance-highlight {
|
||||
position: relative;
|
||||
z-index: 10001;
|
||||
}
|
||||
//.el-form-item__content {
|
||||
// display: flex;
|
||||
// width: 80%;
|
||||
// .tag-container {
|
||||
// width: 95%;
|
||||
// }
|
||||
//}
|
||||
.tag-from-item .el-form-item__content {
|
||||
margin-left: 0 !important;
|
||||
display: flex;
|
||||
//align-items: center;
|
||||
.tag-container {
|
||||
width: 95%;
|
||||
}
|
||||
}
|
||||
.guidance-highlight .el-form-item__content {
|
||||
margin-left: 0 !important;
|
||||
display: flex;
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
|
||||
<template>
|
||||
<div class="tag-container">
|
||||
<div class="tag-container" @click="handleContainerClick">
|
||||
<el-select style="width: 100%;"
|
||||
v-model="selectedTags"
|
||||
multiple
|
||||
filterable
|
||||
value-key="id"
|
||||
remote
|
||||
reserve-keyword
|
||||
:remote-method="debouncedSearch"
|
||||
:loading="loading"
|
||||
:placeholder="'回车创建新标签'"
|
||||
@remove-tag="handleTagRemove"
|
||||
@change="handleSelectionChange"
|
||||
@keyup.enter.native="handleEnterKey"
|
||||
@keyup.delete.native="handleDeleteKey"
|
||||
@focus="handleFocus"
|
||||
ref="tagSelect"
|
||||
v-model="selectedTags"
|
||||
multiple
|
||||
filterable
|
||||
value-key="id"
|
||||
remote
|
||||
reserve-keyword
|
||||
:remote-method="debouncedSearch"
|
||||
:loading="loading"
|
||||
:placeholder="'回车创建新标签'"
|
||||
:no-data-text="'无此标签,按回车键创建'"
|
||||
@remove-tag="handleTagRemove"
|
||||
@change="handleSelectionChange"
|
||||
@keyup.enter.native="handleEnterKey"
|
||||
@keyup.delete.native="handleDeleteKey"
|
||||
@focus="handleFocus"
|
||||
ref="tagSelect"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in searchResults"
|
||||
@@ -141,6 +141,11 @@ export default {
|
||||
if (this.sysTypeList.length > 0) {
|
||||
await this.doSearch('');
|
||||
}
|
||||
this.$emit('focus');
|
||||
},
|
||||
handleContainerClick() {
|
||||
// 容器点击时也触发焦点事件
|
||||
this.$emit('focus');
|
||||
},
|
||||
// 新增:重置标签状态的方法
|
||||
resetTagState() {
|
||||
@@ -212,6 +217,9 @@ export default {
|
||||
this.$emit('change', this.displayTags);
|
||||
|
||||
this.clearInput();
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tagSelect.visible = false;
|
||||
});
|
||||
},
|
||||
|
||||
clearInput() {
|
||||
@@ -313,7 +321,7 @@ export default {
|
||||
this.searchResults = tags
|
||||
// 当搜索结果为空时,提示用户可以按回车键创建标签
|
||||
if (tags.length === 0) {
|
||||
this.$message.info('无此标签,按回车键创建')
|
||||
// this.$message.info('无此标签,按回车键创建')
|
||||
}
|
||||
} finally {
|
||||
this.loading = false
|
||||
@@ -359,7 +367,7 @@ export default {
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/*
|
||||
::v-deep(.el-tag) {
|
||||
flex: 0 0 calc(50% - 8px);
|
||||
max-width: calc(50% - 8px);
|
||||
@@ -369,6 +377,20 @@ export default {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}*/
|
||||
|
||||
::v-deep(.el-tag) {
|
||||
flex: 1 1 auto; /* 自动调整宽度 */
|
||||
min-width: 30%; /* 设置最小宽度 */
|
||||
max-width: 48%; /* 设置最大宽度,留出边距 */
|
||||
box-sizing: border-box;
|
||||
margin-right: 8px;
|
||||
margin-bottom: 4px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
::v-deep(.el-select__input) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script setup>
|
||||
<script>
|
||||
import {getCertificationProcess} from "@/api/modules/lecturer";
|
||||
|
||||
export default {
|
||||
|
||||
16
src/main.js
16
src/main.js
@@ -3,6 +3,22 @@ import App from './App.vue'
|
||||
import router from './router'
|
||||
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 xpage from '@/utils/xpage'
|
||||
|
||||
@@ -7,7 +7,11 @@ const state = {
|
||||
withoutAnimation: false
|
||||
},
|
||||
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 = {
|
||||
@@ -34,6 +38,14 @@ const mutations = {
|
||||
SET_SIZE: (state, size) => {
|
||||
state.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) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,4 +77,4 @@ export default {
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
}
|
||||
83
src/utils/sseHelper.js
Normal file
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)
|
||||
})
|
||||
}
|
||||
@@ -483,8 +483,11 @@ export default {
|
||||
} else if (this.form.device2 === true) {
|
||||
this.form.device = 2;
|
||||
}
|
||||
//时长,秒与分钟的转化
|
||||
//if(this.form.)
|
||||
// 时长,秒与分钟的转化
|
||||
if (this.form.minute) {
|
||||
this.form.duration = this.form.minute * 60;
|
||||
}
|
||||
|
||||
try {
|
||||
const { status,message} = await coueseFile.batchUpdate([this.form]);
|
||||
if (status === 200) {
|
||||
|
||||
873
src/views/portal/case/AICall.vue
Normal file
873
src/views/portal/case/AICall.vue
Normal file
@@ -0,0 +1,873 @@
|
||||
<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="false"
|
||||
top="10vh"
|
||||
v-resizeable
|
||||
v-draggable
|
||||
>
|
||||
<!-- 标题 -->
|
||||
<div slot="title" class="dialog-title">
|
||||
<span>案例专家</span>
|
||||
<el-button
|
||||
style="color:#96999f"
|
||||
type="text"
|
||||
class="window-control-btn"
|
||||
@click="minimizeWindow"
|
||||
>
|
||||
<i class="el-icon-minus"></i>
|
||||
</el-button>
|
||||
</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"></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,则不触发拖动
|
||||
}
|
||||
|
||||
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 {
|
||||
openImg,
|
||||
AIContent: '',
|
||||
isLoading: false,
|
||||
windowState: 'maximized', // 'maximized' 或 'minimized'
|
||||
messageList: [
|
||||
{
|
||||
typing:true,
|
||||
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: {
|
||||
// / 关闭最小化窗口
|
||||
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')
|
||||
// 可以在这里执行其他逻辑
|
||||
},
|
||||
|
||||
minimizeWindow() {
|
||||
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,
|
||||
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; /* 黑色图标 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.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;
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
63
src/views/portal/case/components/AICaseConsult.vue
Normal file
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
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 |
423
src/views/portal/case/components/messages.vue
Normal file
423
src/views/portal/case/components/messages.vue
Normal file
@@ -0,0 +1,423 @@
|
||||
<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>
|
||||
|
||||
<!-- 用户消息 -->
|
||||
<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';
|
||||
|
||||
// 初始化 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: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
md,
|
||||
displayText: '',
|
||||
typingTimer: null,
|
||||
typingSpeed: 30, // 毫秒/字符
|
||||
showAllCaseRefers: 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 = '';
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageData.isBot && !this.messageData.typing) {
|
||||
// this.startTyping(newVal); // 启动打字机效果/**/
|
||||
|
||||
this.displayText = newVal || ''
|
||||
} else {
|
||||
this.displayText = this.md.render(newVal);
|
||||
this.$nextTick(this.renderMermaid); // 直接渲染 Mermaid
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
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.$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
BIN
src/views/portal/case/components/open.png
Normal file
BIN
src/views/portal/case/components/open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 283 B |
391
src/views/portal/case/components/sendMessage.vue
Normal file
391
src/views/portal/case/components/sendMessage.vue
Normal file
@@ -0,0 +1,391 @@
|
||||
<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 = {
|
||||
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;
|
||||
}
|
||||
} 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
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
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 |
@@ -30,8 +30,13 @@
|
||||
<!-- <div class="course-title-right"> -->
|
||||
<!-- <interactBar :readonly="!stuStusts || stuStusts==0" :type="1" :data="courseInfo" :comments="false" :views="false"></interactBar> -->
|
||||
<!-- </div> -->
|
||||
<div class="label-div">
|
||||
<!-- <div class="label-div">
|
||||
<el-tag class="label-item" effect="plain" v-for="(item,tagIdx) in tagArray" :key="tagIdx">{{item}}</el-tag>
|
||||
</div>-->
|
||||
<div class="label-div">
|
||||
<div v-for="(item, tagIdx) in tagArray" :key="tagIdx" class="keyword-tag">
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="study-count">{{courseInfo.studys}}人学习</div>
|
||||
@@ -420,7 +425,7 @@ export default {
|
||||
|
||||
.course-title{
|
||||
position: relative;
|
||||
height: 60px;
|
||||
height: auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.title {
|
||||
@@ -453,18 +458,43 @@ export default {
|
||||
padding: 24px 24px 5px 24px;
|
||||
// margin-right: 361px;
|
||||
.study-count {
|
||||
margin-top: 10px;
|
||||
margin-top: 30px;
|
||||
font-size: 16px;
|
||||
color: #444444;
|
||||
}
|
||||
|
||||
.label-div {
|
||||
/*.label-div {
|
||||
margin: 5px 0;
|
||||
min-height: 20px;
|
||||
.label-item {
|
||||
padding: 0 7px;
|
||||
padding: 0px 8px;
|
||||
margin-top: 5px;
|
||||
float: left;
|
||||
line-height: 24px;
|
||||
font-size: 12px;
|
||||
border-radius: 2px;
|
||||
margin-right: 8px;
|
||||
margin-bottom: 0px;
|
||||
color: #2C68FF;
|
||||
height: 24px;
|
||||
background: rgba(44, 104, 255, 0.06);
|
||||
border: none; // 或者使用 border-color: transparent;
|
||||
}
|
||||
}*/
|
||||
.label-div {
|
||||
margin: 5px 0;
|
||||
min-height: 20px;
|
||||
|
||||
.keyword-tag {
|
||||
padding: 0px 10px;
|
||||
margin-top: 7px;
|
||||
float: left;
|
||||
line-height: 24px;
|
||||
font-size: 12px;
|
||||
border-radius: 2px;
|
||||
margin-right: 10px;
|
||||
color: #2C68FF;
|
||||
height: 24px;
|
||||
background: rgba(44, 104, 255, 0.06);
|
||||
}
|
||||
}
|
||||
::v-deep .el-rate__icon {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div id="couser-list-content" class="couser-list-content">
|
||||
<div class="course-banner">
|
||||
<portal-header current="course" textColor="#fff" :keywords="keyword" @emitInput="emitInput"
|
||||
@showClass="showClass"></portal-header>
|
||||
@showClass="showClass"></portal-header>
|
||||
</div>
|
||||
<div style="padding-top:30px">
|
||||
<div class="xcontent2">
|
||||
@@ -11,7 +11,7 @@
|
||||
<span v-if="navTitle.length">></span>
|
||||
<template v-if="navTitle.length">
|
||||
<div class="oneTitle" v-for="(item, index) in navTitle" :key="item.id"
|
||||
@click="handleOptionClick(item, index)">
|
||||
@click="handleOptionClick(item, index)">
|
||||
<span class="titleName"> {{ item.name }} </span>
|
||||
<span v-if="index !== navTitle.length - 1">></span>
|
||||
</div>
|
||||
@@ -35,15 +35,15 @@
|
||||
<div class="course-one" v-for="one in oneList" :key="one.id" @click.stop="handleOptionClick(one, 1, oneList)">
|
||||
<div class="course-one-content">{{ one.name }}</div>
|
||||
<div class="course-two" v-for="(twoList, twoIndex) in one.children" :key="twoList.id"
|
||||
@click.stop="handleOptionClick(twoList, 2, one.children)"
|
||||
:class="{ courseTwoActive: twoList.id == twoId || twoList.checked }" @mouseleave.stop="leaveIndex"
|
||||
@mouseenter.stop="changeIndex(twoList.id)">
|
||||
@click.stop="handleOptionClick(twoList, 2, one.children)"
|
||||
:class="{ courseTwoActive: twoList.id == twoId || twoList.checked }" @mouseleave.stop="leaveIndex"
|
||||
@mouseenter.stop="changeIndex(twoList.id)">
|
||||
<!-- 三级分类 -->
|
||||
<el-popover class="popover" popper-class='coursePopperClass' placement="right-start" width="536"
|
||||
:disabled="!twoList.children.length" :open-delay="0" :close-delay="0" trigger="hover"
|
||||
:visible-arrow="false" @hide="leaveIndex" @show="changeIndex(twoList.id)" transition="none">
|
||||
:disabled="!twoList.children.length" :open-delay="0" :close-delay="0" trigger="hover"
|
||||
:visible-arrow="false" @hide="leaveIndex" @show="changeIndex(twoList.id)" transition="none">
|
||||
<div class="course-two-content" slot="reference">{{
|
||||
twoList.name }}</div>-
|
||||
twoList.name }}</div>-
|
||||
<!-- 内容 -->
|
||||
<div class="course-three-box">
|
||||
<div class="course-three-box-title">
|
||||
@@ -51,8 +51,8 @@
|
||||
</div>
|
||||
<div style="padding: 0 40px;display: flex;flex-wrap: wrap;">
|
||||
<div :class="threeList.checked ? 'threeActive' : ''" v-for="threeList in twoList.children"
|
||||
:key="threeList.id" @click.stop="handleOptionClick(threeList, 3, twoList.children)"
|
||||
class="course-three">
|
||||
:key="threeList.id" @click.stop="handleOptionClick(threeList, 3, twoList.children)"
|
||||
class="course-three">
|
||||
<span>{{ threeList.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -62,300 +62,85 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="fixd-box">
|
||||
<!-- 好评榜 -->
|
||||
<!-- <div class="portal-ranking-list ranking-bg">
|
||||
<div class="ranking-title">好评榜</div>
|
||||
<ul class="ranking-data">
|
||||
<li class="list-info" v-for="(item, index) in scorelist" :key="index"
|
||||
style="cursor: pointer;margin-top:24px;line-height: 30px;display: flex;">
|
||||
<a style="display: inherit" @click="toCourseDetail(item)">
|
||||
<span class="portal-right-text blue-one" v-if="index == 0">
|
||||
<img :src="`${webBaseUrl}/images/listblue01.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text blue-tow" v-if="index == 1">
|
||||
<img :src="`${webBaseUrl}/images/listblue02.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text blue-three" v-if="index == 2">
|
||||
<img :src="`${webBaseUrl}/images/listblue03.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text" v-if="index == 3">
|
||||
<img :src="`${webBaseUrl}/images/list04.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text" v-if="index == 4">
|
||||
<img :src="`${webBaseUrl}/images/list05.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-title-desc title-line-ellipsis" v-if="item.images == ''"
|
||||
style="font-size: 14px;">{{ item.name }}</span>
|
||||
<span class="portal-title-desc" v-else style="font-size: 14px;">
|
||||
<span class="portal-images-title two-line-ellipsis">{{ item.name }}</span>
|
||||
</span>
|
||||
|
||||
<div class="list-active">
|
||||
<div class="list-content">
|
||||
<div class="list-img">
|
||||
<course-image :course="item" :text="false" width="108px" height="60px"></course-image>
|
||||
<span v-if="item.type < 21" class="course-type">录播</span>
|
||||
<span v-if="item.type == 30" class="course-type">线下课</span>
|
||||
<span v-if="item.type == 40" class="course-type">学习项目</span>
|
||||
</div>
|
||||
<div class="list-text">
|
||||
<h6 class="index-one-line-ellipsis">{{ item.name }}</h6>
|
||||
<span class="index-one-line-ellipsis">{{ item.publishTime }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-bottom">
|
||||
<couresinteract :type="1" :data="item"></couresinteract>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
<!-- 人气榜 -->
|
||||
<!-- <div style="margin-top:26px" class="portal-ranking-list ranking-bg1">
|
||||
<div class="ranking-title">人气榜</div>
|
||||
<ul class="ranking-data">
|
||||
<li class="list-info" v-for="(item, index) in ankingList" :key="index"
|
||||
style="cursor: pointer;margin-top:24px;line-height: 30px;display: flex;">
|
||||
<a style="display: inherit" @click="toCourseDetail(item)">
|
||||
<span class="portal-right-text orange-one" v-if="index == 0">
|
||||
<img :src="`${webBaseUrl}/images/list-01.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text orange-tow" v-if="index == 1">
|
||||
<img :src="`${webBaseUrl}/images/list02.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text orange-three" v-if="index == 2">
|
||||
<img :src="`${webBaseUrl}/images/list03.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text" v-if="index == 3">
|
||||
<img :src="`${webBaseUrl}/images/list04.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text" v-if="index == 4">
|
||||
<img :src="`${webBaseUrl}/images/list05.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-title-desc title-line-ellipsis" v-if="item.images == ''"
|
||||
style="font-size: 14px;">{{ item.name }}</span>
|
||||
<span class="portal-title-desc" v-else style="font-size: 14px;">
|
||||
<span class="portal-images-title two-line-ellipsis">{{ item.name }}</span>
|
||||
</span>
|
||||
|
||||
<div class="list-active">
|
||||
<div class="list-content">
|
||||
<div class="list-img">
|
||||
<course-image :course="item" :text="false" width="108px" height="60px"></course-image>
|
||||
<span v-if="item.type < 21" class="course-type">录播</span>
|
||||
<span v-if="item.type == 30" class="course-type">线下课</span>
|
||||
<span v-if="item.type == 40" class="course-type">学习项目</span>
|
||||
</div>
|
||||
<div class="list-text">
|
||||
<h6 class="index-one-line-ellipsis">{{ item.name }}</h6>
|
||||
<span class="index-one-line-ellipsis">{{ item.publishTime }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-bottom">
|
||||
<couresinteract :type="1" :data="item"></couresinteract>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
<!-- 热榜 -->
|
||||
<!-- <div style="margin-top:26px" class="portal-ranking-list ranking-bg2">
|
||||
<div class="ranking-title">热度榜</div>
|
||||
<ul class="ranking-data">
|
||||
<li class="list-info" v-for="(item, index) in hotList" :key="index"
|
||||
style="cursor: pointer;margin-top:24px;line-height: 30px;display: flex;">
|
||||
<a style="display: inherit" @click="toCourseDetail(item)">
|
||||
<span class="portal-right-text orange-one" v-if="index == 0">
|
||||
<img :src="`${webBaseUrl}/images/listred01 .png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text orange-tow" v-if="index == 1">
|
||||
<img :src="`${webBaseUrl}/images/listred02.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text orange-three" v-if="index == 2">
|
||||
<img :src="`${webBaseUrl}/images/listred03.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text" v-if="index == 3">
|
||||
<img :src="`${webBaseUrl}/images/list04.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-right-text" v-if="index == 4">
|
||||
<img :src="`${webBaseUrl}/images/list05.png`" alt="">
|
||||
</span>
|
||||
<span class="portal-title-desc title-line-ellipsis list-lidex" v-if="item.images == ''"
|
||||
style="font-size: 14px;">{{ item.courseName }}</span>
|
||||
<span class="portal-title-desc " v-else style="font-size: 14px;">
|
||||
<span class="portal-images-title two-line-ellipsis">{{ item.courseName }}</span>
|
||||
</span>
|
||||
<div class="list-active">
|
||||
<div class="list-content">
|
||||
<div class="list-img">
|
||||
<course-image :course="item" :text="false" width="108px" height="60px"></course-image>
|
||||
<span v-if="item.type < 21" class="course-type">录播</span>
|
||||
<span v-if="item.type == 30" class="course-type">线下课</span>
|
||||
<span v-if="item.type == 40" class="course-type">学习项目</span>
|
||||
</div>
|
||||
<div class="list-text">
|
||||
<h6 class="index-one-line-ellipsis">{{ item.courseName }}</h6>
|
||||
<span class="index-one-line-ellipsis">{{ item.publishTime }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-bottom">
|
||||
<couresinteract :type="1" :data="item"></couresinteract>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- 右侧 -->
|
||||
<div class="xcontent2-main content-div">
|
||||
<!-- 之前的 -->
|
||||
<!-- <div class="search-div" style="margin-right:36px">
|
||||
<div class="searchbar" style="padding-right: 40px;" v-if="stagList.length > 0">
|
||||
<span @click="handleClearTags" style="float: right;margin-top: 6px;margin-right: -20px;color: #858585;cursor: pointer;" title="清除查询条件"><i class="el-icon-close"></i> 清除</span>
|
||||
<div style="line-height: 30px;">
|
||||
<span class="item-title"> 搜索条件</span>
|
||||
<el-tag closable v-for="(tag, tagIdx) in stagList" :key="'t'+tagIdx" @close="stagClose(tag,tagIdx)">{{ tag.name }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div style="margin-top:10px; display: flex;">
|
||||
<div style="line-height: 25px;padding-right: 10px;">
|
||||
<span class="item-title" style="padding-right: 5px;">授课方式:</span>
|
||||
</div>
|
||||
<div>
|
||||
<a @click="handleTypeAllClick(1)" class="option-item" :class="{'option-active':ctypeTagAll}">全部</a>
|
||||
<a @click="handleTypeClick(ctypeList[0],ctypeList)" class="option-item" :class="{'option-active':ctypeList[0].checked}">录播课</a>
|
||||
<a @click="handleTypeClick(ctypeList[1],ctypeList)" class="option-item" :class="{'option-active':ctypeList[1].checked}">线下课</a>
|
||||
<a class="option-border"> </a>
|
||||
<a @click="handleTypeClick(ctypeList[2],ctypeList)" class="option-item" :class="{'option-active':ctypeList[2].checked}">学习项目</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div style="line-height: 25px;margin-top:10px; display: flex;">
|
||||
<div class="search-item-type">
|
||||
<span class="item-title" style="padding-right: 5px;">一级分类:</span>
|
||||
</div>
|
||||
<div>
|
||||
<a @click="handleTypeAllClick(11)" class="option-item" :class="{'option-active':oneTagAll}">全部</a>
|
||||
<a v-for="one in oneList" @click="handleOptionClick(one,oneList,1)" class="option-item" :class="{'option-active':one.checked}">{{one.name}}</a>
|
||||
<a class="option-border"> </a>
|
||||
<a class="option-item">
|
||||
<span @click="uClassClick" class="Uxtext" style=""> U选小课堂
|
||||
<span class="uxicon">
|
||||
<svg-icon icon-class="hot" style="font-size:22px"></svg-icon>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item" v-if="twoList.length>0">
|
||||
<div style="line-height: 25px;margin-top:10px; display: flex;justify-content: flex-start;">
|
||||
<div class="search-item-type">
|
||||
<span class="item-title" style="padding-right: 5px;">二级分类:</span>
|
||||
</div>
|
||||
<div style="white-space: nowrap;">
|
||||
<a @click="handleTypeAllClick(12)" class="option-item" :class="{'option-active':twoTagAll}">全部</a>
|
||||
</div>
|
||||
<div>
|
||||
<a v-for="two in twoList" @click="handleOptionClick(two,twoList,2)" class="option-item" :class="{'option-active':two.checked}">{{two.name}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item" v-if="threeList.length>0">
|
||||
<div style="line-height: 25px;margin-top:10px; display: flex;justify-content: flex-start;">
|
||||
<div class="search-item-type">
|
||||
<span class="item-title" style="padding-right: 5px;">三级分类:</span>
|
||||
</div>
|
||||
<div style="white-space: nowrap;">
|
||||
<a @click="handleTypeAllClick(13)" class="option-item" :class="{'option-active':threeTagAll}">全部</a>
|
||||
</div>
|
||||
<div>
|
||||
<a v-for="three in threeList" :key="three.id" @click="handleOptionClick(three,threeList,3)" class="option-item" :class="{'option-active':three.checked}">{{three.name}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- 内容导航 -->
|
||||
<div class="topNav" v-if="!newData">
|
||||
<div class="search-div nav" style="height: 100px;flex: 1;">
|
||||
<div @click="handleTypeAllClick(1)" class="option-item" style="font-weight: bold;position: relative;margin-right: 20px;" :class="{ 'option-active': ctypeTagAll }">
|
||||
<a>全部</a>
|
||||
<span :class="ctypeTagAll ? 'nav-bottbor' : ''"></span>
|
||||
<div class="search-div nav" style="flex: 1;height: auto;background: #fff;">
|
||||
<div class="nav-primary" style="gap: 15px;display: flex;margin-top: 20px;">
|
||||
<div @click="handleTypeAllClick(1)" class="option-item" style="position: relative;" :class="{ 'option-active': ctypeTagAll }">
|
||||
<a>全部</a>
|
||||
</div>
|
||||
<div @click="handleTypeClick(ctypeList[0], ctypeList)" class="option-item"
|
||||
:class="{ 'option-active': ctypeList[0].checked }">
|
||||
<a>录播课</a>
|
||||
</div>
|
||||
<div @click="handleTypeClick(ctypeList[1], ctypeList)" class="option-item"
|
||||
:class="{ 'option-active': ctypeList[1].checked }">
|
||||
<a>线下课</a>
|
||||
</div>
|
||||
<div @click="handleTypeClick(ctypeList[2], ctypeList)" class="option-item"
|
||||
:class="{ 'option-active': ctypeList[2].checked }">
|
||||
<a>学习项目</a>
|
||||
</div>
|
||||
<a class="option-item">
|
||||
<span @click="uClassClick" class="Uxtext" > U选小课堂
|
||||
<span class="uxicon">
|
||||
<svg-icon icon-class="hot" style="font-size:22px"></svg-icon>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div @click="handleTypeClick(ctypeList[0], ctypeList)" class="option-item" style="font-weight: bold"
|
||||
:class="{ 'option-active': ctypeList[0].checked }">
|
||||
<a>录播课</a>
|
||||
<span :class="ctypeList[0].checked ? 'nav-bottbor' : ''"></span>
|
||||
</div>
|
||||
<div @click="handleTypeClick(ctypeList[1], ctypeList)" class="option-item" style="font-weight: bold"
|
||||
:class="{ 'option-active': ctypeList[1].checked }">
|
||||
<a>线下课</a>
|
||||
<span :class="ctypeList[1].checked ? 'nav-bottbor' : ''"></span>
|
||||
</div>
|
||||
<div @click="handleTypeClick(ctypeList[2], ctypeList)" class="option-item" style="font-weight: bold"
|
||||
:class="{ 'option-active': ctypeList[2].checked }">
|
||||
<a>学习项目</a>
|
||||
<span :class="ctypeList[2].checked ? 'nav-bottbor' : ''"></span>
|
||||
</div>
|
||||
<a class="option-item">
|
||||
<span @click="uClassClick" class="Uxtext" style="font-weight: bold"> U选小课堂
|
||||
<span class="uxicon">
|
||||
<svg-icon icon-class="hot" style="font-size:22px"></svg-icon>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
<!-- 修改热点标签区域 -->
|
||||
<div style="margin-top:10px;flex: 1;">
|
||||
<!-- <div class="search-item-type" style="padding-top: 2px; float: left;">
|
||||
<span class="item-title" style="padding-right: 5px;">热点标签:</span>
|
||||
</div>-->
|
||||
<div style="margin:20px 0;flex: 1;">
|
||||
<!-- 修改热点标签容器,支持换行 -->
|
||||
<div class="hot-tags-wrapper">
|
||||
<div
|
||||
class="option-item" style="font-weight: bold; padding-top: 2px;"
|
||||
:class="{ 'option-active': isAllHotTagsSelected }"
|
||||
@click="handleClearHotTags"
|
||||
>
|
||||
<span>全部</span>
|
||||
<span :class="isAllHotTagsSelected ? 'nav-bottbor' : ''"></span>
|
||||
</div>
|
||||
<div>
|
||||
<div style="display: flex">
|
||||
<div
|
||||
class="option-item" style=" padding-top: 2px;"
|
||||
:class="{ 'option-active': isAllHotTagsSelected }"
|
||||
@click="handleClearHotTags"
|
||||
>
|
||||
<span>全部</span>
|
||||
</div>
|
||||
|
||||
<div class="fieldbox" style="padding-left: 15px;">
|
||||
<div
|
||||
class="option-item" style=" padding-top: 2px;"
|
||||
v-for="tag in hotTagsList"
|
||||
:key="tag.id"
|
||||
@click="handleTagClick(tag, hotTagsList,1)"
|
||||
:class="{ 'option-active': tag.checked }"
|
||||
>
|
||||
<span>{{tag.tagName}} </span>
|
||||
<!-- <span :class="tag.checked ? 'nav-bottbor' : ''"></span>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="option-item" style="font-weight: bold; padding-top: 2px;"
|
||||
v-for="tag in hotTagsList"
|
||||
:key="tag.id"
|
||||
@click="handleTagClick(tag, hotTagsList,1)"
|
||||
:class="{ 'option-active': tag.checked }"
|
||||
>
|
||||
<span>{{tag.tagName}}</span>
|
||||
<span :class="tag.checked ? 'nav-bottbor' : ''"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div id="fixd-box" class="upload" style="margin-left: 26px;">
|
||||
<div v-if="identity == 2 || identity == 3 || identity == 5">
|
||||
<div class="portal-model-btn pointer" style="margin-bottom: 0px;height: 100px;line-height: 100px;"
|
||||
@click="toNeedCourse">
|
||||
<svg-icon style="margin-right: 10px;font-size: 24px;" icon-class="upCourse"></svg-icon>
|
||||
上传课程
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<!-- <div id="fixd-box" class="upload" style="margin-left: 26px;">
|
||||
<div v-if="identity == 2 || identity == 3 || identity == 5">
|
||||
<div class="portal-model-btn pointer" style="margin-bottom: 0px;height: 100px;line-height: 100px;"
|
||||
@click="toNeedCourse">
|
||||
<svg-icon style="margin-right: 10px;font-size: 24px;" icon-class="upCourse"></svg-icon>
|
||||
上传课程
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<!-- 清除 -->
|
||||
<div v-if="stagList.length > 0 && !newData" class="search-div" style="padding: 0;margin-bottom: 20px;">
|
||||
<div class="searchbar" style="background-color:#f6f7fb;display: flex;justify-content: space-between;">
|
||||
<div v-if="stagList.length > 0 && !newData" class="search-div" style="padding: 0">
|
||||
<div class="searchbar" style="display: flex;justify-content: space-between;">
|
||||
<div style="line-height: 30px;">
|
||||
<span class="item-title"> 搜索条件:</span>
|
||||
<el-tag closable v-for="(tag, tagIdx) in stagList" :key="'t' + tagIdx" @close="stagClose(tag, tagIdx)"
|
||||
:style="{ color: tag.type === 0 ? '#ff0000' : '' }">
|
||||
<el-tag closable v-for="(tag, tagIdx) in stagList" :key="'t' + tagIdx" @close="stagClose(tag, tagIdx)" >
|
||||
{{ tag.tagName }}
|
||||
</el-tag>
|
||||
</div>
|
||||
@@ -370,11 +155,11 @@
|
||||
<div class="order-div" v-if="!newData">
|
||||
<span class="quyer-tag">
|
||||
<el-button type="text" class="order-class" @click="orderChange('studys')"
|
||||
:class="{ actice: course.orderField == 'studys' }">最热</el-button>
|
||||
:class="{ actice: course.orderField == 'studys' }">最热</el-button>
|
||||
<el-button type="text" class="order-class" @click="orderChange('publishTime')"
|
||||
:class="{ actice: course.orderField == 'publishTime' }">最新</el-button>
|
||||
:class="{ actice: course.orderField == 'publishTime' }">最新</el-button>
|
||||
<el-button type="text" class="order-class" @click="orderChange('score')"
|
||||
:class="{ actice: course.orderField == 'score' }">好评率</el-button>
|
||||
:class="{ actice: course.orderField == 'score' }">好评率</el-button>
|
||||
</span>
|
||||
<span class="order-count">
|
||||
共找到<span>{{ count }}</span>个结果
|
||||
@@ -397,17 +182,17 @@
|
||||
v-for="(tag, tagIndex) in cinfo.tagsList"
|
||||
:key="tagIndex"
|
||||
size="mini"
|
||||
type="info" style="margin: 2px 2px; border-radius: 2px;"
|
||||
:style="{ color: isTagMatched(tag) ? '#387DF7' : '#333333' }"
|
||||
type="info"
|
||||
style="margin: 2px 2px; border-radius: 2px;"
|
||||
>
|
||||
{{ tag }}
|
||||
<span v-html="highlightTagKeyword(tag)"></span>
|
||||
</el-tag>
|
||||
</div>
|
||||
<!-- 关键字 -->
|
||||
<div class="keywordInfo-every">
|
||||
<div class="keywordInfo" v-for="(keyword, index) in cinfo.keywordsActive" :key="index">
|
||||
<el-tooltip popper-class="keywordInfo-class" :visible-arrow="false"
|
||||
:disabled="!keyword.showTitle">
|
||||
:disabled="!keyword.showTitle">
|
||||
<template #content>
|
||||
<span v-html="keyword.title"></span>
|
||||
</template>
|
||||
@@ -431,7 +216,7 @@
|
||||
<div class="course-info-score">
|
||||
<div style="display: flex;">
|
||||
<interactBar :type="1" nodeWidth="20px" :data="cinfo" :courseExclusive="true" :comments="false"
|
||||
:praises="false" :shares="false" :views="false"></interactBar>
|
||||
:praises="false" :shares="false" :views="false"></interactBar>
|
||||
<div v-if="cinfo.score">
|
||||
<span class="course-score-value">{{ toScore(cinfo.score) }}分</span>
|
||||
</div>
|
||||
@@ -466,17 +251,13 @@
|
||||
</template>
|
||||
<!-- 暂无数据 -->
|
||||
<div class="pagination-div">
|
||||
<!-- <span class="pag-text" @click="loadMore()"
|
||||
v-if="moreState == 1 && courseList.length >= course.pageSize">加载更多</span> -->
|
||||
<!-- <span class="pag-text-msg" v-if="moreState == 2">数据加载中</span> -->
|
||||
<!-- <span class="pag-text-msg" v-else-if="moreState == 3 && courseList.length > 0">没有更多数据了</span> -->
|
||||
<span class="notcoures" v-if="moreState == 3 && courseList.length == 0">
|
||||
<img :src="`${webBaseUrl}/images/nocouresimg.png`" alt="">
|
||||
<h5>暂无课程,请优先学习其它课程吧~</h5>
|
||||
</span>
|
||||
<div v-if="courseList.length > 0">
|
||||
<pagination :size="course.pageSize" :total="count" :page="course.pageIndex"
|
||||
layout="total, prev, pager, next, jumper" @change-page="currentChange"></pagination>
|
||||
layout="total, prev, pager, next, jumper" @change-page="currentChange"></pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -740,7 +521,8 @@ export default {
|
||||
searchRecords: [],
|
||||
hotList: [],
|
||||
totalPages: 1,
|
||||
localSessionKey: this.$xpage.constants.localCourseFiltersKey
|
||||
localSessionKey: this.$xpage.constants.localCourseFiltersKey,
|
||||
// isAllHotTagsSelected: true,
|
||||
};
|
||||
},
|
||||
// 受众需要每次刷新
|
||||
@@ -755,7 +537,7 @@ export default {
|
||||
}
|
||||
})
|
||||
//初始化:获取最新前10个热点标签
|
||||
apiCourseTag.getHotTagList(null).then(rs => {
|
||||
apiCourseTag.getHotTagList(null).then(rs => {
|
||||
if (rs.status == 200) {
|
||||
this.hotTagsList = rs.result.map(tag => ({
|
||||
...tag,
|
||||
@@ -847,6 +629,131 @@ export default {
|
||||
// window.removeEventListener("scroll", this.handleScroll);
|
||||
},
|
||||
methods: {
|
||||
getSearchMode() {
|
||||
const hasKeyword = this.keyword && this.keyword.trim() !== '';
|
||||
|
||||
// 检查是否有导航标签被选中
|
||||
const hasNavigationTags = this.stagList.some(tag => {
|
||||
// 课程类型(1)、热点标签(14)、分类标签(11,12,13)
|
||||
return [1, 11, 12, 13, 14].includes(tag.type) && tag.checked;
|
||||
});
|
||||
|
||||
if (hasKeyword && hasNavigationTags) {
|
||||
return 'mixed'; // 混合模式:关键字 + 导航标签
|
||||
} else if (hasKeyword) {
|
||||
return 'keyword'; // 纯关键字搜索
|
||||
} else if (hasNavigationTags) {
|
||||
return 'navigation'; // 纯导航标签搜索
|
||||
} else {
|
||||
return 'none'; // 无搜索条件
|
||||
}
|
||||
},
|
||||
|
||||
// 高亮标签关键字
|
||||
highlightTagKeyword(tag) {
|
||||
const searchMode = this.getSearchMode();
|
||||
|
||||
switch (searchMode) {
|
||||
case 'keyword':
|
||||
return this.highlightPartialMatch(tag);
|
||||
case 'navigation':
|
||||
return this.highlightExactMatch(tag);
|
||||
case 'mixed':
|
||||
return this.highlightMixedMode(tag);
|
||||
default:
|
||||
return tag;
|
||||
}
|
||||
},
|
||||
|
||||
// 部分匹配高亮(纯关键字搜索模式)
|
||||
highlightPartialMatch(tag) {
|
||||
const searchKeywords = this.stagList
|
||||
.filter(searchTag => searchTag.type === 0) // 只处理关键字类型
|
||||
.map(searchTag => searchTag.tagName || searchTag.name)
|
||||
.filter(keyword => keyword && keyword.trim());
|
||||
|
||||
if (searchKeywords.length === 0) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
let highlightedTag = tag;
|
||||
|
||||
searchKeywords.forEach(keyword => {
|
||||
if (tag.includes(keyword)) {
|
||||
const regex = new RegExp(`(${this.escapeRegExp(keyword)})`, 'gi');
|
||||
highlightedTag = highlightedTag.replace(regex, '<span class="keyword-highlight">$1</span>');
|
||||
}
|
||||
});
|
||||
|
||||
return highlightedTag;
|
||||
},
|
||||
|
||||
// 完全匹配高亮(纯导航标签模式)
|
||||
highlightExactMatch(tag) {
|
||||
const isMatched = this.stagList.some(searchTag => {
|
||||
// 只检查导航标签类型
|
||||
if (searchTag.type === 0) return false;
|
||||
|
||||
const searchName = searchTag.tagName || searchTag.name;
|
||||
return searchName === tag;
|
||||
});
|
||||
|
||||
if (isMatched) {
|
||||
return `<span class="exact-match-highlight">${tag}</span>`;
|
||||
}
|
||||
|
||||
return tag;
|
||||
},
|
||||
|
||||
// 混合模式高亮(关键字 + 导航标签)
|
||||
highlightMixedMode(tag) {
|
||||
// 1. 先检查是否完全匹配导航标签
|
||||
const exactMatched = this.stagList.some(searchTag => {
|
||||
if (searchTag.type === 0) return false;
|
||||
|
||||
const searchName = searchTag.tagName || searchTag.name;
|
||||
return searchName === tag;
|
||||
});
|
||||
|
||||
// 2. 如果完全匹配导航标签,整个标签高亮
|
||||
if (exactMatched) {
|
||||
return `<span class="exact-match-highlight">${tag}</span>`;
|
||||
}
|
||||
|
||||
// 3. 否则检查是否包含关键字,进行部分高亮
|
||||
const searchKeywords = this.stagList
|
||||
.filter(searchTag => searchTag.type === 0)
|
||||
.map(searchTag => searchTag.tagName || searchTag.name)
|
||||
.filter(keyword => keyword && keyword.trim());
|
||||
|
||||
if (searchKeywords.length === 0) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
let highlightedTag = tag;
|
||||
let hasKeywordMatch = false;
|
||||
|
||||
searchKeywords.forEach(keyword => {
|
||||
if (tag.includes(keyword)) {
|
||||
const regex = new RegExp(`(${this.escapeRegExp(keyword)})`, 'gi');
|
||||
highlightedTag = highlightedTag.replace(regex, '<span class="keyword-highlight">$1</span>');
|
||||
hasKeywordMatch = true;
|
||||
}
|
||||
});
|
||||
|
||||
// 4. 如果有关键字匹配,返回部分高亮结果
|
||||
if (hasKeywordMatch) {
|
||||
return highlightedTag;
|
||||
}
|
||||
|
||||
// 5. 都不匹配,返回原标签
|
||||
return tag;
|
||||
},
|
||||
|
||||
// 辅助方法:转义正则表达式特殊字符
|
||||
escapeRegExp(string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
},
|
||||
|
||||
isTagMatched(tag) {
|
||||
// 检查stagList中是否有匹配的标签
|
||||
@@ -1036,33 +943,33 @@ export default {
|
||||
this.searchData(1);
|
||||
},
|
||||
// 清除
|
||||
handleClearTags() {
|
||||
//清空所有的条件
|
||||
this.keyword = '';
|
||||
this.ctypeList.forEach(item => {
|
||||
item.checked = false;
|
||||
});
|
||||
this.hotTagsList.forEach(item => {
|
||||
item.checked = false;
|
||||
});
|
||||
this.course.tags = ''; // 清空标签ID
|
||||
|
||||
// 添加清除三级分类的逻辑
|
||||
this.oneList.forEach(one => {
|
||||
one.checked = false;
|
||||
one.children.forEach(two => {
|
||||
two.checked = false;
|
||||
two.children.forEach(three => {
|
||||
three.checked = false;
|
||||
handleClearTags() {
|
||||
//清空所有的条件
|
||||
this.keyword = '';
|
||||
this.ctypeList.forEach(item => {
|
||||
item.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
this.hotTagsList.forEach(item => {
|
||||
item.checked = false;
|
||||
});
|
||||
this.course.tags = ''; // 清空标签ID
|
||||
|
||||
// 清空导航标题
|
||||
this.navTitle = [];
|
||||
// 添加清除三级分类的逻辑
|
||||
this.oneList.forEach(one => {
|
||||
one.checked = false;
|
||||
one.children.forEach(two => {
|
||||
two.checked = false;
|
||||
two.children.forEach(three => {
|
||||
three.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.searchData();
|
||||
},
|
||||
// 清空导航标题
|
||||
this.navTitle = [];
|
||||
|
||||
this.searchData();
|
||||
},
|
||||
// 导航切换(录播课,线下课,学习项目)
|
||||
handleTypeClick(item, list) {
|
||||
item.checked = !item.checked;
|
||||
@@ -1076,6 +983,7 @@ handleClearTags() {
|
||||
},
|
||||
//点击标签
|
||||
handleTagClick(item, list,type) {
|
||||
|
||||
item.checked = !item.checked;
|
||||
|
||||
// 更新course.tags
|
||||
@@ -1580,7 +1488,7 @@ handleClearTags() {
|
||||
if (item.teacher) {
|
||||
item.teacher = item.teacher.split(',').filter(itemValue => itemValue !== 'BOE教师').join(',');
|
||||
// if (dotIdx > 0) {
|
||||
// item.teacher = item.teacher.substring(0, dotIdx);
|
||||
// item.teacher = item.teacher.substring(0, dotIdx);
|
||||
// }
|
||||
}
|
||||
if (item.teacher && item.teacher == 'BOE教师') {
|
||||
@@ -1856,6 +1764,9 @@ handleClearTags() {
|
||||
.topNav {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
height: auto;
|
||||
min-height: 80px;
|
||||
align-items: center;
|
||||
|
||||
.nav {
|
||||
display: flex;
|
||||
@@ -1863,10 +1774,11 @@ handleClearTags() {
|
||||
|
||||
.option-item {
|
||||
position: relative;
|
||||
margin: 0 15px;
|
||||
|
||||
.nav-bottbor {
|
||||
position: absolute;
|
||||
top: 130%;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
@@ -2094,13 +2006,6 @@ handleClearTags() {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.couderbox {
|
||||
// width: 5px;
|
||||
// padding: 0;
|
||||
// display: inline-block;
|
||||
// text-align: center;
|
||||
}
|
||||
|
||||
.coures-border {
|
||||
width: 2px;
|
||||
height: 15px;
|
||||
@@ -2237,7 +2142,7 @@ handleClearTags() {
|
||||
right: 23.5%;
|
||||
// bottom: 26%;
|
||||
top: 0;
|
||||
height: 20;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
font-size: 12px;
|
||||
color: #FFFFFF;
|
||||
@@ -2333,8 +2238,8 @@ handleClearTags() {
|
||||
margin-left: 15px;
|
||||
font-size: 14px;
|
||||
color: #3d3d3d;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
//cursor: pointer;
|
||||
//position: relative;
|
||||
}
|
||||
|
||||
.uxicon {
|
||||
@@ -2344,16 +2249,6 @@ handleClearTags() {
|
||||
left: 98%;
|
||||
}
|
||||
|
||||
// .el-radio-button{
|
||||
// margin-right: 10px;
|
||||
// margin-bottom: 10px;
|
||||
|
||||
// .el-radio-button__inner{
|
||||
// background: #fff;
|
||||
// border: none;
|
||||
// height: 20px;
|
||||
// }
|
||||
// }
|
||||
::v-deep .el-radio-button__inner,
|
||||
.el-radio-group {
|
||||
vertical-align: top;
|
||||
@@ -2407,13 +2302,6 @@ handleClearTags() {
|
||||
}
|
||||
}
|
||||
|
||||
.searchbar {
|
||||
background-color: #ffffff;
|
||||
// border: 1px solid #f3f3f3;
|
||||
// width: 900px;
|
||||
// padding: 5px 20px;
|
||||
}
|
||||
|
||||
.fixed {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
@@ -2462,9 +2350,12 @@ handleClearTags() {
|
||||
}
|
||||
|
||||
.search-div {
|
||||
background: #fff;
|
||||
//background: #fff;
|
||||
padding: 10px 25px;
|
||||
border-radius: 8px;
|
||||
height: auto;
|
||||
min-height: 60px;
|
||||
|
||||
|
||||
::v-deep .el-input {
|
||||
width: 420px;
|
||||
@@ -2502,14 +2393,6 @@ handleClearTags() {
|
||||
}
|
||||
}
|
||||
|
||||
// .tip{
|
||||
// color:#999999;
|
||||
// font-size: 12px;
|
||||
// >span{
|
||||
// margin-right: 8px;
|
||||
// cursor: pointer;
|
||||
// }
|
||||
// }
|
||||
.search-item {
|
||||
// padding: 10px 0;
|
||||
}
|
||||
@@ -2552,30 +2435,6 @@ handleClearTags() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// .course-form {
|
||||
// width: 100%;
|
||||
// margin: 10px 0;
|
||||
// ::v-deep.el-button {
|
||||
// width: 100%;
|
||||
// color: #fff;
|
||||
// }
|
||||
// }
|
||||
|
||||
// .right-box {
|
||||
// .add-btn {
|
||||
// width: 100%;
|
||||
// padding: 15px 0;
|
||||
// }
|
||||
// .ranking-card {
|
||||
// margin-top: 0px;
|
||||
// }
|
||||
|
||||
// .ranking-data {
|
||||
// margin: 10px 0;
|
||||
// color: #999999;
|
||||
// }
|
||||
// }]
|
||||
.search-item-type {
|
||||
line-height: 25px;
|
||||
padding-right: 10px;
|
||||
@@ -2588,7 +2447,8 @@ handleClearTags() {
|
||||
color: #3d3d3d;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
margin: 0px 15px;
|
||||
//margin: 0px 15px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.option-border {
|
||||
@@ -2602,7 +2462,7 @@ handleClearTags() {
|
||||
.option-active {
|
||||
color: #387DF7;
|
||||
}
|
||||
/* 项目简介 方法一:外部 CSS 类 */
|
||||
/* 项目简介 方法一:外部 CSS 类 */
|
||||
::v-deep.el-dialog {
|
||||
border-radius: 3% 3% 1% 1%;
|
||||
padding: 0;
|
||||
@@ -2628,12 +2488,13 @@ handleClearTags() {
|
||||
padding: 0 !important;
|
||||
}
|
||||
/* ---end--- */
|
||||
/* ---标签管理 added by zhengsongbo on 2025-08-01--- */
|
||||
.search-div.nav {
|
||||
display: block;
|
||||
width: 100%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
|
||||
.option-item {
|
||||
margin: 0px 5px;
|
||||
}
|
||||
@@ -2672,7 +2533,7 @@ a.custom2 {
|
||||
|
||||
.hot-tags-container {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
//white-space: nowrap;
|
||||
overflow-x: auto;
|
||||
vertical-align: top;
|
||||
}
|
||||
@@ -2681,22 +2542,6 @@ a.custom2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 添加标签样式 */
|
||||
//.course-tags {
|
||||
// margin: 5px 0;
|
||||
// min-height: 20px;
|
||||
//}
|
||||
//.course-tags ::v-deep .el-tag {
|
||||
// color: #387DF7 !important;
|
||||
// border-color: #387DF7 !important;
|
||||
//}
|
||||
//.course-tags ::v-deep .el-tag .el-tag__close {
|
||||
// color: #387DF7 !important;
|
||||
//}
|
||||
//.course-tags ::v-deep .el-tag .el-tag__close:hover {
|
||||
// background-color: #387DF7 !important;
|
||||
// color: white !important;
|
||||
//}
|
||||
|
||||
.course-tag-item {
|
||||
color: #333333; // 默认深灰色
|
||||
@@ -2705,16 +2550,6 @@ a.custom2 {
|
||||
color: #387DF7 !important; // 匹配时的蓝色
|
||||
}
|
||||
|
||||
/* 添加热点标签容器样式,支持换行 */
|
||||
.hot-tags-wrapper {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
align-items: center;
|
||||
padding-top: 2px;
|
||||
//margin-left: 90px; /* 为"热点标签:"文本留出空间 */
|
||||
}
|
||||
|
||||
/* 调整option-item样式以适应换行布局 */
|
||||
.option-item {
|
||||
position: relative;
|
||||
@@ -2725,7 +2560,7 @@ a.custom2 {
|
||||
/* 保持原有的导航底部横线样式 */
|
||||
.nav-bottbor {
|
||||
position: absolute;
|
||||
top: 130%;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
@@ -2745,5 +2580,78 @@ a.custom2 {
|
||||
gap: 5px;
|
||||
}
|
||||
}
|
||||
/* ---end--- */
|
||||
|
||||
.hot-tags-wrapper {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
align-items: center;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.course-tags {
|
||||
margin: 5px 0;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
.course-tag-item {
|
||||
color: #333333;
|
||||
}
|
||||
.course-tag-item[style*="color: #387DF7"] {
|
||||
color: #387DF7 !important;
|
||||
}
|
||||
|
||||
|
||||
/* 关键字部分匹配高亮样式 */
|
||||
.keyword-highlight {
|
||||
color: #387DF7 !important;
|
||||
font-weight: bold;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
/* 导航标签完全匹配高亮样式 */
|
||||
.exact-match-highlight {
|
||||
color: #387DF7 !important;
|
||||
font-weight: bold;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
/* 混合模式下的特殊样式(可选) */
|
||||
.mixed-exact-highlight {
|
||||
color: #387DF7 !important;
|
||||
font-weight: bold;
|
||||
background-color: #f0f7ff !important;
|
||||
padding: 1px 3px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
/* 确保标签基础样式 */
|
||||
.course-tags ::v-deep .el-tag {
|
||||
color: #333333;
|
||||
background-color: #f4f4f5;
|
||||
border-color: #e9e9eb;
|
||||
}
|
||||
.course-tags ::v-deep .el-tag .keyword-highlight,
|
||||
.course-tags ::v-deep .el-tag .exact-match-highlight {
|
||||
color: #387DF7 !important;
|
||||
font-weight: bold;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.fieldbox {
|
||||
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
|
||||
div {
|
||||
margin: 0 15px;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
line-height: 25px;
|
||||
//color: #3d3d3d;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.fieldactive {
|
||||
color: #387DF7;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -57,6 +57,13 @@ module.exports = {
|
||||
// set svg-sprite-loader
|
||||
config.plugins.delete('preload')
|
||||
config.plugins.delete('prefetch')
|
||||
// 添加对 mathxyjax3 的处理规则
|
||||
config.module
|
||||
.rule('mathxyjax3')
|
||||
.test(/node_modules[\/\\]mathxyjax3[\/\\].*\.js$/)
|
||||
.use('null-loader')
|
||||
.loader('null-loader')
|
||||
.end()
|
||||
config.module
|
||||
.rule('svg')
|
||||
.exclude.add(resolve('src/icons'))
|
||||
|
||||
Reference in New Issue
Block a user