fix:修复渠道复制问题

This commit is contained in:
du.meimei
2025-03-27 11:13:11 +08:00
parent 768f7c5a50
commit 3964ad769e
5 changed files with 26 additions and 22 deletions

View File

@@ -41,10 +41,7 @@ const getDetail = async (surveyPublishId) => {
}
onMounted(() => {
const { record, surveyPublishId } = route.query
// if (record) {
// handleRecordData(record)
// } else
const { surveyPublishId } = route.query
if (surveyPublishId) {
getDetail(surveyPublishId)
}

View File

@@ -9,7 +9,6 @@
:class="{'active_channel':channel.appId === active,
'disabled': isDisabled(channel.appCategory)}"
class="flex"
:key="index"
@click="selectChannel(channel,index)">
<div>

View File

@@ -244,7 +244,7 @@ const cancel = () => {
// 监听 channel 变化
watch(() => props.channel, (newVal) => {
if (!route.query.record) {
if (!route.query.surveyPublishId) {
formState.value = {
launchName: '',
launchMessage: ''

View File

@@ -220,7 +220,7 @@ watch(() => props.channel, (newVal) => {
console.log('watch channel change:', newVal);
isHasLink.value = false;
// 只有在没有 record 参数时才重置表单
if (!route.query.record) {
if (!route.query.surveyPublishId) {
formState.value = {
launchName: '',
launchMessage: ''
@@ -236,6 +236,7 @@ onMounted(() => {
getDetail(surveyPublishId);
}
});
</script>
<style scoped lang="scss">
.mr-12{

View File

@@ -41,7 +41,7 @@
class="custom-button mr-12"
@click="onSubmit"
:loading="submitLoading"
:disabled="!formState.launchName ||!formState.launchMessage">
:disabled="!formState.launchName ||!formState.launchMessage ">
<span>去配置</span>
</a-button>
<a-button class="custom-button mr-12" @click="onCancel" style="width: 98px;">
@@ -104,8 +104,10 @@ const getContactList = async () => {
appType:'APPLICATION'
});
applicationList.value = res.data;
if (applicationList.value.length){
formState.value.appId = formState.value.appId?formState.value.appId:applicationList.value[0].appId
if (!route.query.surveyPublishId) {
if (applicationList.value.length){
formState.value.appId = formState.value.appId?formState.value.appId:applicationList.value[0].appId
}
}
} catch (error) {
console.error('获取触点列表失败:', error);
@@ -160,20 +162,10 @@ async function submitData(){
const onCancel = () => {
router.go(-1)
};
// 监听 channel 变化
watch(() => props.channel, (newVal) => {
if (!route.query.record) {
formState.value = {
launchName: '',
launchMessage: ''
};
}
if (newVal.appId === 'SHOPPING_GUIDE'){
getContactList()
}
});
// 获取详情数据
const getDetail = async (id) => {
console.log('getDetail');
try {
const res = await getPublishDetail({ surveyPublishId: id });
if (res.data) {
@@ -183,13 +175,28 @@ const getDetail = async (id) => {
launchMessage: res.data.launchMessage,
appId: res.data.appId,
};
if (res.data.appCategory !== 'SHOPPING_GUIDE'){
formState.value.appId = ''
}
}
} catch (error) {
console.error('获取详情失败:', error);
}
};
// 监听 channel 变化
watch(() => props.channel, (newVal) => {
if (!route.query.surveyPublishId) {
formState.value.launchName = '';
formState.value.launchMessage = ''
formState.value.appId= ''
}
if (newVal.appId === 'SHOPPING_GUIDE'){
getContactList()
}
});
// 组件挂载时检查路由参数
onMounted(() => {
console.log('onMounted');
getContactList()
const { surveyPublishId } = route.query;
if (surveyPublishId) {