Browse Source

第一次提交

hjs 1 year ago
commit
ecf575ad6a

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+unpackage
+node_modules
+yarn.lock
+package-lock.json

+ 16 - 0
.hbuilderx/launch.json

@@ -0,0 +1,16 @@
+{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version": "0.0",
+    "configurations": [{
+     	"default" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"mp-alipay" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"type" : "uniCloud"
+     }
+    ]
+}

+ 22 - 0
App.vue

@@ -0,0 +1,22 @@
+<script>
+	export default {
+		globalData: {
+		  authAppId: '2021003181682188',
+		  authAppToken: '0fee78a7f10d90577bbce8e0cf9bee0cde207cb9',
+		  appId: '2021004108612189'
+		},
+		onLaunch: function() {
+			console.log('App Launch')
+		},
+		onShow: function() {
+			console.log('App Show')
+		},
+		onHide: function() {
+			console.log('App Hide')
+		}
+	}
+</script>
+
+<style>
+	/*每个页面公共css */
+</style>

+ 1 - 0
README.md

@@ -0,0 +1 @@
+# 苏州园林核验服务

+ 20 - 0
index.html

@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <script>
+      var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
+        CSS.supports('top: constant(a)'))
+      document.write(
+        '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
+        (coverSupport ? ', viewport-fit=cover' : '') + '" />')
+    </script>
+    <title></title>
+    <!--preload-links-->
+    <!--app-context-->
+  </head>
+  <body>
+    <div id="app"><!--app-html--></div>
+    <script type="module" src="/main.js"></script>
+  </body>
+</html>

+ 22 - 0
main.js

@@ -0,0 +1,22 @@
+import App from './App'
+
+// #ifndef VUE3
+import Vue from 'vue'
+import './uni.promisify.adaptor'
+Vue.config.productionTip = false
+App.mpType = 'app'
+const app = new Vue({
+  ...App
+})
+app.$mount()
+// #endif
+
+// #ifdef VUE3
+import { createSSRApp } from 'vue'
+export function createApp() {
+  const app = createSSRApp(App)
+  return {
+    app
+  }
+}
+// #endif

+ 73 - 0
manifest.json

@@ -0,0 +1,73 @@
+{
+    "name" : "hh-szyl-face",
+    "appid" : "__UNI__7341B32",
+    "description" : "",
+    "versionName" : "1.0.0",
+    "versionCode" : "100",
+    "transformPx" : false,
+    /* 5+App特有相关 */
+    "app-plus" : {
+        "usingComponents" : true,
+        "nvueStyleCompiler" : "uni-app",
+        "compilerVersion" : 3,
+        "splashscreen" : {
+            "alwaysShowBeforeRender" : true,
+            "waiting" : true,
+            "autoclose" : true,
+            "delay" : 0
+        },
+        /* 模块配置 */
+        "modules" : {},
+        /* 应用发布信息 */
+        "distribute" : {
+            /* android打包配置 */
+            "android" : {
+                "permissions" : [
+                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CAMERA\"/>",
+                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
+                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera\"/>",
+                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
+                ]
+            },
+            /* ios打包配置 */
+            "ios" : {},
+            /* SDK配置 */
+            "sdkConfigs" : {}
+        }
+    },
+    /* 快应用特有相关 */
+    "quickapp" : {},
+    /* 小程序特有相关 */
+    "mp-weixin" : {
+        "appid" : "",
+        "setting" : {
+            "urlCheck" : false
+        },
+        "usingComponents" : true
+    },
+    "mp-alipay" : {
+        "usingComponents" : true,
+        "appid" : "2021004108612189",
		"plugins": {
			"IoTVsp": {
				"version": "*",
				"provider": "2021003111634614"
			}
		}
+    },
+    "mp-baidu" : {
+        "usingComponents" : true
+    },
+    "mp-toutiao" : {
+        "usingComponents" : true
+    },
+    "uniStatistics" : {
+        "enable" : false
+    },
+    "vueVersion" : "2"
+}

+ 34 - 0
pages.json

