Commit 7ec3301a by haojie

修复互动内容的bug

parent cb4f9a87
...@@ -96,8 +96,10 @@ export default defineComponent({ ...@@ -96,8 +96,10 @@ export default defineComponent({
} }
if (props.accept) { if (props.accept) {
let fileName = file.name.split('.')[1]; let fileName = file.name.split('.')[1];
if (props.accept.indexOf(fileName) == -1) { fileName = fileName.toLowerCase();
show_message(`本次上传仅支持${props.accept}格式`); let proAccept = props.accept.toLowerCase();
if (proAccept.indexOf(fileName) == -1) {
show_message(`本次上传仅支持${proAccept}格式`);
return false; return false;
} }
} }
......
...@@ -53,13 +53,13 @@ export const getRoutes = () => { ...@@ -53,13 +53,13 @@ export const getRoutes = () => {
path: routerConfig.createLive.path, path: routerConfig.createLive.path,
name: routerConfig.createLive.name, name: routerConfig.createLive.name,
component: () => import('@/pages/createLive/index.vue'), component: () => import('@/pages/createLive/index.vue'),
meta: { title: 'snowhome', liveName: true }, meta: { title: 'snowhome', liveName: true, keepAlive: true },
}, },
{ {
path: routerConfig.createInteract.path, path: routerConfig.createInteract.path,
name: routerConfig.createInteract.name, name: routerConfig.createInteract.name,
component: () => import('@/pages/createInteract/index.vue'), component: () => import('@/pages/createInteract/index.vue'),
meta: { title: 'snowhome' }, meta: { title: 'snowhome', keepAlive: true },
}, },
{ {
path: routerConfig.startLive.path, path: routerConfig.startLive.path,
...@@ -77,13 +77,13 @@ export const getRoutes = () => { ...@@ -77,13 +77,13 @@ export const getRoutes = () => {
path: routerConfig.ImageCustomization.path, path: routerConfig.ImageCustomization.path,
name: routerConfig.ImageCustomization.name, name: routerConfig.ImageCustomization.name,
component: () => import('@/pages/ImageCustomization/index.vue'), component: () => import('@/pages/ImageCustomization/index.vue'),
meta: { title: 'snowhome' }, meta: { title: 'snowhome', keepAlive: true },
}, },
{ {
path: routerConfig.VocalCustomization.path, path: routerConfig.VocalCustomization.path,
name: routerConfig.VocalCustomization.name, name: routerConfig.VocalCustomization.name,
component: () => import('@/pages/VocalCustomization/index.vue'), component: () => import('@/pages/VocalCustomization/index.vue'),
meta: { title: 'snowhome' }, meta: { title: 'snowhome', keepAlive: true },
}, },
]; ];
} }
......
<template> <template>
<router-view v-slot="{ Component }"> <!-- <router-view v-slot="{ Component }">
<keep-alive>
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<component :is="Component" /> <component :is="Component" v-if="route.meta.keepAlive" />
</transition> </transition>
</keep-alive>
</router-view> -->
<router-view v-slot="{ Component }">
<keep-alive>
<component :is="Component" :key="getKey()" v-if="route.meta.keepAlive" />
</keep-alive>
<component :is="Component" :key="getKey()" v-if="!route.meta.keepAlive" />
</router-view> </router-view>
</template> </template>
<script lang="ts" setup></script> <script lang="ts" setup>
import { useRoute } from 'vue-router';
const route = useRoute();
const getKey = () => {
return route.fullPath;
};
</script>
<style lang="less"> <style lang="less">
@import '@/style/variables'; @import '@/style/variables';
......
...@@ -310,12 +310,14 @@ const onCreate = async (params: any, status: any) => { ...@@ -310,12 +310,14 @@ const onCreate = async (params: any, status: any) => {
// 修改 // 修改
const onEdit = async (params) => { const onEdit = async (params) => {
// 通知父组件修改 // 通知父组件修改
loading.value = true;
let result = await props.editRow(params, props.info.id); let result = await props.editRow(params, props.info.id);
if (result) { if (result) {
// 更新表格 // 更新表格
emit('updateTable'); emit('updateTable');
emit('update:visible', false); emit('update:visible', false);
} }
loading.value = false;
}; };
watch( watch(
...@@ -332,6 +334,7 @@ watch( ...@@ -332,6 +334,7 @@ watch(
() => props.info, () => props.info,
(v) => { (v) => {
if (v) { if (v) {
console.log(v);
if (Object.keys(v).length) { if (Object.keys(v).length) {
questionValue.value = v.problem; questionValue.value = v.problem;
switchStatus.value = v.status == 1 ? true : false; switchStatus.value = v.status == 1 ? true : false;
...@@ -347,6 +350,16 @@ watch( ...@@ -347,6 +350,16 @@ watch(
textTonesValue.value = v.tone_id; textTonesValue.value = v.tone_id;
soundColorValue.value = v.phonetic_timbres_id; soundColorValue.value = v.phonetic_timbres_id;
textValue.value = v.reply_content; textValue.value = v.reply_content;
// 选中后的音调信息
let tonesObj = lists.tones.find((item: any) => item.id == v.tone_id);
if (tonesObj) {
textTonesInfo.value = tonesObj;
}
// 选中后的音色信息
let soundColorObj = lists.soundColor.find((item: any) => item.id == v.phonetic_timbres_id);
if (soundColorObj) {
soundColorInfo.value = soundColorObj;
}
} }
} else { } else {
// //
......
<template>
<Dialog v-model="visible" @confirm="confirm">
<template #body>
<div class="custom-add-interact-lib-dialog-body">
<span class="input-label">请输入互动库标题:</span>
<CustomInput v-model="inputValue" align="left"></CustomInput>
</div>
</template>
</Dialog>
</template>
<script lang="ts" setup>
import Dialog from '@/components/Dialog.vue';
import CustomInput from '@/components/input/index.vue';
import { show_message } from '@/utils/tool';
import { ref, watch } from 'vue';
const props = withDefaults(
defineProps<{
modelValue: boolean;
}>(),
{},
);
const emit = defineEmits(['update:modelValue', 'submitTitle']);
const visible = ref(props.modelValue);
const inputValue = ref('');
const confirm = () => {
if (!inputValue.value) {
show_message('标题必填');
return;
}
// 提交标题和清空
emit('submitTitle', inputValue.value);
inputValue.value = '';
emit('update:modelValue', false);
};
watch(
() => props.modelValue,
(v) => {
visible.value = v;
},
);
watch(
() => visible.value,
(v) => {
emit('update:modelValue', v);
},
);
</script>
<style lang="less">
.custom-add-interact-lib-dialog-body {
margin: 30px 0;
display: flex;
align-items: center;
.input-label {
color: white;
}
}
</style>
...@@ -100,7 +100,7 @@ const editRow = async (params: any, id: any) => { ...@@ -100,7 +100,7 @@ const editRow = async (params: any, id: any) => {
}; };
const rowChange = (row: any) => { const rowChange = (row: any) => {
tableList.row = row; tableList.row = JSON.parse(JSON.stringify(row));
dialogType.value = 'edit'; dialogType.value = 'edit';
dialogVisible.value = true; dialogVisible.value = true;
}; };
......
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
</div> </div>
</div> </div>
<ConfirmDialog v-model="confirmDialog" title="确定删除吗?" @confirm="onConfirm"></ConfirmDialog> <ConfirmDialog v-model="confirmDialog" title="确定删除吗?" @confirm="onConfirm"></ConfirmDialog>
<AddInteractLib v-model="createLibVisible" @submitTitle="submitTitle"></AddInteractLib>
</div> </div>
</template> </template>
...@@ -101,6 +102,7 @@ import { getLiveInteraction } from '@/service/Common'; ...@@ -101,6 +102,7 @@ import { getLiveInteraction } from '@/service/Common';
import { createInteraction, editGroupsInteractionName, deleteGroupsInteraction } from '@/utils/api/userApi'; import { createInteraction, editGroupsInteractionName, deleteGroupsInteraction } from '@/utils/api/userApi';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import AddInteractLib from './components/AddInteractLib.vue';
const store = useStore(); const store = useStore();
...@@ -114,6 +116,8 @@ const currentGroup = ref(''); ...@@ -114,6 +116,8 @@ const currentGroup = ref('');
// 确认弹窗 // 确认弹窗
const confirmDialog = ref(false); const confirmDialog = ref(false);
// 创建互动库弹窗
const createLibVisible = ref(false);
// 本次item的参数 // 本次item的参数
const confirmParams = ref({}); const confirmParams = ref({});
...@@ -180,16 +184,13 @@ const inputBlur = async (value: string, id: number) => { ...@@ -180,16 +184,13 @@ const inputBlur = async (value: string, id: number) => {
}; };
// 新增互动 // 新增互动
const addInteract = () => { const addInteract = () => {
interactList.list.push({ // 打开弹窗
name: '', createLibVisible.value = true;
c_name: '', };
c_status: false,
number: 0, // 提交创建互动库
popup: false, const submitTitle = (title: string) => {
edit: true, confirm(title);
blurNum: 1,
loading: false,
});
}; };
// 删除互动 // 删除互动
...@@ -225,30 +226,30 @@ const onConfirm = async () => { ...@@ -225,30 +226,30 @@ const onConfirm = async () => {
} }
}; };
const confirm = async (item: any) => { const confirm = async (title: string) => {
if (!item.c_name) { if (!title) {
show_message('请输入标题'); show_message('请输入标题');
return; return;
} }
// 提交创建 // 提交创建
try { try {
item.loading = true; loading.value = true;
let res: any = await createInteraction({ let res: any = await createInteraction({
name: item.c_name, name: title,
}); });
if (res.code == 0) { if (res.code == 0) {
// 提交成功后修改状态 // 提交成功后修改状态
item.c_status = true;
item.loading = false;
item.name = item.c_name;
item.id = res.data.id;
show_message('创建成功', 'success'); show_message('创建成功', 'success');
// 获取列表
getInteractList();
} else { } else {
deleteInteract(); deleteInteract();
} }
loading.value = false;
} catch (e) { } catch (e) {
console.log(e); console.log(e);
deleteInteract(); deleteInteract();
loading.value = false;
} }
}; };
......
...@@ -43,6 +43,7 @@ const [commitInfo] = useLiveInfoSubmit(); ...@@ -43,6 +43,7 @@ const [commitInfo] = useLiveInfoSubmit();
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
toolHeight: number; toolHeight: number;
initNum: number;
}>(), }>(),
{}, {},
); );
...@@ -107,6 +108,14 @@ watch( ...@@ -107,6 +108,14 @@ watch(
}, },
); );
watch(
() => props.initNum,
(v) => {
// init
currentCard.value = '';
},
);
const onSelectChange = (value: string) => { const onSelectChange = (value: string) => {
commitInfo({ commitInfo({
[createLiveKeys.id_type]: value, [createLiveKeys.id_type]: value,
......
...@@ -39,6 +39,12 @@ import { useLiveInfoSubmit } from '@/hooks/useStoreCommit'; ...@@ -39,6 +39,12 @@ import { useLiveInfoSubmit } from '@/hooks/useStoreCommit';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import { getLiveInteraction } from '@/service/Common'; import { getLiveInteraction } from '@/service/Common';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
const props = withDefaults(
defineProps<{
initNum: number;
}>(),
{},
);
const [commitInfo] = useLiveInfoSubmit(); const [commitInfo] = useLiveInfoSubmit();
const store = useStore(); const store = useStore();
const router = useRouter(); const router = useRouter();
...@@ -82,6 +88,14 @@ watch( ...@@ -82,6 +88,14 @@ watch(
}, },
); );
watch(
() => props.initNum,
(v) => {
currentComment.value = '';
interactiveLibrary.value = [];
},
);
const onCommentChange = (value: string) => { const onCommentChange = (value: string) => {
// 提交 // 提交
commitInfo({ commitInfo({
......
...@@ -108,6 +108,12 @@ import { getUploadConfig, getTonesList } from '@/service/Common'; ...@@ -108,6 +108,12 @@ import { getUploadConfig, getTonesList } from '@/service/Common';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
const [commitInfo] = useLiveInfoSubmit(); const [commitInfo] = useLiveInfoSubmit();
const props = withDefaults(
defineProps<{
initNum: number;
}>(),
{},
);
const imgs = { const imgs = {
success: new URL('../../../assets/svg/upload/success1.svg', import.meta.url).href, success: new URL('../../../assets/svg/upload/success1.svg', import.meta.url).href,
...@@ -225,6 +231,22 @@ watch( ...@@ -225,6 +231,22 @@ watch(
}, },
); );
watch(
() => props.initNum,
(v) => {
tonesValue.value = '';
tonesInfo.value = {};
soundColorValue.value = '';
soundColorInfo.value = {};
disabled.value = true;
mp3Url.value = '';
phoneticsValue.value = '';
phoneticsInfo.value = {};
textareaValue.value = '';
currentOption.value = scriptTypeText;
},
);
const openSoundColor = () => { const openSoundColor = () => {
if (tonesValue.value) { if (tonesValue.value) {
// 允许打开 // 允许打开
...@@ -250,13 +272,29 @@ const tonesItemChange = (item: any) => { ...@@ -250,13 +272,29 @@ const tonesItemChange = (item: any) => {
}; };
// 文本 音色提交 // 文本 音色提交
const soundColorItemChange = (item: any) => { const soundColorItemChange = (item: any = false) => {
if (item) {
soundColorInfo.value = item; soundColorInfo.value = item;
commitInfo({ commitInfo({
[createLiveKeys.textSoundColor]: item.id, [createLiveKeys.textSoundColor]: item.id,
}); });
} else {
soundColorInfo.value = {};
commitInfo({
[createLiveKeys.textSoundColor]: '',
});
}
}; };
watch(
() => soundColorValue.value,
(v) => {
if (!v) {
soundColorItemChange();
}
},
);
// 音频 音色提交 // 音频 音色提交
const phoneticsItemChange = (item: any) => { const phoneticsItemChange = (item: any) => {
phoneticsInfo.value = item; phoneticsInfo.value = item;
......
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
<div class="setps-body"> <div class="setps-body">
<template v-if="setpsList[0].load"> <template v-if="setpsList[0].load">
<div class="steps-item" v-show="currentSetp == '1'"> <div class="steps-item" v-show="currentSetp == '1'">
<ChoseDigitalPerson :toolHeight="toolHeight"></ChoseDigitalPerson> <ChoseDigitalPerson :toolHeight="toolHeight" :initNum="initNum"></ChoseDigitalPerson>
</div> </div>
</template> </template>
<template v-if="setpsList[1].load"> <template v-if="setpsList[1].load">
<div class="steps-item" v-show="currentSetp == '2'"> <div class="steps-item" v-show="currentSetp == '2'">
<ScriptVue></ScriptVue> <ScriptVue :initNum="initNum"></ScriptVue>
</div> </div>
</template> </template>
<template v-if="setpsList[2].load"> <template v-if="setpsList[2].load">
<div class="steps-item" v-show="currentSetp == '3'"> <div class="steps-item" v-show="currentSetp == '3'">
<InteractVue></InteractVue> <InteractVue :initNum="initNum"></InteractVue>
</div> </div>
</template> </template>
<div class="public-tool" ref="publicTool"> <div class="public-tool" ref="publicTool">
...@@ -97,6 +97,9 @@ const toolHeight = ref(0); ...@@ -97,6 +97,9 @@ const toolHeight = ref(0);
const currentSetp = ref(1); const currentSetp = ref(1);
// 通知子组件初始化
const initNum = ref(1);
const videoPlay = ref<HTMLVideoElement>(); const videoPlay = ref<HTMLVideoElement>();
const videoCanplay = () => { const videoCanplay = () => {
...@@ -392,14 +395,20 @@ const confirm = async () => { ...@@ -392,14 +395,20 @@ const confirm = async () => {
let res: any = await createLiveTask(filterFiled()); let res: any = await createLiveTask(filterFiled());
if (res.code == 0) { if (res.code == 0) {
show_message('创建成功', 'success'); show_message('创建成功', 'success');
// 回首页
backHome();
// 清空name // 清空name
store.commit('live/setName', ''); store.commit('live/setName', '');
// 清空edit // 清空edit
store.commit('live/clearEditLive'); store.commit('live/clearEditLive');
// 清空createLive // 清空createLive
store.commit('live/clearCreateLive'); store.commit('live/clearCreateLive');
// 回首页 store.commit('live/initLiveInfo');
backHome(); // 清空信息
// 通知三个模块清空自己的内容
initNum.value += 1;
// 回到模块1
currentSetp.value = 1;
} }
loading.value = false; loading.value = false;
} catch (e) { } catch (e) {
......
...@@ -104,16 +104,19 @@ const toolList = [ ...@@ -104,16 +104,19 @@ const toolList = [
label: '形象定制', label: '形象定制',
icon: imgs.profile, icon: imgs.profile,
path: routerConfig.ImageCustomization.path, path: routerConfig.ImageCustomization.path,
name: routerConfig.ImageCustomization.name,
}, },
{ {
label: '音色定制', label: '音色定制',
icon: imgs.speaking, icon: imgs.speaking,
path: routerConfig.VocalCustomization.path, path: routerConfig.VocalCustomization.path,
name: routerConfig.VocalCustomization.name,
}, },
{ {
label: '互动回答', label: '互动回答',
icon: imgs.interaction, icon: imgs.interaction,
path: routerConfig.createInteract.path, path: routerConfig.createInteract.path,
name: routerConfig.createInteract.name,
}, },
]; ];
...@@ -126,6 +129,7 @@ const openPage = (item: any) => { ...@@ -126,6 +129,7 @@ const openPage = (item: any) => {
if (item.path) { if (item.path) {
router.push({ router.push({
path: item.path, path: item.path,
name: item.name,
}); });
} }
}; };
......
...@@ -33,6 +33,20 @@ const mutations = { ...@@ -33,6 +33,20 @@ const mutations = {
state.createLive[item] = info[item]; state.createLive[item] = info[item];
}); });
}, },
initLiveInfo(state: StateType) {
state.createLive = {
[createLiveKeys.id]: '',
[createLiveKeys.id_type]: '',
[createLiveKeys.scriptType]: '',
[createLiveKeys.textTones]: '',
[createLiveKeys.textSoundColor]: '',
[createLiveKeys.textScriptValue]: '',
[createLiveKeys.phoneticsSoundColor]: '',
[createLiveKeys.phoneticsFile]: '',
[createLiveKeys.commentMethod]: '',
[createLiveKeys.interactiveLibrary]: [],
};
},
// 清空创建直播时的参数 // 清空创建直播时的参数
clearCreateLive(state: StateType) { clearCreateLive(state: StateType) {
Object.keys(state.createLive).forEach((key: any) => { Object.keys(state.createLive).forEach((key: any) => {
......
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