112 lines
3.4 KiB
JavaScript
112 lines
3.4 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
const common_js_util = require("../../../common/js/util.js");
|
|
const api_index = require("../../../api/index.js");
|
|
if (!Array) {
|
|
const _easycom_uni_file_picker2 = common_vendor.resolveComponent("uni-file-picker");
|
|
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
|
|
(_easycom_uni_file_picker2 + _easycom_uni_easyinput2)();
|
|
}
|
|
const _easycom_uni_file_picker = () => "../../../uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.js";
|
|
const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
|
|
if (!Math) {
|
|
(_easycom_uni_file_picker + _easycom_uni_easyinput)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "index",
|
|
setup(__props) {
|
|
const liveModule = common_vendor.index.requireNativePlugin("Hisign-Face");
|
|
const store = common_vendor.useStore();
|
|
const form = common_vendor.reactive({
|
|
// 真实姓名
|
|
userRealName: "",
|
|
// 用户id
|
|
userId: "",
|
|
// 设备imei
|
|
// userImei: '',
|
|
// 用户身份证号
|
|
userIdCard: ""
|
|
});
|
|
const faceImage = common_vendor.ref("");
|
|
common_vendor.computed(() => {
|
|
let result = store.state.userinfo;
|
|
return result;
|
|
});
|
|
function startLive() {
|
|
liveModule.startLive(
|
|
{
|
|
openSound: true,
|
|
signKey: "HISP1YFG44LQ29W0"
|
|
},
|
|
(result) => {
|
|
console.log("startLive", result);
|
|
if (result.errorCode == 0) {
|
|
faceImage.value = "data:image/jpg;base64," + result.liveImage;
|
|
}
|
|
}
|
|
);
|
|
}
|
|
function handleSubmit() {
|
|
const data = {
|
|
...form
|
|
};
|
|
if (!data.userRealName) {
|
|
common_js_util.util.alert("真实姓名不能为空");
|
|
return;
|
|
}
|
|
if (!data.userIdCard) {
|
|
common_js_util.util.alert("用户身份证号不能为空");
|
|
return;
|
|
}
|
|
if (!faceImage.value) {
|
|
common_js_util.util.alert("请先进行人脸识别");
|
|
return;
|
|
}
|
|
api_index.api.mine.certification({
|
|
query: {
|
|
image: faceImage
|
|
},
|
|
data
|
|
}).then((rs) => {
|
|
console.log("certification", rs);
|
|
if (rs.code == 200) {
|
|
common_js_util.util.alert("认证成功");
|
|
common_js_util.util.getUserinfo();
|
|
setTimeout(() => {
|
|
common_vendor.index.navigateBack();
|
|
}, 500);
|
|
return;
|
|
}
|
|
common_js_util.util.alert({
|
|
content: rs.msg,
|
|
showCancel: false
|
|
});
|
|
});
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({}, {
|
|
g: common_vendor.o$1(($event) => form.userRealName = $event),
|
|
h: common_vendor.p({
|
|
inputBorder: false,
|
|
type: "text",
|
|
placeholder: "请输入姓名",
|
|
modelValue: form.userRealName
|
|
}),
|
|
i: common_vendor.o$1(($event) => form.userIdCard = $event),
|
|
j: common_vendor.p({
|
|
inputBorder: false,
|
|
type: "text",
|
|
placeholder: "请输入身份证号",
|
|
modelValue: form.userIdCard
|
|
}),
|
|
k: faceImage.value
|
|
}, faceImage.value ? {} : {}, {
|
|
l: common_vendor.o$1(startLive),
|
|
m: common_vendor.o$1(handleSubmit)
|
|
});
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-abedca23"]]);
|
|
wx.createPage(MiniProgramPage);
|