【优化】优化一些移动端相关的代码

pull/85/head
小诺 2023-02-06 22:56:12 +08:00 committed by 俞宝山
parent 4926efe662
commit 3aee08136b
6 changed files with 246 additions and 260 deletions

View File

@ -29,8 +29,8 @@ export default {
name: '实底风格', name: '实底风格',
key: 'filled', key: 'filled',
item: filledJsonData.glyphs item: filledJsonData.glyphs
}, }
] ]
}, }
] ]
} }

View File

@ -55,9 +55,7 @@
} }
// //
const onSubmit = () => { const onSubmit = () => {
formRef.value formRef.value.validate().then(() => {
.validate()
.then(() => {
const defParam = { const defParam = {
category: 'BUTTON', category: 'BUTTON',
parentId: recordData.value.id parentId: recordData.value.id

View File

@ -10,21 +10,16 @@
> >
<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical"> <a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
<a-form-item label="显示名称:" name="title"> <a-form-item label="显示名称:" name="title">
<span>{{formData.title}}</span> <span>{{ formData.title }}</span>
</a-form-item> </a-form-item>
<a-form-item label="所属目录:" name="module" v-if="formData.parentId === '0'" > <a-form-item label="所属目录:" name="module" v-if="formData.parentId === '0'">
<a-radio-group v-model:value="formData.module" button-style="solid"> <a-radio-group v-model:value="formData.module" button-style="solid">
<a-radio-button <a-radio-button v-for="module in moduleTypeList" :key="module.id" :value="module.id">
v-for="module in moduleTypeList"
:key="module.id"
:value="module.id"
>
<component :is="module.icon" /> <component :is="module.icon" />
{{ module.title }}</a-radio-button {{ module.title }}</a-radio-button
> >
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
</a-form> </a-form>
<template #footer> <template #footer>
<a-button style="margin-right: 8px" @click="onClose"></a-button> <a-button style="margin-right: 8px" @click="onClose"></a-button>
@ -35,9 +30,7 @@
<script setup> <script setup>
import { required } from '@/utils/formRules' import { required } from '@/utils/formRules'
import tool from '@/utils/tool'
import mobileMenuApi from '@/api/mobile/resource/menuApi' import mobileMenuApi from '@/api/mobile/resource/menuApi'
import { getCurrentInstance } from 'vue'
// //
let visible = $ref(false) let visible = $ref(false)
const emit = defineEmits({ successful: null }) const emit = defineEmits({ successful: null })
@ -64,23 +57,24 @@
} }
// //
const formRules = { const formRules = {
module: [required('请选择所属目录')], module: [required('请选择所属目录')]
} }
// //
const onSubmit = () => { const onSubmit = () => {
formRef.value formRef.value.validate().then(() => {
.validate()
.then(() => {
const param = { const param = {
id: formData.value.id, id: formData.value.id,
module: formData.value.module module: formData.value.module
} }
submitLoading.value = true submitLoading.value = true
mobileMenuApi.mobileMenuChangeModule(param).then(() => { mobileMenuApi
.mobileMenuChangeModule(param)
.then(() => {
submitLoading.value = false submitLoading.value = false
emit('successful') emit('successful')
}).finally(() => { })
.finally(() => {
visible = false visible = false
}) })
}) })

View File

@ -43,9 +43,7 @@
<a-form-item v-if="formData.menuType !== 'CATALOG'" name="path"> <a-form-item v-if="formData.menuType !== 'CATALOG'" name="path">
<template #label> <template #label>
<a-tooltip> <a-tooltip>
<template #title> <template #title> 类型为内外链条时输入https开头的链接即可https://xiaonuo.vip </template>
类型为内外链条时输入https开头的链接即可https://xiaonuo.vip
</template>
<question-circle-outlined /> <question-circle-outlined />
</a-tooltip> </a-tooltip>
&nbsp {{ formData.menuType === 'MENU' || formData.menuType === 'CATALOG' ? '界面地址' : 'https链接地址' }} &nbsp {{ formData.menuType === 'MENU' || formData.menuType === 'CATALOG' ? '界面地址' : 'https链接地址' }}
@ -191,9 +189,7 @@
} }
// //
const onSubmit = () => { const onSubmit = () => {
formRef.value formRef.value.validate().then(() => {
.validate()
.then(() => {
submitLoading.value = true submitLoading.value = true
const formDataParam = parameterChanges(cloneDeep(formData.value)) const formDataParam = parameterChanges(cloneDeep(formData.value))
mobileMenuApi mobileMenuApi

View File

@ -47,11 +47,11 @@
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'path'"> <template v-if="column.dataIndex === 'path'">
<span v-if="record.menuType === 'CATALOG'">-</span> <span v-if="record.menuType === 'CATALOG'">-</span>
<span v-else>{{record.path}}</span> <span v-else>{{ record.path }}</span>
</template> </template>
<template v-if="column.dataIndex === 'icon'"> <template v-if="column.dataIndex === 'icon'">
<a-tag :color="record.color"> <a-tag :color="record.color">
<span class="snowy xn-icons" :class="record.icon" ></span> <span class="snowy xn-icons" :class="record.icon"></span>
</a-tag> </a-tag>
</template> </template>
<template v-if="column.dataIndex === 'regType'"> <template v-if="column.dataIndex === 'regType'">
@ -92,7 +92,7 @@
</s-table> </s-table>
</a-card> </a-card>
<Form ref="formRef" @successful="table.refresh(true)" /> <Form ref="formRef" @successful="table.refresh(true)" />
<changeModuleForm ref="changeModuleFormRef" @successful="table.refresh(true)"/> <changeModuleForm ref="changeModuleFormRef" @successful="table.refresh(true)" />
<Button ref="button" /> <Button ref="button" />
</template> </template>

View File

@ -74,9 +74,7 @@
// //
const onSubmit = () => { const onSubmit = () => {
formRef.value formRef.value.validate().then(() => {
.validate()
.then(() => {
moduleApi.submitForm(formData.value, !formData.value.id).then(() => { moduleApi.submitForm(formData.value, !formData.value.id).then(() => {
onClose() onClose()
emit('successful') emit('successful')