acdr-ui/dist/dev/mp-weixin/pages/push/door.js.map

1 line
15 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"door.js","sources":["../../../../../src/pages/push/door.vue","../../../../../uniPage:/cGFnZXMvcHVzaC9kb29yLnZ1ZQ"],"sourcesContent":["<route lang=\"json5\" type=\"page\">\n{\n layout: 'default',\n style: {\n navigationBarTitleText: '发布上门服务',\n },\n}\n</route>\n\n<template>\n <view class=\"p-4 flex flex-col h-[120vh]\">\n <view class=\"card mt-4 flex-grow\">\n <!-- 服务名称 -->\n <view class=\"mb-4\">\n <input\n v-model=\"serviceName\"\n class=\"input w-full\"\n placeholder=\"输入服务名称(例如:宠物看护)\"\n />\n </view>\n\n <!-- 服务类型 -->\n <view class=\"mb-4\">\n <label class=\"label block mb-2\">选择服务类型</label>\n <picker mode=\"selector\" :range=\"serviceTypes\">\n <view class=\"input w-full bg-gray-100 p-2 rounded\">\n {{ serviceTypes[selectedServiceType] }}\n </view>\n </picker>\n </view>\n\n <!-- 服务描述 -->\n <view class=\"mb-4\">\n <textarea\n v-model=\"serviceDescription\"\n class=\"input h-24 w-full\"\n placeholder=\"描述服务内容,例如:包含宠物喂养、遛狗等...\"\n ></textarea>\n </view>\n\n <!-- 服务价格 -->\n <view class=\"mb-4\">\n <label class=\"label block mb-2\">服务价格(每小时)</label>\n <view class=\"flex w-[140px] items-center\">\n <button\n class=\"btn w-10 bg-gray-200 text-black text-center\"\n @touchstart=\"startIncrement(false)\"\n @touchend=\"stopIncrement\"\n @click=\"incrementPrice(1)\"\n >\n -\n </button>\n <input v-model=\"servicePrice\" type=\"number\" class=\"input text-center\" readonly />\n <button\n class=\"btn w-12 bg-gray-200 text-black text-center\"\n @touchstart=\"startIncrement(true)\"\n @touchend=\"stopIncrement\"\n @click=\"incrementPrice(1)\"\n >\n +\n </button>\n </view>\n </view>\n\n <!-- 服务地址 -->\n <view class=\"flex justify-between mb-4\">\n <text class=\"text-gray-500\">服务地点(范围)</text>\n <text class=\"text-gray-500\">{{ serviceLocation }}</text>\n </view>\n\n <!-- 地图容器 -->\n <view v-show=\"loadmap\" class=\"mb-4\">正在定位......</view>\n <!-- <view id=\"mapContainer\" class=\"mb-4 mapContainer\"></view> -->\n <view class=\"mapContainer\">\n <Map @doneFun=\"doneFun\" />\n </view>\n\n <!-- 服务状态 -->\n <view class=\"flex justify-between mb-4\">\n <label class=\"label\">服务状态(开启/关闭)</label>\n <switch :checked=\"serviceState\" @change=\"switchChange\" color=\"#42b983\"></switch>\n </view>\n\n <!-- 图片上传 -->\n <view class=\"mb-4\">\n <label class=\"label block mb-2\">上传服务封面</label>\n <button class=\"btn bg-gray-200 text-black mb-2\" @click=\"chooseImage\">选择图片</button>\n <view v-if=\"uploadedImages.length > 0\" class=\"flex flex-wrap\">\n <view\n v-for=\"(image, index) in uploadedImages\"\n :key=\"index\"\n class=\"w-24 h-24 m-2 bg-cover bg-center\"\n :style=\"{ backgroundImage: 'url(' + baseUrl + image + ')' }\"\n ></view>\n </view>\n </view>\n </view>\n\n <!-- 发布按钮固定在页面底部 -->\n <view class=\"fixed bottom-0 left-0 right-0 p-4 bg-white border-t border-gray-200\">\n <button class=\"btn w-full bg-yellow-500 text-black\" @click=\"submitService\">\n {{ isEditMode ? '更新服务' : '发布上门服务' }}\n </button>\n </view>\n </view>\n</template>\n\n<script lang=\"js\" setup>\nimport { ref } from 'vue'\nimport { httpGet, httpPost, httpUploadFile } from '@/utils/http'\nimport { baseUrl, toast } from '@/utils/commUtils'\nimport { getCurrentLocation, showLocationOnMap, initMap } from '@/utils/map-utils'\nimport config from '@/utils/config'\nimport Map from '@/components/Map.vue'\nimport { useUserStore } from '@/store'\nimport { isBindPhone } from '@/service/auth'\n\nlet incrementInterval = null\n\n// 数据和状态变量\nconst serviceId = ref(null)\nconst isEditMode = ref(!!serviceId.value)\nconst serviceName = ref('')\nconst serviceTypes = ref(['宠物看护', '宠物洗澡', '宠物训练', '宠物寄养'])\nconst selectedServiceType = ref(0)\nconst serviceDescription = ref('')\nconst servicePrice = ref(0)\nconst serviceLocation = ref('')\nconst serviceState = ref(true)\nconst uploadedImages = ref([])\nconst loadmap = ref(true)\nconst location = ref({})\nconst mapDetail = ref({})\nconst userStore = useUserStore()\n\n// 页面加载时获取位置信息并显示在地图上\nonLoad(async (options) => {\n if (options.id) {\n serviceId.value = options.id\n await fetchServiceData()\n }\n})\n\nonShow(async () => {\n await auth()\n})\n\n// 验证用户信息是否符合发布服务的状态\nconst auth = async () => {\n if (!userStore.userInfo.isRealName) {\n toast('您还未实名认证,请先实名认证!')\n try {\n const res = await isBindPhone()\n if (res.code != 200 || !res.data) {\n toast('您手机号还未绑定!')\n uni.navigateTo({ url: '/pages/permission/bind-phone' })\n return\n }\n } catch (e) {\n console.log('手机号发送验证信息失败:', e)\n }\n toast('请先实名认证!')\n // 跳转到指定实名页面\n uni.navigateTo({ url: '/pages/permission/real-name-auth' })\n return\n }\n}\n\n/**\n * 地图加载完后执行的方法\n * @param mapDetail 返回服务器获取的详细地址\n */\nconst doneFun = (mapDetail) => {\n loadmap.value = false\n mapDetail.value = mapDetail\n serviceLocation.value = mapDetail.formatted_address\n}\n\n// 如果是编辑模式,获取服务数据\nconst fetchServiceData = async () => {\n try {\n const response = await httpPost('/personal-service/get', { id: serviceId.value })\n if (response.code == 200) {\n const service = response.data\n serviceName.value = service.serviceName\n selectedServiceType.value = serviceTypes.value.indexOf(service.type)\n serviceDescription.value = service.description\n servicePrice.value = service.price\n serviceLocation.value = service.serviceHost\n serviceState.value = service.state === 1\n uploadedImages.value = [service.url]\n location.value = {\n latitude: service.latitude,\n longitude: service.longitude,\n address: service.address,\n }\n }\n } catch (error) {\n uni.showToast({ title: '获取服务数据失败', icon: 'none' })\n console.error('Error fetching service data:', error)\n }\n}\n\n// 这个初始化方法已经被废弃\nconst init = async () => {\n // #ifdef H5\n window._AMapSecurityConfig = {\n securityJsCode: config.MapSecurityJsCode,\n }\n // #endif\n if (isEditMode.value) {\n try {\n // 初始化地图H5 和小程序分别处理)\n const mapContextOrMap = await initMap(\n 'mapContainer',\n [location.value.longitude, location.value.latitude],\n 15,\n )\n // 显示当前位置\n showLocationOnMap(mapContextOrMap, location.value)\n loadmap.value = false\n } catch (error) {\n console.error('获取位置信息失败:', error)\n } finally {\n loadmap.value = false\n }\n } else {\n try {\n const locationInfo = await getCurrentLocation()\n serviceLocation.value = locationInfo.address\n location.value = locationInfo\n console.log('获取位置信息成功:', locationInfo)\n\n // 初始化地图H5 和小程序分别处理)\n const mapContextOrMap = await initMap(\n 'mapContainer',\n [locationInfo.longitude, locationInfo.latitude],\n 15,\n )\n\n // 显示当前位置\n showLocationOnMap(mapContextOrMap, locationInfo)\n } catch (error) {\n console.error('获取位置信息失败:', error)\n } finally {\n loadmap.value = false\n }\n }\n}\n\n// 增加或减少服务价格\nconst incrementPrice = (increment) => {\n servicePrice.value = Math.max(servicePrice.value + increment, 0)\n}\n\n// 长按开始\nconst startIncrement = (isIncrement) => {\n incrementInterval = setInterval(() => {\n incrementPrice(isIncrement ? 10 : -10)\n }, 200)\n}\n\n// 长按结束\nconst stopIncrement = () => {\n clearInterval(incrementInterval)\n}\n\n// 开关切换服务状态\nconst switchChange = (e) => {\n serviceState.value = e.value\n}\n\n// 选择并上传图片\nconst chooseImage = () => {\n uni.chooseImage({\n count: 1,\n success: async (res) => {\n for (const filePath of res.tempFilePaths) {\n const uploadedUrl = await uploadImage(filePath)\n if (uploadedUrl) {\n uploadedImages.value.pop()\n uploadedImages.value.push(uploadedUrl)\n }\n }\n },\n fail: () => {\n uni.showToast({ title: '图片选择失败', icon: 'none' })\n },\n })\n}\n\n// 上传图片到服务器\nconst uploadImage = async (filePath) => {\n try {\n const uploadResult = await httpUploadFile('/file/upload', filePath)\n if (uploadResult && uploadResult.data && uploadResult.data.url) {\n return uploadResult.data.url\n } else {\n uni.showToast({ title: '图片上传失败', icon: 'none' })\n return ''\n }\n } catch (error) {\n uni.showToast({ title: '图片上传失败', icon: 'none' })\n return ''\n }\n}\n\n// 发布或更新服务的函数\nconst submitService = () => {\n const serviceData = {\n id: serviceId.value,\n serviceName: serviceName.value,\n type: serviceTypes.value[selectedServiceType.value],\n description: serviceDescription.value,\n price: servicePrice.value,\n serviceHost: serviceLocation.value,\n state: serviceState.value ? 1 : 0,\n url: uploadedImages.value[0],\n address: location.value.address,\n latitude: `${location.value.latitude}`,\n longitude: `${location.value.longitude}`,\n country: mapDetail.value.country,\n province: mapDetail.value.province,\n city: mapDetail.value.city,\n district: mapDetail.value.district,\n township: mapDetail.value.township,\n streetNumber: mapDetail.value.streetNumber.street + mapDetail.value.streetNumber.number,\n }\n const endpoint = isEditMode.value ? '/personal-service/update' : '/personal-service/push'\n httpPost(endpoint, serviceData).then((response) => {\n if (response.code === 200) {\n uni.showToast({ title: isEditMode.value ? '更新成功' : '发布成功', icon: 'success' })\n } else {\n uni.showToast({ title: isEditMode.value ? '更新失败' : '发布失败', icon: 'none' })\n }\n })\n}\n</script>\n\n<style scoped>\n.mapContainer {\n width: 100%;\n height: 20vh;\n margin-bottom: 20px;\n}\n\n.fixed {\n position: fixed;\n}\n\n.bottom-0 {\n bottom: 0;\n}\n\n.left-0 {\n left: 0;\n}\n\n.right-0 {\n right: 0;\n}\n\n.bg-white {\n background-color: white;\n}\n\n.border-t {\n border-top-width: 1px;\n}\n\n.border-gray-200 {\n border-color: #e5e7eb;\n}\n</style>\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/pages/push/door.vue'\nwx.createPage(MiniProgramPage)"],"names":["ref","useUserStore","onLoad","onShow","toast","isBindPhone","uni","mapDetail","httpPost","httpUploadFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOQ,MAAA,MAAA,MAAA;;;;AAAA,QAAA,oBAAA;AAAA,UAAA,YAAAA,cAAA,IAAA,IAAA;AAAA,UAAA,aAAAA,cAAA,IAAA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