Jelajahi Sumber

add: 屏蔽获取用户地理位置和微信地址导入的功能

joe 2 tahun lalu
induk
melakukan
5d70bb6528

+ 2 - 2
view/xcx/pages/goods_details_store/index.js

@@ -55,14 +55,14 @@ Page({
     /**
      * 授权地址
      */
-    selfLocation: function () {
+    // selfLocation: function () {
         // const that = this;
         // wxh.selfLocation().then(res => {
         //     that.getList(res.longitude, res.latitude);
         // }).catch(() => {
         //     that.getList();
         // });
-    },
+    // },
 
     /**
      * 选中门店

+ 66 - 0
view/xcx/pages/login/login.js

@@ -0,0 +1,66 @@
+// pages/login/login.js
+Page({
+
+  /**
+   * Page initial data
+   */
+  data: {
+
+  },
+
+  /**
+   * Lifecycle function--Called when page load
+   */
+  onLoad(options) {
+
+  },
+
+  /**
+   * Lifecycle function--Called when page is initially rendered
+   */
+  onReady() {
+
+  },
+
+  /**
+   * Lifecycle function--Called when page show
+   */
+  onShow() {
+
+  },
+
+  /**
+   * Lifecycle function--Called when page hide
+   */
+  onHide() {
+
+  },
+
+  /**
+   * Lifecycle function--Called when page unload
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * Page event handler function--Called when user drop down
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * Called when page reach bottom
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * Called when user click on the top right corner to share
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
view/xcx/pages/login/login.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 2 - 0
view/xcx/pages/login/login.wxml

@@ -0,0 +1,2 @@
+<!--pages/login/login.wxml-->
+<text>pages/login/login.wxml</text>

+ 1 - 0
view/xcx/pages/login/login.wxss

@@ -0,0 +1 @@
+/* pages/login/login.wxss */

+ 79 - 76
view/xcx/pages/user_address/index.js

@@ -159,82 +159,85 @@ Page({
 	},
 
 	getWxAddress: function () {
-		var that = this;
-		wx.authorize({
-			scope: 'scope.address',
-			success: function (res) {
-				wx.chooseAddress({
-					success: function (res) {
-						var addressP = {};
-						addressP.province = res.provinceName;
-						addressP.city = res.cityName;
-						addressP.district = res.countyName;
-						editAddress({
-							address: addressP,
-							is_default: 1,
-							real_name: res.userName,
-							post_code: res.postalCode,
-							phone: res.telNumber,
-							detail: res.detailInfo,
-							id: 0,
-							type: 1,
-						}).then(res => {
-							setTimeout(function () {
-								if (that.data.cartId) {
-									var cartId = that.data.cartId;
-									var pinkId = that.data.pinkId;
-									var couponId = that.data.couponId;
-									that.setData({
-										cartId: '',
-										pinkId: '',
-										couponId: ''
-									})
-									wx.navigateTo({
-										url: '/pages/order_confirm/index?cartId=' + cartId + '&addressId=' + (that.data.id ? that.data.id : res.data.id) + '&pinkId=' + pinkId + '&couponId=' + couponId
-									});
-								} else {
-									wx.navigateBack({
-										delta: 1
-									});
-								}
-							}, 1000);
-							return app.Tips({
-								title: "添加成功",
-								icon: 'success'
-							});
-						}).catch(err => {
-							return app.Tips({
-								title: err
-							});
-						});
-					},
-					fail: function (res) {
-						if (res.errMsg == 'chooseAddress:cancel') return app.Tips({
-							title: '取消选择'
-						});
-					},
-				})
-			},
-			fail: function (res) {
-				wx.showModal({
-					title: '您已拒绝导入微信地址权限',
-					content: '是否进入权限管理,调整授权?',
-					success(res) {
-						if (res.confirm) {
-							wx.openSetting({
-								success: function (res) {
-									console.log(res.authSetting)
-								}
-							});
-						} else if (res.cancel) {
-							return app.Tips({
-								title: '已取消!'
-							});
-						}
-					}
-				})
-			},
-		})
+    wx.showToast({
+      title: '敬请期待',
+    })
+		// var that = this;
+		// wx.authorize({
+		// 	scope: 'scope.address',
+		// 	success: function (res) {
+		// 		wx.chooseAddress({
+		// 			success: function (res) {
+		// 				var addressP = {};
+		// 				addressP.province = res.provinceName;
+		// 				addressP.city = res.cityName;
+		// 				addressP.district = res.countyName;
+		// 				editAddress({
+		// 					address: addressP,
+		// 					is_default: 1,
+		// 					real_name: res.userName,
+		// 					post_code: res.postalCode,
+		// 					phone: res.telNumber,
+		// 					detail: res.detailInfo,
+		// 					id: 0,
+		// 					type: 1,
+		// 				}).then(res => {
+		// 					setTimeout(function () {
+		// 						if (that.data.cartId) {
+		// 							var cartId = that.data.cartId;
+		// 							var pinkId = that.data.pinkId;
+		// 							var couponId = that.data.couponId;
+		// 							that.setData({
+		// 								cartId: '',
+		// 								pinkId: '',
+		// 								couponId: ''
+		// 							})
+		// 							wx.navigateTo({
+		// 								url: '/pages/order_confirm/index?cartId=' + cartId + '&addressId=' + (that.data.id ? that.data.id : res.data.id) + '&pinkId=' + pinkId + '&couponId=' + couponId
+		// 							});
+		// 						} else {
+		// 							wx.navigateBack({
+		// 								delta: 1
+		// 							});
+		// 						}
+		// 					}, 1000);
+		// 					return app.Tips({
+		// 						title: "添加成功",
+		// 						icon: 'success'
+		// 					});
+		// 				}).catch(err => {
+		// 					return app.Tips({
+		// 						title: err
+		// 					});
+		// 				});
+		// 			},
+		// 			fail: function (res) {
+		// 				if (res.errMsg == 'chooseAddress:cancel') return app.Tips({
+		// 					title: '取消选择'
+		// 				});
+		// 			},
+		// 		})
+		// 	},
+		// 	fail: function (res) {
+		// 		wx.showModal({
+		// 			title: '您已拒绝导入微信地址权限',
+		// 			content: '是否进入权限管理,调整授权?',
+		// 			success(res) {
+		// 				if (res.confirm) {
+		// 					wx.openSetting({
+		// 						success: function (res) {
+		// 							console.log(res.authSetting)
+		// 						}
+		// 					});
+		// 				} else if (res.cancel) {
+		// 					return app.Tips({
+		// 						title: '已取消!'
+		// 					});
+		// 				}
+		// 			}
+		// 		})
+		// 	},
+		// })
 	},
 
 	/**

+ 61 - 58
view/xcx/pages/user_address_list/index.js

@@ -52,65 +52,68 @@ Page({
      * 导入微信地址
      */
     getWxAddress: function () {
-        var that = this;
-        wx.authorize({
-            scope: 'scope.address',
-            success: function (res) {
-                wx.chooseAddress({
-                    success: function (res) {
-                        var addressP = {};
-                        addressP.province = res.provinceName;
-                        addressP.city = res.cityName;
-                        addressP.district = res.countyName;
-                        editAddress({
-                            address: addressP,
-                            is_default: 1,
-                            real_name: res.userName,
-                            post_code: res.postalCode,
-                            phone: res.telNumber,
-                            detail: res.detailInfo,
-                            type: 1,
-                            id: 0
-                        }).then(res => {
-                            app.Tips({
-                                title: "添加成功",
-                                icon: 'success'
-                            }, function () {
-                                that.getAddressList(true);
-                            });
-                        }).catch(err => {
-                            return app.Tips({
-                                title: err
-                            });
-                        });
-                    },
-                    fail: function (res) {
-                        if (res.errMsg == 'chooseAddress:cancel') return app.Tips({
-                            title: '取消选择'
-                        });
-                    },
-                })
-            },
-            fail: function (res) {
-                wx.showModal({
-                    title: '您已拒绝导入微信地址权限',
-                    content: '是否进入权限管理,调整授权?',
-                    success(res) {
-                        if (res.confirm) {
-                            wx.openSetting({
-                                success: function (res) {
-                                    console.log(res.authSetting)
-                                }
-                            });
-                        } else if (res.cancel) {
-                            return app.Tips({
-                                title: '已取消!'
-                            });
-                        }
-                    }
-                })
-            },
+        wx.showToast({
+          title: '敬请期待',
         })
+        // var that = this;
+        // wx.authorize({
+        //     scope: 'scope.address',
+        //     success: function (res) {
+        //         wx.chooseAddress({
+        //             success: function (res) {
+        //                 var addressP = {};
+        //                 addressP.province = res.provinceName;
+        //                 addressP.city = res.cityName;
+        //                 addressP.district = res.countyName;
+        //                 editAddress({
+        //                     address: addressP,
+        //                     is_default: 1,
+        //                     real_name: res.userName,
+        //                     post_code: res.postalCode,
+        //                     phone: res.telNumber,
+        //                     detail: res.detailInfo,
+        //                     type: 1,
+        //                     id: 0
+        //                 }).then(res => {
+        //                     app.Tips({
+        //                         title: "添加成功",
+        //                         icon: 'success'
+        //                     }, function () {
+        //                         that.getAddressList(true);
+        //                     });
+        //                 }).catch(err => {
+        //                     return app.Tips({
+        //                         title: err
+        //                     });
+        //                 });
+        //             },
+        //             fail: function (res) {
+        //                 if (res.errMsg == 'chooseAddress:cancel') return app.Tips({
+        //                     title: '取消选择'
+        //                 });
+        //             },
+        //         })
+        //     },
+        //     fail: function (res) {
+        //         wx.showModal({
+        //             title: '您已拒绝导入微信地址权限',
+        //             content: '是否进入权限管理,调整授权?',
+        //             success(res) {
+        //                 if (res.confirm) {
+        //                     wx.openSetting({
+        //                         success: function (res) {
+        //                             console.log(res.authSetting)
+        //                         }
+        //                     });
+        //                 } else if (res.cancel) {
+        //                     return app.Tips({
+        //                         title: '已取消!'
+        //                     });
+        //                 }
+        //             }
+        //         })
+        //     },
+        // })
     },
 
     /**

+ 81 - 81
view/xcx/utils/wxh.js

@@ -158,86 +158,86 @@ var tapsize = function (that, e) {
 }
 
 // 取得授权地址
-var selfLocation = function (showMode) {
-    const that = this;
-    return new Promise((resolve, reject) => {
-        let longitude = wx.getStorageSync(CACHE_LONGITUDE); //经度
-        let latitude = wx.getStorageSync(CACHE_LATITUDE); //纬度
-        if (longitude && latitude) {
-            return resolve({
-                longitude: longitude,
-                latitude: latitude
-            });
-        }
-        wx.getSetting({
-            success: (res) => {
-                if (!res.authSetting['scope.userLocation']) {
-                    wx.removeStorageSync(CACHE_LONGITUDE);
-                    wx.removeStorageSync(CACHE_LATITUDE);
-                    wx.getLocation({
-                        success: function (res) {
-                            var latitude = res.latitude;
-                            var longitude = res.longitude;
-                            wx.setStorageSync(CACHE_LONGITUDE, longitude);
-                            wx.setStorageSync(CACHE_LATITUDE, latitude);
-                            resolve(res);
-                        },
-                        fail(res) {
-                            if (res.errMsg == "getLocation:fail auth deny" && showMode == undefined) {
-                                wx.showModal({
-                                    title: '您已经拒绝授权地理位置',
-                                    content: '是否需要开启权限',
-                                    success: function (res) {
-                                        if (res.cancel) {
-                                            reject(res);
-                                        } else if (res.confirm) {
-                                            wx.openSetting({
-                                                success: function (res) {
-                                                    if (res.authSetting["scope.userLocation"] == true) {
-                                                        wx.showToast({
-                                                            title: '授权成功',
-                                                            icon: 'success',
-                                                            duration: 1000
-                                                        })
-                                                        wx.getLocation({
-                                                            success: function (res) {
-                                                                var latitude = res.latitude;
-                                                                var longitude = res.longitude;
-                                                                wx.setStorageSync(CACHE_LONGITUDE, longitude);
-                                                                wx.setStorageSync(CACHE_LATITUDE, latitude);
-                                                                resolve(res);
-                                                            }
-                                                        })
-                                                    } else {
-                                                        wx.showToast({
-                                                            title: '授权失败',
-                                                            icon: 'none',
-                                                            duration: 1000
-                                                        })
-                                                    }
-                                                }
-                                            })
-                                        }
-                                    },
-                                })
-                            }
-                        },
-                    });
-                } else {
-                    wx.getLocation({
-                        success: function (res) {
-                            let latitude = res.latitude;
-                            let longitude = res.longitude;
-                            wx.setStorageSync(CACHE_LONGITUDE, longitude);
-                            wx.setStorageSync(CACHE_LATITUDE, latitude);
-                            resolve(res);
-                        }
-                    })
-                }
-            }
-        })
-    })
-}
+// var selfLocation = function (showMode) {
+//     const that = this;
+//     return new Promise((resolve, reject) => {
+//         let longitude = wx.getStorageSync(CACHE_LONGITUDE); //经度
+//         let latitude = wx.getStorageSync(CACHE_LATITUDE); //纬度
+//         if (longitude && latitude) {
+//             return resolve({
+//                 longitude: longitude,
+//                 latitude: latitude
+//             });
+//         }
+//         wx.getSetting({
+//             success: (res) => {
+//                 if (!res.authSetting['scope.userLocation']) {
+//                     wx.removeStorageSync(CACHE_LONGITUDE);
+//                     wx.removeStorageSync(CACHE_LATITUDE);
+//                     wx.getLocation({
+//                         success: function (res) {
+//                             var latitude = res.latitude;
+//                             var longitude = res.longitude;
+//                             wx.setStorageSync(CACHE_LONGITUDE, longitude);
+//                             wx.setStorageSync(CACHE_LATITUDE, latitude);
+//                             resolve(res);
+//                         },
+//                         fail(res) {
+//                             if (res.errMsg == "getLocation:fail auth deny" && showMode == undefined) {
+//                                 wx.showModal({
+//                                     title: '您已经拒绝授权地理位置',
+//                                     content: '是否需要开启权限',
+//                                     success: function (res) {
+//                                         if (res.cancel) {
+//                                             reject(res);
+//                                         } else if (res.confirm) {
+//                                             wx.openSetting({
+//                                                 success: function (res) {
+//                                                     if (res.authSetting["scope.userLocation"] == true) {
+//                                                         wx.showToast({
+//                                                             title: '授权成功',
+//                                                             icon: 'success',
+//                                                             duration: 1000
+//                                                         })
+//                                                         wx.getLocation({
+//                                                             success: function (res) {
+//                                                                 var latitude = res.latitude;
+//                                                                 var longitude = res.longitude;
+//                                                                 wx.setStorageSync(CACHE_LONGITUDE, longitude);
+//                                                                 wx.setStorageSync(CACHE_LATITUDE, latitude);
+//                                                                 resolve(res);
+//                                                             }
+//                                                         })
+//                                                     } else {
+//                                                         wx.showToast({
+//                                                             title: '授权失败',
+//                                                             icon: 'none',
+//                                                             duration: 1000
+//                                                         })
+//                                                     }
+//                                                 }
+//                                             })
+//                                         }
+//                                     },
+//                                 })
+//                             }
+//                         },
+//                     });
+//                 } else {
+//                     wx.getLocation({
+//                         success: function (res) {
+//                             let latitude = res.latitude;
+//                             let longitude = res.longitude;
+//                             wx.setStorageSync(CACHE_LONGITUDE, longitude);
+//                             wx.setStorageSync(CACHE_LATITUDE, latitude);
+//                             resolve(res);
+//                         }
+//                     })
+//                 }
+//             }
+//         })
+//     })
+// }
 
 module.exports = {
     carmin: carmin,
@@ -247,5 +247,5 @@ module.exports = {
     tapsize: tapsize,
     home: home,
     time2: time2,
-    selfLocation: selfLocation
+    // selfLocation: selfLocation
 }