fix: 修改我的订阅

This commit is contained in:
100011797 2023-07-25 14:58:38 +08:00
parent e65a7c4c6d
commit 49b3dce2e3
5 changed files with 62 additions and 57 deletions

View File

@ -6,6 +6,8 @@
width="770px" width="770px"
@cancel="emits('close')" @cancel="emits('close')"
:confirmLoading="loading" :confirmLoading="loading"
:zIndex="1100"
:maskClosable='false'
> >
<j-form :model="form" layout="vertical" ref="formRef"> <j-form :model="form" layout="vertical" ref="formRef">
<j-row :gutter="24"> <j-row :gutter="24">
@ -66,7 +68,7 @@
:rules="[ :rules="[
{ {
pattern: /^1[3456789]\d{9}$/, pattern: /^1[3456789]\d{9}$/,
message: '请输入正确手机号', message: '请输入正确手机号',
}, },
]" ]"
> >

View File

@ -1,5 +1,5 @@
<template> <template>
<j-modal :width="'900px'" visible @cancel="emit('close')" :zIndex="1100"> <j-modal :maskClosable='false' :width="'900px'" visible @cancel="emit('close')" :zIndex="1100">
<template v-if="getType === 'notifier-weixin'"> <template v-if="getType === 'notifier-weixin'">
<j-spin :spinning="loading"> <j-spin :spinning="loading">
<div class="code" style="height: 450px"> <div class="code" style="height: 450px">

View File

@ -28,11 +28,14 @@
<template v-else> <template v-else>
<Detail <Detail
@unsubscribe="onUnSubscribe" @unsubscribe="onUnSubscribe"
@save="onSave" v-if="
v-if="current?.channelProvider !== 'inside-mail' && popoverVisible" current?.channelProvider !== 'inside-mail' &&
popoverVisible
"
:current="current" :current="current"
:data="props.data" :data="data"
@close="popoverVisible = false" @bindChange="onChange('bind')"
@infoChange="onChange('info')"
/> />
<PermissionButton <PermissionButton
v-else v-else
@ -51,12 +54,28 @@
{{ current?.name }} {{ current?.name }}
</j-ellipsis> </j-ellipsis>
</div> </div>
<EditInfo
v-if="editInfoVisible"
:data="user.userInfos"
@close="editInfoVisible = false"
@save="onSave"
/>
<Bind
@close="visible = false"
v-if="visible"
:data="data"
:current="current"
@save="onBindSave"
/>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getImage } from '@/utils/comm'; import { getImage } from '@/utils/comm';
import Detail from './Detail.vue'; import Detail from './Detail.vue';
import { useUserInfo } from '@/store/userInfo';
import EditInfo from '../../EditInfo/index.vue';
import Bind from './Bind.vue';
const iconMap = new Map(); const iconMap = new Map();
iconMap.set('notifier-dingTalk', getImage('/notice-rule/dingtalk.png')); iconMap.set('notifier-dingTalk', getImage('/notice-rule/dingtalk.png'));
@ -81,19 +100,44 @@ const props = defineProps({
}, },
notifyChannels: { notifyChannels: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}); });
const user = useUserInfo();
const popoverVisible = ref<boolean>(false); const popoverVisible = ref<boolean>(false);
const editInfoVisible = ref<boolean>(false);
const visible = ref<boolean>(false);
const onChange = (type: 'bind' | 'info') => {
if(type === 'bind'){
editInfoVisible.value = true
} else {
visible.value = true
}
}
const onSave = () => {
editInfoVisible.value = false;
user.getUserInfo();
emit('save', props.current);
popoverVisible.value = false;
};
const onBindSave = () => {
visible.value = false
emit('save', props.current);
popoverVisible.value = false;
}
const onUnSubscribe = (dt: any) => { const onUnSubscribe = (dt: any) => {
emit('unsubscribe', dt); emit('unsubscribe', dt);
popoverVisible.value = false popoverVisible.value = false;
}; };
const onCheckChange = (dt: any) => { const onCheckChange = (dt: any) => {
emit('save', dt) emit('save', dt);
popoverVisible.value = false popoverVisible.value = false;
}; };
</script> </script>

View File

@ -21,29 +21,14 @@
> >
</div> </div>
</div> </div>
<EditInfo
v-if="editInfoVisible"
:data="user.userInfos"
@close="editInfoVisible = false"
@save="onSave"
/>
<Bind
@close="visible = false"
v-if="visible"
:data="props.data"
:current="current"
@save="onBindSave"
/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getIsBindThird } from '@/api/account/notificationSubscription'; import { getIsBindThird } from '@/api/account/notificationSubscription';
import { useUserInfo } from '@/store/userInfo'; import { useUserInfo } from '@/store/userInfo';
import EditInfo from '../../EditInfo/index.vue';
import Bind from './Bind.vue';
const user = useUserInfo(); const user = useUserInfo();
const emit = defineEmits(['save', 'unsubscribe', 'close']); const emit = defineEmits(['infoChange', 'unsubscribe', 'bindChange']);
const info = ref<any>(null); const info = ref<any>(null);
const props = defineProps({ const props = defineProps({
data: { data: {
@ -58,39 +43,23 @@ const props = defineProps({
}, },
}); });
const editInfoVisible = ref<boolean>(false);
const visible = ref<boolean>(false);
const getType = computed(() => { const getType = computed(() => {
return props.current?.channelProvider; return props.current?.channelProvider;
}); });
const onBind = () => { const onBind = () => {
if ( if (
['notifier-voice', 'notifier-sms', 'notifier-email'].includes( !['notifier-voice', 'notifier-sms', 'notifier-email'].includes(
props.current?.channelProvider, props.current?.channelProvider,
) )
) { ) {
editInfoVisible.value = true; emit('infoChange')
} else { } else {
visible.value = true emit('bindChange')
} }
}; };
const onSave = () => {
editInfoVisible.value = false;
user.getUserInfo();
emit('save', props.current);
emit('close')
};
const onBindSave = () => {
visible.value = false
emit('save', props.current);
emit('close')
}
const handleSearch = async () => { const handleSearch = async () => {
if ( if (
!['notifier-voice', 'notifier-sms', 'notifier-email'].includes( !['notifier-voice', 'notifier-sms', 'notifier-email'].includes(
@ -114,16 +83,6 @@ onMounted(() => {
handleSearch() handleSearch()
}) })
// watch(
// () => props.current,
// () => {
// handleSearch();
// },
// {
// immediate: true,
// deep: true,
// },
// );
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -1,5 +1,5 @@
<template> <template>
<j-modal :width="'384px'" visible @cancel="emit('close')" :footer="null"> <j-modal :maskClosable='false' :width="'384px'" visible @cancel="emit('close')" :footer="null">
<template v-if="getType === 'notifier-dingTalk'"> <template v-if="getType === 'notifier-dingTalk'">
<div class="tip">请先绑定钉钉账号</div> <div class="tip">请先绑定钉钉账号</div>
</template> </template>