Browse Source

长按公众号认证微信

hmp 4 years ago
parent
commit
820ddef73d

+ 1 - 1
assets/http/service.js

@@ -46,7 +46,7 @@ http.interceptors.request.use((config) => {
 		"Authorization": "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
 		"Blade-Auth": getTokenStorage()
 	}
-	if (setting.enabledCrypto && config.method == 'POST' && config.data) {
+	if (setting.enabledCrypto && config.method == 'POST' && config.data && crypto.isNotInWhiteList(config.url) ) {
 		let encrypt = crypto.encrypt(JSON.stringify(config.data))
 		config.data = encrypt
 	}

+ 3 - 1
main.js

@@ -163,10 +163,12 @@ Vue.prototype.$isNotEmpty=function(value){
 
 //消息模板
 Vue.prototype.$tmplIds=[
+	//签约成功通知
+	// 'nbIQLyWc4TaogP-NFIlpoO66qYyCDVvtjMpalF5S01k',
 	//认证消息模板
 	'yAtQ6AY8zBHDT1PxXHv7x7gS-qiN1DnSedN4MWLbHwk',
 	//收款消息模板
-	'2TcoWv042wo8Bf0SLRkjSLG00JAb9bE-usMy_aAW3Js'
+	// '2TcoWv042wo8Bf0SLRkjSLG00JAb9bE-usMy_aAW3Js'
 ]
 
 

+ 6 - 1
pages/login/account-login.vue

@@ -91,7 +91,6 @@
 						this.$refs.loading.hide()
 					}
 				})
