You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

169 lines
5.9 KiB

"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_assets = require("../../../common/assets.js");
const utils_utils = require("../../../utils/utils.js");
const mp_ecard_sdk_main = require("../../../mp_ecard_sdk/main.js");
const config_api = require("../../../config/api.js");
const store_index = require("../../../store/index.js");
if (!Array) {
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
const _easycom_oneBtn2 = common_vendor.resolveComponent("oneBtn");
(_easycom_u_icon2 + _easycom_oneBtn2)();
}
const _easycom_u_icon = () => "../../../uni_modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_oneBtn = () => "../../../components/oneBtn/oneBtn.js";
if (!Math) {
(_easycom_u_icon + _easycom_oneBtn)();
}
const _sfc_main = {
__name: "authentication",
setup(__props) {
const counterStore = store_index.userStore();
const currentStep = common_vendor.ref(0);
const proressWith = common_vendor.computed(() => {
if (currentStep.value == 1)
return "290rpx";
if (currentStep.value == 2)
return "100%";
return 0;
});
const houseStr = common_vendor.computed(() => {
let item = counterStore.chooseHouse;
if (!item.houseId)
return "";
let str = item.communityName + " - " + item.houseTypeName + " - " + item.roomNum;
return str;
});
function nextStep(num) {
if (num == 0 && !counterStore.chooseHouse.houseId)
return;
if (num == 1)
currentStep.value = num;
if (num == 2) {
getpersonfaceFn();
}
if (num == 3) {
counterStore.chooseHouse = {
"roomNum": "",
"houseType": "",
"houseTypeName": "",
"communityId": "",
"communityName": "",
"userName": 0,
"idNo": "",
"houseId": ""
};
common_vendor.index.switchTab({
url: "/pages/tabbar/index/index"
});
}
}
async function getpersonfaceFn() {
const { data: res } = await config_api.getFacetoken();
console.log("获取到token了,很好");
console.log(res);
console.log(res.eidToken);
goSDK(res.eidToken);
}
async function GetDetectInfoEnhancedFn(EidToken) {
const { data: res } = await config_api.getFaceResult({ token: EidToken });
console.log("返回的结果信息");
console.log(res);
counterStore.upDateHouse("idNo", res.idCard);
counterStore.upDateHouse("userName", res.name);
counterStore.upDateUseInfo("idCard", res.idCard);
counterStore.upDateUseInfo("name", res.name);
houseRoomBindFn();
}
async function houseRoomBindFn() {
const { data: res } = await config_api.houseRoomBind(counterStore.chooseHouse);
console.log(res);
currentStep.value = 2;
common_vendor.index.hideLoading();
}
function goSDK(token) {
mp_ecard_sdk_main.startEid({
data: {
token
},
verifyDoneCallback(res) {
const { token: token2, verifyDone } = res;
console.log("收到核身完成的res:", res);
console.log("核身的token是:", token2);
common_vendor.index.showLoading({
title: "正在加载,请稍后……"
});
GetDetectInfoEnhancedFn(token2);
console.log("是否完成核身:", verifyDone);
}
});
}
function chooseImages() {
common_vendor.index.chooseImage({
count: 1,
//允许选择的数量
sizeType: ["original", "compressed"],
//可以指定是原图还是压缩图,默认二者都有
sourceType: ["album", "camera"],
//从相册选择
success: async (res) => {
common_vendor.index.showLoading({
title: "图片上传中..."
});
console.log(res);
console.log("图片信息");
const imgLink = await utils_utils.uploadImgApi(res.tempFilePaths[0], "roomCertificateImg");
console.log(imgLink);
counterStore.upDateHouse("roomCertificateImg", imgLink);
}
});
}
return (_ctx, _cache) => {
return common_vendor.e({
a: proressWith.value,
b: currentStep.value ? 1 : "",
c: currentStep.value == 2 ? 1 : "",
d: currentStep.value == 0
}, currentStep.value == 0 ? common_vendor.e({
e: common_vendor.unref(counterStore).chooseHouse.houseId
}, common_vendor.unref(counterStore).chooseHouse.houseId ? {
f: common_vendor.t(houseStr.value)
} : {}, {
g: common_vendor.p({
name: "arrow-right",
color: "#CCCCCC"
}),
h: common_vendor.o(($event) => _ctx.$goPage("/pages/subPage/authentication/comp/select1")),
i: common_vendor.unref(counterStore).chooseHouse.roomCertificateImg
}, common_vendor.unref(counterStore).chooseHouse.roomCertificateImg ? {
j: common_vendor.unref(counterStore).chooseHouse.roomCertificateImg
} : {
k: common_assets._imports_0$2
}, {
l: common_vendor.o(chooseImages),
m: common_vendor.o(($event) => nextStep(1)),
n: common_vendor.p({
text: "下一步",
disabled: !common_vendor.unref(counterStore).chooseHouse.houseId
})
}) : {}, {
o: currentStep.value == 1
}, currentStep.value == 1 ? {
p: common_vendor.o(($event) => nextStep(2)),
q: common_vendor.p({
text: "点击开始实名认证"
})
} : {}, {
r: currentStep.value == 2
}, currentStep.value == 2 ? {
s: common_assets._imports_1,
t: common_vendor.o(($event) => nextStep(3)),
v: common_vendor.p({
text: "返回首页"
})
} : {});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0ab17929"]]);
wx.createPage(MiniProgramPage);