|
@@ -3,12 +3,6 @@
|
|
|
|
|
|
|
|
LRESULT CSaomaYouhuiquanWnd::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
LRESULT CSaomaYouhuiquanWnd::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
|
{
|
|
{
|
|
|
- CEditUI* pFukuanEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
|
|
|
|
|
-
|
|
|
|
|
- pFukuanEdit->SetFocus();
|
|
|
|
|
-
|
|
|
|
|
- pFukuanEdit->Invalidate();
|
|
|
|
|
-
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -99,8 +93,6 @@ LRESULT CSaomaYouhuiquanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lPa
|
|
|
{
|
|
{
|
|
|
if (wParam == VK_RETURN)
|
|
if (wParam == VK_RETURN)
|
|
|
{
|
|
{
|
|
|
- StartYanzheng();
|
|
|
|
|
-
|
|
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
else if (wParam == VK_ESCAPE)
|
|
else if (wParam == VK_ESCAPE)
|
|
@@ -120,15 +112,6 @@ LRESULT CSaomaYouhuiquanWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lPa
|
|
|
else if (uMsg == WM_MEMBER_CHECK_FAIL)
|
|
else if (uMsg == WM_MEMBER_CHECK_FAIL)
|
|
|
{
|
|
{
|
|
|
//验证失败了
|
|
//验证失败了
|
|
|
- CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
|
|
|
|
|
- pContent->SetEnabled(true);
|
|
|
|
|
-
|
|
|
|
|
- CButtonUI* pQuit = static_cast<CButtonUI*>(m_pm.FindControl(_T("quit")));
|
|
|
|
|
- pQuit->SetEnabled(true);
|
|
|
|
|
- CButtonUI* pSave = static_cast<CButtonUI*>(m_pm.FindControl(_T("save")));
|
|
|
|
|
- pSave->SetEnabled(true);
|
|
|
|
|
-
|
|
|
|
|
- //失败原因
|
|
|
|
|
CLabelUI* pErrorInfo = static_cast<CLabelUI*>(m_pm.FindControl(_T("errinfo")));
|
|
CLabelUI* pErrorInfo = static_cast<CLabelUI*>(m_pm.FindControl(_T("errinfo")));
|
|
|
pErrorInfo->SetText(m_errorInfo.c_str());
|
|
pErrorInfo->SetText(m_errorInfo.c_str());
|
|
|
pErrorInfo->SetVisible(true);
|
|
pErrorInfo->SetVisible(true);
|
|
@@ -172,40 +155,11 @@ void CSaomaYouhuiquanWnd::Notify(TNotifyUI& msg)
|
|
|
{
|
|
{
|
|
|
DuiLib::CDuiString senderName = msg.pSender->GetName();
|
|
DuiLib::CDuiString senderName = msg.pSender->GetName();
|
|
|
|
|
|
|
|
- if (senderName == _T("quit"))
|
|
|
|
|
|
|
+ if (senderName == _T("closebtn"))
|
|
|
{
|
|
{
|
|
|
Close(IDCANCEL);
|
|
Close(IDCANCEL);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- else if (senderName == _T("save"))
|
|
|
|
|
- {
|
|
|
|
|
- StartYanzheng();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (msg.sType == _T("textchanged"))
|
|
|
|
|
- {
|
|
|
|
|
- //只能输入数字,其他的全部删除
|
|
|
|
|
- CEditUI* m_pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
|
|
|
|
|
- if (!m_pEdit->GetText().IsEmpty())
|
|
|
|
|
- {
|
|
|
|
|
- wstring ws_Value = m_pEdit->GetText();
|
|
|
|
|
- string strValue = CLewaimaiString::UnicodeToUTF8(ws_Value);
|
|
|
|
|
-
|
|
|
|
|
- for (size_t nIndex = 0; nIndex < strValue.length(); nIndex++)
|
|
|
|
|
- {
|
|
|
|
|
- unsigned char tmp = strValue.at(nIndex);
|
|
|
|
|
- if (tmp > 122 || tmp < 48)
|
|
|
|
|
- {
|
|
|
|
|
- //ASCII码不是数字的都过滤掉
|
|
|
|
|
- strValue = strValue.substr(0, nIndex);
|
|
|
|
|
-
|
|
|
|
|
- m_pEdit->SetText(CLewaimaiString::UTF8ToUnicode(strValue).c_str());
|
|
|
|
|
- m_pEdit->SetSel(strValue.length(), strValue.length());//重设给光标设置位置
|
|
|
|
|
-
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -214,12 +168,6 @@ void CSaomaYouhuiquanWnd::Init()
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-std::string CSaomaYouhuiquanWnd::getContent()
|
|
|
|
|
-{
|
|
|
|
|
- return m_content;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
void CSaomaYouhuiquanWnd::SetTitle(std::wstring title)
|
|
void CSaomaYouhuiquanWnd::SetTitle(std::wstring title)
|
|
|
{
|
|
{
|
|
|
CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("memo_dlg_title")));
|
|
CLabelUI* pLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("memo_dlg_title")));
|
|
@@ -228,23 +176,11 @@ void CSaomaYouhuiquanWnd::SetTitle(std::wstring title)
|
|
|
|
|
|
|
|
void CSaomaYouhuiquanWnd::StartYanzheng()
|
|
void CSaomaYouhuiquanWnd::StartYanzheng()
|
|
|
{
|
|
{
|
|
|
- CEditUI* pContent = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
|
|
|
|
|
- wstring wsReason = pContent->GetText();
|
|
|
|
|
-
|
|
|
|
|
- m_content = CLewaimaiString::UnicodeToUTF8(wsReason);
|
|
|
|
|
-
|
|
|
|
|
- if (m_content.length() == 0)
|
|
|
|
|
|
|
+ if (m_code.length() == 0)
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- pContent->SetEnabled(false);
|
|
|
|
|
-
|
|
|
|
|
- CButtonUI* pQuit = static_cast<CButtonUI*>(m_pm.FindControl(_T("quit")));
|
|
|
|
|
- pQuit->SetEnabled(false);
|
|
|
|
|
- CButtonUI* pSave = static_cast<CButtonUI*>(m_pm.FindControl(_T("save")));
|
|
|
|
|
- pSave->SetEnabled(false);
|
|
|
|
|
-
|
|
|
|
|
//开始处理
|
|
//开始处理
|
|
|
std::thread(&CSaomaYouhuiquanWnd::ConfirmMember, this).detach();
|
|
std::thread(&CSaomaYouhuiquanWnd::ConfirmMember, this).detach();
|
|
|
}
|
|
}
|
|
@@ -252,7 +188,7 @@ void CSaomaYouhuiquanWnd::StartYanzheng()
|
|
|
void CSaomaYouhuiquanWnd::ConfirmMember()
|
|
void CSaomaYouhuiquanWnd::ConfirmMember()
|
|
|
{
|
|
{
|
|
|
std::map<string, string> params;
|
|
std::map<string, string> params;
|
|
|
- params["rand_number"] = m_content;
|
|
|
|
|
|
|
+ params["rand_number"] = m_code;
|
|
|
|
|
|
|
|
std::string response;
|
|
std::string response;
|
|
|
bool ret = CZhipuziHttpClient::Request("/coupon/getcouponinfobyrandnumber", params, response);
|
|
bool ret = CZhipuziHttpClient::Request("/coupon/getcouponinfobyrandnumber", params, response);
|
|
@@ -317,4 +253,12 @@ void CSaomaYouhuiquanWnd::ConfirmMember()
|
|
|
|
|
|
|
|
PostMessage(WM_MEMBER_CHECK_SUCCESS);
|
|
PostMessage(WM_MEMBER_CHECK_SUCCESS);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+//处理键盘捕捉结果
|
|
|
|
|
+void CSaomaYouhuiquanWnd::HandleTextCapture(std::string content)
|
|
|
|
|
+{
|
|
|
|
|
+ m_code = content;
|
|
|
|
|
+
|
|
|
|
|
+ StartYanzheng();
|
|
|
}
|
|
}
|