@@ -0,0 +1,34 @@
+{
+	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+		{
+			"path": "pages/index/index",
+			"style": {
+				"navigationStyle": "custom",
+				"navigationBarTitleText": "",
+				"mp-alipay": {
+					"allowsBounceVertical": "NO",
+					"transparentTitle": "always",
+					"titlePenetrate": "YES"
+				}
+			}
+		},
+		{
+			"path": "pages/index/open",
+			"style": {
+				"navigationBarBackgroundColor": "#FFF",
+				"navigationBarTitleText": "代他人开通",
+				"navigationBarTextStyle": "black",
+				"mp-alipay": {
+					"allowsBounceVertical": "NO"
+				}
+			}
+		}
+	],
+	"globalStyle": {
+		"navigationBarTextStyle": "black",
+		"navigationBarTitleText": "uni-app",
+		"navigationBarBackgroundColor": "#F8F8F8",
+		"backgroundColor": "#F8F8F8"
+	},
+	"uniIdRouter": {}
+}

+ 330 - 0
pages/index/index.vue

@@ -0,0 +1,330 @@
+<template>
+	<view class="container">
+		<view class="title-card">苏州园林刷脸极速入园</view>
+		<view class="title"></view>	
+		<view class="grid-layout">
+			<view class="grid-item">
+				<image src="/static/index-grid1.png" style="width: 47rpx;height: 47rpx;"></image>
+				<text>1秒极速入园</text>
+			</view>
+			<view class="grid-item">
+				<image src="/static/index-grid2.png" style="width: 47rpx;height: 47rpx;"></image>
+				<text>无需扫码</text>
+			</view>
+			<view class="grid-item">
+				<image src="/static/index-grid3.png"></image>
+				<text>无需刷证</text>
+			</view>
+		</view>
+		<view style="margin-top: 56rpx;" @click="openDaoLan">
+			<image src="/static/img-daolan.png" style="width: 654rpx;height: 80rpx;"></image>
+		</view>
+		<view class="prompt-layout">
+			<view class="prompt-title">注意事项:</view>
+			<view class="prompt-item">
+				* 根据景区要求,开通刷脸功能需要具备公安部人脸实名认证资质,如您<text style="color: rgba(241, 127, 82, 1);">开通失败</text>,请走<text style="color: rgba(22, 119, 255, 1);letter-spacing: 0;">刷码 / 刷证通道。</text>
+			</view>
+			<view class="prompt-item">
+				* 如您的亲友没有支付宝,可以在下方点击<text style="color: rgba(22, 119, 255, 1);">代他人开通</text>,输入身份信息即可完成开通。14周岁以下儿童或者非大陆籍公民请走人工通道。
+			</view>
+		</view>
+		<view style="flex: auto;"></view>
+		<button class="btn blue" type="primary" @click="authClick">自己开通</button>
+		<button class="btn blue" type="primary" style="margin-top: 50rpx;line-height: 1;" @click="openOther">代他人开通<view style="font-size: 20rpx; margin-top: 6rpx;letter-spacing: 0;">(亲友便捷开通)</view></button>
+		<view style="flex: none;height: 80rpx;"></view>
+	</view>
+</template>
+
+<script>
+	import _ from 'lodash'
+	import {
+		request
+	} from '@/utils/request'
+	import {
+		formatTime
+	} from '@/utils/util.js'
+	import {
+		getZFBThree
+	} from '@/utils/zfbThree.js'
+	import {
+		iotVspInit,
+		iotVspUniqueId
+	} from '@/utils/ioTVsp'
+	export default {
+		data() {
+			return {
+				// authTaskId: null
+			}
+		},
+		onLoad() {
+			// uni.onAppShow(this.onAppShowHandler)
+			let launchOptions = uni.getLaunchOptionsSync()
+			if(!launchOptions.query) {
+			  launchOptions = uni.getEnterOptionsSync()
+			}
+			if(launchOptions.query && launchOptions.query.lotsmall) {
+				const that = this
+				setTimeout(() => {
+				  that.openDaoLan()
+				}, 300)
+			}
+		},
+		// onUnload: function() {
+		// 	my.offAppShow(this.onAppShowHandler)
+		// },
+		onReady() {
+			iotVspInit((res) => {
+				my.navigateBack()
+				if (res.success) {
+					setTimeout(() => {
+						my.navigateBack()
+						uni.showModal({
+							title: '提示',
+							content: '恭喜您,已成功开通快速刷脸通行!',
+							showCancel: false
+						})
+					}, 1000)
+				}
+			})
+		},
+		methods: {
+			openOther() {
+				uni.navigateTo({
+					url: '/pages/index/open'
+				})
+			},
+			// 跳转到720导览网页
+			openDaoLan() {
+				my.ap.openURL({
+					url: 'https://wap.lotsmall.cn/vue/custompage?id=37912&m_id=1939',
+					success: (res) => {},
+					fail: (err) => {}
+				})
+			},
+			authClick: _.throttle(function() {
+				// const taskId = `${parseInt((Math.random() * 9 + 1) * 10000)}${formatTime(Date.now(), "YYYYMMDDHHNNSS")}${parseInt((Math.random() * 9 + 1) * 10000)}`
+				// this.authTaskId = taskId
+				// my.navigateToMiniProgram({
+				// 	appId: getApp().globalData.authAppId,
+				// 	path: 'pages/authorize_three/authorize_three',
+				// 	query: {
+				// 		name: '苏州园林核验服务',
+				// 		notify: null,
+				// 		token: getApp().globalData.authAppToken,
+				// 		taskId: this.authTaskId
+				// 	}
+				// })
+				getZFBThree((res) => {
+					if(res.code === 200) {
+						iotVspUniqueId(res.data.idNumber, res.data.username, res.data.phone, res.data.avatar)
+							.then((res) => {
+								if (res) {
+									uni.showModal({
+										title: "提示",
+										content: '您已开通快速刷脸通行!',
+										showCancel: false
+									})
+								} else {
+									// uni.showModal({
+									// 	title: "提示",
+									// 	content: '人脸已入库失败!',
+									// 	showCancel: false
+									// })
+								}
+							})
+					} else {
+						my.alert({
+							title: '提示',
+							content: '身份信息获取失败!'
+						})
+					}
+				})
+			}, 2000),
+			// onAppShowHandler(options) {
+			// 	if (options && options.referrerInfo) {
+			// 		// 从三要素认证返回
+			// 		if (options.referrerInfo.appId === getApp().globalData.authAppId && options.referrerInfo.extraData) {
+			// 			const authStatus = options.referrerInfo.extraData.authStatus
+			// 			const authTaskId = this.authTaskId
+			// 			this.authTaskId = null
+			// 			if (authStatus) {
+			// 				this.zfbAuthCallback(authTaskId)
+			// 			} else {
+			// 				uni.showModal({
+			// 					title: '提示',
+			// 					content: '操作失败,请重试',
+			// 					showCancel: false
+			// 				})
+			// 			}
+			// 		}
+			// 	}
+			// },
+			// async zfbAuthCallback(authTaskId) {
+			// 	uni.showLoading({
+			// 		content: "加载中..."
+			// 	})
+			// 	request({
+			// 		url: 'https://tx.hz-hanghui.com:8088/hanghui-server-platform/api/v1/alipay/user/query',
+			// 		method: 'POST',
+			// 		data: {
+			// 			taskId: authTaskId,
+			// 			token: getApp().globalData.authAppToken
+			// 		},
+			// 		dataType: 'json',
+			// 		header: {
+			// 			'Content-type': 'application/json'
+			// 		},
+			// 		success: result => {
+			// 			uni.hideLoading()
+			// 			/**
+			// 			 * certNo 身份证号
+			// 			 * certName 姓名
+			// 			 * phone  手机号
+			// 			 */
+			// 			if (result.errcode) {
+			// 				uni.showModal({
+			// 					title: "提示",
+			// 					content: "未查询到认证结果,请重新认证!",
+			// 					showCancel: false
+			// 				})
+			// 				return
+			// 			}
+			// 			if (!result.data || !result.data.token) {
+			// 				uni.showModal({
+			// 					title: "提示",
+			// 					content: result.msg,
+			// 					showCancel: false
+			// 				})
+			// 				return
+			// 			}
+			// 			iotVspUniqueId(result.data.certNo, result.data.certName, result.data.phone, null)
+			// 				.then((res) => {
+			// 					if (res) {
+			// 						uni.showModal({
+			// 							title: "提示",
+			// 							content: '您已开通快速刷脸通行!',
+			// 							showCancel: false
+			// 						})
+			// 					} else {
+			// 						// uni.showModal({
+			// 						// 	title: "提示",
+			// 						// 	content: '人脸已入库失败!',
+			// 						// 	showCancel: false
+			// 						// })
+			// 					}
+			// 				})
+			// 		},
+			// 		fail: res => {
+			// 			uni.hideLoading()
+			// 		}
+			// 	})
+			// }
+		}
+	}
+</script>
+
+<style scoped>
+	.container {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		width: 100%;
+		height: 100vh;
+		background-image: url('/static/index-head-bg.png'), url('/static/main-bg.jpg');
+		background-position: left top, left top;
+		background-repeat: no-repeat, no-repeat;
+		background-size: 100% 440rpx, 100% 100%;
+	}
+
+	.container .title-card {
+		letter-spacing: 0;
+		width: 700rpx;
+		height: calc(284rpx - 32rpx);
+		text-align: center;
+		padding-top: 32rpx;
+		margin-top: 200rpx;
+		font-size: 48rpx;
+		color: rgba(22, 119, 255, 1);
+		font-weight: 700;
+		background-image: url('/static/index-title-card.png');
+		background-position: left top;
+		background-repeat: no-repeat;
+		background-size: 100% 100%;
+	}
+
+	.container .title {
+		width: 654rpx;
+		height: 370rpx;
+		margin-top: -160rpx;
+		font-size: 36rpx;
+		background-image: url('/static/index-title.png');
+		background-position: left top;
+		background-repeat: no-repeat;
+		background-size: 100% 100%;
+	}
+	
+	.container .grid-layout {
+		margin-top: 36rpx;
+		width: 100%;
+		display: flex;
+		align-items: center;
+		justify-content: space-around;
+	}
+	.container .grid-layout .grid-item {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+	}
+	.container .grid-layout .grid-item image {
+		width: 60rpx;
+		height: 60rpx;
+	}
+	.container .grid-layout .grid-item text {
+		color: rgba(51, 51, 51, 1);
+		font-size: 26rpx;
+		font-weight: 400;
+		margin-top: 6rpx;
+		letter-spacing: 0;
+	}
+	
+	.container .prompt-layout {
+		width: calc(670rpx - 32rpx);
+		margin-top: 8rpx;
+		border-radius: 6rpx;
+		padding: 20rpx 16rpx 16rpx;
+		background-color: rgba(216, 216, 216, 0.5);
+	}
+	.container .prompt-layout .prompt-title {
+		font-weight: 500;
+		font-size: 28rpx;
+		color: rgba(93, 107, 106, 1);
+		letter-spacing: 2rpx;
+	}
+	.container .prompt-layout .prompt-item {
+		margin-top: 16rpx;
+		font-weight: 400;
+		font-size: 25rpx;
+		color: rgba(93, 107, 106, 1);
+		line-height: 1.5;
+		letter-spacing: 1rpx;
+	}
+
+	.container .btn {
+		width: 474rpx;
+		height: 98rpx;
+		border: none;
+		border-radius: 16rpx;
+		overflow: hidden;
+		font-size: 40rpx;
+		font-weight: 500;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		letter-spacing: 2rpx;
+	}
+
+	.container .blue {
+		background-color: rgba(22, 119, 255, 1);
+	}
+</style>