-				
 			}
 		},
 		methods: {
@@ -103,6 +102,12 @@
 				});
 			},
 			async loginIn() {
+				uni.getSetting({
+					withSubscriptions:true,
+					success: (res) => {
+						console.log(res);
+					}
+				})
 				await this.$mpi.subscribe(this.$tmplIds)
 				let p = {
 					type: this.form.type,

+ 6 - 6
pages/login/submit-success.vue

@@ -4,9 +4,9 @@
 		<view class="content">
 			<image src="@/static/icon/success3.png" mode=""></image>
 			<text class="tips">{{params.title}}</text>
-			<view  class="cu-btn round btn" @click="$jump(params.path)">
+			<button  class="cu-btn round btn" @click="$jump(params.path)">
 				确认
-			</view>
+			</button>
 		</view>
 	</view>
 </template>
@@ -46,8 +46,8 @@
 		flex-direction: column;
 		
 		image{
-			width: 200rpx;
-			height: 200rpx;
+			width: 160rpx;
+			height: 160rpx;
 		}
 		
 		.tips{
@@ -60,8 +60,8 @@
 			margin-top: 150rpx;
 			background-color: #EF9944;
 			color: #FFFFFF;
-			width: 74%;
-			padding: 46rpx;
+			width: 70%;
+			padding: 44rpx;
 		}
 	}
 </style>

+ 20 - 18
pages/shop-info/shop-info.vue

@@ -117,7 +117,8 @@
 						</view>
 						<view class="border">
 							<u-form-item label="店铺地址" label-position="top" prop="address">
-								<u-input :border="false" disabled placeholder="请选择店铺地址" v-model="form.address"></u-input>
+								<u-input :border="false" disabled placeholder="请选择店铺地址" v-model="form.address">
+								</u-input>
 								<view slot="right">
 									<u-button @click="chooseAddress" size="mini">获取地址</u-button>
 								</view>
@@ -252,9 +253,9 @@
 									v-model="auditForm.bankCodeLabel" @click="bankCodeShow = true" />
 							</u-form-item>
 							<u-form-item :request="true" label="账户类型" label-position="top">
-								<!-- <u-input  type="select" placeholder="请选银行择账户类型" v-model="auditForm.bankAccountTypeLabel" @click="bankAccountTypeShow = true"/> -->
-								<u-input :border="false" disabled placeholder="请选银行择账户类型"
-									v-model="auditForm.bankAccountTypeLabel" />
+								<u-input  type="select" placeholder="请选银行择账户类型" v-model="auditForm.bankAccountTypeLabel" @click="bankAccountTypeShow = true"/>
+							<!-- 	<u-input :border="false"  placeholder="请选银行择账户类型"
+									v-model="auditForm.bankAccountTypeLabel" /> -->
 							</u-form-item>
 						</view>
 					</view>
@@ -394,10 +395,14 @@
 		},
 		data() {
 			return {
-				labelStyle:{'color':'#6d6d6d'},
-				
+				labelStyle: {
+					'color': '#6d6d6d'
+				},
+
 				loading: true,
 				typeIndex: 1,
+				step:1,
+				totalStep: 4,
 				//银行类型
 				bankKeyword: '',
 				bankCodeShow: false,
@@ -752,8 +757,6 @@
 				defaultRegion: [],
 				//门店地址
 				shopAddress: '',
-				step: 1,
-				totalStep: 4,
 				needBankInfo: true,
 				//编辑还是修改
 				isEdit: false,
@@ -827,9 +830,9 @@
 				this.getProcessDefinitionId()
 			}
 			await this.initDict()
-			await this.fetchMallList(	)
+			await this.fetchMallList()
 			this.$refs.loading.hide()
-			this.loading=false
+			this.loading = false
 		},
 		methods: {
 			clickType(index) {
@@ -910,14 +913,10 @@
 			},
 			//具体地址
 			chooseAddress() {
-				var _this = this
-				uni.chooseLocation({
-					success(res) {
-						console.log(res);
-						_this.form.address = res.address
-						_this.form.longitude = res.longitude
-						_this.form.latitude = res.latitude
-					}
+				this.$mpi.chooseLocation().then(res => {
+					this.form.address = res.address
+					this.form.longitude = res.longitude
+					this.form.latitude = res.latitude
 				})
 			},
 			//选择标签
@@ -969,6 +968,9 @@
 				}
 				let res = await this.$api.audit.detail(params)
 				this.$util.objectCopy(this.auditForm, res.data)
+				if (this.auditForm.typeOfEnterprise == 'ENTERPRISE') {
+					this.typeIndex=0
+				}
 				if (this.isFail) {
 					//获取流程历史
 					this.getHistoryFlowList()

+ 1 - 20
pagesPoster/pages/createPoster.vue

@@ -14,7 +14,7 @@
 		</view>
 		<view class="" style="position: fixed;bottom: 150rpx;width: 100%;">
 			<view class="center">
-				<view @click="savePhoto" class="cu-btn  flex round text-lg"
+				<view @click="$mpi.saveImg(this.imgUrl)" class="cu-btn  flex round text-lg"
 					style="padding: 46rpx 0;background-color: #EF9944;color: #FFFFFF;width: 76%;">
 					<u-icon name="download"></u-icon>
 					<text class="margin-left-20">保存到相册</text>
@@ -106,25 +106,6 @@
 			});
 			this.imgUrl = await dp.createImagePath();
 		},
-		methods: {
-			savePhoto() {
-				uni.saveImageToPhotosAlbum({
-					filePath: this.imgUrl,
-					success: function() {
-						uni.showToast({
-							title: "保存成功",
-							icon: "none"
-						});
-					},
-					fail: function() {
-						uni.showToast({
-							title: "保存失败,请稍后重试",
-							icon: "none"
-						});
-					}
-				});
-			}
-		}
 	};
 </script>
 

+ 24 - 0
utils/crypto.js

@@ -5,8 +5,32 @@ let crypto = {}
 
 //前后端定义的密钥,AES使用16位
 const CRYPTOJS_KEY = "uAY9ugkHQpvozZeA";
