acdr-ui/dist/dev/mp-weixin/pages/certification/pet-sitter.js.map

1 line
5.7 KiB
Plaintext
Raw Normal View History

2024-09-19 07:20:14 +08:00
{"version":3,"file":"pet-sitter.js","sources":["../../../../../src/pages/certification/pet-sitter.vue","../../../../../uniPage:/cGFnZXMvY2VydGlmaWNhdGlvbi9wZXQtc2l0dGVyLnZ1ZQ"],"sourcesContent":["<route lang=\"json5\" type=\"page\">\n{\n layout: 'default',\n style: {\n navigationBarTitleText: '宠托师资格证申请页面',\n // 设置为白色\n navigationBarBackgroundColor: '#ffffff', // 设置导航栏背景颜色为白色\n },\n}\n</route>\n\n<template>\n <view class=\"bg-gray-100\">\n <view class=\"h-full w-full bg-white p-6\">\n <view class=\"mb-4 flex items-center justify-between\">\n <label for=\"type\" class=\"block\">申请职位</label>\n <picker\n mode=\"selector\"\n :range=\"positionOptions\"\n :value=\"application.typeIndex\"\n @change=\"pickerTypeChange\"\n >\n <view class=\"w-full pl-3 border rounded py-2 w-full\">\n {{ positionOptions[application.typeIndex] || '请选择职位' }}\n </view>\n </picker>\n </view>\n\n <view class=\"mb-4\">\n <label for=\"content\" class=\"block mb-2\">审核内容</label>\n <textarea\n v-model=\"application.content\"\n id=\"content\"\n placeholder=\"请输入审核内容\"\n class=\"w-full p-3 border rounded bg-gray-100\"\n rows=\"5\"\n ></textarea>\n </view>\n\n <view class=\"mb-4\">\n <label for=\"image_url\" class=\"block mb-2\">审核材料</label>\n <view class=\"flex flex-wrap gap-4\">\n <view v-for=\"(image, index) in application.imageUrls\" :key=\"index\" class=\"w-20 h-20\">\n <image :src=\"image\" class=\"w-full h-full object-cover rounded\" />\n </view>\n <button\n v-if=\"application.imageUrls.length < 6\"\n class=\"text-size-3xl ml-0 w-20 h-20 bg-gray-200 flex justify-center items-center rounded\"\n @click=\"chooseImages\"\n >\n +\n </button>\n </view>\n </view>\n\n <button\n class=\"w-full py-3 bg-[#FCCB30] text-black text-lg rounded-full flex items-center justify-center\"\n @click=\"submitApplication\"\n >\n 提交申请\n </button>\n </view>\n </view>\n</template>\n\n<script setup>\nimport { ref } from 'vue'\nimport { httpPost, httpPostMultipart, httpUploadMultipleFiles } from '@/utils/http' // 使用httpPostMultipart方法\nimport { toPath } from '@/utils/commUtils'\n\nconst positionOptions = [\n '宠托师',\n '宠物营养师',\n '宠物陪伴师',\n '宠物心理健康指导员',\n '宠物达人',\n '其他宠物师',\n]\n\nconst application = ref({\n typeIndex: 0, // 存储选择的职位索引\n content: '',\n imageUrls: [], // 存储图片文件路径\n})\n\nconst pickerTypeChange = (e) => {\n application.value.typeIndex = e.detail.value\n}\n\nconst chooseImages = () => {\n uni.chooseImage({\n count: 6 - application.value.imageUrls.length, // 最多选择的图片数量\n success: (res) => {\n application.value.imageUrls.push(...res.tempFilePaths)\n },\n })\n}\n\nconst submitApplication = async () => {\n try {\n // 将本地文件上传到服务器上\n application.value.imageUrls = await httpUploadMultipleFiles(\n '/file/upload',\n application.value.imageUrls,\n )\n application.value.type = positionOptions[application.value.typeIndex]\n\n // 上传文件和表单数据\n const response = await httpPost('/petInfo/apply', application.value)\n console.log(response)\n\n if (response.code == 200) {\n uni.showToast({ title: '申请已提交', icon: 'none' })\n application.value = {\n typeIndex: 0,\n content: '',\n imageUrls: [],\n }\n } else {\n uni.showToast({ title: '提交失败 ' + response.message, icon: 'none' })\n if (response.message.includes('未实名认证')) {\n // 暂停一段时间\n await new Promise((resolve) => setTimeout(resolve, 500))\n // 跳转<E8B7B3>