+ 172 - 0
pages/index/open.vue

@@ -0,0 +1,172 @@
+<template>
+	<view class="container-open">
+		<view class="form-layout">
+			<view class="form-label">姓名</view>
+			<input v-model="form.userName" maxlength="20" placeholder="请输入您的姓名" placeholder-class="form-input-placeholder"/>
+			<view class="form-label" style="margin-top: 28rpx;">身份证号</view>
+			<input v-model="form.idNumber" maxlength="18" type="idcard" placeholder="请输入您的身份证号" placeholder-class="form-input-placeholder"/>
+		</view>
+		<view style="flex: auto;"></view>
+		<button class="btn black" type="primary" @click="zfbIotVsp">提 交</button>
+		<view style="flex: none;height: 100rpx;"></view>
+	</view>
+</template>
+
+<script>
+	import _ from 'lodash'
+	import {
+		iotVspInit,
+		iotVspUniqueId
+	} from '@/utils/ioTVsp'
+	export default {
+		data() {
+			return {
+				form: {
+					idNumber: null,
+					userName: null
+				}
+			}
+		},
+		onLoad() {
+			uni.onAppShow(this.onAppShowHandler)
+		},
+		onUnload: function() {
+			my.offAppShow(this.onAppShowHandler)
+		},
+		onReady() {
+			iotVspInit((res) => {
+				my.navigateBack()
+				if (res.success) {
+					setTimeout(() => {
+						my.navigateBack()
+						uni.showModal({
+							title: '提示',
+							content: '恭喜您,已成功开通快速刷脸通行!',
+							showCancel: false
+						})
+						this.form = {
+							idNumber: null,
+							userName: null
+						}
+					}, 1000)
+				}
+			})
+		},
+		methods: {
+			zfbIotVsp: _.throttle(function() {
+				if(!this.form.userName) {
+					uni.showToast({
+						title: '姓名不能为空',
+						duration: 2000
+					})
+					return
+				}
+				if(!this.form.idNumber) {
+					uni.showToast({
+						title: '身份证号不能为空',
+						duration: 2000
+					})
+					return
+				}
+				if(this.form.idNumber.length === 15) {
+					const idreg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/
+					if(!idreg.test(this.form.idNumber)) {
+						uni.showToast({
+							title: '身份证号格式错误',
+							duration: 2000
+						})
+						return
+					}
+				} else if(this.form.idNumber.length === 18) {
+					const idreg = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/
+					if(!idreg.test(this.form.idNumber)) {
+						uni.showToast({
+							title: '身份证号格式错误',
+							duration: 2000
+						})
+						return
+					}
+				} else {
+					uni.showToast({
+						title: '身份证号位数错误',
+						duration: 2000
+					})
+					return
+				}
+				iotVspUniqueId(this.form.idNumber, this.form.userName, null, null).then((res) => {
+					if(res) {
+						uni.showModal({
+							title: "提示",
+							content: '您已开通快速刷脸通行!',
+							showCancel: false
+						})
+						this.form = {
+							idNumber: null,
+							userName: null
+						}
+					} else {
+						// uni.showModal({
+						// 	title: "提示",
+						// 	content: '人脸已入库!',
+						// 	showCancel: false
+						// })
+					}
+				})
+			}, 3000)
+		}
+	}
+</script>
+
+<style scoped>
+	.container-open {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		width: 100%;
+		height: 100vh;
+	}
+	
+	.form-layout {
+		width: calc(100% - 144rpx);
+		margin: 24rpx 32rpx 0;
+		background-color: #fff;
+		border-radius: 20rpx;
+		padding: 50rpx 40rpx;
+	}
+	.form-layout .form-label {
+		color: rgba(51, 51, 51, 1);
+		font-size: 32rpx;
+		font-weight: 500;
+	}
+	
+	.form-layout input {
+		padding: 0;
+		margin: 0;
+		border: 0;
+		background-color: transparent;
+		width: 100%;
+		border-bottom: 1px solid rgba(238, 238, 238, 1);
+		min-height: 80rpx;
+		line-height: 80rpx;
+	}
+	
+	.form-layout .form-input-placeholder {
+		color: rgba(204, 204, 204, 1);
+		font-size: 36rpx;
+		font-weight: 400;
+	}
+	
+	.container-open .btn {
+		width: 82%;
+		height: 112rpx;
+		line-height: 112rpx;
+		border: none;
+		border-radius: 16rpx;
+		overflow: hidden;
+		font-size: 36rpx;
+		font-weight: 500;
+	}
+	.container-open .black {
+		background-color: rgba(35, 54, 59, 1);
+	}
+</style>

