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

4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
2 weeks ago
4 months ago
2 weeks ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
2 weeks ago
4 months ago
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const common_assets = require("../../../common/assets.js");
  4. const utils_utils = require("../../../utils/utils.js");
  5. const mp_ecard_sdk_main = require("../../../mp_ecard_sdk/main.js");
  6. const config_api = require("../../../config/api.js");
  7. const store_index = require("../../../store/index.js");
  8. if (!Array) {
  9. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  10. const _easycom_oneBtn2 = common_vendor.resolveComponent("oneBtn");
  11. (_easycom_u_icon2 + _easycom_oneBtn2)();
  12. }
  13. const _easycom_u_icon = () => "../../../uni_modules/uview-plus/components/u-icon/u-icon.js";
  14. const _easycom_oneBtn = () => "../../../components/oneBtn/oneBtn.js";
  15. if (!Math) {
  16. (_easycom_u_icon + _easycom_oneBtn)();
  17. }
  18. const _sfc_main = {
  19. __name: "authentication",
  20. setup(__props) {
  21. const counterStore = store_index.userStore();
  22. const currentStep = common_vendor.ref(0);
  23. const proressWith = common_vendor.computed(() => {
  24. if (currentStep.value == 1)
  25. return "290rpx";
  26. if (currentStep.value == 2)
  27. return "100%";
  28. return 0;
  29. });
  30. const houseStr = common_vendor.computed(() => {
  31. let item = counterStore.chooseHouse;
  32. if (!item.houseId)
  33. return "";
  34. let str = item.communityName + " - " + item.houseTypeName + " - " + item.roomNum;
  35. return str;
  36. });
  37. function nextStep(num) {
  38. if (num == 0 && !counterStore.chooseHouse.houseId)
  39. return;
  40. if (num == 1)
  41. currentStep.value = num;
  42. if (num == 2) {
  43. getpersonfaceFn();
  44. }
  45. if (num == 3) {
  46. counterStore.chooseHouse = {
  47. "roomNum": "",
  48. "houseType": "",
  49. "houseTypeName": "",
  50. "communityId": "",
  51. "communityName": "",
  52. "userName": 0,
  53. "idNo": "",
  54. "houseId": ""
  55. };
  56. common_vendor.index.switchTab({
  57. url: "/pages/tabbar/index/index"
  58. });
  59. }
  60. }
  61. async function getpersonfaceFn() {
  62. const { data: res } = await config_api.getFacetoken();
  63. console.log("获取到token了,很好");
  64. console.log(res);
  65. console.log(res.eidToken);
  66. goSDK(res.eidToken);
  67. }
  68. async function GetDetectInfoEnhancedFn(EidToken) {
  69. const { data: res } = await config_api.getFaceResult({ token: EidToken });
  70. console.log("返回的结果信息");
  71. console.log(res);
  72. counterStore.upDateHouse("idNo", res.idCard);
  73. counterStore.upDateHouse("userName", res.name);
  74. counterStore.upDateUseInfo("idCard", res.idCard);
  75. counterStore.upDateUseInfo("name", res.name);
  76. houseRoomBindFn();
  77. }
  78. async function houseRoomBindFn() {
  79. const { data: res } = await config_api.houseRoomBind(counterStore.chooseHouse);
  80. console.log(res);
  81. currentStep.value = 2;
  82. common_vendor.index.hideLoading();
  83. }
  84. function goSDK(token) {
  85. mp_ecard_sdk_main.startEid({
  86. data: {
  87. token
  88. },
  89. verifyDoneCallback(res) {
  90. const { token: token2, verifyDone } = res;
  91. console.log("收到核身完成的res:", res);
  92. console.log("核身的token是:", token2);
  93. common_vendor.index.showLoading({
  94. title: "正在加载,请稍后……"
  95. });
  96. GetDetectInfoEnhancedFn(token2);
  97. console.log("是否完成核身:", verifyDone);
  98. }
  99. });
  100. }
  101. function chooseImages() {
  102. common_vendor.index.chooseImage({
  103. count: 1,
  104. //允许选择的数量
  105. sizeType: ["original", "compressed"],
  106. //可以指定是原图还是压缩图,默认二者都有
  107. sourceType: ["album", "camera"],
  108. //从相册选择
  109. success: async (res) => {
  110. common_vendor.index.showLoading({
  111. title: "图片上传中..."
  112. });
  113. console.log(res);
  114. console.log("图片信息");
  115. const imgLink = await utils_utils.uploadImgApi(res.tempFilePaths[0], "roomCertificateImg");
  116. console.log(imgLink);
  117. counterStore.upDateHouse("roomCertificateImg", imgLink);
  118. }
  119. });
  120. }
  121. return (_ctx, _cache) => {
  122. return common_vendor.e({
  123. a: proressWith.value,
  124. b: currentStep.value ? 1 : "",
  125. c: currentStep.value == 2 ? 1 : "",
  126. d: currentStep.value == 0
  127. }, currentStep.value == 0 ? common_vendor.e({
  128. e: common_vendor.unref(counterStore).chooseHouse.houseId
  129. }, common_vendor.unref(counterStore).chooseHouse.houseId ? {
  130. f: common_vendor.t(houseStr.value)
  131. } : {}, {
  132. g: common_vendor.p({
  133. name: "arrow-right",
  134. color: "#CCCCCC"
  135. }),
  136. h: common_vendor.o(($event) => _ctx.$goPage("/pages/subPage/authentication/comp/select1")),
  137. i: common_vendor.unref(counterStore).chooseHouse.roomCertificateImg
  138. }, common_vendor.unref(counterStore).chooseHouse.roomCertificateImg ? {
  139. j: common_vendor.unref(counterStore).chooseHouse.roomCertificateImg
  140. } : {
  141. k: common_assets._imports_0$2
  142. }, {
  143. l: common_vendor.o(chooseImages),
  144. m: common_vendor.o(($event) => nextStep(1)),
  145. n: common_vendor.p({
  146. text: "下一步",
  147. disabled: !common_vendor.unref(counterStore).chooseHouse.houseId
  148. })
  149. }) : {}, {
  150. o: currentStep.value == 1
  151. }, currentStep.value == 1 ? {
  152. p: common_vendor.o(($event) => nextStep(2)),
  153. q: common_vendor.p({
  154. text: "点击开始实名认证"
  155. })
  156. } : {}, {
  157. r: currentStep.value == 2
  158. }, currentStep.value == 2 ? {
  159. s: common_assets._imports_1,
  160. t: common_vendor.o(($event) => nextStep(3)),
  161. v: common_vendor.p({
  162. text: "返回首页"
  163. })
  164. } : {});
  165. };
  166. }
  167. };
  168. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0ab17929"]]);
  169. wx.createPage(MiniProgramPage);