mini-antui
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -0,1 +1,8 @@ | ||
# 0.3.1 | ||
`2018-07-27` | ||
- **Feature** | ||
- `face-detection`组件新增`appName`和`serviceName`字段 | ||
## 0.3.0 | ||
@@ -2,0 +9,0 @@ |
@@ -354,2 +354,11 @@ { | ||
}, | ||
"popup/demo/index": { | ||
"enableWK": "YES", | ||
"enableDSL": "YES", | ||
"enableJSC": "YES", | ||
"defaultTitle": "popup 弹出菜单", | ||
"backgroundColor": 16119289, | ||
"pullRefresh": false, | ||
"allowsBounceVertical": true | ||
}, | ||
"message/demo/index": { | ||
@@ -356,0 +365,0 @@ "enableWK": "YES", |
@@ -5,6 +5,11 @@ Component({ | ||
appName: '', | ||
serviceName: '' | ||
serviceName: '', | ||
useLiveFaceCheck: false | ||
}, | ||
didMount: function didMount() { | ||
this.webViewContext = my.createWebViewContext('am-face-detection'); | ||
this.doFaceLeftResolve = null; | ||
this.isDidFaceLeftResolve = false; | ||
this.doFaceRightResolve = null; | ||
this.isDidFaceRightResolve = false; | ||
}, | ||
@@ -16,5 +21,33 @@ didUnMount: function didUnMount() { | ||
methods: { | ||
onMessage: function onMessage(e) { | ||
doLeftFaceCheck: function doLeftFaceCheck() { | ||
var _this = this; | ||
return new Promise(function (resolve, reject) { | ||
_this.isDidFaceLeftResolve = false; | ||
_this.webViewContext.postMessage({ action: 'doFaceLeft' }); | ||
_this.doFaceLeftResolve = resolve; | ||
setTimeout(function () { | ||
if (!_this.isDidFaceLeftResolve) { | ||
reject(); | ||
} | ||
}, 30000); | ||
}); | ||
}, | ||
doRightFaceCheck: function doRightFaceCheck() { | ||
var _this2 = this; | ||
return new Promise(function (resolve, reject) { | ||
_this2.isDidFaceRightResolve = false; | ||
_this2.webViewContext.postMessage({ action: 'doFaceRight' }); | ||
_this2.doFaceRightResolve = resolve; | ||
setTimeout(function () { | ||
if (!_this2.isDidFaceRightResolve) { | ||
reject(); | ||
} | ||
}, 30000); | ||
}); | ||
}, | ||
onMessage: function onMessage(e) { | ||
var _this3 = this; | ||
var _props = this.props, | ||
@@ -28,11 +61,29 @@ onFaceStatusChange = _props.onFaceStatusChange, | ||
if (action === 'faceRotated' && data.forward === 'left') { | ||
this.isDidFaceLeftResolve = true; | ||
this.doFaceLeftResolve(true); | ||
return; | ||
} | ||
if (action === 'faceRotated' && data.forward === 'right') { | ||
this.isDidFaceRightResolve = true; | ||
this.doFaceRightResolve(true); | ||
return; | ||
} | ||
if (action === 'captureImage') { | ||
if (onFaceStatusChange) { | ||
var promise = onFaceStatusChange({ imageBase64: data.imageBase64, faceRect: data.faceRect }); | ||
var promise = onFaceStatusChange({ | ||
imageBase64: data.imageBase64, | ||
faceRect: data.faceRect | ||
}, { | ||
doLeftFaceCheck: this.doLeftFaceCheck.bind(this), | ||
doRightFaceCheck: this.doRightFaceCheck.bind(this) | ||
}); | ||
if (promise instanceof Promise) { | ||
promise.then(function () { | ||
_this.webViewContext.postMessage({ action: 'requestSuccess' }); | ||
_this3.webViewContext.postMessage({ action: 'requestSuccess' }); | ||
})['catch'](function () { | ||
_this.webViewContext.postMessage({ action: 'requestFailure' }); | ||
_this3.webViewContext.postMessage({ action: 'requestFailure' }); | ||
}); | ||
@@ -39,0 +90,0 @@ } else { |
{ | ||
"name": "mini-antui", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "小程序版AntUI", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
122990
118
1905