|
@@ -224,7 +224,52 @@
|
|
|
</el-card>
|
|
|
</div>
|
|
|
<div v-if="item.contentType == 4">
|
|
|
+ <el-card class="box-card">
|
|
|
+
|
|
|
+ <el-form-item label="选择课程">
|
|
|
+ <el-select
|
|
|
+ v-model="item.courseId"
|
|
|
+ placeholder="请选择课程"
|
|
|
+ style="margin-right: 10px"
|
|
|
+ size="mini"
|
|
|
+ @change="handleRuleCourseChange(item)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in courseList"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="parseInt(dict.dictValue)"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-select
|
|
|
+ v-model="item.videoId"
|
|
|
+ placeholder="请选择小节"
|
|
|
+ size="mini"
|
|
|
+ style="margin-right: 10px"
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ :remote-method="(query) => remoteMethodRuleVideo(query, item)"
|
|
|
+ :loading="videoOptionsLoading"
|
|
|
+ @change="handleRuleVideoChange(item)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in videoOptions || []"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="parseInt(dict.dictValue)"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
+ <el-card class="box-card" style="margin-top: 10px">
|
|
|
+ <el-form-item label="标题" prop="miniprogramTitle">
|
|
|
+ <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="封面" prop="miniprogramPicUrl">
|
|
|
+ <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-card>
|
|
|
+ </el-card>
|
|
|
</div>
|
|
|
<div v-if="item.contentType == 5 ">
|
|
|
|
|
@@ -361,7 +406,52 @@
|
|
|
</el-card>
|
|
|
</div>
|
|
|
<div v-if="item.contentType == 4">
|
|
|
+ <el-card class="box-card">
|
|
|
|
|
|
+ <el-form-item label="选择课程">
|
|
|
+ <el-select
|
|
|
+ v-model="item.courseId"
|
|
|
+ placeholder="请选择课程"
|
|
|
+ style="margin-right: 10px"
|
|
|
+ size="mini"
|
|
|
+ @change="handleRuleCourseChange(item)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in courseList"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="parseInt(dict.dictValue)"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-select
|
|
|
+ v-model="item.videoId"
|
|
|
+ placeholder="请选择小节"
|
|
|
+ size="mini"
|
|
|
+ style="margin-right: 10px"
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ :remote-method="(query) => remoteMethodRuleVideo(query, item)"
|
|
|
+ :loading="videoOptionsLoading"
|
|
|
+ @change="handleRuleVideoChange(item)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in videoOptions || []"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="parseInt(dict.dictValue)"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-card class="box-card" style="margin-top: 10px">
|
|
|
+ <el-form-item label="标题" prop="miniprogramTitle">
|
|
|
+ <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="封面" prop="miniprogramPicUrl">
|
|
|
+ <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-card>
|
|
|
+ </el-card>
|
|
|
</div>
|
|
|
<div v-if="item.contentType == 5 ">
|
|
|
|
|
@@ -513,6 +603,9 @@ export default {
|
|
|
components: {Tip, ImageUpload,userVideo},
|
|
|
data() {
|
|
|
return {
|
|
|
+ videoOptionsLoading: false,
|
|
|
+ videoOptions: [],
|
|
|
+ videoLoading: false,
|
|
|
videoNumOptions: {
|
|
|
title: '选择视频号',
|
|
|
open: false,
|
|
@@ -576,6 +669,7 @@ export default {
|
|
|
chatSetting: [],
|
|
|
// 表单参数
|
|
|
form: {
|
|
|
+ companyUserIds: [],
|
|
|
setting: null,
|
|
|
chatSetting: null,
|
|
|
videoIdSet: null,
|
|
@@ -614,7 +708,83 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 处理规则中课程变化
|
|
|
+ handleRuleCourseChange(item) {
|
|
|
+ // 为当前规则项单独加载视频列表
|
|
|
+ videoList(item.courseId).then((response) => {
|
|
|
+ // 只保存视频列表,不保存整个响应对象
|
|
|
+ this.videoOptions = response.list;
|
|
|
+
|
|
|
+ this.$set(item, 'videoId', null); // Reset video selection when course changes
|
|
|
+
|
|
|
+ // 自动设置封面为课程封面
|
|
|
+ const selectedCourse = this.courseList.find(
|
|
|
+ course => parseInt(course.dictValue) === item.courseId
|
|
|
+ );
|
|
|
+ if (selectedCourse) {
|
|
|
+ this.$set(item, 'miniprogramPicUrl', selectedCourse.dictImgUrl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 处理规则中视频变化
|
|
|
+ handleRuleVideoChange(item) {
|
|
|
+ if (!item.videoId) return;
|
|
|
+
|
|
|
+ // 自动设置标题为视频标题
|
|
|
+ const selectedVideo = (this.videoOptions || []).find(
|
|
|
+ video => parseInt(video.dictValue) === item.videoId
|
|
|
+ );
|
|
|
+ if (selectedVideo) {
|
|
|
+ this.$set(item, 'miniprogramTitle', selectedVideo.dictLabel);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 远程搜索规则中的视频
|
|
|
+ remoteMethodRuleVideo(query, item) {
|
|
|
+ if (!item.courseId) {
|
|
|
+ this.$message.warning('请先选择课程');
|
|
|
+ this.videoOptions = [];
|
|
|
+ reject();
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
+ this.videoOptionsLoading = true;
|
|
|
+ const data = query ? { title: query } : {};
|
|
|
+
|
|
|
+ videoList(item.courseId, data).then((response) => {
|
|
|
+ this.videoOptions = response.list;
|
|
|
+ this.videoOptionsLoading = false;
|
|
|
+ resolve(response);
|
|
|
+ }).catch((error) => {
|
|
|
+ this.videoOptionsLoading = false;
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ remoteMethodVideo(query) {
|
|
|
+ if (!this.form.courseId) {
|
|
|
+ this.$message.warning('请先选择课程');
|
|
|
+ this.videoList = []; // 清空小节列表
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (query !== '') {
|
|
|
+ this.videoLoading = true;
|
|
|
+ // 这里调用接口搜索小节,假设 videoList 方法支持搜索参数
|
|
|
+ var data = {
|
|
|
+ title:query
|
|
|
+ }
|
|
|
+ videoList(this.form.courseId, data).then((response) => {
|
|
|
+ this.videoList = response.list;
|
|
|
+ this.videoLoading = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 如果查询为空,则加载全部
|
|
|
+ videoList(this.form.courseId).then((response) => {
|
|
|
+ this.videoList = response.list;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
qwUserVideoResult(val) {
|
|
|
|
|
|
// 根据选中的内容,将返回的数据更新到相应的表单项
|
|
@@ -826,7 +996,18 @@ export default {
|
|
|
videoList(this.form.courseId).then(response => {
|
|
|
this.videoList = response.list;
|
|
|
});
|
|
|
+ this.setting.forEach(item => {
|
|
|
+ if (item.contentType == 4 && item.courseId) {
|
|
|
+ // 初始化 videoOptions
|
|
|
+ this.videoOptions = [];
|
|
|
+ this.videoOptionsLoading = false;
|
|
|
|
|
|
+ // 获取课程对应的小节列表
|
|
|
+ videoList(item.courseId).then((videoResponse) => {
|
|
|
+ this.videoOptions = videoResponse.list;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
this.open = true;
|
|
|
this.title = "修改完课模板";
|
|
@@ -844,7 +1025,19 @@ export default {
|
|
|
this.form.companyUserIds = this.companyUserIds.toString()
|
|
|
this.form.parentId = this.parentId
|
|
|
|
|
|
- this.form.setting = JSON.stringify(this.setting)
|
|
|
+
|
|
|
+ const processedSetting = this.setting.map(item => {
|
|
|
+ const newItem = {...item};
|
|
|
+ if (newItem.videoOptions) {
|
|
|
+ delete newItem.videoOptions;
|
|
|
+ }
|
|
|
+ if (newItem.videoLoading !== undefined) {
|
|
|
+ delete newItem.videoLoading;
|
|
|
+ }
|
|
|
+ return newItem;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.form.setting = JSON.stringify(processedSetting);
|
|
|
this.form.chatSetting = JSON.stringify(this.chatSetting)
|
|
|
|
|
|
if (this.setting.length <= 0) {
|