zhengyiming
4 天以前 2935cf3629d1495d959381a1550cddaa500a0986
apps/cMiniApp/src/subpackages/curriculum/mineDetailedInfo/InnerPage.vue
@@ -17,7 +17,7 @@
        prop="photo"
        label-position="top"
      >
        <Uploader v-model:file-list="form.photo" :maximum="6" class="bole-uploader"> </Uploader>
        <Uploader v-model:file-list="form.photos" :maximum="6" class="bole-uploader"> </Uploader>
      </nut-form-item>
    </nut-form>
  </ContentScrollView>
@@ -27,22 +27,66 @@
</template>
<script setup lang="ts">
import { useUser } from '@/hooks';
import { goBack } from '@/utils';
import { NumberInput } from '@12333/components';
import * as userResumeServices from '@12333/services/apiV2/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 { userDetail } = useUser();
const { updateUserResume } = useUpdateResume();
const form = reactive({
  height: '',
  weight: '',
  photo: [],
const {
  isLoading,
  isError,
  data: detail,
  refetch,
} = useQuery({
  queryKey: ['userResumeServices/getUserResumeDetail'],
  queryFn: async () => {
    return await userResumeServices.getUserResumeDetail(
      {},
      {
        showLoading: false,
      }
    );
  },
  placeholderData: () => ({} as API.GetUserResumeDetailQueryResult),
  onSuccess(data) {
    form.height = data.height;
    form.weight = data.weight;
    form.photos = data.photos?.length ? data.photos.map((x) => convertApiPath2Url(x)) : [];
  },
});
function handleConfirm() {}
const form = reactive({
  height: 0,
  weight: 0,
  photos: [] as FileItem[],
});
async function handleConfirm() {
  try {
    let params: API.SaveUserResumeDetailCommand = {
      weight: form.weight,
      height: form.weight,
      photos: form.photos?.length ? form.photos.map((x) => x.path) : [],
    };
    let res = await userResumeServices.saveUserResumeDetail(params);
    if (res) {
      Message.success('保存成功', {
        onClosed() {
          goBack();
          updateUserResume();
        },
      });
    }
  } catch (error) {}
}
</script>
<style lang="scss">