浏览代码

控制分享返回按钮&鱼市通知页面

viczhq 4 月之前
父节点
当前提交
32cbf43d2e

+ 14 - 7
project.private.config.json

@@ -10,6 +10,20 @@
10
     "miniprogram": {
10
     "miniprogram": {
11
       "list": [
11
       "list": [
12
         {
12
         {
13
+          "name": "pages/mineSub/inform/index",
14
+          "pathName": "pages/mineSub/inform/index",
15
+          "query": "",
16
+          "launchMode": "default",
17
+          "scene": null
18
+        },
19
+        {
20
+          "name": "pages/indexSub/activity/index",
21
+          "pathName": "pages/indexSub/activity/index",
22
+          "query": "isShare=true",
23
+          "launchMode": "default",
24
+          "scene": null
25
+        },
26
+        {
13
           "name": "pages/mineSub/explain/index",
27
           "name": "pages/mineSub/explain/index",
14
           "pathName": "pages/mineSub/explain/index",
28
           "pathName": "pages/mineSub/explain/index",
15
           "query": "",
29
           "query": "",
@@ -52,13 +66,6 @@
52
           "scene": null
66
           "scene": null
53
         },
67
         },
54
         {
68
         {
55
-          "name": "pages/indexSub/activity/index",
56
-          "pathName": "pages/indexSub/activity/index",
57
-          "query": "",
58
-          "launchMode": "default",
59
-          "scene": null
60
-        },
61
-        {
62
           "name": "pages/indexSub/seckillIndex/index",
69
           "name": "pages/indexSub/seckillIndex/index",
63
           "pathName": "pages/indexSub/seckillIndex/index",
70
           "pathName": "pages/indexSub/seckillIndex/index",
64
           "query": "id=124&title=%E8%82%AF%E9%BA%A6%E5%BF%85%E6%BD%AE%E8%B6%B4&isBanner=true",
71
           "query": "id=124&title=%E8%82%AF%E9%BA%A6%E5%BF%85%E6%BD%AE%E8%B6%B4&isBanner=true",

+ 2 - 1
src/app.config.js

@@ -39,7 +39,8 @@ export default defineAppConfig({
39
       pages: [
39
       pages: [
40
         "infoEdit/index",
40
         "infoEdit/index",
41
         "userSpecification/index",
41
         "userSpecification/index",
42
-        "explain/index"
42
+        "explain/index",
43
+        "inform/index"
43
       ]
44
       ]
44
     },
45
     },
45
     {
46
     {

+ 22 - 4
src/pages/indexSub/activity/index.jsx

@@ -3,6 +3,7 @@ import { View, Image, Text, ScrollView } from "@tarojs/components";
3
 import { AtTabs, AtActivityIndicator } from "taro-ui";
3
 import { AtTabs, AtActivityIndicator } from "taro-ui";
4
 import "./index.less";
4
 import "./index.less";
5
 import Taro from "@tarojs/taro";
5
 import Taro from "@tarojs/taro";
6
+import { getShareSwitch } from "../../../service";
6
 import {
7
 import {
7
   getNewYearTab,
8
   getNewYearTab,
8
   getNewYearProductList,
9
   getNewYearProductList,
@@ -17,6 +18,7 @@ export default class Index extends Component {
17
     tabList: [], //tab列表
18
     tabList: [], //tab列表
18
     productList: [], //商品列表
19
     productList: [], //商品列表
19
     isShare: false, // 是否是分享跳转
20
     isShare: false, // 是否是分享跳转
21
+    shareSwitch: 1, //分享返回开关
20
     isShowBack: false, // 是否显示返回按钮
22
     isShowBack: false, // 是否显示返回按钮
21
   };
23
   };
22
   componentDidMount() {
24
   componentDidMount() {
@@ -29,8 +31,8 @@ export default class Index extends Component {
29
         shareUserId: shareUserId || "",
31
         shareUserId: shareUserId || "",
30
       },
32
       },
31
       () => {
33
       () => {
32
-        if (isShare) {
33
-          Taro.hideHomeButton(); //隐藏返回首页
34
+        if (this.state.isShare) {
35
+          this.getShareSwitch(); //获取分享开关
34
         }
36
         }
35
         this.getTab(); //获取tab
37
         this.getTab(); //获取tab
36
         handleLog({
38
         handleLog({
@@ -45,6 +47,15 @@ export default class Index extends Component {
45
       }
47
       }
46
     );
48
     );
47
   }
49
   }
50
+  // 获取分享开关
51
+  getShareSwitch = async () => {
52
+    const res = await getShareSwitch({
53
+      key: "share_switch",
54
+    });
55
+    this.setState({
56
+      shareSwitch: Number(res.value),
57
+    });
58
+  };
48
   // 获取tab
59
   // 获取tab
49
   getTab = async () => {
60
   getTab = async () => {
50
     const res = await getNewYearTab();
61
     const res = await getNewYearTab();
@@ -77,7 +88,14 @@ export default class Index extends Component {
77
   };
88
   };
78
   // 返回
89
   // 返回
79
   handleBack = () => {
90
   handleBack = () => {
80
-    Taro.navigateBack();
91
+    const pages = Taro.getCurrentPages();
92
+    if (pages.length > 1) {
93
+      Taro.navigateBack();
94
+    } else {
95
+      Taro.switchTab({
96
+        url: "/pages/index/index",
97
+      });
98
+    }
81
   };
99
   };
82
   // 专场点击
100
   // 专场点击
83
   siteClick = (title, index) => {
101
   siteClick = (title, index) => {
@@ -134,7 +152,7 @@ export default class Index extends Component {
134
     return (
152
     return (
135
       <View className="index">
153
       <View className="index">
136
         {/* 返回按钮 */}
154
         {/* 返回按钮 */}
137
-        {!this.state.isShare && (
155
+        {this.state.shareSwitch == 1 && (
138
           <Image
156
           <Image
139
             onClick={this.handleBack}
157
             onClick={this.handleBack}
140
             style={{ top: Taro.navigationBarHeight + "px" }}
158
             style={{ top: Taro.navigationBarHeight + "px" }}

+ 20 - 4
src/pages/indexSub/productDetail/index.jsx

@@ -7,6 +7,7 @@ import {
7
   getProductPromotion,
7
   getProductPromotion,
8
   getShareJump,
8
   getShareJump,
9
   bindShareJump,
9
   bindShareJump,
10
+  getShareSwitch,
10
 } from "../../../service";
11
 } from "../../../service";
11
 import { handleLog } from "../../../common/track";
12
 import { handleLog } from "../../../common/track";
12
 import { isDebounce } from "../../../common/debounce";
13
 import { isDebounce } from "../../../common/debounce";
@@ -35,6 +36,7 @@ export default class Index extends Component {
35
     shareTitle: "", //分享标题
36
     shareTitle: "", //分享标题
36
     shareUserId: "", //分享用户id
37
     shareUserId: "", //分享用户id
37
     isShowBack: false, //是否显示返回
38
     isShowBack: false, //是否显示返回
39
+    shareSwitch: 1, //分享返回开关
38
   };
40
   };
39
   // 获取产品详情的方法
41
   // 获取产品详情的方法
40
   fetchProductDetails = async (id) => {
42
   fetchProductDetails = async (id) => {
@@ -57,7 +59,7 @@ export default class Index extends Component {
57
     const res = await getProductPromotion({
59
     const res = await getProductPromotion({
58
       goods_id: [this.state.id],
60
       goods_id: [this.state.id],
59
       item_id: [this.state.productDetail.item_id],
61
       item_id: [this.state.productDetail.item_id],
60
-      material_type:1,//1:自购省,2:红包购买
62
+      material_type: 1, //1:自购省,2:红包购买
61
     });
63
     });
62
     this.setState({
64
     this.setState({
63
       productPromotion:
65
       productPromotion:
@@ -78,9 +80,9 @@ export default class Index extends Component {
78
       tagTitle,
80
       tagTitle,
79
       shareType,
81
       shareType,
80
       isShowBack,
82
       isShowBack,
81
-      share_unique_value
83
+      share_unique_value,
82
     } = Taro.getCurrentInstance().router.params;
84
     } = Taro.getCurrentInstance().router.params;
83
-    shareJump = shareJump || share_unique_value
85
+    shareJump = shareJump || share_unique_value;
84
     let session_key = Taro.getStorageSync("session_key");
86
     let session_key = Taro.getStorageSync("session_key");
85
     let userInfo = Taro.getStorageSync("userInfo");
87
     let userInfo = Taro.getStorageSync("userInfo");
86
     let isShowSign = Taro.getStorageSync("isShowSign");
88
     let isShowSign = Taro.getStorageSync("isShowSign");
@@ -94,6 +96,11 @@ export default class Index extends Component {
94
         isShowBack: isShowBack === "true" || false,
96
         isShowBack: isShowBack === "true" || false,
95
       },
97
       },
96
       () => {
98
       () => {
99
+        // 分享页面才判断是否展示
100
+        if (this.state.isShare) {
101
+          // 获取分享开关
102
+          this.getShareSwitch();
103
+        }
97
         // 获取分享跳转标识
104
         // 获取分享跳转标识
98
         shareJump &&
105
         shareJump &&
99
           Taro.setStorage({
106
           Taro.setStorage({
@@ -134,6 +141,15 @@ export default class Index extends Component {
134
       }
141
       }
135
     );
142
     );
136
   }
143
   }
144
+  // 获取分享开关
145
+  getShareSwitch = async () => {
146
+    const res = await getShareSwitch({
147
+      key: "share_switch",
148
+    });
149
+    this.setState({
150
+      shareSwitch: Number(res.value),
151
+    });
152
+  };
137
   // 复制商品编号
153
   // 复制商品编号
138
   handleCopy = (text) => {
154
   handleCopy = (text) => {
139
     Taro.setClipboardData({
155
     Taro.setClipboardData({
@@ -239,7 +255,7 @@ export default class Index extends Component {
239
         className="index"
255
         className="index"
240
         style={{ paddingTop: Taro.navigationBarHeight + "px" }}
256
         style={{ paddingTop: Taro.navigationBarHeight + "px" }}
241
       >
257
       >
242
-        {!this.state.isShare && (
258
+        {this.state.shareSwitch == 1 && (
243
           <View className="back-btn" onClick={this.handleBack}>
259
           <View className="back-btn" onClick={this.handleBack}>
244
             <AtIcon value="chevron-left" size="24" color="#999999"></AtIcon>
260
             <AtIcon value="chevron-left" size="24" color="#999999"></AtIcon>
245
           </View>
261
           </View>

+ 15 - 1
src/pages/indexSub/seckillIndex/index.jsx

@@ -8,6 +8,7 @@ import {
8
   getShareJump,
8
   getShareJump,
9
   bindShareJump,
9
   bindShareJump,
10
   getFishMarketTags,
10
   getFishMarketTags,
11
+  getShareSwitch,
11
 } from "../../../service";
12
 } from "../../../service";
12
 import { handleLog } from "../../../common/track";
13
 import { handleLog } from "../../../common/track";
13
 import { getShareContent } from "../../../common/share";
14
 import { getShareContent } from "../../../common/share";
@@ -30,6 +31,7 @@ export default class Index extends Component {
30
     current: 0, // 当前选中的tab索引
31
     current: 0, // 当前选中的tab索引
31
     tabList: [], // 标签列表
32
     tabList: [], // 标签列表
32
     isTabFixed: false, // 添加新的状态来控制tab是否固定
33
     isTabFixed: false, // 添加新的状态来控制tab是否固定
34
+    shareSwitch: 1, //分享返回开关
33
   };
35
   };
34
   componentDidMount() {
36
   componentDidMount() {
35
     const {
37
     const {
@@ -60,7 +62,7 @@ export default class Index extends Component {
60
           title: this.state.title || "鱼市",
62
           title: this.state.title || "鱼市",
61
         });
63
         });
62
         if (isShare) {
64
         if (isShare) {
63
-          Taro.hideHomeButton(); //隐藏返回首页
65
+          this.getShareSwitch(); //获取分享开关
64
         }
66
         }
65
         handleLog({
67
         handleLog({
66
           event_type: isDirect
68
           event_type: isDirect
@@ -98,6 +100,18 @@ export default class Index extends Component {
98
       }
100
       }
99
     );
101
     );
100
   }
102
   }
103
+  // 获取分享开关
104
+  getShareSwitch = async () => {
105
+    const res = await getShareSwitch({
106
+      key: "share_switch",
107
+    });
108
+    if (res.value == 0) {
109
+      Taro.hideHomeButton(); //隐藏返回首页
110
+    }
111
+    this.setState({
112
+      shareSwitch: Number(res.value),
113
+    });
114
+  };
101
   // 获取标签
115
   // 获取标签
102
   getFishMarketTags = async () => {
116
   getFishMarketTags = async () => {
103
     let res = await getFishMarketTags({
117
     let res = await getFishMarketTags({

+ 15 - 2
src/pages/memberSub/storeManagement/index.jsx

@@ -9,6 +9,7 @@ import {
9
   getShareShopProductList,
9
   getShareShopProductList,
10
   getShareJump,
10
   getShareJump,
11
   bindShareJump,
11
   bindShareJump,
12
+  getShareSwitch,
12
 } from "../../../service";
13
 } from "../../../service";
13
 import storeManagement from "../../../images/storeManagement/storeManagement.png";
14
 import storeManagement from "../../../images/storeManagement/storeManagement.png";
14
 import storeManagementIcon from "../../../images/storeManagement/storeManagementIcon.png";
15
 import storeManagementIcon from "../../../images/storeManagement/storeManagementIcon.png";
@@ -27,6 +28,7 @@ export default class Index extends Component {
27
     shopId: "", // 店铺id
28
     shopId: "", // 店铺id
28
     isNoMore: false, // 是否没有更多
29
     isNoMore: false, // 是否没有更多
29
     isShowBack: false, // 是否显示返回
30
     isShowBack: false, // 是否显示返回
31
+    shareSwitch: 1, //分享返回开关
30
   };
32
   };
31
   // 获取店铺详情
33
   // 获取店铺详情
32
   getMyShopDetail = async () => {
34
   getMyShopDetail = async () => {
@@ -82,8 +84,7 @@ export default class Index extends Component {
82
         this.getMyShopDetail(); //获取店铺详情
84
         this.getMyShopDetail(); //获取店铺详情
83
         this.getMyShopList(true); //获取店铺数据
85
         this.getMyShopList(true); //获取店铺数据
84
         if (isShare) {
86
         if (isShare) {
85
-          // 分享隐藏返回首页
86
-          Taro.hideHomeButton();
87
+          this.getShareSwitch(); //获取分享开关
87
         }
88
         }
88
         // 获取分享跳转标识
89
         // 获取分享跳转标识
89
         shareJump &&
90
         shareJump &&
@@ -102,6 +103,18 @@ export default class Index extends Component {
102
       }
103
       }
103
     );
104
     );
104
   }
105
   }
106
+  // 获取分享开关
107
+  getShareSwitch = async () => {
108
+    const res = await getShareSwitch({
109
+      key: "share_switch",
110
+    });
111
+    if (res.value == 0) {
112
+      Taro.hideHomeButton();
113
+    }
114
+    this.setState({
115
+      shareSwitch: Number(res.value),
116
+    });
117
+  };
105
   // 绑定分享跳转标识
118
   // 绑定分享跳转标识
106
   bindShareJump = async () => {
119
   bindShareJump = async () => {
107
     let shareJump = Taro.getStorageSync("shareJump");
120
     let shareJump = Taro.getStorageSync("shareJump");

+ 3 - 0
src/pages/mineSub/inform/index.config.js

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '通知'
3
+})

+ 30 - 0
src/pages/mineSub/inform/index.jsx

@@ -0,0 +1,30 @@
1
+import { Component } from 'react'
2
+import { View, RichText } from '@tarojs/components'
3
+import './index.less'
4
+import { getUserAgreement } from '../../../service'
5
+export default class Index extends Component {
6
+  state = {
7
+    agreement: ''
8
+  }
9
+  componentDidMount () { 
10
+    this.getUserAgreement()
11
+  }
12
+  // 获取用户协议
13
+  getUserAgreement = async () => {
14
+    const res = await getUserAgreement({
15
+      type:5
16
+    })
17
+    // 替换图片样式
18
+    res.content = res.content.replace(/<img/g, '<img style="max-width: 100%; width: 100%; height: auto; display: block; margin: 0 auto;"')
19
+    this.setState({
20
+      agreement: res.content
21
+    })
22
+  }
23
+  render () {
24
+    return (
25
+      <View className='index'>
26
+        {this.state.agreement && <RichText nodes={this.state.agreement} />}
27
+      </View>
28
+    )
29
+  }
30
+}

+ 6 - 0
src/pages/mineSub/inform/index.less

@@ -0,0 +1,6 @@
1
+.index {
2
+  padding: 20rpx;
3
+  background-color: #f5f5f5;
4
+  min-height: 100vh;
5
+  box-sizing: border-box;
6
+}

+ 8 - 1
src/service/index.js

@@ -229,7 +229,14 @@ export const addLog = data =>
229
     method: 'POST',
229
     method: 'POST',
230
     data,
230
     data,
231
   })
231
   })
232
-
232
+// ----------------------------------------字典
233
+// 分享开关接口(0关闭,1打开)
234
+export const getShareSwitch = data =>
235
+  Request({
236
+    url: '/user/get_app_dict_list',
237
+    method: 'POST',
238
+    data,
239
+  })
233
 
240
 
234
 
241
 
235
 
242