Sfoglia il codice sorgente

Merge branch 'dev' of http://git.ycjcjy.com/shigongli/miniapp-v2 into dev

李志伟 3 anni fa
parent
commit
d8489bd7ef

+ 2
- 1
config/dev.js Vedi File

@@ -3,7 +3,8 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"http://192.168.89.147:8080"',
6
+    // HOST: '"http://192.168.89.147:8080"',
7
+    HOST: '"https://sgl-v2.njyunzhi.com"',
7 8
   },
8 9
   mini: {},
9 10
   h5: {}

+ 1
- 1
config/prod.js Vedi File

@@ -3,7 +3,7 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"http://192.168.89.147:8080"',
6
+    HOST: '"https://sgl-v2.njyunzhi.com"',
7 7
   },
8 8
   mini: {},
9 9
   h5: {

+ 1
- 1
src/app.config.js Vedi File

@@ -16,5 +16,5 @@ export default {
16 16
     'scope.userLocation': {
17 17
       desc: '您的位置信息将方便您更好的小程序体验'
18 18
     }
19
-  }
19
+  },
20 20
 }

+ 2
- 2
src/components/AuthPage/index.jsx Vedi File

@@ -1,7 +1,7 @@
1 1
 import React, { useState } from 'react'
2 2
 import Taro from '@tarojs/taro'
3 3
 import { useModel } from '@/store'
4
-import { Label, RadioGroup } from '@tarojs/components'
4
+import { Label, RadioGroup, Radio } from '@tarojs/components'
5 5
 import index from '@/assets/icons/login/LOGO.png'
6 6
 import './login.less'
7 7
 
@@ -40,7 +40,7 @@ export default (props) => {
40 40
       <view className='buttom'>
41 41
         <Label>
42 42
           <RadioGroup onChange={handleChange}>
43
-            <radio checked={checked} />
43
+            <Radio checked={checked} />
44 44
           </RadioGroup>
45 45
           <view>
46 46
             我已阅读知晓并同意 <text>《平台用户服务协议》</text>

+ 43
- 27
src/components/BossCard/index.jsx Vedi File

@@ -1,62 +1,78 @@
1
-import withLayout from '@/layouts'
1
+import Taro from '@tarojs/taro'
2 2
 import useSave from "@/utils/hooks/useSave"
3
-import image from '@/assets/icons/ProCard/8kb.jpg'
4
-import AuthPage from '@/components/AuthPage'
5
-import formatTimes from '@/utils/formatTime'
3
+import { getShopDetail, getShopcity } from '@/services/home'
6 4
 import { useState, useEffect } from 'react'
7
-import { Button, Radio, Input } from '@tarojs/components'
5
+import Star from '@/components/Star/Star.jsx'
6
+import position from '@/assets/icons/GuideCheck/position_logo.png'
7
+import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
8
+import starOff from '@/assets/icons/GuideCheck/starOff.png'
9
+import starOn from '@/assets/icons/GuideCheck/starOn.png'
8 10
 import food from '@/assets/icons/ProCard/food.png'
9 11
 import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
10
-import OrderMolded from '@/components/OrderMolded'
11
-import Popup from '@/components/Popup'
12
+
13
+
14
+//入住指引--老板推荐
12 15
 
13 16
 
14 17
 
15 18
 import './style.less'
16 19
 
17 20
 export default (props) => {
18
-  const { } = props
21
+  const { item } = props
22
+  const { shopId } = props.item
23
+  const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.packageId)
24
+  const [city, setCity] = useState({})
25
+  const [detail, setDetail] = useState({})
19 26
 
20
-  return (
27
+  const goFood = () => {
28
+    Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${shopId}` })
21 29
 
30
+  }
31
+
32
+  useEffect(() => {
33
+    getShopDetail(item.shopId).then((res) => {
34
+      setDetail(res)
35
+      getShopcity(res.cityId).then((x) => {
36
+        setCity(x)
37
+      })
38
+    })
39
+  }, [])
40
+  const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
41
+  return (
22 42
     <view class='container'>
23 43
       <view class='wrapper'>
24
-        <view class='left-complete-one'>
44
+        <view class='left-complete-one' onClick={() => { goFood() }} >
25 45
           <image className='left-image-1' src={ProCard_hot}></image>
26 46
           <view className='left-viewText'>
27
-            返现¥16.00
47
+            返现¥{item.cashback / 100}
28 48
           </view>
29 49
           {/* 评分 */}
30 50
           <view className='card-box-star'>
31
-            {
32
-              scoreList.map((_, index) => {
33
-                const src = (index + '0.1') < score ? starOn : starOff
34
-                return (
35
-                  <image className='card-star-image' key={index} src={src} />
36
-                )
37
-              })
38
-            }
39
-            <text className='card-star-text' >{score}</text>
51
+            <Star star={star} />
52
+            <text className='card-star-text' >{star}</text>
40 53
           </view>
41 54
           <view className='title-image'>
42
-            <image className='image-1' mode='scaleToFill' src={image}></image>
55
+            <image className='image-1' mode='scaleToFill' src={item.poster}></image>
43 56
             <image className='image-2' src={food}></image>
44 57
           </view>
45 58
           <view className='title-content'>
46 59
             <view className='Pro-title'>
47
-              <view className='title-text'>【橘里橘啊换行啊啊啊气咖啡店】新鲜出炉啦!</view>
60
+              <view className='title-text'>{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
48 61
             </view>
49
-            <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
62
+            <text className='title-money' >¥{item.actualPrice / 100}元<text className='title-money-2'>门市价{item.standardPrice / 100}元</text></text>
50 63
             <view className='title-position-on'>
51 64
               <image className='title-position' src={position} />
52
-              <text className='title-position-image'>南京市/秦淮区</text>
53
-              <image className='title-on' src={imageSrc} />
54
-              <text onClick={() => AddCollect()} className='title-on-text'>{value}</text>
65
+              <text className='title-position-image'>{city.areaPName}/{city.areaName}</text>
66
+              <view style={{ display: 'inline-block' }} onClick={toggleSave}>
67
+
68
+                <image className='title-on' src={isSaved > 0 ? starOn : starOff} />
69
+                <text className='title-on-text'>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
70
+              </view>
55 71
             </view>
56 72
           </view>
57 73
         </view>
58 74
         <view class='right-complete-two'>
59
-          <view className='right-content'>
75
+          <view className='right-content' onClick={() => { Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` }); }}>
60 76
             {/* <view className='right-number'>×1</view> */}
