From 83736345f53df0d9994f07dfde255602d8423e1a Mon Sep 17 00:00:00 2001 From: wangzhitong Date: Fri, 13 Dec 2024 15:45:57 +0800 Subject: [PATCH] Update univerify-custom-page.uvue --- .../univerify-custom-page.uvue | 76 ++++++++++--------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/pages/API/get-univerify-manager/univerify-custom-page.uvue b/pages/API/get-univerify-manager/univerify-custom-page.uvue index 12680842..b48a0641 100644 --- a/pages/API/get-univerify-manager/univerify-custom-page.uvue +++ b/pages/API/get-univerify-manager/univerify-custom-page.uvue @@ -70,41 +70,49 @@ const loginButtonElement = this.$page.getElementById('login-button'); const privacyCheckBoxElement = this.$page.getElementById('privacy-checkbox'); const privacyTextElement = this.$page.getElementById('privacy-text'); - - this.univerifyManager?.customLogin({ - numberTextElement: numberTextElement!, - sloganTextElement: sloganTextElement!, - loginButtonElement: loginButtonElement!, - privacyCheckBoxElement: privacyCheckBoxElement!, - privacyTextElement: privacyTextElement!, - success: (res) => { - console.log(res); - this.takePhoneNumber(res.accessToken, res.openId); - }, - fail: (error) => { - if (error.errCode == 40001){ - uni.showToast({ - title:"请同意服务条款", - position: "bottom", - duration:2000 - }) - }else if(error.errCode == 40002){ - uni.showToast({ - title:"授权页不符合规范", - position: "bottom", - duration:2000 - }) - }else{ - const errorMsg = JSON.parseObject(error.cause?.cause?.message ?? "")?.getString("errorDesc") ?? error.errMsg; - uni.showToast({ - title:errorMsg, - position: "bottom", - duration:2000 - }) + if(numberTextElement != null && sloganTextElement != null && loginButtonElement != null && privacyCheckBoxElement != null && privacyTextElement != null){ + this.univerifyManager?.customLogin({ + numberTextElement: numberTextElement!, + sloganTextElement: sloganTextElement!, + loginButtonElement: loginButtonElement!, + privacyCheckBoxElement: privacyCheckBoxElement!, + privacyTextElement: privacyTextElement!, + success: (res) => { + console.log(res); + this.takePhoneNumber(res.accessToken, res.openId); + }, + fail: (error) => { + if (error.errCode == 40001){ + uni.showToast({ + title:"请同意服务条款", + position: "bottom", + duration:2000 + }) + }else if(error.errCode == 40002){ + uni.showToast({ + title:"授权页不符合规范", + position: "bottom", + duration:2000 + }) + }else{ + const errorMsg = JSON.parseObject(error.cause?.cause?.message ?? "")?.getString("errorDesc") ?? error.errMsg; + uni.showToast({ + title:errorMsg, + position: "bottom", + duration:2000 + }) - } - } - }) + } + } + }) + }else{ + uni.showToast({ + title:"元素不能为空", + position: "bottom", + duration:2000 + }) + } + }, takePhoneNumber(token : string, openId : string) { //云函数取号 -- GitLab