Browse Source

perf: 优化推送企业认证

master
wangxiang 2 years ago
parent
commit
d9543a71d4
  1. 2
      src/views/common/push/pushEnterprise/index.vue
  2. 2
      src/views/common/push/pushEnterpriseAudit/EnterpriseAuditModal.vue
  3. 2
      src/views/common/push/pushEnterpriseAudit/index.vue
  4. 27
      src/views/system/user/account/setting/entCertification/Step1.vue
  5. 4
      src/views/system/user/account/setting/entCertification/Step2.vue
  6. 20
      src/views/system/user/account/setting/entCertification/index.vue

2
src/views/common/push/pushEnterprise/index.vue

@ -92,7 +92,7 @@
fixed: false fixed: false
}, },
searchInfo: { searchInfo: {
status: '1' status: 2
}, },
handleSearchInfoFn: () => clearSelectedRowKeys() handleSearchInfoFn: () => clearSelectedRowKeys()
}); });

2
src/views/common/push/pushEnterpriseAudit/EnterpriseAuditModal.vue

@ -58,7 +58,7 @@
try { try {
const formData = await validate(); const formData = await validate();
formData.license = Array(formData.license).join(','); formData.license = Array(formData.license).join(',');
formData.status = '1'; formData.status = '2';
setModalProps({ confirmLoading: true }); setModalProps({ confirmLoading: true });
await editPushEnterprise(formData); await editPushEnterprise(formData);
closeModal(); closeModal();

2
src/views/common/push/pushEnterpriseAudit/index.vue

@ -88,7 +88,7 @@
fixed: false fixed: false
}, },
searchInfo: { searchInfo: {
status: '0' status: 1
}, },
handleSearchInfoFn: () => clearSelectedRowKeys() handleSearchInfoFn: () => clearSelectedRowKeys()
}); });

27
src/views/system/user/account/setting/entCertification/Step1.vue

@ -4,21 +4,28 @@
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref, unref } from 'vue'; import { defineComponent, ref, unref, watchEffect } from 'vue';
import { BasicForm, useForm } from '/@/components/Form'; import { BasicForm, useForm } from '/@/components/Form';
import { formSchema } from './data'; import { formSchema } from './data';
import { addPushEnterprise } from '/@/api/platform/common/controller/pushEnterprise'; import { addPushEnterprise, editPushEnterprise } from '/@/api/platform/common/controller/pushEnterprise';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import type { PushEnterprise } from '/@/api/platform/common/entity/pushEnterprise';
export default defineComponent({ export default defineComponent({
components: { components: {
BasicForm BasicForm
}, },
props: {
pushEnterprise: {
type: Object as PropType<PushEnterprise>,
default: () => ({})
}
},
emits: ['next'], emits: ['next'],
setup(_, { emit }) { setup(props, { emit }) {
const submitBtnLoading = ref(false); const submitBtnLoading = ref(false);
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const [registerForm, { validate }] = useForm({ const [registerForm , { validate, setFieldsValue }] = useForm({
labelWidth: 100, labelWidth: 100,
schemas: formSchema, schemas: formSchema,
submitButtonOptions: { submitButtonOptions: {
@ -32,15 +39,25 @@
}, },
showResetButton: false showResetButton: false
}); });
setFieldsValue(props.pushEnterprise);
watchEffect(() => {
setFieldsValue(props.pushEnterprise);
});
async function handleSubmit() { async function handleSubmit() {
try { try {
const formData = await validate(); const formData = await validate();
formData.status = 1;
formData.license = Array(formData.license).join(','); formData.license = Array(formData.license).join(',');
submitBtnLoading.value = true; submitBtnLoading.value = true;
if (!formData.id) {
await addPushEnterprise(formData); await addPushEnterprise(formData);
} else {
await editPushEnterprise(formData);
}
createMessage.success('提交成功!'); createMessage.success('提交成功!');
emit('next'); emit('next', 1);
} finally { } finally {
submitBtnLoading.value = false; submitBtnLoading.value = false;
} }

4
src/views/system/user/account/setting/entCertification/Step2.vue

@ -1,6 +1,6 @@
<template> <template>
<div class="step2"> <div class="step2">
<AResult v-if="props.pushEnterprise.status == -1" <AResult v-if="props.pushEnterprise?.status == -1"
status="error" status="error"
title="审核位通过" title="审核位通过"
sub-title="请检查并修改以下信息,然后再重新提交。" sub-title="请检查并修改以下信息,然后再重新提交。"
@ -44,7 +44,7 @@
}); });
async function handleSubmit() { async function handleSubmit() {
const contentText = props.pushEnterprise?.status == -1 const contentText = props.pushEnterprise?.status == 1
? '是否确认撤销审核?' ? '是否确认撤销审核?'
: '是否确认返回到填写企业信息?'; : '是否确认返回到填写企业信息?';
createConfirm({ createConfirm({

20
src/views/system/user/account/setting/entCertification/index.vue

@ -13,14 +13,20 @@
</ASteps> </ASteps>
</div> </div>
<div class="mt-5"> <div class="mt-5">
<Step1 v-show="state.current === 0" @next="state.current++"/> <Step1 v-show="state.current === 0"
:push-enterprise="state.pushEnterprise"
@next=" val => {
state.current++
state.pushEnterprise.status = val
}"
/>
<Step2 v-show="state.current === 1" :push-enterprise="state.pushEnterprise" @previous="state.current--"/> <Step2 v-show="state.current === 1" :push-enterprise="state.pushEnterprise" @previous="state.current--"/>
<Step3 v-show="state.current === 2"/> <Step3 v-show="state.current === 2"/>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, unref, computed, CSSProperties, reactive, onMounted } from 'vue'; import { ref, unref, computed, CSSProperties, reactive, onBeforeMount } from 'vue';
import Step1 from './Step1.vue'; import Step1 from './Step1.vue';
import Step2 from './Step2.vue'; import Step2 from './Step2.vue';
import Step3 from './Step3.vue'; import Step3 from './Step3.vue';
@ -32,7 +38,7 @@
interface State { interface State {
current: number; current: number;
loadingStatus: boolean; loadingStatus: boolean;
pushEnterprise: PushEnterprise | undefined; pushEnterprise: PushEnterprise | {};
} }
const ASteps = Steps; const ASteps = Steps;
@ -41,7 +47,7 @@
const state = reactive<State>({ const state = reactive<State>({
current: 0, current: 0,
loadingStatus: false, loadingStatus: false,
pushEnterprise: undefined pushEnterprise: {}
}); });
const { contentHeight } = useContentHeight( const { contentHeight } = useContentHeight(
computed(() => true), computed(() => true),
@ -52,7 +58,7 @@
ref(30)); ref(30));
const getContentStyle = computed((): CSSProperties => ({ minHeight: `${unref(contentHeight)}px` })); const getContentStyle = computed((): CSSProperties => ({ minHeight: `${unref(contentHeight)}px` }));
onMounted(async () => { onBeforeMount(async () => {
await loadPushEnterprise(); await loadPushEnterprise();
}); });
@ -61,11 +67,11 @@
const pushEnterprise = await getAuthData(); const pushEnterprise = await getAuthData();
state.pushEnterprise = pushEnterprise; state.pushEnterprise = pushEnterprise;
switch (pushEnterprise?.status) { switch (pushEnterprise?.status) {
case 1:
case -1: case -1:
case 0:
state.current = 1; state.current = 1;
break; break;
case 1: case 2:
state.current = 2; state.current = 2;
break; break;
default: default:

Loading…
Cancel
Save