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

1 line
7.4 KiB
Plaintext
Raw Normal View History

2024-09-19 07:20:14 +08:00
{"version":3,"file":"share.js","sources":["../../../../../src/pages/push/share.vue","../../../../../uniPage:/cGFnZXMvcHVzaC9zaGFyZS52dWU"],"sourcesContent":["<route lang=\"json5\">\r\n{\r\n style: {\r\n navigationBarTitleText: '发布页面',\r\n },\r\n}\r\n</route>\r\n\r\n<template>\r\n <view class=\"flex flex-col h-full p-5 bg-[#f8f8f8]\">\r\n <!-- 顶部导航栏 -->\r\n <view class=\"flex items-center py-2\">\r\n <icon type=\"back\" size=\"20\" @click=\"goBack\"></icon>\r\n <view class=\"ml-3 text-lg font-bold\">发布笔记</view>\r\n </view>\r\n\r\n <!-- 图片上传区域 -->\r\n <view class=\"flex flex-nowrap overflow-x-scroll mt-4\">\r\n <view\r\n class=\"w-25 h-25 bg-white border border-[#eaeaea] flex items-center justify-center mr-2\"\r\n v-for=\"(image, index) in images\"\r\n :key=\"index\"\r\n >\r\n <image :src=\"image.url\" mode=\"aspectFill\" class=\"w-full h-full\"></image>\r\n </view>\r\n <view\r\n class=\"w-25 h-25 bg-white border-dashed border-[#eaeaea] flex items-center justify-center mr-2 cursor-pointer\"\r\n @click=\"chooseImage\"\r\n >\r\n <wd-icon name=\"add\" size=\"22px\" color=\"#888\"></wd-icon>\r\n </view>\r\n </view>\r\n\r\n <!-- 文本输入区域 -->\r\n <view class=\"mt-5\">\r\n <input\r\n type=\"text\"\r\n placeholder=\"填写标题会有更多赞哦~\"\r\n class=\"w-full h-10 mt-2 p-2 border border-[#eaeaea] rounded-md\"\r\n v-model=\"title\"\r\n />\r\n <textarea\r\n placeholder=\"添加正文\"\r\n class=\"w-full h-25 mt-2 p-2 border border-[#eaeaea] rounded-md\"\r\n v-model=\"content\"\r\n ></textarea>\r\n </view>\r\n\r\n <!-- 标签区域 -->\r\n <view class=\"flex flex-wrap mt-5\">\r\n <view\r\n class=\"bg-[#f0f0f0] rounded-full px-3 py-1 m-1 text-sm\"\r\n v-for=\"(tag, index) in tags\"\r\n :key=\"index\"\r\n >\r\n {{ tag }}\r\n </view>\r\n </view>\r\n\r\n <!-- 添加地点和公开可见选项 -->\r\n <view class=\"mt-5\">\r\n <view class=\"flex justify-between items-center py-2 border-b border-[#eaeaea]\">\r\n <text>添加地点</text>\r\n <input\r\n type=\"text\"\r\n placeholder=\"请输入地点\"\r\n class=\"text-sm text-[#888]\"\r\n v-model=\"location\"\r\n />\r\n </view>\r\n <view class=\"flex justify-between items-center py-2 border-b border-[#eaeaea]\">\r\n <text>公开可见</text>\r\n <switch :checked=\"isPublic\" @change=\"togglePublic\"></switch>\r\n </view>\r\n </view>\r\n\r\n <!-- 底部操作栏 -->\r\n <view class=\"flex justify-center mt-5\">\r\n <button\r\n class=\"w-full font-bold bg-[#FCD038] text-white rounded-md py-2 text-lg\"\r\n @click=\"postNote\"\r\n >\r\n 发布笔记\r\n </button>\r\n </view>\r\n </view>\r\n</template>\r\n\r\n<script lang=\"js\" setup>\r\nimport { ref } from 'vue'\r\nimport { httpPost, httpUploadFile } from '@/utils/http'\r\nimport { useUserStore } from '@/store/user'\r\n\r\nconst images = ref([])\r\nconst title = ref('')\r\nconst content = ref('')\r\nconst location = ref('')\r\nconst isPublic = ref(true) // 公开可见的状态\r\nconst tags = ref(['#搞笑日常', '#快乐无限供应', '#生活随拍', '#日常碎片'])\r\n\r\nconst userStore = useUserStore()\r\n\r\n// 返回上一页\r\nconst goBack = () => {\r\n uni.navigateBack()\r\n}\r\n\r\n// 选择图片\r\nconst chooseImage = () => {\r\n uni.chooseImage({\r\n count: 1,\r\n success: (res) => {\r\n images.value.push({ url: res.tempFilePaths[0] })\r\n },\r\n })\r\n}\r\n\r\n// 切换公开状态\r\nconst togglePublic = (event) => {\r\n isPublic.value = event.detail.value\r\n}\r\n\r\n// 上传图片文件并获取URL\r\nconst uploadImage = async (filePath) => {\r\n try {\r\n const response = await httpUploadFile('/file/upload', filePath)\r\n if (response.code === 200) {\r\n