BIN
static/img-daolan.png


BIN
static/index-grid1.png


BIN
static/index-grid2.png


BIN
static/index-grid3.png


BIN
static/index-head-bg.png


BIN
static/index-title-card.png


BIN
static/index-title.png


BIN
static/logo.png


BIN
static/main-bg.jpg


+ 10 - 0
uni.promisify.adaptor.js

@@ -0,0 +1,10 @@
+uni.addInterceptor({
+  returnValue (res) {
+    if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
+      return res;
+    }
+    return new Promise((resolve, reject) => {
+      res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
+    });
+  },
+});

+ 76 - 0
uni.scss

@@ -0,0 +1,76 @@
+/**
+ * 这里是uni-app内置的常用样式变量
+ *
+ * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
+ * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
+ *
+ */
+
+/**
+ * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
+ *
+ * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
+ */
+
+/* 颜色变量 */
+
+/* 行为相关颜色 */
+$uni-color-primary: #007aff;
+$uni-color-success: #4cd964;
+$uni-color-warning: #f0ad4e;
+$uni-color-error: #dd524d;
+
+/* 文字基本颜色 */
+$uni-text-color:#333;//基本色
+$uni-text-color-inverse:#fff;//反色
+$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
+$uni-text-color-placeholder: #808080;
+$uni-text-color-disable:#c0c0c0;
+
+/* 背景颜色 */
+$uni-bg-color:#ffffff;
+$uni-bg-color-grey:#f8f8f8;
+$uni-bg-color-hover:#f1f1f1;//点击状态颜色
+$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
+
+/* 边框颜色 */
+$uni-border-color:#c8c7cc;
+
+/* 尺寸变量 */
+
+/* 文字尺寸 */
+$uni-font-size-sm:12px;
+$uni-font-size-base:14px;
+$uni-font-size-lg:16;
+
+/* 图片尺寸 */
+$uni-img-size-sm:20px;
+$uni-img-size-base:26px;
+$uni-img-size-lg:40px;
+
+/* Border Radius */
+$uni-border-radius-sm: 2px;
+$uni-border-radius-base: 3px;
+$uni-border-radius-lg: 6px;
+$uni-border-radius-circle: 50%;
+
+/* 水平间距 */
+$uni-spacing-row-sm: 5px;
+$uni-spacing-row-base: 10px;
+$uni-spacing-row-lg: 15px;
+
+/* 垂直间距 */
+$uni-spacing-col-sm: 4px;
+$uni-spacing-col-base: 8px;
+$uni-spacing-col-lg: 12px;
+
+/* 透明度 */
+$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
+
+/* 文章场景相关 */
+$uni-color-title: #2C405A; // 文章标题颜色
+$uni-font-size-title:20px;
+$uni-color-subtitle: #555555; // 二级标题颜色
+$uni-font-size-subtitle:26px;
+$uni-color-paragraph: #3F536E; // 文章段落颜色
+$uni-font-size-paragraph:15px;

