diff --git a/babel.config.js b/babel.config.js index eed6eb160df31dd96d039ffbbf1c966678fbf2f5..cd96b1d6d466857ed3a39070c58daf8db13693c0 100644 --- a/babel.config.js +++ b/babel.config.js @@ -32,16 +32,14 @@ module.exports = { "@taroify/icons", ], [ - 'import', + "import", { - libraryName: '@nutui/nutui-react-taro', - style: 'css', + libraryName: "@nutui/nutui-react-taro", + libraryDirectory: "dist/esm", + style: "css", camel2DashComponentName: false, - customName: (name, file) => { - return `@nutui/nutui-react-taro/dist/es/packages/${name.toLowerCase()}` - }, }, - 'nutui-react-taro', + "nutui-react-taro", ], ], diff --git a/config/index.ts b/config/index.ts index e34cb5ffb81cb11d8f717a3b5ccf1528264cdf01..4235e6cdfe78804762add8ae7712eda288898181 100644 --- a/config/index.ts +++ b/config/index.ts @@ -9,7 +9,15 @@ export default defineConfig<"vite">(async (merge, {}) => { const baseConfig: UserConfigExport<"vite"> = { projectName: "xindu-citizen-applet", date: "2024-7-29", - designWidth: 750, + + designWidth(input) { + // 配置 NutUI 375 尺寸 + if (input?.file?.replace(/\\+/g, "/").indexOf("@nutui") > -1) { + return 375; + } + // 全局使用 Taro 默认的 750 尺寸 + return 750; + }, deviceRatio: { 640: 2.34 / 2, 750: 1, @@ -18,7 +26,7 @@ export default defineConfig<"vite">(async (merge, {}) => { }, sourceRoot: "src", outputRoot: "dist", - plugins: ['@tarojs/plugin-html'], + plugins: ["@tarojs/plugin-html"], defineConstants: {}, copy: { patterns: [], @@ -30,6 +38,7 @@ export default defineConfig<"vite">(async (merge, {}) => { "@/utils": path.resolve(__dirname, "../src/utils"), "@/store": path.resolve(__dirname, "../src/store"), "@/components": path.resolve(__dirname, "../src/components"), + "@/hooks": path.resolve(__dirname, "../src/hooks"), }, framework: "react", compiler: "vite", diff --git a/package.json b/package.json index 482ca3ebd2b880ccc40b3568cee54b5e2d714e80..2bd4624a12169f7f4fdc25619385b55b59678177 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "author": "", "dependencies": { "@babel/runtime": "^7.24.4", - "@nutui/nutui-react-taro": "^3.0.4", + "@nutui/icons-react-taro": "^3.0.1", + "@nutui/nutui-react-taro": "^2.6.21", "@taroify/core": "^0.3.1-alpha.0", "@taroify/icons": "0.4.1-alpha.0", "@tarojs/components": "4.0.3", diff --git a/src/app.config.ts b/src/app.config.ts index aca138f59053089f3962fd35b4ff733c15fafc72..e96086a0723e7be8aa7a853566c081d53c1eae31 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -43,12 +43,23 @@ export default defineAppConfig({ }, { root: "pages/Approve", - pages: ["Apply/index", "ApplyDesc/index",'applyRecord/applyRecord','applyRecordDetail/index'], + pages: [ + "Apply/index", + "ApplyDesc/index", + "applyRecord/applyRecord", + "applyRecordDetail/index", + ], }, { root: "pages/Feedback", - pages: ["Record/index", "RecordDetail/index", "Report/index",'suggestAndConsult/suggestAndConsult','usageRecord/usageRecord'], + pages: [ + "Record/index", + "RecordDetail/index", + "Report/index", + "suggestAndConsult/suggestAndConsult", + "usageRecord/usageRecord", + ], }, { root: "pages/kitchenWaste", @@ -58,18 +69,22 @@ export default defineAppConfig({ "pages/addCollection/index", "pages/contracted/index", "pages/addMerchants/index", + "pages/newStoreEntry/newStoreEntry", + "pages/shopPerfectInfo/shopPerfectInfo", + "pages/shopList/shopList", + "pages/cameraComp/cameraComp" ], }, { root: "pages/Event", pages: [ - "index",//事件列表 - "view/cameraComp/index",//拍照页 - "view/miniAiIdentify/index",//极简上报(AI识别) - "view/confirmLocation/index",//确认位置 - "view/autoDispatch/index",//自动派遣 - "view/orderDirect/index",//单兵直达 - "view/detail/index",//事件详情 + "index", //事件列表 + "view/cameraComp/index", //拍照页 + "view/miniAiIdentify/index", //极简上报(AI识别) + "view/confirmLocation/index", //确认位置 + "view/autoDispatch/index", //自动派遣 + "view/orderDirect/index", //单兵直达 + "view/detail/index", //事件详情 ], }, ], diff --git a/src/app.less b/src/app.less index c65499f683dab630bc0017f6506a1dcdc6c9825d..ead9a0c71a80bdba22bcfc633fdf3de06f081d9a 100644 --- a/src/app.less +++ b/src/app.less @@ -3,7 +3,8 @@ page { height: 100%; position: relative; --nutui-color-primary: #3E6BDA; //主要内容用色,常用语常规标题内容、细文浏览、常规按钮文字以及图表引导 - --badge-background-color: red + --badge-background-color: red; + --nutui-form-item-required-color:'red' } /* 下面样式代码餐厨垃圾页面需要请勿删除 */ @@ -12,7 +13,9 @@ Button, Image { box-sizing: border-box; } - +.nut-form-item-label-required{ + color: red !important; +} .placeholder { font-size: 31px; color: #999999; diff --git a/src/assets/images/address.png b/src/assets/images/address.png new file mode 100644 index 0000000000000000000000000000000000000000..d87213a0dceb23488f7d9738af9ea9d07adf55b4 Binary files /dev/null and b/src/assets/images/address.png differ diff --git a/src/assets/images/audio.png b/src/assets/images/audio.png new file mode 100644 index 0000000000000000000000000000000000000000..43552205a4ad7886cd3fef616f920e15c26cab81 Binary files /dev/null and b/src/assets/images/audio.png differ diff --git a/src/assets/images/dragPoint.png b/src/assets/images/dragPoint.png new file mode 100644 index 0000000000000000000000000000000000000000..75c2224a03eed171b112f37f759fe5b6a623a8e9 Binary files /dev/null and b/src/assets/images/dragPoint.png differ diff --git a/src/assets/images/empty.png b/src/assets/images/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..d9ff21fbe3c16728c1c737f9065b0b8deaa3f688 Binary files /dev/null and b/src/assets/images/empty.png differ diff --git a/src/assets/images/empty2.png b/src/assets/images/empty2.png new file mode 100644 index 0000000000000000000000000000000000000000..7edb4242f44e8768b410aad26984e1f8926e4a4e Binary files /dev/null and b/src/assets/images/empty2.png differ diff --git a/src/assets/images/event/location.png b/src/assets/images/event/locationIcon.png similarity index 100% rename from src/assets/images/event/location.png rename to src/assets/images/event/locationIcon.png diff --git a/src/assets/images/kitchenWaste/localPoint.png b/src/assets/images/kitchenWaste/localPoint.png new file mode 100644 index 0000000000000000000000000000000000000000..bb986a5c288ddba768a59b360fc46ee10ee49b2b Binary files /dev/null and b/src/assets/images/kitchenWaste/localPoint.png differ diff --git a/src/assets/images/kitchenWaste/saomiao.png b/src/assets/images/kitchenWaste/saomiao.png new file mode 100644 index 0000000000000000000000000000000000000000..9901e73051542d566a1a2ae718980313feb7043f Binary files /dev/null and b/src/assets/images/kitchenWaste/saomiao.png differ diff --git a/src/assets/images/paizhao.png b/src/assets/images/paizhao.png new file mode 100644 index 0000000000000000000000000000000000000000..5fd5c4a30ffe1df4ce28d35284c15aa8860b1e27 Binary files /dev/null and b/src/assets/images/paizhao.png differ diff --git a/src/assets/images/photoBtn.png b/src/assets/images/photoBtn.png new file mode 100644 index 0000000000000000000000000000000000000000..9683f0123b6fa7a0393ae400dd15f042a3ea9565 Binary files /dev/null and b/src/assets/images/photoBtn.png differ diff --git a/src/assets/images/region.png b/src/assets/images/region.png new file mode 100644 index 0000000000000000000000000000000000000000..812341ee112b05863cd853f95bd1a38e60710f20 Binary files /dev/null and b/src/assets/images/region.png differ diff --git a/src/assets/images/report.png b/src/assets/images/report.png new file mode 100644 index 0000000000000000000000000000000000000000..c40b753f3fbf2e67e2e68d6d9f4d6529640333be Binary files /dev/null and b/src/assets/images/report.png differ diff --git a/src/components/AddressSelect/AddressSelect.module.less b/src/components/AddressSelect/AddressSelect.module.less new file mode 100644 index 0000000000000000000000000000000000000000..65d4071f709d83fca9ffa2dddfeffc4d82a38154 --- /dev/null +++ b/src/components/AddressSelect/AddressSelect.module.less @@ -0,0 +1,154 @@ +.mapBox { + width: 100vw; + height: 100vh; + position: fixed; + top: 0; + left: 0; + z-index: 100; + + .drag { + position: fixed; + top: 50%; + left: 50%; + width: 180px; + height: 60px; + margin-left: -90px; + margin-top: -60px; + display: flex; + justify-content: center; + align-items: center; + + .drag-img { + width: 25px; + height: 38px; + } + } + + .top-info, + .bottom-confrim, + .right-control, + .right-lacate { + position: absolute; + top: 30px; + left: 22%; + margin-left: -170px; + width: 340px; + padding: 15px; + border-radius: 10px; + background-color: #ffffff; + box-shadow: 1px 1px 10px 2px #e4e7e9; + display: flex; + + .picture { + width: 60px; + height: 70px; + border-radius: 10px; + background: #f6f7f8; + overflow: hidden; + } + + .text { + flex: 1; + text-align: justify; + line-height: 26px; + margin-left: 20px; + color: #1d2541; + font-size: 15px; + + .name { + color: #ff5167; + } + + .address_1 { + color: #2c63ff; + } + + .tip { + display: block; + } + } + + &.right-control { + width: 40px; + top: auto; + bottom: 260px; + left: auto; + right: 20px; + flex-direction: column; + align-items: center; + justify-content: space-between; + font-size: 26px; + font-weight: bold; + padding: 6px; + } + + &.right-lacate { + width: 40px; + top: auto; + bottom: 210px; + left: auto; + right: 20px; + padding: 6px; + justify-content: center; + + .lacate-icon { + width: 24px; + height: 24px; + } + } + + &.bottom-confrim { + top: auto; + bottom: 60px; + gap: 15px; + font-size: 34px; + color: #1d2541; + font-weight: bold; + flex-direction: column; + width: 100%; + + .icon { + width: 14px; + height: 16px; + margin-right: 4px; + } + + .editTxt { + padding-left: 10px; + color: #3e6bda; + } + } + } +} + +.title { + font-weight: bold; + color: #1d2541; + font-size: 36px; +} + +.text-area { + margin-top: 10px; + background: #f5f6fa; + border-radius: 10px; + padding: 10px; +} + +.audio-icon { + width: 10px; + height: 15px; + margin-right: 4px; +} + +.audio { + width: 100%; + height: 38px; + color: #66c164; + background: #d6e3ff !important; +} + +.btn { + width: 100%; + height: 76px; + background-color: #66c164; +} \ No newline at end of file diff --git a/src/components/AddressSelect/AddressSelect.tsx b/src/components/AddressSelect/AddressSelect.tsx new file mode 100644 index 0000000000000000000000000000000000000000..e9323b249fe0152779b0297d62ae71fd6225fb1e --- /dev/null +++ b/src/components/AddressSelect/AddressSelect.tsx @@ -0,0 +1,245 @@ +import { View, Map, Image, Text } from "@tarojs/components"; +import { Button, Col, Dialog, Row, TextArea } from "@nutui/nutui-react-taro"; +import { FC, useEffect, useRef, useState } from "react"; +import styles from "./AddressSelect.module.less"; +import locationImg from "@/assets/images/kitchenWaste/localPoint.png"; +import Taro, { requirePlugin } from "@tarojs/taro"; +import { baiduLocationAnalysis } from "@/services/kitchenWaste"; +import Flex from "../Flex/Flex"; + +type LocationSelectProps = { + show: boolean; + onConfirm: (data: any) => void; + onCancale: () => void; +}; + +const AddressSelect: FC = (props) => { + const { show, onConfirm, onCancale } = props; + + useEffect(() => { + Taro.getLocation({ + type: "gcj02", + success: ({ longitude, latitude }) => { + setMarketPoint({ longitude, latitude }); + getAnalysisAddress(longitude, latitude); + }, + }); + }, []); + + const [marketPoint, setMarketPoint] = useState({ + longitude: 104.164987, + latitude: 30.829873, + }); + const regionChange = async (e) => { + if (e.causedBy === "drag") { + if (e.detail.type === "end") { + const { longitude, latitude } = e.detail.centerLocation; + await getAnalysisAddress(longitude, latitude); + setMarketPoint({ longitude, latitude }); + } + } + }; + + const [addressInfo, setAddressInfo] = useState({}); + const getAnalysisAddress = async (longitude: number, latitude: number) => { + return new Promise(async (resolve, _reject) => { + const res = await baiduLocationAnalysis(longitude, latitude); + if (res.code === 200) { + if (res.data.status !== 0) { + Taro.showToast({ title: "地址解析失败", icon: "none", mask: true }); + return; + } + const result = res.data.result; + const addressInfo = { + cityCode: "5101", + cityName: result.addressComponent.city, + districtCode: result.addressComponent.adcode, + districtName: result.addressComponent.district, + streetCode: result.addressComponent.town_code, + streetName: result.addressComponent.street, + communityCode: "", + communityName: "", + lon: longitude, + lat: latitude, + coordinateType: "GCJ-02", + address: result.formatted_address_poi, + }; + setAddressInfo(addressInfo); + resolve(addressInfo); + } + }); + }; + + const [editShow, setEditShow] = useState(false); + const [editStr, setEditStr] = useState(); +// const plugin = requirePlugin("QCloudAIVoice"); +// const speechRecognizerManager = useRef(plugin.speechRecognizerManager()); +// const handleAudioToText = () => { +// speechRecognizerManager.current.start({ +// // 用户参数 +// secretkey: "jBMGtGMBizziAMHuGL9fvuc3D6i49xUk", +// secretid: "AKIDAIAm7ByVkiPqzrSnreAQP7YhaCXaNt85", +// appid: 1308579967, +// // 实时识别接口参数 +// engine_model_type: "16k_zh", +// filter_punc: 1, +// filter_modal: 2, +// word_info: 2, +// }); +// }; +// const handleCloseAudio = () => { +// console.log("停止"); +// speechRecognizerManager.current.stop(); +// }; +// // 开始识别 +// speechRecognizerManager.current.OnRecognitionStart = (res) => { +// console.log("开始识别", res); +// }; +// // 一句话开始 +// speechRecognizerManager.current.OnSentenceBegin = (res) => { +// console.log("一句话开始", res); +// }; +// // 识别变化时 +// speechRecognizerManager.current.OnRecognitionResultChange = (res) => { +// console.log("识别变化", res); +// if (res.code === 0) { +// const text = res.result.voice_text_str; +// setEditStr((val) => val + text.slice(0, 100)); +// } +// }; +// // 一句话结束 +// speechRecognizerManager.current.OnSentenceEnd = (res) => { +// console.log("一句话结束", res.result.voice_text_str); +// }; +// // 识别结束 +// speechRecognizerManager.current.OnRecognitionComplete = (res) => { +// console.log("识别结束", res); +// }; +// // 识别错误 +// speechRecognizerManager.current.OnError = (res) => { +// // code为6001时,国内站用户请检查是否使用境外代理,如果使用请关闭。境外调用需开通国际站服务 +// console.log("识别失败", res); +// }; +// // 录音结束(最长10分钟)时回调 +// speechRecognizerManager.current.OnRecorderStop = (res) => { +// console.log("录音结束", res); +// }; + + return ( + + {}} + /> + + {/* */} + + + + {/* */} + {addressInfo?.address} + {`(${addressInfo?.streetName || ""})`} + { + setEditStr(addressInfo?.address); + setEditShow(true); + }} + > + 编辑地址 + + + + + + + + + 位置信息} + visible={editShow} + style={{ zIndex: 999999 }} + closeOnOverlayClick={false} + footer={ + + {/* + + */} + + + + + } + onConfirm={() => setEditShow(false)} + onCancel={() => setEditShow(false)} + > +