Kaynağa Gözat

登录的优化

张洋 6 yıl önce
ebeveyn
işleme
3928c097be

+ 18 - 0
bin/Win32/Debug/zhipuzi_pay_plugin/skin/about.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Window>
+	<Font id="0" name="微软雅黑" size="16" />
+	<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
+		<Control height="180" />
+		<HorizontalLayout align="center" height="50" padding="0,0,0,30">
+			<Control></Control>
+			<Control bkimage="file='logo_50.png'" width="50" height="50" align="center"></Control>
+			<Control></Control>
+		</HorizontalLayout>
+		
+		<Label text="智铺子收银插件" align="center">
+		</Label>
+		
+		<Label name="about_version" text="版本号:1.0.0.1" align="center">
+		</Label>
+	</VerticalLayout>
+</Window>

+ 1 - 7
bin/Win32/Debug/zhipuzi_pay_plugin/skin/menu.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Window size="220,392" caption="0,0,0,0" layeredimage="file='value_bkg.png' corner='5,5,5,5'" layeredopacity="255">
+<Window size="220,348" caption="0,0,0,0" layeredimage="file='value_bkg.png' corner='5,5,5,5'" layeredopacity="255">
  <Font id="0" name="微软雅黑" size="16"/>
  <Font id="1" name="微软雅黑" size="20"/>
 <VerticalLayout bkimage="file='value_bkg.png' corner='5,5,5,5'">
@@ -42,12 +42,6 @@
 	</MenuItem>
 	
 	<MenuItem height="36" hotimage="menu_hover.png" inset="10,0,10,0" padding="0, 10, 0, 0">
-		<Control mouse="false" bkimage="guanyuwomen.png" float="true" pos="35,5,63,33"></Control>
-		<Button name="value_menu_guanyuwomen"></Button>
-		<Label mouse="false" text="关于我们" font="0" textcolor="0xFFFFFFFF" float="true" pos="75,5,220,36"></Label>
-	</MenuItem>
-	
-	<MenuItem height="36" hotimage="menu_hover.png" inset="10,0,10,0" padding="0, 10, 0, 0">
 		<Control mouse="false" bkimage="tuichu.png" float="true" pos="35,5,63,33"></Control>
 		<Button name="value_menu_quit"></Button>
 		<Label mouse="false" text="退出" font="0" textcolor="0xFFFFFFFF" float="true" pos="75,5,220,36"></Label>

BIN
bin/Win32/Debug/zhipuzi_pay_plugin/skin/shop_logo.png


+ 7 - 3
bin/Win32/Debug/zhipuzi_pay_plugin/skin/system_setting.xml

@@ -5,13 +5,17 @@
 	<Font id="2" name="微软雅黑" size="18" />
 	<Font id="3" name="微软雅黑" size="32" />
 	<VerticalLayout bkimage="shoukuan_bkg.png">
-		<HorizontalLayout name="shoukuan_title_bkg" height="44" bkcolor="0xFF3CB371">
+		<HorizontalLayout name="system_setting_title_bkg" height="44" bkcolor="0xFF3CB371">
 			<Label name="system_setting_title" text="设置" height="44" align="center" valign="center" padding="0,0,0,0" textcolor="#FFFFFFFF" font="2"/>
 			<Button name="system_setting_closebtn" padding="0,13,15,0" width="16" height="16" tooltip="关闭" normalimage="file='close_normal.png'" hotimage="file='close_hover.png'" pushedimage="file='close_normal.png'"/>
 		</HorizontalLayout>
 		<HorizontalLayout>
 			<VerticalLayout width="160" bkcolor="0xFFF8F8F8">			
-				<Control height="150" ></Control>
+				<Control bkimage="shop_logo.png" width="70" height="70" padding="48,20,0,10"></Control>
+				<Label name="system_setting_shopname" text="店铺名字店铺" font="0" width="140" padding="10,0,10,0" align="center" multiline="true" ></Label>
+				
+				<Control width="160" height="1" bkcolor="#FFE0E0E6" padding="0,25,0,25"></Control>
+				
 				<Option name="system_setting_option_zhuaqu" text="金额抓取" font="0" group="system_setting_item" selected="true" height="40" hotimage="tab_hot.bmp" selectedimage="setting_tab_bkg.png" selectedtextcolor="0xFFFFFFFF"/>
 				<Option name="system_setting_option_kuaijiejian" text="快捷键" font="0" group="system_setting_item" height="40" hotimage="tab_hot.bmp" selectedimage="setting_tab_bkg.png" selectedtextcolor="0XFFFFFFFF"/>
 				<Option name="system_setting_option_about" text="关于" font="0" group="system_setting_item" height="40" hotimage="tab_hot.bmp" selectedimage="setting_tab_bkg.png" selectedtextcolor="0XFFFFFFFF"/>