+ 0 - 0
utils/api.js


+ 104 - 0
utils/ioTVsp.js

@@ -0,0 +1,104 @@
+const { IoTVsp, IoTVspEvent, modeType } = requirePlugin('IoTVsp')
+
+import { request } from '@/utils/request'
+
+const isvPid = '2088441938577206'
+const orgOutId = 'suzhouyuanlin'
+const componentOutId = 'common_verify_import'
+
+let throttle = false
+
+const iotVspInit = function(callback = null) {
+  // 跳转到开通结果时监听上报结果数据
+  IoTVsp.addEventListener(IoTVspEvent.query, (data) => {
+    // 当跳转至开通结果页,data中能获取到上报到信息,不需要点击完成拿到信息
+    // console.log('IoTVspEvent.query-->', data)
+  })
+  // 开通结果页点击完成返回事件
+  IoTVsp.addEventListener(IoTVspEvent.back, (data) => {
+    //若配置不跳转至默认开通成功页,则开通成功后执行此回调
+    // console.log('IoTVspEvent.back-->', data)
+    // my.alert({content: 'IoTVspEvent.back-->' + JSON.stringify(data)})
+    if(callback != null && throttle) {
+      throttle = false
+      callback(data)
+    }
+  })
+  // 错误事件监听
+  IoTVsp.addEventListener(IoTVspEvent.result, (data) => {})
+}
+
+const _startComponent = function(uniqueId) {
+  if(!uniqueId) {
+    return
+  }
+  throttle = true
+  IoTVsp.start({
+    mode: modeType.faceverify,
+    config: {
+      uniqueId,
+      isvPid: isvPid,
+      orgOutId: orgOutId,
+      componentOutId: componentOutId
+    }
+  })
+}
+
+const iotVspUniqueId = function(idNumber, username, phone, avatar, uniqueId = null) {
+  return new Promise((resolve, reject) => {
+    if(!idNumber && !username && !phone) {
+      reject()
+      return
+    }
+    if(uniqueId) {
+      _startComponent(uniqueId)
+      resolve(false)
+      return
+    }
+	uni.showLoading({
+		content: "加载中..."
+	})
+	request({
+		url: 'https://tx.hz-hanghui.com:8088/yx-fyzd/alipay/api/v1/open/iotvsp/userwithvid/create',
+		// url: 'http://192.168.11.11:9100/yx-fyzd/alipay/api/v1/open/iotvsp/userwithvid/create',
+		method: 'POST',
+		data: {
+			componentOutId: componentOutId,
+			isvPid: isvPid,
+			orgOutId: orgOutId,
+			appId: getApp().globalData.appId,
+			userInfoList: [{
+				certType: 'IDENTITY_CARD',
+				certNo: idNumber,
+				certName: username,
+				phone: phone || null,
+				avatar: avatar || null
+			}]
+		},
+		dataType: 'json',
+		header: {
+			'Content-type': 'application/json'
+		},
+		success: res => {
+			if(res.data && !res.data.uniqueId) {
+				// uniqueId为空,表示已入库
+				resolve(true)
+			} else {
+				_startComponent(res.data.uniqueId)
+				resolve(false)
+			}
+		},
+		fail: res => {
+			reject(res)
+		},
+		complete: res => {
+			uni.hideLoading()
+		}
+	})
+  })
+}
+
+module.exports = {
+  iotVspUniqueId,
+  iotVspInit
+}

