From fb5e38207a7d6a716f94e0e0ab444c0f2cc8ba7d Mon Sep 17 00:00:00 2001 From: lcaidm Date: Sat, 29 Jan 2022 16:56:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lcaidm --- .../dialog_ui/js/pages/index/index.css | 22 ++++++------ .../dialog_ui/js/pages/index/index.hml | 2 +- .../include/dialog_ui/js/pages/index/index.js | 11 ------ common/include/dm_constants.h | 6 ++-- .../dialog_ui/js/pages/index/index.css | 35 ++++++++++--------- .../dialog_ui/js/pages/index/index.hml | 7 ++-- .../dialog_ui/js/pages/index/index.js | 28 +++++++-------- ext/pin_auth/include/pin_auth.h | 2 +- ext/pin_auth/include/pin_auth_ui.h | 2 +- ext/pin_auth/src/pin_auth.cpp | 4 +-- ext/pin_auth/src/pin_auth_ui.cpp | 13 ++++--- .../dialog_ui/js/pages/index/index.css | 18 +++++----- .../dialog_ui/js/pages/index/index.js | 1 + .../include/authentication/authentication.h | 2 +- .../include/authentication/dm_auth_manager.h | 3 ++ .../src/authentication/dm_auth_manager.cpp | 13 ++++--- 16 files changed, 85 insertions(+), 84 deletions(-) diff --git a/common/include/dialog_ui/js/pages/index/index.css b/common/include/dialog_ui/js/pages/index/index.css index b87a3962a..997f0c8af 100644 --- a/common/include/dialog_ui/js/pages/index/index.css +++ b/common/include/dialog_ui/js/pages/index/index.css @@ -7,8 +7,8 @@ } .title { - font-size: 48px; - line-height: 70px; + font-size: 80px; + line-height: 150px; font-weight: 800; } @@ -16,26 +16,26 @@ width: 85%; margin-top: 10%; text-align: center; - height: 45px; + height: 100px; } .but1 { - width: 40%; - height: 36px; - font-size: 26px; + width: 30%; + height: 80px; + font-size: 50px; margin-left: 10%; } .but2 { - width: 20%; - height: 36px; - font-size: 26px; + width: 30%; + height: 80px; + font-size: 50px; margin-left: 55%; } .title-list { - font-size: 38px; - line-height: 40px; + font-size: 70px; + line-height: 100px; font-weight: 800; } diff --git a/common/include/dialog_ui/js/pages/index/index.hml b/common/include/dialog_ui/js/pages/index/index.hml index 81ab90ff6..0ab94e3af 100644 --- a/common/include/dialog_ui/js/pages/index/index.hml +++ b/common/include/dialog_ui/js/pages/index/index.hml @@ -7,7 +7,7 @@
-
diff --git a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js index 8a38e6188..36f83be47 100644 --- a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js +++ b/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js @@ -1,4 +1,4 @@ -import router from '@ohos.router' +import router from '@ohos.router'; var numbs = 0; export default { @@ -9,22 +9,20 @@ export default { console.info('getParams: ' + router.getParams()); }, onConfirm() { - console.info('click confirm'); + console.info('click inpout confirm numbs'+ numbs); + console.info('click inpout confirm'); numbs = numbs + 1; - if (numbs < 3){ - var input= document.getElementById("input").value; - console.info('input: ' + input); - console.info('pincode: ' + pincode); - if (input == pincode){ - console.info('pincode: = input'); - callNativeHandler(input, "0"); - } else { - console.info('pincode: != input'); - //刷新页面,提示输入错误 - } + console.info('click inpout confirm numbs'+ numbs); + console.info('click 22confirm'); + var input= this.$element('input').value; + console.info('click 33confirm'); + console.info('input: ' + input); + console.info('pincode: ' + pincode); + if (input == pincode){ + console.info('pincode: = input'); + callNativeHandler(input, "0"); } else { - console.info('click cancel'); - callNativeHandler("EVENT_CONFIRM", "1"); + console.info('pincode: != input'); } }, onCancel() { diff --git a/ext/pin_auth/include/pin_auth.h b/ext/pin_auth/include/pin_auth.h index b2636e0af..dca2e7e7f 100644 --- a/ext/pin_auth/include/pin_auth.h +++ b/ext/pin_auth/include/pin_auth.h @@ -30,7 +30,7 @@ class PinAuth : public IAuthentication { public: PinAuth(); ~PinAuth(); - int32_t ShowAuthInfo(int32_t code) override; + int32_t ShowAuthInfo(int32_t code, std::shared_ptr authManager) override; int32_t StartAuth(int32_t code, std::shared_ptr authManager) override; int32_t VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) override; diff --git a/ext/pin_auth/include/pin_auth_ui.h b/ext/pin_auth/include/pin_auth_ui.h index 61575797f..5ff26c3e1 100644 --- a/ext/pin_auth/include/pin_auth_ui.h +++ b/ext/pin_auth/include/pin_auth_ui.h @@ -26,7 +26,7 @@ namespace DistributedHardware { class PinAuthUi { public: PinAuthUi(); - int32_t ShowPinDialog(int32_t code); + int32_t ShowPinDialog(int32_t code, std::shared_ptr authManager); int32_t InputPinDialog(int32_t code, std::shared_ptr authManager); private: diff --git a/ext/pin_auth/src/pin_auth.cpp b/ext/pin_auth/src/pin_auth.cpp index 138abc56f..0bbadd15f 100644 --- a/ext/pin_auth/src/pin_auth.cpp +++ b/ext/pin_auth/src/pin_auth.cpp @@ -33,9 +33,9 @@ PinAuth::~PinAuth() { } -int32_t PinAuth::ShowAuthInfo(int32_t code) +int32_t PinAuth::ShowAuthInfo(int32_t code, std::shared_ptr authManager) { - return pinAuthUi_->ShowPinDialog(code); + return pinAuthUi_->ShowPinDialog(code, authManager); } int32_t PinAuth::StartAuth(int32_t code, std::shared_ptr authManager) diff --git a/ext/pin_auth/src/pin_auth_ui.cpp b/ext/pin_auth/src/pin_auth_ui.cpp index a3cfeefe2..51f76bdb4 100644 --- a/ext/pin_auth/src/pin_auth_ui.cpp +++ b/ext/pin_auth/src/pin_auth_ui.cpp @@ -28,7 +28,7 @@ PinAuthUi::PinAuthUi() LOGI("AuthUi constructor"); } -int32_t PinAuthUi::ShowPinDialog(int32_t code) +int32_t PinAuthUi::ShowPinDialog(int32_t code, std::shared_ptr authManager) { LOGI("ShowPinDialog start"); nlohmann::json jsonObj; @@ -41,9 +41,14 @@ int32_t PinAuthUi::ShowPinDialog(int32_t code) params, OHOS::Rosen::WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW, ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT, - [](int32_t id, const std::string& event, const std::string& params) { - LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str()); - Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id); + [authManager](int32_t id, const std::string& event, const std::string& params) { + if (strcmp(params.c_str(), "0") == 0) { + authManager->ClosePage(id); + } + if (strcmp(params.c_str(), "1") == 0) { + LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str()); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id); + } }); LOGI("ShowConfigDialog end"); return DM_OK; diff --git a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css b/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css index feb20b4fd..4e83197eb 100644 --- a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css +++ b/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css @@ -7,25 +7,25 @@ } .title { - font-size: 48px; - line-height: 50px; + font-size: 80px; + line-height: 120px; font-weight: 800; } .title-list { - font-size: 38px; - line-height: 40px; + font-size: 60px; + line-height: 100px; font-weight: 800; } .title-pin { - font-size: 48px; - line-height: 50px; + font-size: 60px; + line-height: 100px; font-weight: 800; } .but { - width: 100%; - font-size: 26px; - height: 36px; + width: 30%; + font-size: 50px; + height: 80px; } \ No newline at end of file diff --git a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js b/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js index 114655c3a..3a55ac1cc 100644 --- a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js +++ b/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js @@ -6,6 +6,7 @@ export default { }, onInit() { console.info('getParams: ' + router.getParams()); + callNativeHandler("EVENT_CONFIRM", "0"); }, onConfirm() { console.info('click confirm'); diff --git a/services/devicemanagerservice/include/authentication/authentication.h b/services/devicemanagerservice/include/authentication/authentication.h index 43c486511..67ca0c3ee 100644 --- a/services/devicemanagerservice/include/authentication/authentication.h +++ b/services/devicemanagerservice/include/authentication/authentication.h @@ -24,7 +24,7 @@ class DmAuthManager; class IAuthentication { public: virtual ~IAuthentication() = default; - virtual int32_t ShowAuthInfo(int32_t code) = 0; + virtual int32_t ShowAuthInfo(int32_t code, std::shared_ptr authManager) = 0; virtual int32_t StartAuth(int32_t code, std::shared_ptr authManager) = 0; virtual int32_t VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) = 0; }; diff --git a/services/devicemanagerservice/include/authentication/dm_auth_manager.h b/services/devicemanagerservice/include/authentication/dm_auth_manager.h index 6b0298ec9..a24f9d45d 100644 --- a/services/devicemanagerservice/include/authentication/dm_auth_manager.h +++ b/services/devicemanagerservice/include/authentication/dm_auth_manager.h @@ -86,6 +86,7 @@ typedef struct DmAuthRequestContext { std::string appThumbnail; std::string token; int32_t reason; + int32_t aceId; std::vector syncGroupList; } DmAuthRequestContext; @@ -112,6 +113,7 @@ typedef struct DmAuthResponseContext { int64_t requestId; int32_t code; int32_t state; + int32_t aceId; std::vector syncGroupList; } DmAuthResponseContext; @@ -162,6 +164,7 @@ public: int32_t GetAuthenticationParam(DmAuthParam &authParam); int32_t OnUserOperation(int32_t action); void UserSwitchEventCallback(void); + void ClosePage(const int32_t &id); private: std::shared_ptr softbusConnector_; diff --git a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp index 1e9976f44..23d55c7f2 100644 --- a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp +++ b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp @@ -520,7 +520,7 @@ int32_t DmAuthManager::AddMember(const std::string &deviceId) return DM_FAILED; } LOGI("DmAuthManager::authRequestContext CancelDisplay start"); - CancelDisplay(); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId); return DM_OK; } @@ -547,7 +547,7 @@ void DmAuthManager::AuthenticateFinish() LOGI("DmAuthManager::AuthenticateFinish start"); if (authResponseState_ != nullptr) { if (authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_FINISH) { - CancelDisplay(); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId); } if (!timerMap_.empty()) { for (auto &iter : timerMap_) { @@ -569,7 +569,7 @@ void DmAuthManager::AuthenticateFinish() } if (authResponseContext_->state == AuthState::AUTH_REQUEST_INPUT) { - CancelDisplay(); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId); } listener_->OnAuthResult(authRequestContext_->hostPkgName, authRequestContext_->deviceId, @@ -688,7 +688,7 @@ void DmAuthManager::ShowAuthInfoDialog() } ptr = authenticationMap_[1]; LOGI("ShowAuthInfoDialog code:%d", authResponseContext_->code); - ptr->ShowAuthInfo(authResponseContext_->code); + ptr->ShowAuthInfo(authResponseContext_->code, shared_from_this()); } void DmAuthManager::ShowStartAuthDialog() @@ -785,5 +785,10 @@ void DmAuthManager::VerifyPinAuthAuthentication(const std::string &action) } LOGI("DmAuthManager::VerifyAuthentication complete"); } + +void DmAuthManager::ClosePage(const int32_t &id) +{ + authResponseContext_->aceId = id; +} } // namespace DistributedHardware } // namespace OHOS -- Gitee