refactor: mp模块,一个大大的重构+fix

This commit is contained in:
dhb52
2023-04-21 20:22:11 +08:00
parent 6662b04d12
commit b45b85984c
43 changed files with 518 additions and 438 deletions

View File

@ -94,7 +94,8 @@
</div>
<el-dialog title="选择图文" v-model="showNewsDialog" width="80%" destroy-on-close>
<WxMaterialSelect
:objData="{ type: 'news', accountId: props.accountId }"
type="news"
:account-id="props.accountId"
@select-material="selectMaterial"
/>
</el-dialog>
@ -104,7 +105,7 @@
class="configur_content"
v-if="menu.type === 'click' || menu.type === 'scancode_waitmsg'"
>
<WxReplySelect v-if="hackResetWxReplySelect" :objData="menu.reply" />
<WxReplySelect v-if="hackResetWxReplySelect" v-model="menu.reply" />
</div>
</div>
</div>
@ -112,15 +113,15 @@
</template>
<script setup lang="ts">
import WxReplySelect from '@/views/mp/components/wx-reply/main.vue'
import WxNews from '@/views/mp/components/wx-news/main.vue'
import WxMaterialSelect from '@/views/mp/components/wx-material-select/main.vue'
import WxReplySelect from '@/views/mp/components/wx-reply'
import WxNews from '@/views/mp/components/wx-news'
import WxMaterialSelect from '@/views/mp/components/wx-material-select'
import menuOptions from './menuOptions'
const message = useMessage()
const props = defineProps<{
accountId?: number
accountId: number
modelValue: any
isParent: boolean
}>()
@ -130,7 +131,6 @@ const emit = defineEmits<{
(e: 'update:modelValue', v: any)
}>()
// TODO @Dhb52 输入的 table 切换时,表单应该保留
const menu = computed({
get() {
return props.modelValue

View File

@ -53,7 +53,7 @@
</template>
<script lang="ts" setup name="MpMenu">
import WxAccountSelect from '@/views/mp/components/wx-account-select/main.vue'
import WxAccountSelect from '@/views/mp/components/wx-account-select'
import MenuEditor from './components/MenuEditor.vue'
import MenuPreviewer from './components/MenuPreviewer.vue'
import * as MpMenuApi from '@/api/mp/menu'
@ -65,8 +65,8 @@ const MENU_NOT_SELECTED = '__MENU_NOT_SELECTED__'
// ======================== 列表查询 ========================
const loading = ref(false) // 遮罩层
const accountId = ref<number | undefined>()
const accountName = ref<string | undefined>('')
const accountId = ref<number>(0)
const accountName = ref<string>('')
const menuList = ref<Menu[]>([])
// ======================== 菜单操作 ========================
@ -103,7 +103,7 @@ const tempSelfObj = ref<{
const dialogNewsVisible = ref(false) // 跳转图文时的素材选择弹窗
/** 侦听公众号变化 **/
const onAccountChanged = (id?: number, name?: string) => {
const onAccountChanged = (id: number, name: string) => {
accountId.value = id
accountName.value = name
getList()