+ 43 - 0
utils/request.js

@@ -0,0 +1,43 @@
+/**
+ * 网络请求
+ * @param {Object} req
+ */
+export function request(req) {
+	let header = {
+		'Content-type': 'application/x-www-form-urlencoded'
+	}
+	if (req.header) {
+		header = Object.assign(header, req.header)
+	}
+	uni.request({
+		url: req.url,
+		data: req.data || {},
+		header: header,
+		method: req.method || "GET",
+		dataType: req.dataType || "json",
+		success: function(res) {
+			console.info('--- request success >>>', res)
+			if (req.success) {
+				req.success(res.data)
+			}
+		},
+		fail: function(res) {
+			console.warn('--- request fail >>>', res)
+			uni.showToast({
+				title: '网络异常~',
+				icon: 'none'
+			})
+			if (req.fail) {
+				req.fail(res)
+			}
+		},
+		complete: function(res) {
+			if (res.statusCode !== 200) {
+				console.log('--- request http error >>>', res)
+			}
+			if (req.complete) {
+				req.complete(res)
+			}
+		}
+	})
+}

+ 26 - 0
utils/util.js

@@ -0,0 +1,26 @@
+const formatTime = (time, type) => {
+    var date = new Date(time);
+    var format = type || "YYYY-MM-DD HH:NN:SS";
+    const year = date.getFullYear();
+    const month =
+        date.getMonth() + 1 < 10
+            ? "0" + (date.getMonth() + 1)
+            : date.getMonth() + 1;
+    const day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
+    const hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
+    const minute =
+        date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
+    const second =
+        date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
+    format.indexOf("YYYY") > -1 ? (format = format.replace("YYYY", year)) : "";
+    format.indexOf("MM") > -1 ? (format = format.replace("MM", month)) : "";
+    format.indexOf("DD") > -1 ? (format = format.replace("DD", day)) : "";
+    format.indexOf("HH") > -1 ? (format = format.replace("HH", hour)) : "";
+    format.indexOf("NN") > -1 ? (format = format.replace("NN", minute)) : "";
+    format.indexOf("SS") > -1 ? (format = format.replace("SS", second)) : "";
+    return format;
+}
+
+module.exports = {
+    formatTime
+}

