Browse Source

店铺景点提示

吃个甘蔗嚼一年 3 years ago
parent
commit
76316ec599

+ 1
- 1
src/components/add-tips/index.wxss View File

@@ -6,7 +6,7 @@
6 6
   justify-content: flex-end;
7 7
   align-items: flex-end;
8 8
   flex-direction: column;
9
-  width: 600px;
9
+  /* width: 600px; */
10 10
 }
11 11
 .arrow {
12 12
   width: 0;

+ 72
- 0
src/components/add-tipsFood/index.js View File

@@ -0,0 +1,72 @@
1
+
2
+const STORAGE_KEY = 'PLUG-ADD-MYAPP-KEY'
3
+Component({
4
+  properties: {
5
+    name: {
6
+      type: String,
7
+      value: '测试'
8
+    },
9
+    duration: {
10
+      type: Number,
11
+      value: 10
12
+    },
13
+    delay: {
14
+      type: Number,
15
+      value: 2
16
+    },
17
+    logo: {
18
+      type: String,
19
+      value: 'https://cdn.blog.makergyt.com/mini/assets/component-add_tips.png'
20
+    },
21
+    custom: {
22
+      type: Boolean,
23
+      value: false
24
+    }
25
+  },
26
+  lifetimes: {
27
+    attached: function () {
28
+      if (wx.getStorageSync(STORAGE_KEY)) return;
29
+      //取胶囊位置
30
+      let rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null
31
+      //取屏幕宽度
32
+      let { screenWidth } = wx.getSystemInfoSync()
33
+      this.setData({
34
+        navbarHeight: rect.bottom,
35
+        arrowR: screenWidth - rect.right + rect.width * 0.5 / 1 - 20,
36
+        bodyR: screenWidth - rect.right
37
+      })
38
+      this.startTimer = setTimeout(() => {
39
+        this.setData({
40
+          SHOW_TOP: true
41
+        })
42
+      }, this.data.delay * 1000)
43
+      this.duraTimer = setTimeout(() => {
44
+        this.shrink();
45
+      }, (this.data.duration + this.data.delay) * 1000)
46
+    },
47
+    detached: function () {
48
+      if (this.startTimer) clearTimeout(this.startTimer)
49
+      if (this.duraTimer) clearTimeout(this.duraTimer)
50
+    },
51
+  },
52
+  data: {
53
+    SHOW_TOP: false
54
+  },
55
+  methods: {
56
+    hiddenButton: function () {
57
+      // wx.setStorageSync(STORAGE_KEY, true)
58
+      this.shrink()
59
+    },
60
+    shrink: function () {
61
+      this.animate('#add-tips', [
62
+        { scale: [1, 1] },
63
+        { scale: [0, 0], ease: 'ease', transformOrigin: `calc(600rpx - ${this.data.arrowR}px) 2%` }
64
+      ], 500, function () {
65
+        this.setData({
66
+          SHOW_TOP: false
67
+        })
68
+      }.bind(this))
69
+    }
70
+  }
71
+})
72
+

+ 3
- 0
src/components/add-tipsFood/index.json View File

@@ -0,0 +1,3 @@
1
+{
2
+  "component": true
3
+}

+ 7
- 0
src/components/add-tipsFood/index.wxml View File

@@ -0,0 +1,7 @@
1
+<view class="box" wx:if="{{SHOW_TOP}}" style="top:{{custom?navbarHeight:0}}px;" id="add-tips">
2
+  <view class='arrow' style="margin-right:{{arrowR}}vw;"></view>
3
+  <view class='body' bindtap='hiddenButton' style="margin-right:{{bodyR}}px;">
4
+    <image src="{{logo}}" class="logo"></image>
5
+    <view class="tips">更多美食优惠点这里</view>
6
+  </view>
7
+</view>

+ 53
- 0
src/components/add-tipsFood/index.wxss View File

@@ -0,0 +1,53 @@
1
+.box {
2
+  position: absolute;
3
+  left: 0;
4
+  z-index: 999;
5
+  display: flex;
6
+  justify-content: flex-end;
7
+  align-items: flex-end;
8
+  flex-direction: column;
9
+  margin-left: 20px;
10
+}
11
+.arrow {
12
+  width: 0;
13
+  height: 0;
14
+  border-width: 18px;
15
+  border-style: solid;
16
+  border-color: transparent transparent rgba(252, 156, 87, 0.9) transparent;
17
+}
18
+.body {
19
+  background-color: rgba(252, 156, 87, 0.9);
20
+  border-radius: 15rpx;
21
+  display: -webkit-flex;
22
+  display: -ms-flexbox;
23
+  display: flex;
24
+  -webkit-align-items: center;
25
+  -ms-flex-align: center;
26
+  align-items: center;
27
+  -webkit-justify-content: center;
28
+  -ms-flex-pack: center;
29
+  justify-content: center;
30
+  padding: 20rpx 20rpx;
31
+  width: 318px;
32
+  height: 20px;
33
+}
34
+.tips {
35
+  flex: 1;
36
+  color: #fff;
37
+  font-size: 30px;
38
+  /* font-weight: 700; */
39
+}
40
+.logo {
41
+  height: 35px;
42
+  width: 35px;
43
+  border-radius: 8px;
44
+  margin-right: 10px;
45
+}
46
+
47
+.button-view {
48
+  color: #04b040;
49
+  text-align: center;
50
+  font-size: 20px;
51
+  /* line-height: 22px; */
52
+  display: initial;
53
+}

+ 0
- 2
src/pages/MineUserAll/AllOrder/index.jsx View File

@@ -43,12 +43,10 @@ export default withLayout((props) => {
43 43
 
44 44
 
45 45
   const handleTabClick = (index) => {
46
-    console.log('------tab-----event--------', index)
47 46
     setActiveTab(index)
48 47
 
49 48
   }
50 49
 
51
-  console.log('------setActiveTab--------', activeTab)
52 50
 
53 51
   return (
54 52
     <view className='page-index box-content'>

+ 2
- 0
src/pages/details/foodDetails/foodDetails.config.js View File

@@ -5,5 +5,7 @@ export default {
5 5
   enableShareAppMessage: true,
6 6
   usingComponents: {
7 7
     "mp-dialog": "weui-miniprogram/dialog/dialog",
8
+    "add-tipsFood": "../../../components/add-tipsFood/index"
9
+
8 10
   }
9 11
 }

+ 26
- 3
src/pages/details/foodDetails/foodDetails.jsx View File

@@ -28,12 +28,15 @@ import weibaozan from "@/assets/icons/housemantj/unLike.png";
28 28
 import useSave from "@/utils/hooks/useSave";
29 29
 import useLike from "@/utils/hooks/useLike";
30 30
 import Extend from "../components/Extend/extend";
31
+import logo from "./laba.png";
32
+
31 33
 import "./foodDetails.less";
32 34
 
33 35
 export default withLayout((props) => {
34 36
   const { router, person, location } = props;
35 37
   const { id, subOrderId, scene } = props.router.params;
36 38
 
39
+
37 40
   useEffect(() => {
38 41
     if (id && (scene || subOrderId)) {
39 42
       getVerifyTargetList({
@@ -65,6 +68,21 @@ export default withLayout((props) => {
65 68
   const [isSaved, toggleSave] = useSave(detail.isSaved, "shop", id);
66 69
   const [isLike, toggleLike] = useLike(detail.isLike, "shop", id);
67 70
 
71
+  //引导显隐
72
+  const [guidance, setGuidance] = useState('shareOff')
73
+  //引导显隐
74
+
75
+  useEffect(() => {
76
+    if (router.params.scene || router.params.enterType === "share") {
77
+      setGuidance('shareOn')
78
+    }
79
+  }, [router.params.enterType, router.params.scene])
80
+
81
+
82
+
83
+
84
+
85
+
68 86
   //本店指南
69 87
   const [extend, setExtend] = useState([]);
70 88
 
@@ -80,7 +98,6 @@ export default withLayout((props) => {
80 98
   const log = useRef("");
81 99
   const lat = useRef("");
82 100
 
83
-
84 101
   const handlePhone = () => {
85 102
     if (!detail.phone) {
86 103
       Taro.showToast({
@@ -120,15 +137,21 @@ export default withLayout((props) => {
120 137
 
121 138
   // 分享
122 139
   useShareAppMessage(() => {
140
+    // setShareAppMessage('shareOff')
123 141
     return {
124 142
       title: detail.shopName,
125
-      path: `/pages/details/foodDetails/foodDetails?id=${id}&subOrderId=${subOrderId}`,
143
+      path: `/pages/details/foodDetails/foodDetails?id=${id}&subOrderId=${subOrderId}&enterType=share`,
126 144
       imageUrl: detail.poster,
145
+
127 146
     };
128 147
   });
129
- const [isScroll,setScroll]=useState(true)
148
+  const [isScroll, setScroll] = useState(true)
130 149
   return (
131 150
     <view className='page-index'>
151
+      {
152
+        guidance === 'shareOn' && (<add-tipsFood logo={logo} custom duration={-1} />)
153
+      }
154
+      {/* <add-tipsFood custom duration={-1} /> */}
132 155
       <view className='index-navbar'>
133 156
         <CustomNav title='十公里' />
134 157
       </view>

BIN
src/pages/details/foodDetails/laba.png View File


+ 1
- 0
src/pages/index/index.jsx View File

@@ -22,6 +22,7 @@ const tips = 'https://yz-shigongli.oss-cn-shanghai.aliyuncs.com/images/sgl-v2-ti
22 22
 
23 23
 export default withLayout((props) => {
24 24
   const { router, person, location } = props
25
+  console.log("🚀 ~ file: index.jsx ~ line 25 ~ withLayout ~ router", router)
25 26
   let { roomId, roomOrderId } = router.params
26 27
   const { roomId: rid } = useModel('hotel')
27 28