acdr-ui/dist/dev/mp-weixin/pages/service/my-service.js.map

1 line
4.4 KiB
Plaintext

{"version":3,"file":"my-service.js","sources":["../../../../../src/pages/service/my-service.vue","../../../../../uniPage:/cGFnZXMvc2VydmljZS9teS1zZXJ2aWNlLnZ1ZQ"],"sourcesContent":["<route lang=\"json5\" type=\"page\">\r\n{\r\n layout: 'default',\r\n style: {\r\n navigationBarTitleText: '我的服务',\r\n },\r\n}\r\n</route>\r\n\r\n<template>\r\n <view class=\"p-4\">\r\n <view class=\"card mt-4\" v-for=\"service in services\" :key=\"service.id\">\r\n <view class=\"flex justify-between items-center mb-4\">\r\n <text class=\"text-xl\">{{ service.serviceName }}</text>\r\n <view class=\"flex space-x-4\">\r\n <button class=\"btn bg-blue-500 text-white\" @click=\"editService(service)\">编辑</button>\r\n <button class=\"btn bg-red-500 text-white\" @click=\"deleteService(service.id)\">删除</button>\r\n </view>\r\n </view>\r\n <text class=\"text-gray-500\">{{ service.description }}</text>\r\n <text class=\"text-gray-500\">价格: ¥{{ service.price }}</text>\r\n <text class=\"text-gray-500\">地点: {{ service.address }}</text>\r\n </view>\r\n </view>\r\n</template>\r\n\r\n<script setup>\r\nimport { ref, onMounted } from 'vue'\r\nimport { httpPost } from '@/utils/http'\r\n\r\nconst services = ref([])\r\n\r\n// 获取所有已发布的服务\r\nconst fetchServices = async () => {\r\n try {\r\n const response = await httpPost('/personal-service/list', {\r\n pageNo: 1,\r\n pageSize: 10,\r\n })\r\n if (response.code == 200) {\r\n services.value = response.records || []\r\n } else {\r\n uni.showToast({ title: '获取服务列表失败', icon: 'none' })\r\n }\r\n } catch (error) {\r\n uni.showToast({ title: '获取服务列表失败', icon: 'none' })\r\n console.error('Error fetching services:', error)\r\n }\r\n}\r\n\r\n// 编辑服务\r\nconst editService = (service) => {\r\n // 将服务数据保存到全局状态或使用查询参数传递到发布服务页面\r\n uni.navigateTo({\r\n url: `/pages/push/door?id=${service.id}`,\r\n })\r\n}\r\n\r\n// 删除服务\r\nconst deleteService = async (serviceId) => {\r\n try {\r\n const response = await httpPost('/personal-service/delete', { id: serviceId })\r\n if (response && response.data) {\r\n services.value = services.value.filter((service) => service.id !== serviceId)\r\n uni.showToast({ title: '服务已删除', icon: 'success' })\r\n } else {\r\n uni.showToast({ title: '删除服务失败', icon: 'none' })\r\n }\r\n } catch (error) {\r\n uni.showToast({ title: '删除服务失败', icon: 'none' })\r\n console.error('Error deleting service:', error)\r\n }\r\n}\r\n\r\nonMounted(() => {\r\n fetchServices()\r\n})\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.card {\r\n padding: 1rem;\r\n margin-bottom: 1rem;\r\n background-color: white;\r\n border-radius: 0.5rem;\r\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\r\n}\r\n\r\n.btn {\r\n padding: 0.5rem 1rem;\r\n font-size: 1rem;\r\n text-align: center;\r\n border-radius: 0.5rem;\r\n}\r\n\r\n.bg-blue-500 {\r\n background-color: #4299e1;\r\n}\r\n\r\n.bg-red-500 {\r\n background-color: #f56565;\r\n}\r\n\r\n.text-white {\r\n color: white;\r\n}\r\n\r\n.text-gray-500 {\r\n color: #a0aec0;\r\n}\r\n</style>\r\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/pages/service/my-service.vue'\nwx.createPage(MiniProgramPage)"],"names":["ref","httpPost","uni","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,UAAA,WAAAA,cAAA,IAAA,EAAA;AAGA,UAAA,gBAAA,MAAA;AACA,UAAA;AACA,cAAA,WAAA,MAAAC,WAAA,SAAA,0BAAA;AAAA,UACA,QAAA;AAAA,UACA,UAAA;AAAA,QACA,CAAA;AACA,YAAA,SAAA,QAAA,KAAA;AACA,mBAAA,QAAA,SAAA,WAAA,CAAA;AAAA,QACA,OAAA;AACAC,wBAAA,MAAA,UAAA,EAAA,OAAA,YAAA,MAAA,QAAA;AAAA,QACA;AAAA,MACA,SAAA,OAAA;AACAA,sBAAA,M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