61 77
             <image className='right-image' src={Pay} />
62 78
             <view className='right-title'>支付</view>

+ 1
- 1
src/components/CompoentsOrder/AlreadyExpired/index.jsx Vedi File

@@ -23,7 +23,7 @@ const score = '3.9'
23 23
 export default (props) => {
24 24
 
25 25
   return (
26
-    <scroll-view scroll-y style='height: 90vh;'  >
26
+    <scroll-view scroll-y style='height:100%;'  >
27 27
 
28 28
       <view className='AlreadyExpired-box' >
29 29
 

+ 2
- 1
src/components/CompoentsOrder/AlreadyUsed/index.jsx Vedi File

@@ -38,7 +38,8 @@ export default (props) => {
38 38
 
39 39
   return (
40 40
 
41
-    <scroll-view scroll-y style='height: 90vh;'  >
41
+    <scroll-view scroll-y style='height:100%;'  >
42
+
42 43
       <view className='AlreadyUsed-box' >
43 44
         <Popup show={showDialog} maskClosable={false}>
44 45
           <AlreadyUsedMolded />

+ 2
- 1
src/components/CompoentsOrder/TobePaid/index.jsx Vedi File

@@ -17,7 +17,8 @@ export default (props) => {
17 17
     Taro.navigateTo({ url: '/pages/PayOrder/index' })
18 18
   }
19 19
   return (
20
-    <scroll-view scroll-y style='height: 90vh;'  >
20
+    <scroll-view scroll-y style='height:100%;'  >
21
+
21 22
       <view className='TobePaid-box'>
22 23
         <view className='OrderNumber'>订单编号:ABC123456789</view>
23 24
         {/* 待支付 */}

+ 2
- 1
src/components/CompoentsOrder/TobeWritten/index.jsx Vedi File

@@ -9,7 +9,8 @@ import './style.less'
9 9
 export default (props) => {
10 10
 
11 11
   return (
12
-    <scroll-view scroll-y style='height: 90vh;'  >
12
+    <scroll-view scroll-y style='height:100%;'  >
13
+
13 14
 
14 15
       <view className='TobeWritten-box'>
15 16
         <view className='OrderNumber'>订单编号:ABC123456789</view>

+ 7
- 1
src/components/CustomNav/index.jsx Vedi File

@@ -64,6 +64,12 @@ export default (props) => {
64 64
     }
65 65
   }
66 66
 
67
+  const goHome = () => {
68
+    Taro.navigateTo({
69
+      url: '/pages/index/index'
70
+    })
71
+  }
72
+
67 73
   useEffect(() => {
68 74
     Taro.setNavigationBarTitle(title)
69 75
   }, [title])
@@ -81,7 +87,7 @@ export default (props) => {
81 87
                 <view className='custom-nav-bar-action-part' onClick={handleAction}>
82 88
                   <image src={bgImg ? gobackWhite : gobackBlack} mode='aspectFit' />
83 89
                 </view>
84
-                <view className='custom-nav-bar-action-part'>
90
+                <view className='custom-nav-bar-action-part' onClick={goHome}>
85 91
                   <image src={bgImg ? homeWhite : homeBlack} mode='aspectFit' />
86 92
                 </view>
87 93
               </view>

+ 29
- 28
src/components/toggleRole/ToggleRole.jsx Vedi File

@@ -1,4 +1,4 @@
1
-import { useState,useEffect } from 'react';
1
+import { useState, useEffect } from 'react';
2 2
 
3 3
 import touristON from '@/assets/icons/UserCenter/touristON.png'
4 4
 import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
@@ -12,38 +12,39 @@ import './ToggleRole.less'
12 12
 import { useModel } from '@/store'
13 13
 
14 14
 
15
-export default ( props)=>{
16
-  const {showCutover, onClose }=props
17
-  const {getRole}=useModel('person')
18
-  const goToPerson=()=>{
15
+export default (props) => {
16
+  const { showCutover, onClose, role } = props
17
+  const { getRole } = useModel('person')
18
+  const goToPerson = () => {
19 19
     getRole('normal')
20 20
   }
21
-  const goToHotel=()=>{
21
+  const goToHotel = () => {
22 22
     getRole('hotel')
23
+
23 24
   }
24
-  const goToShop=()=>{
25
+  const goToShop = () => {
25 26
     getRole('shop')
26 27
   }
27
-  const onClose2=()=>{
28
-    console.log('2222222222222222222')
28
+  const onClose2 = () => {
29
+    // console.log('2222222222222222222')
29 30
   }
30
-    return (      
31
-      <Popup show={showCutover} onClose={onClose2}>
32
-          <view className='User-box-sths' >
33
-            <view className='User-box-selectUser'>请选择身份:</view>
34
-            <view className='User-box-tourist' onClick={goToPerson}>
35
-              <image className='Ubs-tourist-image' src={touristOFF} />
36
-              <text className='Ubs-tourist-text'>游客</text>
37
-            </view>
38
-            <view className='User-box-hotelBoss' onClick={goToHotel}>
39
-              <image className='Ubs-hotelBoss-image' src={hotelBossOFF} />
40
-              <text className='Ubs-hotelBoss-text'>民宿老板</text>
41
-            </view>
42
-            <view className='User-box-shopBoss' onClick={goToShop}>
43
-              <image className='Ubs-shopBoss-image' src={shopBossON} />
44
-              <text className='Ubs-shopBoss-text'>店铺老板</text>
45
-            </view>
46
-          </view>
47
-        </Popup>
48
-    )  
31
+  return (
32
+    <Popup show={showCutover} onClose={onClose2}>
33
+      <view className='User-box-sths' >
34
+        <view className='User-box-selectUser'>请选择身份:</view>
35
+        <view className='User-box-tourist' onClick={goToPerson}>
36
+          <image className='Ubs-tourist-image' src={role === 'normal' ? touristON : touristOFF} />
37
+          <text className='Ubs-tourist-text'>游客</text>
38
+        </view>
39
+        <view className='User-box-hotelBoss' onClick={goToHotel}>
40
+          <image className='Ubs-hotelBoss-image' src={role === 'hotel' ? hotelBossON : hotelBossOFF} />
41
+          <text className='Ubs-hotelBoss-text'>民宿老板</text>
42
+        </view>
43
+        <view className='User-box-shopBoss' onClick={goToShop}>
44
+          <image className='Ubs-shopBoss-image' src={role === 'shop' ? shopBossON : shopBossOFF} />
45
+          <text className='Ubs-shopBoss-text'>店铺老板</text>
46
+        </view>
47
+      </view>
48
+    </Popup>
49
+  )
49 50
 }

+ 4
- 4
src/hotel/components/Income/income.jsx Vedi File

@@ -34,7 +34,7 @@ export default (props) => {
34 34
   }
35 35
   return (
36 36
     <view>
37
-      <ToggleRole showCutover={showCutover} onClose={onClose} />
37
+      <ToggleRole role='hotel' showCutover={showCutover} onClose={onClose} />
38 38
       <view style={{ padding: '30rpx', height: '100%' }}>
39 39
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
40 40
           <view className='storexx'>
@@ -70,9 +70,9 @@ export default (props) => {
70 70
                     <image className='spreadImg' src={sImg} />
71 71
                   </view>
72 72
                 </view>
73
-              )
74
-            }
75
-            {accountlog.length!=''?<view className='botton'>已经到底了~</view>:''}          
73
+            )
74
+          }
75
+          {accountlog.length != '' ? <view className='botton'>已经到底了~</view> : ''}
76 76
         </scroll-view>
77 77
       </view>
78 78
     </view>

+ 2
- 2
src/hotel/pages/landlord/landlord.jsx Vedi File

@@ -35,9 +35,9 @@ export default withLayout((props) => {
35 35
     })
36 36
   }, [])
37 37
 
38
-  const handleHotelChange = (current) => {    
38
+  const handleHotelChange = (current) => {
39 39
     getNowHotelManage(current.hotelId).then((res) => {
40
-      const {account: acc } = res
40
+      const { account: acc } = res
41 41
       setAccount(acc)
42 42
       setHotel(current)
43 43
       getAccountLogList(acc.accountId).then((res2) => {

+ 20
- 5
src/layouts/index.jsx Vedi File

@@ -2,14 +2,26 @@
2 2
 import { useMemo } from 'react'
3 3
 import Taro from '@tarojs/taro'
4 4
 import { useModel } from '@/store'
5
+import { getQueryString } from '@/utils'
5 6
 import useRouter from '@/utils/hooks/useRouter'
7
+import useTrackPage from '@/utils/hooks/useTrackPage'
6 8
 import Loading from './Loading'
7 9
 import { getPageBy, getIndexPageOf } from '../routes'
8 10
 
9 11
 export default (Child) => (props) => {
12
+  const location = Taro.getStorageSync('location')
13
+
10 14
   const { person } = useModel('person')
11 15
   const router = useRouter()
12 16
 
17
+  // 埋点页面访问
18
+  const trackPageData = {
19
+    page: router.path,
20
+    params: getQueryString(router.params),
21
+    location,
22
+  }
23
+  useTrackPage(trackPageData)
24
+
13 25
   // 确保人员信息到位
14 26
   const loading = !person?.personRole;
15 27
 
@@ -24,8 +36,9 @@ export default (Child) => (props) => {
24 36
     let indexPage = getIndexPageOf(personRole)
25 37
     if (!isNormalPerson) {
26 38
       indexPage = `${personRole}/${indexPage.page}`
27
-    }else{
28
-      indexPage='page/index/index'
39
+
40
+    } else {
41
+      indexPage = `pages/index/index`
29 42
     }
30 43
 
31 44
     const isMatched = isNormalPerson ?
@@ -33,9 +46,11 @@ export default (Child) => (props) => {
33 46
       !currentPage.root :
34 47
       // 其他角色, 应该是对应的
35 48
       currentPage.root === personRole
36
-    
49
+
50
+
37 51
     // 如果对应上, 就不跳转
38
-    return isMatched ? undefined : indexPage
52
+    return isMatched ? personRole : indexPage
53
+
39 54
   }, [router.path, person?.personRole])
40 55
 
41 56
   if (jumpPage) {
@@ -45,5 +60,5 @@ export default (Child) => (props) => {
45 60
     })
46 61
   }
47 62
 
48
-  return loading ? <Loading /> : <Child {...props} person={person} router={router} />
63
+  return loading ? <Loading /> : <Child {...props} person={person} router={router} location={location} />
49 64
 }

+ 12
- 12
src/pages/index/components/Card.js Vedi File

@@ -13,30 +13,30 @@ export default (props) => {
13 13
   const { item } = props
14 14
 
15 15
   const [isSaved, toggleSave] = useSave(item.isSaved, item.targetType, item.targetId)
16
-  const Detail=()=>{
17
-    if (item.targetType=='tourist') {
18
-      let location=item.lng+','+item.lat
19
-      Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}&distance=${(item.distance/1000).toFixed(2)}&location=${location}` });
16
+  const Detail = () => {
17
+    if (item.targetType == 'tourist') {
18
+      let location = item.lng + ',' + item.lat
19
+      Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}&distance=${(item.distance / 1000).toFixed(2)}&location=${location}` });
20 20
     }
21
-    else{
22
-      Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` });
21
+    else {
22
+      Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` })
23 23
     }
24 24
   }
25 25
   return (
26 26
     <view className='contentCard'>
27 27
       <view className='cardTop'>
28 28
         <image mode='widthFix' onClick={Detail} src={item.poster} className='cCardimg' />
29
-        <image className='lefttips' src={item.targetType==='tourist'?mjTip:msTip}/>
30
-        <image onClick={toggleSave} src={isSaved> 0?onlove:love} className='loveharde'></image>
29
+        <image className='lefttips' src={item.targetType === 'tourist' ? mjTip : msTip} />
30
+        <image onClick={toggleSave} src={isSaved > 0 ? onlove : love} className='loveharde'></image>
31 31
       </view>
32 32
       <view className='bContent' onClick={Detail}>
33
-        <view className='cCword'>{(item.title).toString().length>35?(item.title).substring(0, 35)+'...':(item.title)}</view>
33
+        <view className='cCword'>{(item.title).toString().length > 35 ? (item.title).substring(0, 35) + '...' : (item.title)}</view>
34 34
         <view className='cCleft'>
35 35
           <image src={location} className='cCicon'></image>
36
-          <view className='distance'><text>{(item.distance/1000).toFixed(2)}</text>公里</view>
36
+          <view className='distance'><text>{(item.distance / 1000).toFixed(2)}</text>公里</view>
37 37
         </view>
38
-        <view className='cCright'>          
39
-          <view className='price'><text className='money'>¥</text><text>{item.averagePrice/100}</text>/人</view>
38
+        <view className='cCright'>
39
+          <view className='price'><text className='money'>¥</text><text>{item.averagePrice / 100}</text>/人</view>
40 40
         </view>
41 41
       </view>
42 42
     </view>

+ 1
- 1
src/pages/index/index.config.js Vedi File

@@ -4,7 +4,7 @@ export default {
4 4
   styleIsolation: 'shared',
5 5
   usingComponents: {
6 6
     "mp-tabbar": "weui-miniprogram/tabbar/tabbar",
7
-    "mp-tabs": "../../../components/tabs/index",
7
+    "mp-tabs": "../../../components/tabs/index",
8 8
     "mp-checkbox-group": "weui-miniprogram/checkbox-group/checkbox-group",
9 9
     "mp-checkbox": "weui-miniprogram/checkbox/checkbox",
10 10
     "mp-cells": "weui-miniprogram/cells/cells",

+ 5
- 12
src/pages/index/tabs/Guide.jsx Vedi File

@@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from "react";
2 2
 import Taro from '@tarojs/taro'
3 3
 import MoreGuide from "@/components/MoreGuide";
4 4
 import Cards from '@/components/foodCards/foodCards.jsx'
5
-
5
+import BossCard from '@/components/BossCard'
6 6
 import image from '@/assets/icons/ProCard/8kb.jpg'
7 7
 import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
8 8
 import food from '@/assets/icons/ProCard/food.png'
@@ -32,8 +32,6 @@ export default (props) => {
32 32
   const { router, person } = props
33 33
   console.log("🚀 ~ file: Guide.jsx ~ line 34 ~ props", props)
34 34
   const { roomId, location, roomOrderId } = router.params
35
-  const [value, setVaule] = useState('已收藏')
36
-  const [imageSrc, setImageSrc] = useState(starOn)
37 35
   const [extend, setExtend] = useState([])
38 36
   const [ifroomId, setIfroomId] = useState('havenot')
39 37
   const [spackage, setPackage] = useState([])
@@ -76,7 +74,6 @@ export default (props) => {
76 74
 
77 75
 
78 76
 
79
-
80 77
   useEffect(() => {
81 78
     // 老板推荐的套餐
82 79
     getRecommendList({ location: location }).then((res) => {
@@ -151,14 +148,10 @@ export default (props) => {
151 148
 
152 149
 
153 150
 
154
-  const AddCollect = () => {
155
-    setImageSrc(starOff)
156
-    setVaule('加入收藏')
157 151
 
158
-  }
159
-  // onClick={handleClick}
160 152
   return (
161
-    <scroll-view scroll-y style='height: 77vh;' >
153
+    <scroll-view scroll-y style='height:100%;'  >
154
+
162 155
 
163 156
       <view className='Guide-Home-box'>
164 157
         {
@@ -220,7 +213,7 @@ export default (props) => {
220 213
                 </view>
221 214
                 <view className='MessageCard-content'>
222 215
                   <view className='MessageCard-name' >名称:{taRoomContent?.wifiName}</view>
223
-                  <view className='MessageCard-info' ><text className='MessageCard-name'>密码:</text>{taRoomContent?.wifiPassword}</view>
216
+                  <view className='MessageCard-info'  ><text className='MessageCard-name'>密码:</text>{taRoomContent?.wifiPassword}</view>
224 217
                 </view>
225 218
                 <view className='MessageCard-button'>
226 219
                   <image className='MessageCard-image' src={WiFi} />
@@ -249,7 +242,7 @@ export default (props) => {
249 242
             <text className='title-title-boss' >老板推荐好吃的</text>
250 243
           </view>
251 244
         </view>
252
-        {spackage?.map((item, index) => <Cards key={(index)} item={item} />)}
245
+        {spackage?.map((item, index) => <BossCard key={(index)} item={item} />)}
253 246
 
254 247
         {/* 卡片------------- */}
255 248
         {/* <view className='Guide-Content-box-two'>

+ 4
- 1
src/pages/index/tabs/GuideCss/style.less Vedi File

@@ -40,11 +40,14 @@
40 40
       margin-left: 30px;
41 41
 
42 42
       .MessageCard-name {
43
-        height: 30px;
43
+        height: 40px;
44 44
         font-size: 32px;
45 45
         font-weight: bold;
46 46
         color: #202020;
47 47
         line-height: 44px;
48
+        overflow: hidden;
49
+        text-overflow: ellipsis;
50
+        white-space: nowrap;
48 51
       }
49 52
       .MessageCard-info {
50 53
         height: 23px;

+ 5
- 4
src/pages/index/tabs/Mine.jsx Vedi File

@@ -16,10 +16,10 @@ import Rules from '@/assets/icons/UserCenter/Rules.png'
16 16
 import DefaultImage from '@/assets/icons/UserCenter/DefaultImage.png'
17 17
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
18 18
 import { PaysOrder, getMineOrder } from '@/services/payOrder' //创建订单
19
+import ToggleRole from '@/components/toggleRole/ToggleRole'
19 20
 
20 21
 import { useModel } from '@/store'
21 22
 import './MineCss/style.less'
22
-import  ToggleRole  from  '@/components/toggleRole/ToggleRole'
23 23
 
24 24
 
25 25
 
@@ -31,6 +31,7 @@ export default (props) => {
31 31
   const hasAvatar = !!person.avatar
32 32
   const [orderNum, setOrderNum] = useState([])
33 33
 
34
+  console.log('--------DefaultImage-----', DefaultImage)
34 35
 
35 36
   const ShowMoldeOn = () => {
36 37
     setShowCutover(true)
@@ -109,15 +110,15 @@ export default (props) => {
109 110
   //#endregion
110 111
 
111 112
   return !person.phone ? <AuthPage /> : (
112
-    <scroll-view scroll-y style='height: 77vh;' >
113
+    <scroll-view scroll-y style='height: 100%;' >
113 114
 
114 115
 
115 116
       <view className='User-box'>
116 117
         {/* 身份切换 */}
117
-        <ToggleRole showCutover={showCutover} onClose={onClose} />
118
+        <ToggleRole showCutover={showCutover} onClose={onClose} role='normal' />
118 119
         <view className='User-info'>
119 120
           <view className='User-photos-box'>
120
-            <image src={person.avatar || { DefaultImage }} className='User-photos' />
121
+            <image src={person.avatar || DefaultImage} className='User-photos' />
121 122
           </view>
122 123
           <view className='User-info-all'>
123 124
             <view onClick={handleGetUserProfile} className='User-name'>{hasAvatar ? person.nickName : '点击授权头像'}</view>

+ 15
- 0
src/services/track.js Vedi File

@@ -0,0 +1,15 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+ * 埋点页面访问
5
+ * @param {*} data 
6
+ * @returns 
7
+ */
8
+export const trackPage = (data) => request('/track/page', { data, method: 'post', skipError: true })
9
+
10
+/**
11
+ * 更新埋点访问
12
+ * @param {*} id 
13
+ * @returns 
14
+ */
15
+export const updateTrackPage = (id) => request(`/track/page/${id}`, { method: 'put', skipError: true })

+ 54
- 54
src/shop/components/ShopKeeper/shopKeeper.jsx Vedi File

@@ -1,5 +1,5 @@
1 1
 import { React, useState, useEffect, } from 'react'
2
-import Taro,{ useRouter } from '@tarojs/taro'
2
+import Taro, { useRouter } from '@tarojs/taro'
3 3
 import CustomNav from '@/components/CustomNav'
4 4
 import Popup from '@/components/Popup'
5 5
 import eyes from '@/assets/icons/shopKeeper/小眼睛.png'
@@ -14,7 +14,7 @@ import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
14 14
 import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
15 15
 import shopBossOFF from '@/assets/icons/UserCenter/shopBossOFF.png'
16 16
 import './shopKeeper.less'
17
-import  ToggleRole  from  '@/components/toggleRole/ToggleRole'
17
+import ToggleRole from '@/components/toggleRole/ToggleRole'
18 18
 
19 19
 
20 20
 export default (props) => {
@@ -27,7 +27,7 @@ export default (props) => {
27 27
       setActiveTab(tabJump - 0)
28 28
     }
29 29
   }, [tabJump])
30
-  
30
+
31 31
   const handleTabChange = (e) => {
32 32
     const { index } = e.detail
33 33
     setActiveTab(index)
@@ -37,8 +37,8 @@ export default (props) => {
37 37
       title: '未核销订单',
38 38
     },
39 39
     {
40
-      title: '已核销订单',  
41
-    },   
40
+      title: '已核销订单',
41
+    },
42 42
   ]
43 43
 
44 44
   const [showCutover, setShowCutover] = useState(false)
@@ -53,13 +53,13 @@ export default (props) => {
53 53
       <view>
54 54
         <CustomNav title='十公里' />
55 55
       </view>
56
-      <ToggleRole showCutover={showCutover} onClose={onClose} />
57
-  
56
+      <ToggleRole showCutover={showCutover} onClose={onClose} role='shop' />
57
+
58 58
       <view style={{ padding: '30rpx', height: '100%' }}>
59 59
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
60 60
           <view className='storexx'>
61 61
             <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
62
-            <view onClick={ShowMoldeOn}  className='User-info-cutover'>
62
+            <view onClick={ShowMoldeOn} className='User-info-cutover'>
63 63
               <image className='User-info-cutover-image' src={cutoverUser} />
64 64
             </view>
65 65
             <view className='tip'>(计算收入以核销为准)</view>
@@ -81,12 +81,12 @@ export default (props) => {
81 81
             </view>
82 82
           </view>
83 83
           <view className='search'>
84
-            <input className='searchInput'  />
84
+            <input className='searchInput' />
85 85
             <image className='searchicon' src={iconsearch} />
86 86
             <view className="searchword">搜索订单(输入客户手机号码)</view>
87 87
           </view>
88 88
           <view className='index-tabs'>
89
-          <mp-tabs
89
+            <mp-tabs
90 90
               tabClass='tabs-Unselected'
91 91
               swiperClass='tabs-swiper'
92 92
               activeClass='tabs-Selected'
@@ -96,10 +96,10 @@ export default (props) => {
96 96
               activeTab={activeTab}
97 97
             >
98 98
             </mp-tabs>
99
-            </view>
100
-            
99
+          </view>
100
+
101 101
           <view>
102
-            {activeTab === 0&&
102
+            {activeTab === 0 &&
103 103
               <view className='orderCard'>
104 104
                 <view style={{ overflow: 'hidden' }}>
105 105
                   <view className='orderId'>订单编号:<text>ABC123456789</text></view>
@@ -117,52 +117,52 @@ export default (props) => {
117 117
                   <view className='phone'>客户手机:<text>136****9434</text></view>
118 118
                   <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
119 119
                 </view>
120
-              </view>              
121
-            }
122
-            {activeTab === 1&&
123
-            <>
124
-            <view className='orderCard'>
125
-              <view style={{ overflow: 'hidden' }}>
126
-                <view className='orderId'>订单编号:<text>ABC123456789</text></view>
127
-                <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
128 120
               </view>
129
-              <view className='order'>
130
-                <image className='orderImg' src={ms} mode='aspectFit' />
131
-                <view className='orderRight'>
132
-                  <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
133
-                    新街口又开新店啦...</view>
134
-                  <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
135
-                  <view>已下单:等待客户上门就餐</view>
121
+            }
122
+            {activeTab === 1 &&
123
+              <>
124
+                <view className='orderCard'>
125
+                  <view style={{ overflow: 'hidden' }}>
126
+                    <view className='orderId'>订单编号:<text>ABC123456789</text></view>
127
+                    <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
128
+                  </view>
129
+                  <view className='order'>
130
+                    <image className='orderImg' src={ms} mode='aspectFit' />
131
+                    <view className='orderRight'>
132
+                      <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
133
+                        新街口又开新店啦...</view>
134
+                      <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
135
+                      <view>已下单:等待客户上门就餐</view>
136
+                    </view>
137
+                    <view className='line' />
138
+                    <view className='phone'>客户手机:<text>136****9434</text></view>
139
+                    <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
140
+                  </view>
136 141
                 </view>
137
-                <view className='line' />
138
-                <view className='phone'>客户手机:<text>136****9434</text></view>
139
-                <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
140
-              </view>
141
-            </view>
142
-            <view className='orderCard'>
143
-              <view style={{ overflow: 'hidden' }}>
144
-                <view className='orderId'>订单编号:<text>ABC123456789</text></view>
145
-                <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
146
-              </view>
147
-              <view className='order'>
148
-                <image className='orderImg' src={ms} mode='aspectFit' />
149
-                <view className='orderRight'>
150
-                  <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
151
-                    新街口又开新店啦...</view>
152
-                  <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
153
-                  <view>已下单:等待客户上门就餐</view>
142
+                <view className='orderCard'>
143
+                  <view style={{ overflow: 'hidden' }}>
144
+                    <view className='orderId'>订单编号:<text>ABC123456789</text></view>
145
+                    <view className='orderTime'>下单日期:<text>2021-06-22 12:35</text></view>
146
+                  </view>
147
+                  <view className='order'>
148
+                    <image className='orderImg' src={ms} mode='aspectFit' />
149
+                    <view className='orderRight'>
150
+                      <view className='foodName'>【SEOUL.创意韩国料理】火爆全南京,
151
+                        新街口又开新店啦...</view>
152
+                      <view className='price'>合计金额:¥<text style={{ fontSize: '24rpx' }}>88</text>元 <text className='pnum'>数量:<text>1</text>张</text> </view>
153
+                      <view>已下单:等待客户上门就餐</view>
154
+                    </view>
155
+                    <view className='line' />
156
+                    <view className='phone'>客户手机:<text>136****9434</text></view>
157
+                    <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
158
+                  </view>
154 159
                 </view>
155
-                <view className='line' />
156
-                <view className='phone'>客户手机:<text>136****9434</text></view>
157
-                <view className='tripTime'>客户行程日期:预计在<text>2021-06-21中下午10:30-16:30</text></view>
158
-              </view>
159
-            </view>
160
-          </>
160
+              </>
161 161
             }
162
-            </view>
162
+          </view>
163 163
           <view className='botton'>已经到底了~</view>
164
-        </scroll-view>        
165
-      </view>      
164
+        </scroll-view>
166 165
       </view>
166
+    </view>
167 167
   )
168 168
 }

+ 3
- 3
src/shop/components/Sparead/spreadMoney.jsx Vedi File

@@ -9,7 +9,7 @@ import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
9 9
 import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
10 10
 import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
11 11
 import './spreadMoney.less'
12
-import  ToggleRole  from  '@/components/toggleRole/ToggleRole'
12
+import ToggleRole from '@/components/toggleRole/ToggleRole'
13 13
 
14 14
 export default (props) => {
15 15
 
@@ -19,14 +19,14 @@ export default (props) => {
19 19
   }
20 20
   const onClose = () => {
21 21
     setShowCutover(false)
22
-    }
22
+  }
23 23
 
24 24
   return (
25 25
     <view>
26 26
       <view>
27 27
         <CustomNav title='十公里' />
28 28
       </view>
29
-      <ToggleRole showCutover={showCutover} onClose={onClose} />
29
+      <ToggleRole showCutover={showCutover} onClose={onClose} role='shop' />
30 30
       <view style={{ padding: '30rpx', height: '100%' }}>
31 31
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
32 32
           <view className='storexx'>

+ 25
- 0
src/utils/hooks/useTrackPage.js Vedi File

@@ -0,0 +1,25 @@
1
+
2
+import { useRef } from 'react'
3
+import { useDidShow, useDidHide, nextTick } from '@tarojs/taro'
4
+import { trackPage, updateTrackPage } from '@/services/track'
5
+
6
+export default (payload) => {
7
+  const payloadRef = useRef()
8
+  const resRef = useRef()
9
+  payloadRef.current = payload
10
+
11
+  useDidShow(() => {
12
+    trackPage(payloadRef.current).then((res) => {
13
+      resRef.current = res;
14
+    }).catch((err) => {
15
+      console.error(err);
16
+    })
17
+  })
18
+
19
+  useDidHide(() => {
20
+    if (resRef.current) {
21
+      updateTrackPage(resRef.current.trackId)
22
+      resRef.current = undefined
23
+    }
24
+  })
25
+}

+ 22
- 0
src/utils/index.js Vedi File

@@ -1,4 +1,9 @@
1 1
 
2
+/**
3
+ * queryString 转 object
4
+ * @param {*} queryStr 
5
+ * @returns 
6
+ */
2 7
 export function parseQueryString(queryStr) {
3 8
   if (!queryStr) {
4 9
     return;
@@ -20,3 +25,20 @@ export function parseQueryString(queryStr) {
20 25
   }, {});
21 26
   return params;
22 27
 }
28
+
29
+/**
30
+ * object 转 queryStr
31
+ * @param {*} params 
32
+ * @returns 
33
+ */
34
+export function getQueryString(params) {
35
+  if (!params) return ;
36
+
37
+  const keys = Object.keys(params)
38
+  const arr = keys.map((key) => {
39
+    const val = params[key]
40
+    return `${key}=${encodeURIComponent(val)}`
41
+  })
42
+
43
+  return arr.join('&')
44
+}

+ 17
- 1
src/utils/preFetchData.js Vedi File

@@ -5,7 +5,23 @@ export default () => {
5 5
   const personId = Taro.getStorageSync('personId')
6 6
   const openid = Taro.getStorageSync('openid')
7 7
 
8
-  return Promise.resolve({ personId, openid })
8
+  return new Promise((resolve, reject) => {
9
+    Taro.getLocation({
10
+      success(res) {
11
+        const location = `${res.longitude},${res.latitude}`
12
+        Taro.setStorageSync('location', location)
13
+        resolve({
14
+          location,
15
+          personId,
16
+          openid
17
+        })
18
+      },
19
+      fail(err) {
20
+        console.error(err)
21
+        reject(err)
22
+      }
23
+    })
24
+  })
9 25
 
10 26
   // return new Promise((resolve, reject) => {
11 27
   //   Taro.getBackgroundFetchData({

+ 2
- 13
src/utils/request.js Vedi File

@@ -1,23 +1,12 @@
1 1
 
2 2
 import Taro from '@tarojs/taro'
3
+import { getQueryString } from '.'
3 4
 
4 5
 const logger = Taro.getRealtimeLogManager()
5 6
 
6
-const object2QueryString = (params) => {
7
-  if (!params) return ;
8
-
9
-  const keys = Object.keys(params)
10
-  const arr = keys.map((key) => {
11
-    const val = params[key]
12
-    return `${key}=${encodeURIComponent(val)}`
13
-  })
14
-
15
-  return arr.join('&')
16
-}
17
-
18 7
 export default (url, options) => {
19 8
   const { params, skipError, header, ...leftOptions } = options || {}
20
-  const queryStr = object2QueryString(params)
9
+  const queryStr = getQueryString(params)
21 10
 
22 11
   const urlWithParams = queryStr ? `${url}?${queryStr}` : url;
23 12
   const nwUrl = `${HOST}/api/wx${urlWithParams}`