wupengfei
2025-03-13 186234cb3833e620aa0ae46212fe337eb2d6e77d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<template>
  <ContentScrollView :paddingH="false">
    <nut-form :model-value="form" ref="formRef">
      <nut-form-item label="身高:" class="bole-form-item" prop="height">
        <NumberInput v-model="form.height" placeholder="请输入">
          <template #right>cm</template>
        </NumberInput>
      </nut-form-item>
      <nut-form-item label="体重:" class="bole-form-item" prop="weight">
        <NumberInput v-model="form.weight" placeholder="请输入">
          <template #right>kg</template>
        </NumberInput>
      </nut-form-item>
      <nut-form-item
        label="个人生活照(单张照片不超过5m,最多不超过6张):"
        class="bole-form-item person-photo"
        prop="photo"
        label-position="top"
      >
        <Uploader v-model:file-list="form.lifeCircleImgUrlList" :maximum="6" class="bole-uploader">
        </Uploader>
      </nut-form-item>
    </nut-form>
  </ContentScrollView>
  <PageFooter>
    <PageFooterBtn type="primary" @click="handleConfirm">保存</PageFooterBtn>
  </PageFooter>
</template>
 
<script setup lang="ts">
import { goBack } from '@/utils';
import { NumberInput } from '@12333/components';
import * as userResumeServices from '@12333/services/api/userResume';
import { convertApiPath2Url, Message } from '@12333/utils';
import { FileItem } from '@nutui/nutui-taro/dist/types/__VUE/uploader/type';
import { useQuery } from '@tanstack/vue-query';
 
defineOptions({
  name: 'InnerPage',
});
 
const {
  isLoading,
  isError,
  data: detail,
  refetch,
} = useQuery({
  queryKey: ['userResumeServices/getUserResumeDetailInfo'],
  queryFn: async () => {
    return await userResumeServices.getUserResumeDetailInfo({
      showLoading: false,
    });
  },
  placeholderData: () => ({} as API.UserResumeDetailInfoOutput),
  onSuccess(data) {
    form.height = data.height;
    form.weight = data.weight;
    form.lifeCircleImgUrlList = data.lifeCircleImgUrlList?.length
      ? data.lifeCircleImgUrlList.map((x) => convertApiPath2Url(x))
      : [];
  },
});
 
const form = reactive({
  height: '',
  weight: '',
  lifeCircleImgUrlList: [] as FileItem[],
});
 
async function handleConfirm() {
  try {
    let params: API.SaveUserResumeDetailInfoInput = {
      weight: form.weight,
      height: form.weight,
      lifeCircleImgUrlList: form.lifeCircleImgUrlList?.length
        ? form.lifeCircleImgUrlList.map((x) => x.url)
        : [],
    };
    let res = await userResumeServices.saveUserResumeDetailInfo(params);
    if (res) {
      Message.success('保存成功', {
        onClosed() {
          goBack();
        },
      });
    }
  } catch (error) {}
}
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
 
.mineDetailedInfo-page-wrapper {
  .person-photo {
    .nut-form-item__label {
      padding-right: 0;
    }
  }
 
  .nut-form .nut-cell.bole-form-item:not(.alignTop),
  page .nut-form .nut-cell.bole-form-item:not(.alignTop) {
    align-items: flex-start !important;
  }
}
</style>