@@ -27,7 +31,7 @@
 				</HorizontalLayout>
 				
 				<HorizontalLayout vscrollbar="true">
-					<Label text="222"></Label>
+					<Include source="about.xml" />
 				</HorizontalLayout>
 			</TabLayout>
 		</HorizontalLayout>

+ 3 - 1
zhipuzi_pay_plugin/network/CZhipuziHttpClient.h

@@ -18,7 +18,7 @@ public:
 public:
     static CZhipuziHttpClient m_client;
 
-private:
+public:
     std::string m_username;
     std::string m_password;
 
@@ -27,4 +27,6 @@ private:
 
 	std::string m_version_type;
 	std::string lwm_sess_token;
+
+	std::string m_shopname;
 };

+ 55 - 0
zhipuzi_pay_plugin/wnd/CLoginWnd.cpp

@@ -529,6 +529,61 @@ void CLoginWnd::HandleLogin()
 		//把用户名和密码保存起来
 		CSetting::SetLoginInfo(s_account, s_password);
 
+		//开始处理获取账号权限的逻辑
+		std::map<string, string> params;
+
+		params["version_type"] = CZhipuziHttpClient::m_client.m_version_type;
+		params["lwm_sess_token"] = CZhipuziHttpClient::m_client.lwm_sess_token;
+
+		std::string response;
+
+		std::string url = "/common/merchant/account/user/syncuserdata";
+		CZhipuziHttpClient::Request(url.c_str(), params, response);
+
+		rapidjson::Document document;
+		document.Parse(response.c_str());
+
+		if (document.HasParseError())
+		{
+			pLoginResultLabel->SetText(std::wstring(_T("服务器错误")).c_str());
+			pLoginResultLabel->SetVisible(true);
+
+			PostMessage(WM_LOGIN_ERROR);
+
+			return;
+		}
+
+		if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+		{
+			pLoginResultLabel->SetText(std::wstring(_T("服务器错误")).c_str());
+			pLoginResultLabel->SetVisible(true);
+
+			PostMessage(WM_LOGIN_ERROR);
+
+			return;
+		}
+
+		rapidjson::Value& v_errcode = document["errcode"];
+		int errcode = v_errcode.GetInt();
+		if (errcode != 0)
+		{
+			std::string errmsg = document["errmsg"].GetString();
+
+			pLoginResultLabel->SetText(CLewaimaiString::UTF8ToUnicode(errmsg).c_str());
+			pLoginResultLabel->SetVisible(true);
+
+			PostMessage(WM_LOGIN_ERROR);
+
+			return;
+		}
+
+		rapidjson::Value& data = document["data"];
+		rapidjson::Value& shop_name = data["shop_name"];
+
+		std::string shopname = shop_name.GetString();
+
+		CZhipuziHttpClient::m_client.m_shopname = shopname;
+
 		PostMessage(WM_LOGIN_SUCCESS);
 
 		return;

+ 8 - 0
zhipuzi_pay_plugin/wnd/CSystemSettingWnd.cpp

@@ -239,6 +239,14 @@ void CSystemSettingWnd::Init()
 
 	CButtonUI* jiesuan_edit = static_cast<CButtonUI*>(m_pm.FindControl(_T("kuaijiejian_setting_jiesuan_btn")));
 	jiesuan_edit->SetText(shoukuan_info);
+
+	//关于我们
+	CLabelUI* version = static_cast<CLabelUI*>(m_pm.FindControl(_T("about_version")));
+	version->SetText((L"版本号:" + CLewaimaiString::UTF8ToUnicode(CSystem::GetVersion())).c_str());
+
+
+	CLabelUI* system_setting_shopname = static_cast<CLabelUI*>(m_pm.FindControl(_T("system_setting_shopname")));
+	system_setting_shopname->SetText(CLewaimaiString::UTF8ToUnicode(CZhipuziHttpClient::m_client.m_shopname).c_str());
 }
 
 LRESULT CSystemSettingWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)