张洋 1 month ago
parent
commit
e0b4ae49ea

+ 36 - 14
bin/Win32/Debug/zhipuzi_pos_windows/skin/image_attention_dlg.xml

@@ -1,20 +1,42 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Window size="700,550" caption="0,0,0,44" roundcorner="4,4" shadowsize="3" showshadow="true">
-	
-	<VerticalLayout bkimage="shoukuan_bkg.png" >
+<Window size="700,600" caption="0,0,0,44" roundcorner="4,4" shadowsize="3" showshadow="true">
+	<!-- 二维码提示弹框:「智铺子硬件商城 / 下载商家app / 联系客服」三个入口共用本皮肤。
+	     三者只有标题、提示语、二维码图片不同,全部由 CImageAttentionWnd 在运行期注入
+	     (SetTitle / SetAttentionText / SetAttentionImage)。 -->
+	<VerticalLayout bkimage="shoukuan_bkg.png">
+		<!-- 标题栏 44 高绿条。标题字号 18 是全站弹框众数(本皮肤原为 22,本次统一到 18)。 -->
 		<HorizontalLayout name="shoukuan_title_bkg" height="44" bkcolor="0xFF60B177">
-			<Label name="memo_dlg_title" text="" height="44" align="center" valign="center" padding="0,0,0,0" textcolor="#FFFFFFFF" font="22"/>
-			<Button name="closebtn" keyboard="false" padding="0,13,15,0" width="16" height="16" normalimage="file='close_normal.png'" hotimage="file='close_hover.png'" pushedimage="file='close_normal.png'"/>
+			<Label name="memo_dlg_title" text="" height="44" align="center" valign="center" padding="0,0,0,0" textcolor="#FFFFFFFF" font="18"/>
+			<!-- 关闭按钮必须 float:HL 会把子项纵向拉伸到整行高,16x16 的图标会被撑成 16x31。
+			     float 不进流、不参与拉伸,pos 相对标题栏矩形。
+			     顺带把标题也摆正了:原来 closebtn 在流内占掉 31px,标题文字中心偏左 15.5px。 -->
+			<Button name="closebtn" keyboard="false" float="true" pos="669,14,685,30" tooltip="关闭" normalimage="file='close_normal.png'" hotimage="file='close_hover.png'" pushedimage="file='close_normal.png'"/>
 		</HorizontalLayout>
-		
-		<VerticalLayout>
-			<HorizontalLayout padding="0,20,0,0">
-				<Control></Control>
+
+		<VerticalLayout padding="40,26,40,26" childalign="center">
+			<!-- 首尾两个裸 Control 平分剩余高度,nAdjustables=2 → 卡片 + 提示语整组垂直居中。
+			     (原来是二维码顶对齐、下面空一大片,提示语又贴在弹框最底部。) -->
+			<Control/>
+
+			<!-- 二维码白卡:hs_card_r10.png = 白底 + 1px #EAECEE 描边 + r10 圆角,
+			     与会员收款弹框的会员信息卡是同一份资产,配色天然一致。
+			     width/height 由 C++ SetAttentionImage 按二维码实际尺寸撑开(396 得 432、300 得 336),
+			     这里的 432 只是「只换皮肤、没重新编译」时的兜底值。
+			     childalign / childvalign 让 396 与 300 两种二维码都居中。
+			     注意:image 控件不能写 width/height。它的矩形必须等于二维码的像素尺寸 ——
+			     DuiLib 的 bkimage 是按原始尺寸画在控件左上角的,控件变大不会放大图片,
+			     只会把二维码顶到左上角。 -->
+			<VerticalLayout name="qr_card" width="432" height="432" bkimage="file='hs_card_r10.png' corner='10,10,10,10'" childalign="center" childvalign="vcenter">
 				<Control name="image"></Control>
-				<Control></Control>
-			</HorizontalLayout>
-			<Label name="text" text="" height="30" padding="30,50,0,30" align="center"/>
+			</VerticalLayout>
+
+			<!-- 提示语:原来没写 font / textcolor(落到默认黑色 14),
+			     且 padding 左右不对称(30,50,0,30)导致文字实测右偏 15px。
+			     这里统一成 14 号次级灰、左右 padding 对称、与白卡间距 20。 -->
+			<Label name="text" text="" height="22" padding="0,20,0,0" font="14" textcolor="0xFF5F6368" align="center"/>
+
+			<!-- 尾裸 Control -->
+			<Control/>
 		</VerticalLayout>
-	
 	</VerticalLayout>
-</Window>
+</Window>

+ 13 - 0
zhipuzi_pos_windows/wnd/CImageAttentionWnd.cpp

@@ -1,6 +1,9 @@
 #include "pch.h"
 #include "CImageAttentionWnd.h"
 
+//二维码白卡相对二维码四周留出的白边宽度(像素)
+static const int QR_CARD_PADDING = 18;
+
 LRESULT CImageAttentionWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
 	POINT pt;
@@ -165,4 +168,14 @@ void CImageAttentionWnd::SetAttentionImage(std::wstring image, int width, int he
 
 	pImage->SetFixedWidth(width);
 	pImage->SetFixedHeight(height);
+
+	//二维码白卡跟着二维码一起撑开:396 与 300 两种二维码都拿到同样宽的白边。
+	//DuiLib 的容器不会被子项撑开(EstimateSize 只返回 m_cxyFixed),所以只能在这里显式对齐。
+	//取不到 qr_card 时静默跳过,向后兼容没有这个控件的旧皮肤。
+	CControlUI* pQrCard = static_cast<CControlUI*>(m_pm.FindControl(_T("qr_card")));
+	if (pQrCard != NULL)
+	{
+		pQrCard->SetFixedWidth(width + QR_CARD_PADDING * 2);
+		pQrCard->SetFixedHeight(height + QR_CARD_PADDING * 2);
+	}
 }