|
@@ -8,6 +8,7 @@ import jobActive from "@/assets/comm/jobActive.png";
|
8
|
8
|
import user from "@/assets/comm/user.png";
|
9
|
9
|
import userActive from "@/assets/comm/userActive.png";
|
10
|
10
|
import CustomNav from "@/components/CustomNav";
|
|
11
|
+import {setAmap} from '@/services/amap'
|
11
|
12
|
import withLayout from '@/layouts'
|
12
|
13
|
import { useModel } from "@/store";
|
13
|
14
|
import Order from './components/Order'
|
|
@@ -18,21 +19,26 @@ import "./index.less";
|
18
|
19
|
export default withLayout((props) => {
|
19
|
20
|
const { router } = props
|
20
|
21
|
let { tab, isLogin } = router.params
|
21
|
|
- const { phone } = useModel('phone')
|
|
22
|
+ const { location,setLocation } = useModel('location')
|
22
|
23
|
const [currentTab, setCurrentTab] = useState(0);
|
23
|
24
|
const handleClick = (val) => {
|
24
|
25
|
setCurrentTab(val);
|
25
|
26
|
};
|
26
|
|
- useEffect(() => {
|
|
27
|
+ useEffect(() => {
|
|
28
|
+ if(!location){
|
|
29
|
+ Taro.getLocation({
|
|
30
|
+ type:'gcj02',
|
|
31
|
+ success:function(res){
|
|
32
|
+ setLocation(res.longitude+','+res.latitude)
|
|
33
|
+ setAmap({params:'location='+res.longitude+','+res.latitude,path: '/v3/geocode/regeo'})
|
|
34
|
+ }})
|
|
35
|
+ } else {
|
|
36
|
+ setAmap({params:'location='+location,path: '/v3/geocode/regeo'})
|
|
37
|
+ }
|
27
|
38
|
if (tab) {
|
28
|
39
|
setCurrentTab(tab - 0)
|
29
|
40
|
}
|
30
|
41
|
}, [tab])
|
31
|
|
- useEffect(()=>{
|
32
|
|
- if (currentTab!==0&&!phone) {
|
33
|
|
- Taro.reLaunch({ url: '/pages/login/index' });
|
34
|
|
- }
|
35
|
|
- },[currentTab])
|
36
|
42
|
return (
|
37
|
43
|
<View className='page-index'>
|
38
|
44
|
<View className='index-navbar'>
|