+ 58 - 0
utils/zfbThree.js

@@ -0,0 +1,58 @@
+import {
+	request
+} from '@/utils/request'
+
+const getZFBThree = function(callback = null) {
+	my.getAuthCode({
+		scopes: 'auth_user',
+		success: function(res) {
+			const authCode = res.authCode
+			uni.showLoading({
+				title: "加载中..."
+			})
+			request({
+				url: 'https://ldb-permit.hz-hanghui.com:8088/hanghui/outapi/alipayApi/faceAuth/common/getAlipayUserInfo',
+				method: 'POST',
+				data: {
+					authCode: authCode,
+					appId: getApp().globalData.appId
+				},
+				dataType: 'json',
+				header: {
+					'Content-type': 'application/json'
+				},
+				success: res => {
+					uni.hideLoading()
+					const result = {}
+					if (res.data) {
+						result.code = 200
+						result.data = {
+							username: res.data.userName,
+							idNumber: res.data.certNo,
+							phone: res.data.mobile,
+							userId: res.data.userId,
+							avatar: res.data.avatar || null,
+							personPictures: res.data.personPictures || null,
+							photoBase64: res.data.photoBase64 || null
+						}
+						result.msg = '授权成功!'
+					} else {
+						result.code = 500
+						result.data = null
+						result.msg = res.errmsg || '授权失败!'
+					}
+					if (callback) {
+						callback(result)
+					}
+				},
+				fail: res => {
+					uni.hideLoading()
+				}
+			})
+		}
+	})
+}
+
+module.exports = {
+    getZFBThree
+}