|
@@ -0,0 +1,125 @@
|
|
|
+<route lang="json">
|
|
|
+{
|
|
|
+ "style": {
|
|
|
+ "navigationBarTitleText": "编辑基本信息",
|
|
|
+ "navigationBarBackgroundColor": "#ffffff"
|
|
|
+ }
|
|
|
+}
|
|
|
+</route>
|
|
|
+<script setup lang="ts">
|
|
|
+import { getDesignerBasicInfo, updateDesignerBasicInfo } from '../../../../core/libs/agent-requests'
|
|
|
+import { messages } from '../../../../core/libs/messages'
|
|
|
+import BottomAppBar from '@/components/bottom-app-bar.vue'
|
|
|
+import DataForm from '@/components/data-form.vue'
|
|
|
+import { DataFormSchema } from '../../../../components/data-form'
|
|
|
+import { DesignerBasicInfo } from '@designer-hub/app/src/core/libs/models'
|
|
|
+import { requestToast } from '@designer-hub/app/src/core/utils/common'
|
|
|
+import { omit } from 'radash'
|
|
|
+
|
|
|
+const tab = ref('basic')
|
|
|
+// 基础信息 家庭信息 奖项信息 销售信息 游学/活动信息
|
|
|
+const tabs = [
|
|
|
+ { label: '基础信息', value: 'basic' },
|
|
|
+ { label: '家庭信息', value: 'family' },
|
|
|
+ { label: '奖项信息', value: 'award' },
|
|
|
+ { label: '销售信息', value: 'sale' },
|
|
|
+ { label: '游学/活动信息', value: 'activity' },
|
|
|
+ { label: '其他活动信息', value: 'events' },
|
|
|
+]
|
|
|
+const id = ref()
|
|
|
+const { data: basicData, run: setBasicData } = useRequest(() => getDesignerBasicInfo(id.value))
|
|
|
+const formData = ref({})
|
|
|
+const schema = ref<
|
|
|
+ DataFormSchema<
|
|
|
+ Pick<
|
|
|
+ DesignerBasicInfo,
|
|
|
+ | 'companyAddress'
|
|
|
+ | 'idCardNumber'
|
|
|
+ | 'passportNumber'
|
|
|
+ | 'householdAddress'
|
|
|
+ | 'cooperationTime'
|
|
|
+ | 'circle'
|
|
|
+ | 'hobbies'
|
|
|
+ | 'sharingIntent'
|
|
|
+ | 'imageUrl'
|
|
|
+ | 'maritalStatus'
|
|
|
+ >
|
|
|
+ >
|
|
|
+>({
|
|
|
+ companyAddress: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerBasiceInfo.companyAddress,
|
|
|
+ labelWidth: 0,
|
|
|
+ props: undefined,
|
|
|
+ },
|
|
|
+ idCardNumber: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerBasiceInfo.idCardNumber,
|
|
|
+ },
|
|
|
+ passportNumber: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerBasiceInfo.passportNumber,
|
|
|
+ },
|
|
|
+ householdAddress: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerBasiceInfo.householdAddress,
|
|
|
+ },
|
|
|
+ cooperationTime: {
|
|
|
+ type: 'TimePick',
|
|
|
+ label: messages.objects.designerBasiceInfo.cooperationTime,
|
|
|
+ },
|
|
|
+ circle: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerBasiceInfo.circle,
|
|
|
+ },
|
|
|
+ hobbies: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerBasiceInfo.hobbies,
|
|
|
+ },
|
|
|
+ sharingIntent: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerBasiceInfo.sharingIntent,
|
|
|
+ },
|
|
|
+ imageUrl: {
|
|
|
+ type: 'ImageUploader',
|
|
|
+ label: messages.objects.designerBasiceInfo.imageUrl,
|
|
|
+ },
|
|
|
+ maritalStatus: {
|
|
|
+ type: 'Radio',
|
|
|
+ label: messages.objects.designerBasiceInfo.maritalStatus,
|
|
|
+ props: {
|
|
|
+ columns: [
|
|
|
+ { label: '未婚', value: 0 },
|
|
|
+ { label: '已婚', value: 1 },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+})
|
|
|
+const eventsQuery = computed(() => ({ type: '3' }))
|
|
|
+// const {} = useRequest()
|
|
|
+const handleSubmit = async () => {
|
|
|
+ const { code } = await requestToast(() => updateDesignerBasicInfo(formData.value), {
|
|
|
+ success: true,
|
|
|
+ successTitle: '保存成功',
|
|
|
+ })
|
|
|
+ if (code === 0) {
|
|
|
+ await setBasicData()
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+}
|
|
|
+onLoad(async (query: { id: string }) => {
|
|
|
+ id.value = query.id
|
|
|
+ await setBasicData()
|
|
|
+ formData.value = {
|
|
|
+ ...omit(basicData.value, ['sex']),
|
|
|
+ }
|
|
|
+})
|
|
|
+</script>
|
|
|
+<template>
|
|
|
+ <div class="flex-grow bg-white p-4">
|
|
|
+ <DataForm :schema="schema" v-model="formData" :direction="'horizontal'"></DataForm>
|
|
|
+ <BottomAppBar fixed placeholder>
|
|
|
+ <wd-button block :round="false" @click="handleSubmit">保存</wd-button>
|
|
|
+ </BottomAppBar>
|
|
|
+ </div>
|
|
|
+</template>
|