+
+const WHITE_LIST = [
+	'/yeepay',
+	'/put-file',
+	'/blade-test',
+	'/payment',
+	'/sms',
+	'/mall/yeepay/product/fee/modifyProductFeeNotify',
+	'/shop/yeepay/product/fee/modifyProductFeeNotify',
+	'/withdraw',
+	'/pressure_test/scanPay',
+	'/pressure_test/deCodeNotifyData',
+	'/ocr',
+	'/import-bank-type'
+]
+
+crypto.isNotInWhiteList = (url) => {
+	return !WHITE_LIST.some(item => {
+		return url.indexOf(item) > 0
+	})
+}
+
+
 // 加密
 crypto.encrypt = (plaintText) => {
+	var plaintText = plaintText;
 	var options = {
 		mode: CryptoJS.mode.ECB,
 		padding: CryptoJS.pad.Pkcs7

+ 108 - 21
utils/mpi.js

@@ -1,5 +1,81 @@
 let mpi = {}
 
+const tips = (title) => {
+	uni.showToast({
+		title,
+		icon: "none"
+	});
+}
+
+const getScopeDesc = (name) => {
+	let title = ''
+	switch (name) {
+		case 'userInfo':
+			title = '用户信息'
+			break;
+		case 'userLocation':
+			title = '地理位置'
+			break;
+		case 'userLocationBackground':
+			title = "后台定位"
+			break;
+		case 'address':
+			title = "通讯地址"
+			break;
+		case 'record':
+			title = "录音功能"
+			break;
+		case 'writePhotosAlbum':
+			title = "添加到相册"
+			break;
+		case 'camera':
+			title = "摄像头"
+			break;
+		case 'invoice':
+			title = "获取发票"
+			break;
+		case 'invoiceTitle':
+			title = "发票抬头"
+			break;
+		case 'werun':
+			title = "微信运动步数"
+			break;
+		default:
+			break;
+	}
+	return title
+}
+
+
+//打开设置
+const openSetting = (authName) => {
+	return new Promise((resolve, reject) => {
+		const scopeDesc = getScopeDesc(authName)
+		let content = `请先在设置页面打开“${scopeDesc}”使用权限`
+		authName = `scope.${authName}`
+		uni.getSetting({
+			success: (res) => {
+				console.log(res.authSetting);
+				if (res.authSetting[authName]) {
+					resolve(res)
+				} else {
+					uni.showModal({
+						title: '提示',
+						content,
+						confirmText: '去设置',
+						cancelText: '暂不设置',
+						confirmColor: '#EF9944',
+						success: data => {
+							if (data.confirm) {
+								uni.openSetting();
+							}
+						}
+					});
+				}
+			}
+		})
+	})
+}
 // 微信登陆
 mpi.wxLogin = () => {
 	return new Promise((resolve, reject) => {
@@ -61,33 +137,42 @@ mpi.downloadFile = (url) => {
 	})
 }
 
-
-
-
 mpi.saveImg = (filePath) => {
 	return new Promise((resolve, reject) => {
-		uni.saveImageToPhotosAlbum({
-			filePath,
-			success: function(res) {
-				uni.showToast({
-					title: "保存成功",
-					icon: "none"
-				});
-				resolve(res)
-			},
-			fail: function(err) {
-				uni.showToast({
-					title: "保存失败,请稍后重试",
-					icon: "none"
-				});
-				reject(err)
-			}
-		});
+		openSetting('writePhotosAlbum').then(() => {
+			uni.saveImageToPhotosAlbum({
+				filePath,
+				success: function(res) {
+					uni.showToast({
+						title: "保存成功",
+						icon: "none"
+					});
+					resolve(res)
+				},
+				fail: function(err) {
+					tips('保存失败,请稍后重试')
+					reject(err)
+				}
+			});
+		})
 	})
 }
 
 
-
+mpi.chooseLocation = () => {
+	return new Promise((resolve, reject) => {
+		openSetting('userLocation').then(() => {
+			uni.chooseLocation({
+				success(res) {
+					resolve(res)
+				},
+				fail(err) {
+					reject(err)
+				}
+			})
+		})
+	})
+}
 
 mpi.getLocation = () => {
 	return new Promise((resolve, reject) => {
@@ -130,9 +215,11 @@ mpi.subscribe = (tmplIds) => {
 			uni.requestSubscribeMessage({
 				tmplIds,
 				success(res) {
+					console.log(res);
 					resolve(res)
 				},
 				fail(err) {
+					console.log(err);
 					reject(err)
 				}
 			})