Commit 56d408ab by haojie

1

parent 40b1bb9d
<template>
<div class="custom-admin-page">
<div class="custom-admin-page custom-scrollbar">
<div class="admin-page-header">
<div>
<span class="page-header-title">{{ form.title }}</span>
......@@ -48,6 +48,8 @@
:options="item.options"
:item="item"
v-model="item.value"
:filterable="item.filterable"
:align="item.align"
></CustomSelect>
</template>
</template>
......@@ -68,25 +70,28 @@
<div class="admin-table">
<CustomTable
:list="list"
:api="form.table_api"
:api_type="form.table_api_type"
:columns="form.table_columns"
:local_key="form.local_key"
:edit_page="form.edit_page"
:checkbox="form.checkbox"
:edit_key="form.edit_key"
:table_api="form.table_api"
:filter_num="filter_num"
:filter_api="form.filter_api"
:AlreadyChoose="AlreadyChoose"
@ChangeList="ChangeList"
@ChoseList="ChoseList"
@PageNumChange="PageNumChange"
>
<template #title="{ row }">
<slot name="title" :row="row"></slot>
</template>
<template #mp3="{ row }">
<slot name="mp3" :row="row"></slot>
<template #audio="{ row }">
<slot name="audio" :row="row"></slot>
</template>
<template #edit="{ row }">
<slot name="edit" :row="row"> </slot>
</template>
<template #content="{ row }">
<slot name="content" :row="row"></slot>
</template>
</CustomTable>
</div>
<slot></slot>
......@@ -110,22 +115,30 @@ const props = defineProps<{
form: any;
list: any[];
}>();
const emit = defineEmits(['reset', 'update:list']);
const emit = defineEmits(['reset', 'update:list', 'PageNumChange']);
const store = useStore();
const router = useRouter();
// 筛选盒子打开状态
const filterBoxStatus = ref(false);
//
const filter_num = ref(1);
const defaultWidth = ref();
const adminFilter = ref();
// 选中的行
const SelectedRows = ref([]);
// 已选择的筛选的数据
const AlreadyChoose = ref({});
// 重新加载页面
const onReload = () => {
store.commit('progress/reload');
};
// 清空所有筛选的值并重新请求
const onReset = () => {
// 先清空
emit('reset');
setTimeout(() => {
onFilter();
}, 0);
};
// 选中的行
const ChoseList = (list: any[]) => {
......@@ -142,7 +155,9 @@ const onFilter = () => {
const { filter_option } = props.form;
if (filter_option) {
const params = getFilterParams(filter_option);
// 提交
AlreadyChoose.value = params;
// 通知table筛选
filter_num.value += 1;
}
};
......@@ -151,6 +166,11 @@ const ChangeList = (list: any[]) => {
emit('update:list', list);
};
// 分页变化
const PageNumChange = (value: number) => {
emit('PageNumChange', value);
};
// 新增
const onCreate = () => {
const { create_page } = props.form;
......
<template>
<t-tooltip :content="content">
<div class="max-content">
{{ content }}
</div>
</t-tooltip>
</template>
<script lang="ts" setup>
import { Tooltip as TTooltip } from 'tdesign-vue-next';
const props = withDefaults(
defineProps<{
content: string;
}>(),
{}
);
</script>
<style lang="less">
.max-content {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>
<template>
<div class="">
<slot></slot>
{{ CurrentText }}
</div>
</template>
<script lang="ts" setup>
import { onBeforeUnmount, onMounted, ref } from 'vue';
const CurrentText = ref('。');
let interval: any = null;
const openInterval = () => {
interval = window.setInterval(() => {
if (CurrentText.value.length == 3) {
CurrentText.value = '。';
} else if (CurrentText.value.length == 2) {
CurrentText.value = '。。。';
} else if (CurrentText.value.length == 1) {
CurrentText.value = '。。';
}
}, 1000);
};
// 关闭定时器
const closeInterval = () => {
if (interval) {
window.clearInterval(interval);
interval = null;
}
};
onMounted(() => {
// 开启定时器
openInterval();
});
onBeforeUnmount(() => {
closeInterval();
});
</script>
<style lang="less"></style>
<template>
<div class="">
<template v-if="status === 'true'">
<CustomAudio bk="#181818" :need_progress="true" :url="url"></CustomAudio>
</template>
<template v-else-if="status === 'false'">
<!-- loading -->
<div class="voice-loading">
<DotLoop> 语音正在生成中,请耐心等待 </DotLoop>
</div>
</template>
</div>
</template>
<script lang="ts" setup>
import CustomAudio from './audio.vue';
import DotLoop from './DotLoop.vue';
const props = withDefaults(
defineProps<{
status: string;
url?: any[];
}>(),
{
url: () => [],
}
);
</script>
<style lang="less">
.voice-loading {
background: #181818;
border-radius: 42px;
font-weight: 400;
font-size: 13px;
height: 54px;
display: flex;
justify-content: center;
align-items: center;
}
</style>
<template>
<div class="admin-page-edit-parent">
<div class="admin-page-edit-parent custom-scrollbar">
<div class="custom-admin-page-edit">
<div class="admin-page-header">
<div>
......@@ -32,85 +32,91 @@
<div class="edit-form">
<div class="edit-form-content">
<template v-for="item in form.form_options" :key="item.title">
<div class="edit-form-item-label">
<template v-if="item.icon == 'TextToSpeech'">
<TextToSpeechSvg style="fill: white"></TextToSpeechSvg>
</template>
<template v-else-if="item.icon == 'message'">
<MessageSvg style="fill: white"></MessageSvg>
</template>
<template v-else-if="item.icon == 'crossTalk'">
<CrossTalk></CrossTalk>
</template>
<template v-else-if="item.icon == 'discourseBind'">
<DiscourseBindSvg></DiscourseBindSvg>
</template>
<template v-else-if="item.icon == 'ManualResponse'">
<ManualResponseSvg></ManualResponseSvg>
</template>
<template v-else>
<img :src="item.icon" alt="" />
</template>
{{ item.title }}
</div>
<div
class="edit-form-item"
v-for="it in item.lists"
:key="it.name"
>
<div class="label">
{{ it.label }}
</div>
<div class="value">
<template v-if="it.type == 'text'">
<CustomInput
align="left"
class="edit-input"
v-model="it.value"
:placeholder="it.placeholder"
:disabled="it.disabled ? it.disabled : false"
>
<template #rightIcon>
<template v-if="!it.disabled">
<span class="input-right-icon">
<EditInputSvg></EditInputSvg>
</span>
</template>
</template>
</CustomInput>
<div v-show="!item.is_hidden">
<div class="edit-form-item-label">
<template v-if="item.icon == 'TextToSpeech'">
<TextToSpeechSvg style="fill: white"></TextToSpeechSvg>
</template>
<template v-else-if="it.type == 'select'">
<CustomSelect
:options="it.options"
v-model="it.value"
:item="{}"
:align="it.align"
:audio="it.audio"
width="800px"
></CustomSelect>
<template v-else-if="item.icon == 'message'">
<MessageSvg style="fill: white"></MessageSvg>
</template>
<template v-else-if="it.type == 'textarea'">
<CustomTextarea
v-model="it.value"
:disabled="form.is_send ? form.is_send.disabled : false"
></CustomTextarea>
<template v-else-if="item.icon == 'crossTalk'">
<CrossTalk></CrossTalk>
</template>
<template v-else-if="it.type == 'number'">
<CustomInput
type="number"
align="left"
class="edit-input"
v-model="it.value"
:placeholder="it.placeholder"
:disabled="it.disabled ? it.disabled : false"
>
<template #rightIcon>
<template v-if="!it.disabled">
<span class="input-right-icon"> M </span>
</template>
</template>
</CustomInput>
<template v-else-if="item.icon == 'discourseBind'">
<DiscourseBindSvg></DiscourseBindSvg>
</template>
<template v-else-if="item.icon == 'ManualResponse'">
<ManualResponseSvg></ManualResponseSvg>
</template>
<template v-else>
<img :src="item.icon" alt="" />
</template>
{{ item.title }}
</div>
<div
class="edit-form-item"
v-for="it in item.lists"
:key="it.name"
>
<div class="label">
{{ it.label }}
</div>
<div class="value">
<template v-if="it.type == 'text'">
<CustomInput
align="left"
class="edit-input"
width="100%"
v-model="it.value"
:placeholder="it.placeholder"
:disabled="it.disabled ? it.disabled : false"
>
<template #rightIcon>
<template v-if="!it.disabled">
<span class="input-right-icon">
<EditInputSvg></EditInputSvg>
</span>
</template>
</template>
</CustomInput>
</template>
<template v-else-if="it.type == 'select'">
<CustomSelect
:options="it.options"
v-model="it.value"
:item="{}"
:align="it.align"
:audio="it.audio"
:is_watch="it.watch ? it.watch : false"
width="100%"
@change="SelectChange"
></CustomSelect>
</template>
<template v-else-if="it.type == 'textarea'">
<CustomTextarea
v-model="it.value"
:maxlength="it.maxlength ?? null"
:disabled="form.is_send ? form.is_send.disabled : false"
></CustomTextarea>
</template>
<template v-else-if="it.type == 'number'">
<CustomInput
type="number"
align="left"
class="edit-input"
v-model="it.value"
:placeholder="it.placeholder"
:disabled="it.disabled ? it.disabled : false"
>
<template #rightIcon>
<template v-if="!it.disabled">
<span class="input-right-icon"> M </span>
</template>
</template>
</CustomInput>
</template>
</div>
</div>
</div>
</template>
......@@ -126,12 +132,11 @@
</CustomButton>
</div>
</template>
<template v-if="form.play_audio">
<CustomAudio
bk="#181818"
:need_progress="true"
:url="''"
></CustomAudio>
<template v-if="form.audio">
<GenerateVoice
:status="form.audio.status"
:url="form.audio.url"
></GenerateVoice>
</template>
<template v-if="form.start_broadcast">
<StartBroadcast :status="'not_on_air'"></StartBroadcast>
......@@ -164,7 +169,7 @@
</template>
<script lang="ts" setup>
import CustomAudio from './audio.vue';
import GenerateVoice from './GenerateVoice.vue';
import CustomButton from './button.vue';
import CustomTextarea from './Textarea.vue';
import CustomSelect from './select.vue';
......@@ -180,10 +185,12 @@ import DiscourseBindSvg from '@/assets/svg/form/discourseBind.svg';
import ManualResponseSvg from '@/assets/svg/form/ManualResponse.svg';
import { useRouter } from 'vue-router';
import { show_message } from '@/utils/tdesign_tool';
import { ref } from 'vue';
const props = defineProps<{
form: any;
}>();
const router = useRouter();
const backTable = () => {
const { back_url } = props.form;
if (!back_url) {
......@@ -203,6 +210,11 @@ const onSend = () => {
//
}
};
// 下拉框事件
const SelectChange = (value: string, fun: any) => {
fun(value);
};
</script>
<style lang="less">
......@@ -271,7 +283,10 @@ const onSend = () => {
flex: 1;
display: flex;
justify-content: center;
padding: 0 30px;
box-sizing: border-box;
.edit-form-content {
width: 800px;
.edit-form-item-label {
display: flex;
align-items: center;
......@@ -338,7 +353,7 @@ const onSend = () => {
.edit-input {
height: auto;
width: 800px;
max-width: 800px;
.custom-input-box {
height: 34px;
border: none;
......
......@@ -40,21 +40,21 @@
</template>
</div>
<audio ref="audioRef" :src="url" @canplay="onCanplay"></audio>
<audio ref="audioRef" :src="CurrentUrl()" @canplay="onCanplay"></audio>
</template>
<script setup lang="ts">
import { ref, onBeforeMount, onBeforeUnmount } from 'vue';
import { ref, onBeforeMount, onBeforeUnmount, computed } from 'vue';
withDefaults(
const props = withDefaults(
defineProps<{
url?: string;
url?: string[];
need_progress?: boolean;
bk?: string;
}>(),
{
need_progress: false,
url: '',
url: () => [],
bk: 'transparent',
}
);
......@@ -100,13 +100,41 @@ const playStatus = ref<boolean>(false); // 音频播放状态:true 播放,fa
const playProgress = ref(0); // 音频播放进度
const timeInterval = ref(); // 获取音频播放进度定时器
// 当前播放的音频下标
const audio_index = ref(0);
// 当前播放的音频链接
const CurrentUrl = computed(() => {
return function () {
const { url } = props;
if (url && url.length) {
return url[audio_index.value];
}
};
});
// 音频加载完毕的回调
const onCanplay = () => {
audioDuration.value = audioRef?.value.duration || 0;
};
// 更新音频
const UpdateAudio = async () => {
// 进入到下一个
const { url } = props;
if (url && url.length) {
if (audio_index.value === url.length - 1) {
// 最后一个,暂停播放
await onPause();
} else if (audio_index.value < url.length - 1) {
audio_index.value += 1;
await onPause();
onPlay();
}
}
};
const onPlay = async () => {
// 音频播放完后,重新播放
if (playProgress.value === 100) audioRef.value.currentTime = 0;
// if (playProgress.value === 100) audioRef.value.currentTime = 0;
await audioRef.value.play();
playStatus.value = true;
......@@ -115,11 +143,15 @@ const onPlay = async () => {
timeInterval.value = setInterval(() => {
audioCurrent.value = audioRef.value.currentTime;
playProgress.value = (audioCurrent.value / audioDuration.value) * 100;
if (playProgress.value === 100) onPause();
if (playProgress.value === 100) {
UpdateAudio();
}
}, 100);
};
const onPause = () => {
audioRef.value.pause();
// 暂停播放
const onPause = async () => {
await audioRef.value.pause();
playStatus.value = false;
clearInterval(timeInterval.value);
};
......
<template>
<div class="custom-input-global">
<div class="custom-input-global" :style="{ width: width }">
<div
class="custom-input-box"
:class="{ 'custom-input-error': ruleError.status }"
......@@ -69,6 +69,7 @@ const props = withDefaults(
needSelect?: boolean;
selectList?: any;
align?: string;
width?: string;
}>(),
{
// 输入框类型
......@@ -79,6 +80,7 @@ const props = withDefaults(
selectList: [],
// rules: [],
disabled: false,
width: '',
}
);
const emit = defineEmits([
......
......@@ -3,6 +3,7 @@
<TSelect
v-model="SelectValue"
:placeholder="item.placeholder"
:filterable="filterable"
:popupProps="{
overlayClassName: [className, 'admin-select-popup'],
}"
......@@ -44,20 +45,27 @@ const props = withDefaults(
className?: string;
align?: string;
audio?: boolean;
is_watch?: any;
filterable?: boolean;
}>(),
{
width: '357px',
align: 'center',
audio: false,
is_watch: false,
filterable: false,
}
);
const emit = defineEmits(['update:modelValue']);
const emit = defineEmits(['update:modelValue', 'change']);
const SelectValue = ref(props.modelValue);
watch(
() => SelectValue.value,
(v) => {
emit('update:modelValue', v);
if (props.is_watch) {
emit('change', v, props.is_watch);
}
}
);
watch(
......
......@@ -21,11 +21,11 @@
@change="CheckOne(row)"
></TCheckbox>
</template>
<template #title="{ row }">
<slot name="title" :row="row"></slot>
<template #audio="{ row }">
<slot name="audio" :row="row"></slot>
</template>
<template #mp3="{ row }">
<slot name="mp3" :row="row"></slot>
<template #content="{ row }">
<slot name="content" :row="row"></slot>
</template>
<template #edit="{ row }">
<slot name="edit" :row="row">
......@@ -47,27 +47,34 @@
<script lang="ts" setup>
import { Table as TTable, Checkbox as TCheckbox } from 'tdesign-vue-next';
import { onBeforeMount, reactive, ref } from 'vue';
import { onBeforeMount, reactive, ref, watch } from 'vue';
// import { getGenerateRecords } from '@/utils/api/scenes';
import { Pagination as TPagination } from 'tdesign-vue-next';
// import { TASKTYPE } from '@/utils/api/Task';
import { getLocalData, setLocalData } from '@/utils/tool';
import { EditButtonEvent } from '@/constants/admin_form';
import { show_message } from '@/utils/tdesign_tool';
const props = withDefaults(
defineProps<{
api: string;
api_type: string;
columns: any[];
local_key: string;
edit_page: string;
checkbox?: boolean;
edit_key: string;
table_api?: any;
filter_num?: number;
filter_api?: any;
AlreadyChoose?: any;
}>(),
{
checkbox: true,
table_api: false,
filter_num: 1,
filter_api: false,
AlreadyChoose: {},
}
);
const emit = defineEmits(['ChangeList', 'ChoseList']);
const emit = defineEmits(['ChangeList', 'ChoseList', 'PageNumChange']);
// 获取本地的page
const getPage = () => {
const page = getLocalData(props.local_key, 'session');
......@@ -82,8 +89,14 @@ const is_check_all = ref(false);
const tableList = reactive({
list: [],
});
const pageChange = (value: number) => {
// 修改当前页
const ChangeCurrentPage = (value: number) => {
pageNum.value = value;
emit('PageNumChange', value);
};
const pageChange = (value: number) => {
ChangeCurrentPage(value);
// 存本地
setLocalData(props.local_key, value, 'session');
getLog();
......@@ -132,6 +145,45 @@ const CheckOne = (row: any) => {
}
};
// 添加表格多选框和状态
const setTableCheckBox = (res: any) => {
// 增加一个选中状态
res.list.forEach((item: any, index: number) => {
item.is_check = false;
item.index = index;
});
return res;
};
const StartFilter = async () => {
try {
const { filter_api } = props;
if (filter_api) {
// page初始化
ChangeCurrentPage(1);
loading.value = true;
let res: any = await filter_api(props.AlreadyChoose);
res = await setTableCheckBox(res);
tableList.list = res.list;
total.value = res.total;
loading.value = false;
} else {
show_message('未配置filter');
}
} catch (e) {
console.log(e);
loading.value = false;
}
};
watch(
() => props.filter_num,
(v) => {
// 开始筛选
StartFilter();
}
);
// 打开编辑页面
const onEdit = (row: any) => {
const { edit_page, edit_key } = props;
......@@ -142,35 +194,12 @@ const onEdit = (row: any) => {
const getLog = async () => {
try {
loading.value = true;
// let res: any = await getGenerateRecords({
// page: pageNum.value,
// limit: pageSize.value,
// type: TASKTYPE.CHAT,
// });
// if (res.code == 0) {
// RecordList.list = res.data.data;
// total.value = res.data.total;
// }
// console.log(res);
// 假数据
const list = [
{
title: '你好',
detail: '详细',
consumes_characters: '消耗',
download: '编辑',
mp3: new URL('../../assets/mp3/test.aac', import.meta.url).href,
},
];
let res: any = await props.table_api();
if (props.checkbox) {
// 增加一个选中状态
list.forEach((item: any, index: number) => {
item.is_check = false;
item.index = index;
});
res = await setTableCheckBox(res);
}
tableList.list = list;
tableList.list = res.list;
total.value = res.total;
loading.value = false;
} catch (e) {
loading.value = false;
......
......@@ -56,6 +56,8 @@ export const EditFillData = (form: any[], row: any) => {
item.lists.forEach((it: any) => {
// 查找name相同的字段
Object.keys(row).forEach((key: string) => {
// console.log(value);
console.log(it.name);
if (it.name == key) {
// 填充数据
it.value = row[key];
......@@ -63,4 +65,30 @@ export const EditFillData = (form: any[], row: any) => {
});
});
});
console.log(form);
};
// 筛选配置填充
export const FilterConfigFill = (resData: any, form: any[]) => {
form.forEach((item: any) => {
// 循环resdata的key
Object.keys(resData).forEach((it: any) => {
if (item.name == it) {
if (typeof resData[it][0] == 'string') {
// 需要转换格式
const list: any = [];
resData[it].forEach((res: any) => {
const obj = {
label: res,
value: res,
};
list.push(obj);
});
item.options = list;
} else {
item.options = resData[it];
}
}
});
});
};
......@@ -212,7 +212,7 @@ export default defineComponent({
)}
</div>
</div>
<div class="custom-tab-content custom-scrollbar">
<div class="custom-tab-content">
{ProgressStatus.value.show ? (
<div class="admin-page-progress">
<TProgress
......
......@@ -3,24 +3,95 @@
:form="ManagementForm"
v-model:list="ManagementForm.table_list"
@reset="ResetFilter"
@PageNumChange="PageNumChange"
>
<template #title>
<div>111</div>
<template #audio="{ row }">
<CustomAudio :url="row.audio"></CustomAudio>
</template>
<template #mp3="{ row }">
<CustomAudio :url="row.mp3"></CustomAudio>
<template #content="{ row }">
<ContentTooltip :content="row.content"></ContentTooltip>
</template>
</AdminPublicPageVue>
</template>
<script lang="ts" setup>
import ContentTooltip from '@/components/Admin/ContentTooltip.vue';
import CustomAudio from '@/components/Admin/audio.vue';
import AdminPublicPageVue from '@/components/Admin/AdminPublicPage.vue';
import { reactive } from 'vue';
import { onBeforeMount, reactive, ref } from 'vue';
import { isDevContext } from '@/utils/tool';
import { ResetForm } from '@/constants/admin_form';
import { AdminFilterApi } from '@/utils/api/ai';
import { FilterConfigFill, ResetForm } from '@/constants/admin_form';
import { discourse_management_edit } from '@/constants/token';
import {
DiscourseManagementConfig,
DiscourseManagementList,
DiscourseManagementFilter,
} from '@/utils/api/ai';
const pageNum = ref(1);
const pageSize = ref(10);
// 转换列表中音频的格式
const changeAudio = (list: any[]) => {
list.forEach((item: any) => {
// 转换audio列表
if (typeof item.audio == 'string') {
item.audio = JSON.parse(item.audio);
}
});
return list;
};
// 请求表格接口
const getTableList = async () => {
try {
const res: any = await DiscourseManagementList({
page: pageNum.value,
limit: pageSize.value,
});
const list = changeAudio(res.data.data);
return {
list: list,
total: res.data.total,
};
} catch (e) {
console.log(e);
}
};
// 分页变化
const PageNumChange = (value: number) => {
pageNum.value = value;
};
// 获取筛选列表配置
const getFilterList = async () => {
try {
const res: any = await DiscourseManagementConfig();
if (res.data) {
FilterConfigFill(res.data, ManagementForm.filter_option);
}
} catch (e) {
console.log(e);
}
};
// 开始筛选
const onFilter = async (params: any) => {
try {
const res: any = await DiscourseManagementFilter({
page: pageNum.value,
limit: pageSize.value,
...params,
});
const list = changeAudio(res.data.data);
return {
list: list,
total: res.data.total,
};
} catch (e) {
console.log(e);
}
};
// 表单配置项
const ManagementForm = reactive({
title: '话术列表',
......@@ -30,17 +101,15 @@ const ManagementForm = reactive({
// 能否筛选
filter: true,
// 筛选接口
filter_api: isDevContext() ? '' : '',
filter_api: onFilter,
// 能否新增
add: true,
// 表格key--用来缓存表格分页
local_key: 'admin_discourse_management',
// 表格数据
table_list: [],
// 表格接口
table_api: isDevContext() ? '' : '',
// api类型
table_api_type: 'get',
// 表格接口function
table_api: getTableList,
// 能否多选--默认为true
checkbox: true,
// 编辑页面
......@@ -64,22 +133,31 @@ const ManagementForm = reactive({
colKey: 'checkbox',
},
{
title: '产品',
title: 'ID',
colKey: 'id',
},
{
title: '标题',
colKey: 'title',
},
{
title: '详细',
colKey: 'detail',
title: '产品',
colKey: 'product',
},
{
title: '语言',
colKey: 'language',
align: 'center',
},
{
title: '消耗字符数',
colKey: 'consumes_characters',
title: '语音内容',
colKey: 'content',
align: 'center',
width: '20%',
},
{
title: '音频',
colKey: 'mp3',
colKey: 'audio',
align: 'center',
},
{
......@@ -91,52 +169,40 @@ const ManagementForm = reactive({
filter_option: [
{
type: 'select',
name: 'select_title',
name: 'title',
label: '标题',
placeholder: '请选择标题',
value: '',
options: [
{
label: '你好',
value: '你好',
},
{
label: '你好2',
value: '你好2',
},
],
// 能否输入
filterable: true,
align: 'left',
options: [],
},
{
type: 'select',
name: 'select_product',
name: 'product',
label: '产品',
placeholder: '产品',
value: '',
options: [
{
label: '你好',
value: '你好',
},
{
label: '你好2',
value: '你好2',
},
],
// 能否输入
filterable: true,
align: 'left',
options: [],
},
{
type: 'select',
name: 'select_language',
name: 'language',
label: '语言',
placeholder: '语言',
value: '',
options: [
{
label: '你好',
value: '你好',
label: '中文',
value: 'cn',
},
{
label: '你好2',
value: '你好2',
label: '英文',
value: 'en',
},
],
},
......@@ -147,9 +213,11 @@ const ManagementForm = reactive({
const ResetFilter = () => {
ResetForm(ManagementForm.filter_option);
// 请求接口
// AdminFilterApi();
};
onBeforeMount(() => {
getFilterList();
});
</script>
<style lang="less"></style>
......@@ -31,7 +31,11 @@ const ManagementForm = reactive({
//能否重置
reset: true,
// 是否转换为语音
conversion: true,
conversion: {
api: '',
options: [],
value: '',
},
// 播放音频
play_audio: true,
form_options: [
......@@ -42,7 +46,7 @@ const ManagementForm = reactive({
{
type: 'text',
label: '标题',
name: 'title_1',
name: 'title',
value: '',
// 是否禁用
disabled: false,
......@@ -50,7 +54,7 @@ const ManagementForm = reactive({
{
type: 'text',
label: '产品',
name: 'product_1',
name: 'product',
value: '',
},
],
......@@ -63,7 +67,7 @@ const ManagementForm = reactive({
{
type: 'select',
label: '语言',
name: 'language_1',
name: 'language',
placeholder: '请选择语言',
value: '',
align: 'left',
......@@ -73,7 +77,7 @@ const ManagementForm = reactive({
value: 'cn',
},
{
label: '英',
label: '英',
value: 'en',
},
],
......@@ -87,12 +91,24 @@ const ManagementForm = reactive({
align: 'left',
options: [
{
label: '小微 (直播间专属)',
value: '123',
label: '柜姐',
value: 'guijie',
},
{
label: '小仙',
value: 'xiaoxian',
},
{
label: '艾飞',
value: 'aifei',
},
{
label: '老铁',
value: 'laotie',
},
{
label: '小爱 (直播间专属)',
value: '12345',
label: '老妹',
value: 'laomei',
},
],
},
......@@ -102,6 +118,7 @@ const ManagementForm = reactive({
name: 'product_1',
placeholder: '请输入语音内容',
value: '',
maxlength: 1000,
},
],
},
......
......@@ -34,7 +34,10 @@ const ManagementForm = reactive({
// 是否转换为语音
conversion: true,
// 播放音频
play_audio: true,
audio: {
url: [],
status: '',
},
form_options: [
{
icon: imgs.fill,
......@@ -122,6 +125,7 @@ onBeforeMount(() => {
discourse_management_edit,
ManagementForm.back_url
);
console.log(row);
// 填充数据
EditFillData(ManagementForm.form_options, row);
});
......
......@@ -15,7 +15,6 @@ import AdminPublicPageVue from '@/components/Admin/AdminPublicPage.vue';
import { reactive } from 'vue';
import { isDevContext } from '@/utils/tool';
import { ResetForm } from '@/constants/admin_form';
import { AdminFilterApi } from '@/utils/api/ai';
import { interactive_setting_edit } from '@/constants/token';
// 表单配置项
const ManagementForm = reactive({
......@@ -143,8 +142,6 @@ const ManagementForm = reactive({
const ResetFilter = () => {
ResetForm(ManagementForm.filter_option);
// 请求接口
// AdminFilterApi();
};
</script>
......
......@@ -14,6 +14,17 @@ const router = useRouter();
const imgs = {
fill: new URL('../../../assets/svg/form/edit.svg', import.meta.url).href,
};
// 修改组件显示状态
const ChangeComponentsShow = (value: string) => {
ManagementForm.form_options.forEach((item: any) => {
if (item.name === value) {
item.is_hidden = false;
}
if (item.name !== value && item.is_hidden === false) {
item.is_hidden = true;
}
});
};
// 编辑页面组件
const ManagementForm = reactive({
title: '互动设置',
......@@ -41,10 +52,23 @@ const ManagementForm = reactive({
title: '',
lists: [
{
type: 'text',
type: 'select',
label: '类型',
name: 'title_1',
value: '自动回复设置',
name: 'language_1',
placeholder: '请选择类型',
value: 'auto',
align: 'left',
watch: ChangeComponentsShow,
options: [
{
label: '自动回复设置',
value: 'auto',
},
{
label: '串场互动话术设置',
value: 'crosstown',
},
],
},
],
},
......@@ -94,6 +118,8 @@ const ManagementForm = reactive({
{
icon: 'message',
title: '自动回复设置',
is_hidden: false,
name: 'auto',
lists: [
{
type: 'text',
......@@ -112,6 +138,29 @@ const ManagementForm = reactive({
},
],
},
{
icon: 'discourseBind',
title: '串场互动话术设置',
is_hidden: true,
name: 'crosstown',
lists: [
{
type: 'text',
label: '标题',
name: 'language_20',
placeholder: '请输入',
value: '',
align: 'left',
},
{
type: 'textarea',
label: '话术内容',
name: 'product_30',
placeholder: '请输入话术内容',
value: '',
},
],
},
],
});
......
......@@ -21,7 +21,6 @@ import AdminPublicPageVue from '@/components/Admin/AdminPublicPage.vue';
import { reactive } from 'vue';
import { isDevContext } from '@/utils/tool';
import { ResetForm, EditButtonEvent } from '@/constants/admin_form';
import { AdminFilterApi } from '@/utils/api/ai';
import { useRouter } from 'vue-router';
import {
live_stream_edit,
......@@ -154,8 +153,6 @@ const ManagementForm = reactive({
// 重置表单并重新请求
const ResetFilter = () => {
ResetForm(ManagementForm.filter_option);
// 请求接口
// AdminFilterApi();
};
// 编辑
......
......@@ -19,7 +19,7 @@ const ManagementForm = reactive({
body_title: '新增',
// 是否显示返回列表页
back: true,
back_url: '/AILiveStreaming/InteractiveSetting',
back_url: '/AILiveStreaming/LiveStream',
// 能否删除,
delete: false,
// 删除api
......@@ -36,81 +36,88 @@ const ManagementForm = reactive({
play_audio: false,
form_options: [
{
icon: '',
title: '',
icon: imgs.fill,
title: '基础填写',
lists: [
{
type: 'text',
label: '类型',
label: '直播间标题',
name: 'title_1',
value: '',
placeholder: '请输入类型',
// 是否禁用
disabled: false,
disabled: true,
placeholder: '',
},
{
type: 'text',
label: '直播间连接',
name: 'title_12',
value: '',
},
],
},
{
icon: 'TextToSpeech',
title: '语音设置',
icon: 'discourseBind',
title: '话术绑定',
lists: [
{
type: 'select',
label: '语言',
label: '直播话术',
name: 'language_1',
placeholder: '请选择语言',
value: '',
align: 'left',
options: [
{
label: '中文',
label: '话术1',
value: 'cn',
},
{
label: '英语',
label: '话术2',
value: 'en',
},
],
},
{
type: 'select',
label: '语音',
label: '自动回复话术',
name: 'voice',
placeholder: '请选择语音',
placeholder: '请选择自动回复话术',
value: '',
align: 'left',
audio: true,
options: [
{
label: '小微 (直播间专属)',
label: '自动回复话术1',
value: '123',
},
{
label: '小爱 (直播间专属)',
label: '自动回复话术2',
value: '12345',
},
],
},
],
},
// 串场互动
{
icon: 'crossTalk',
title: '串场互动话术设置',
lists: [
{
type: 'text',
label: '标题',
name: 'title_1',
type: 'select',
label: '串场互动话术',
name: 'voice',
placeholder: '请选择串场互动话术',
value: '',
placeholder: '请输入标题',
align: 'left',
options: [
{
label: '串场互动话术1',
value: '123',
},
{
label: '串场互动话术2',
value: '12345',
},
],
},
{
type: 'textarea',
label: '话术内容',
name: 'title_2',
type: 'number',
name: 'number',
label: '串场互动触发时间间隔',
value: '',
placeholder: '请输入话术内容',
},
],
},
......
import request from '@/utils/request';
export const AdminFilterApi = () => {
return request.get('ddd');
import { getUserCookie } from './userApi';
/**
* ai直播模块接口
*/
// 话术管理配置信息
export const DiscourseManagementConfig = () => {
return request.get('/api/voices/get-user-config', {
headers: {
authorization: `Bearer ${getUserCookie()}`,
},
});
};
// 话术管理表格
export const DiscourseManagementList = (data: any) => {
return request.get('/api/voices/get-voice-live', {
params: data,
headers: {
authorization: `Bearer ${getUserCookie()}`,
},
});
};
// 话术管理筛选
export const DiscourseManagementFilter = (data: any) => {
return request.get('/api/voices/get-config-filter', {
params: data,
headers: {
authorization: `Bearer ${getUserCookie()}`,
},
});
};
......@@ -13,7 +13,10 @@ export default defineConfig(({ mode }) => {
const newDate = `${date.getFullYear()}-${
date.getMonth() + 1
}-${date.getDate()}--${date.getHours()}.${date.getMinutes()}`;
const api = 1 ? 'http://156.247.11.21:85' : 'http://ai-gpt.test';
// 192.168.1.13:88 -- zh
// http://ai-gpt.test
// http://156.247.11.21:85--线上
const api = 1 ? 'http://192.168.1.13:88' : 'http://ai-gpt.test';
return {
base: '/',
resolve: {
......
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