123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- const _my = require("../../__antmove/api/index.js")(my);
- const wx = _my;
- // pages/make_appointment/faceCheck/faceCheck.js
- const { BaiDuFaceComparison } = require("../../utils/api/make_appointment");
- const upload_image = require("../../utils/upload/upload_image");
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- cardAvatarUrl: null,
- // (过审专用,禁止删除)- start
- fake: null
- // (过审专用,禁止删除)- start
- },
- getPhotoPath(e) {
- upload_image({
- url: e.detail
- }).then(img => {
- this.BaiDuFaceComparison(img.url);
- });
- },
- BaiDuFaceComparison(faceImageUrl) {
- let data = {
- cardImage: app.data.temporary_userInfo.avatar,
- faceImage: faceImageUrl
- // cardImage: 'https://noise.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/20220517/16527562131689445.jpg',
- // faceImage: 'https://noise.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/20220517/16527562131689445.jpg'
- };
- BaiDuFaceComparison(data).then(res => {
- if (res.data) {
- app.data.temporary_userInfo.avatar = data.faceImage;
- wx.setStorageSync("language", "en");
- wx.showModal({
- title: "prompt",
- content: "Certification successful!",
- showCancel: false,
- //是否显示取消按钮
- success: function () {
- wx.navigateBack({
- delta: 2
- });
- }
- });
- } else {
- app.data.temporary_userInfo = null;
- wx.showModal({
- title: "prompt",
- content: "The witness match failed. Please try again!",
- showCancel: false,
- //是否显示取消按钮
- success: function (res) {
- wx.navigateBack({
- delta: 1
- });
- }
- });
- }
- });
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- // this.BaiDuFaceComparison()
- // (过审专用,禁止删除)- start
- this.setData({
- fake:
- app.data.fake === false || app.data.fake == null ? false : true
- });
- // (过审专用,禁止删除)- end
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () { },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () { },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () { },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () { },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () { },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () { },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () { }
- });
|