Commit 43de7cb4 by haojie

1

parent 514c2ba3
......@@ -90,6 +90,7 @@
:item="{}"
:align="it.align"
:audio="it.audio"
:disabled="it.disabled ?? false"
:audio_list="audio_list"
:is_watch="it.watch ? it.watch : false"
width="100%"
......@@ -228,17 +229,23 @@ const backTable = () => {
};
// 发起请求
const onSend = () => {
const onSend = async () => {
//
const { is_send } = props.form;
if (is_send && is_send.api) {
//
const { is_send, form_options } = props.form;
if (is_send && is_send.api && !is_send.disabled) {
// 获取表单数据
const params = getFormParams(form_options);
if (!params) {
return;
}
loading.value = true;
await is_send.api(params);
loading.value = false;
}
};
// 下拉框事件
const SelectChange = (value: string, fun: any) => {
console.log(value);
fun(value);
};
......
......@@ -5,6 +5,7 @@
:placeholder="item.placeholder"
:filterable="filterable"
:multiple="multiple"
:disabled="disabled"
:popupProps="{
overlayClassName: [className, 'admin-select-popup'],
}"
......@@ -51,6 +52,7 @@ const props = withDefaults(
audio_list?: string[];
name?: string;
multiple?: boolean;
disabled?: boolean;
}>(),
{
width: '357px',
......@@ -60,6 +62,7 @@ const props = withDefaults(
filterable: false,
audio_list: () => [],
multiple: false,
disabled: false,
}
);
const emit = defineEmits(['update:modelValue', 'change', 'ValueChange']);
......
......@@ -66,6 +66,12 @@ const ManagementForm = reactive({
name: 'live_title',
value: '',
placeholder: '请输入直播间标题',
rules: [
{
type: 'required',
message: '直播间标题必填',
},
],
},
{
type: 'text',
......@@ -73,6 +79,12 @@ const ManagementForm = reactive({
name: 'live_link',
value: '',
placeholder: '请输入直播间链接',
rules: [
{
type: 'required',
message: '直播间链接必填',
},
],
},
],
},
......@@ -84,11 +96,17 @@ const ManagementForm = reactive({
type: 'select',
label: '直播话术',
name: 'live_voice',
placeholder: '请选择语言',
placeholder: '请选择直播话术',
value: [],
align: 'left',
options: [],
multiple: true,
rules: [
{
type: 'required',
message: '直播话术必选',
},
],
},
{
type: 'select',
......@@ -99,6 +117,12 @@ const ManagementForm = reactive({
align: 'left',
options: [],
multiple: true,
rules: [
{
type: 'required',
message: '自动回复话术必填',
},
],
},
{
type: 'select',
......@@ -109,12 +133,24 @@ const ManagementForm = reactive({
align: 'left',
options: [],
multiple: true,
rules: [
{
type: 'required',
message: '串场互动话术必填',
},
],
},
{
type: 'number',
name: 'interaction_interval',
label: '串场互动触发时间间隔',
value: '',
rules: [
{
type: 'required',
message: '间隔时间必填',
},
],
},
],
},
......
......@@ -4,7 +4,7 @@
<script lang="ts" setup>
import PageEdit from '@/components/Admin/PageEdit.vue';
import { onBeforeMount, reactive } from 'vue';
import { onBeforeMount, reactive, ref } from 'vue';
import { live_stream_detail } from '@/constants/token';
import { isDevContext } from '@/utils/tool';
import { show_message } from '@/utils/tdesign_tool';
......@@ -18,7 +18,9 @@ const router = useRouter();
const imgs = {
fill: new URL('../../../assets/svg/form/edit.svg', import.meta.url).href,
};
// 编辑页面组件
const cur_id = ref('');
const cur_hash = ref('');
// 查看页面
const ManagementForm = reactive({
title: '直播管理',
title_2: '查看',
......@@ -47,16 +49,29 @@ const ManagementForm = reactive({
{
type: 'text',
label: '直播间标题',
name: 'title_1',
name: 'live_title',
value: '',
disabled: true,
placeholder: '',
rules: [
{
type: 'required',
message: '标题必填',
},
],
},
{
type: 'text',
label: '直播间接',
name: 'title_12',
label: '直播间接',
name: 'live_link',
value: '',
disabled: true,
rules: [
{
type: 'required',
message: '链接必填',
},
],
},
],
},
......@@ -67,62 +82,66 @@ const ManagementForm = reactive({
{
type: 'select',
label: '直播话术',
name: 'language_1',
placeholder: '请选择语言',
value: '',
name: 'live_voice',
placeholder: '',
value: [],
align: 'left',
options: [
{
label: '话术1',
value: 'cn',
},
options: [],
multiple: true,
disabled: true,
rules: [
{
label: '话术2',
value: 'en',
type: 'required',
message: '直播话术必选',
},
],
},
{
type: 'select',
label: '自动回复话术',
name: 'voice',
name: 'live_auto',
placeholder: '请选择自动回复话术',
value: '',
value: [],
align: 'left',
options: [
{
label: '自动回复话术1',
value: '123',
},
multiple: true,
disabled: true,
options: [],
rules: [
{
label: '自动回复话术2',
value: '12345',
type: 'required',
message: '自动回复话术必选',
},
],
},
{
type: 'select',
label: '串场互动话术',
name: 'voice',
name: 'live_interaction',
placeholder: '请选择串场互动话术',
value: '',
align: 'left',
options: [
{
label: '串场互动话术1',
value: '123',
},
options: [],
multiple: true,
disabled: true,
rules: [
{
label: '串场互动话术2',
value: '12345',
type: 'required',
message: '串场互动话术必选',
},
],
},
{
type: 'number',
name: 'number',
name: 'interaction_interval',
disabled: true,
label: '串场互动触发时间间隔',
value: '',
rules: [
{
type: 'required',
message: '间隔时间必填',
},
],
},
],
},
......@@ -138,6 +157,9 @@ onBeforeMount(async () => {
// 本地是否有缓存
const row = getEditLocalData(live_stream_detail, ManagementForm.back_url);
EditFillData(ManagementForm.form_options, row);
cur_id.value = row.id;
cur_hash.value = row.hash;
});
</script>
......
......@@ -84,6 +84,12 @@ const ManagementForm = reactive({
name: 'live_title',
value: '',
placeholder: '请输入直播间标题',
rules: [
{
type: 'required',
message: '标题必填',
},
],
},
{
type: 'text',
......@@ -91,6 +97,12 @@ const ManagementForm = reactive({
name: 'live_link',
value: '',
placeholder: '请输入直播间链接',
rules: [
{
type: 'required',
message: '链接必填',
},
],
},
],
},
......@@ -102,11 +114,17 @@ const ManagementForm = reactive({
type: 'select',
label: '直播话术',
name: 'live_voice',
placeholder: '请选择语言',
placeholder: '请选择直播话术',
value: [],
align: 'left',
options: [],
multiple: true,
rules: [
{
type: 'required',
message: '直播话术必选',
},
],
},
{
type: 'select',
......@@ -117,6 +135,12 @@ const ManagementForm = reactive({
align: 'left',
options: [],
multiple: true,
rules: [
{
type: 'required',
message: '自动回复话术必选',
},
],
},
{
type: 'select',
......@@ -127,12 +151,24 @@ const ManagementForm = reactive({
align: 'left',
options: [],
multiple: true,
rules: [
{
type: 'required',
message: '串场互动话术必选',
},
],
},
{
type: 'number',
name: 'interaction_interval',
label: '串场互动触发时间间隔',
value: '',
rules: [
{
type: 'required',
message: '间隔时间必填',
},
],
},
{
type: 'text',
......
<template>
<PageEdit :form="ManagementForm"></PageEdit>
<PageEdit
:form="ManagementForm"
:audio_list="audio_list"
@ConfigChange="ConfigChange"
></PageEdit>
</template>
<script lang="ts" setup>
import PageEdit from '@/components/Admin/PageEdit.vue';
import { onBeforeMount, reactive } from 'vue';
import { live_stream_edit } from '@/constants/token';
import { getLocalData, isDevContext } from '@/utils/tool';
import { show_message } from '@/utils/tdesign_tool';
import { onBeforeMount, reactive, watch, ref } from 'vue';
import { live_stream_reply } from '@/constants/token';
import { useRouter } from 'vue-router';
import {
language_list,
voice_list,
getEditLocalData,
EditFillData,
} from '@/constants/admin_form';
import { LiveStreamTaskManual } from '@/utils/api/ai';
import { show_message } from '@/utils/tdesign_tool';
const router = useRouter();
const imgs = {
fill: new URL('../../../assets/svg/form/edit.svg', import.meta.url).href,
// 当前试听语音
const audio_list = ref([]);
// 记录当前语音和语言
const CurrentConfig = reactive({
language: '',
voice: '',
});
watch(CurrentConfig, (config) => {
if (config.language && config.voice) {
// 修改试听语音
const obj = voice_list.find((item: any) => item.value == config.voice);
if (obj) {
audio_list.value = [obj.audio[config.language]];
}
}
});
const ConfigChange = (name: string, value: string) => {
CurrentConfig[name] = value;
};
// 发送接口
const onSend = async (data: any) => {
try {
//
const res: any = await LiveStreamTaskManual(data);
if (res.code == 0) {
show_message('提交成功', 'success');
}
} catch (e) {
console.log(e);
}
};
// 编辑页面组件
const ManagementForm = reactive({
......@@ -24,10 +63,12 @@ const ManagementForm = reactive({
// 能否删除,
delete: false,
// 删除api
delete_api: isDevContext() ? '' : '',
delete_api: '',
// 是否试听
audition: true,
// 能否提交
submit: false,
submit_api: isDevContext() ? '' : '',
submit_api: '',
//能否重置
reset: false,
// 是否转换为语音
......@@ -36,9 +77,12 @@ const ManagementForm = reactive({
play_audio: false,
// 发送按钮
is_send: {
// 只有进行中才可以发送
disabled: true,
label: '发送',
api: isDevContext() ? '' : '',
api: onSend,
// 是否自定义parmas,没有就从表单取
// params:''
},
form_options: [
{
......@@ -48,18 +92,15 @@ const ManagementForm = reactive({
{
type: 'select',
label: '语言',
name: 'language_1',
name: 'language',
placeholder: '请选择语言',
value: '',
align: 'left',
options: [
{
label: '中文',
value: 'cn',
},
options: language_list,
rules: [
{
label: '英语',
value: 'en',
type: 'required',
message: '语言必选',
},
],
},
......@@ -71,14 +112,11 @@ const ManagementForm = reactive({
value: '',
align: 'left',
audio: true,
options: [
options: voice_list,
rules: [
{
label: '小微 (直播间专属)',
value: '123',
},
{
label: '小爱 (直播间专属)',
value: '12345',
type: 'required',
message: '语音必选',
},
],
},
......@@ -91,34 +129,45 @@ const ManagementForm = reactive({
{
type: 'textarea',
label: '回复内容',
name: 'product_30',
name: 'manual',
placeholder: '请输入语音内容',
value: '',
rules: [
{
type: 'required',
message: '回复内容必填',
},
],
},
{
type: 'text',
label: 'hash',
name: 'hash',
value: '',
is_hidden: true,
rules: [
{
type: 'required',
message: '缺少hash',
},
],
},
],
},
],
});
const getEditData = () => {
let local_data = getLocalData(live_stream_edit, 'session');
if (!local_data) {
// 没有本地数据,返回页面
show_message('禁止访问');
// 返回话术管理
router.replace({
path: '/AILiveStreaming/DiscourseManagement',
});
} else {
// 有数据--填充到form表单里
// ManagementForm.form
console.log(local_data);
}
};
onBeforeMount(() => {
// 本地是否有缓存
getEditData();
const row = getEditLocalData(live_stream_reply, ManagementForm.back_url);
if (row.hash) {
EditFillData(ManagementForm.form_options, {
hash: row.hash,
});
}
if (row.status === '2') {
ManagementForm.is_send.disabled = false;
}
});
</script>
......
......@@ -241,6 +241,15 @@ export const LiveStreamTableDelete = (data: any) => {
});
};
// 人工回复
export const LiveStreamTaskManual = (data: any) => {
return request.post('/api/voices/add-task-manual', data, {
headers: {
authorization: `Bearer ${getUserCookie()}`,
},
});
};
/**
* 直播管理 end
*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment