Skip to content

Commit d26dae9

Browse files
committed
[200_33] 登陆按钮实现-优化登陆模块的用户信息接口
1 parent ffd394b commit d26dae9

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

src/Plugins/Qt/qt_tm_widget.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,11 +1918,7 @@ qt_tm_widget_rep::fetchUserInfo (const QString& token) {
19181918
reply, &QNetworkReply::finished, [this, reply, manager, token] () {
19191919
// 定义统一的错误处理逻辑
19201920
auto handleError= [this] () {
1921-
updateDialogContent (
1922-
false, qt_translate ("Not logged in"),
1923-
qt_translate ("Login error, please log in again."),
1924-
"liii",qt_translate ("Non-member"),
1925-
"","","");
1921+
showNotLoggedInDialog (qt_translate ("Login error, please log in again."));
19261922

19271923
QPoint buttonBottomCenter= loginButton->mapToGlobal (
19281924
QPoint (loginButton->width () / 2, loginButton->height ()));
@@ -2027,18 +2023,27 @@ qt_tm_widget_rep::updateDialogContent (bool isLoggedIn, const QString& username,
20272023
} else {
20282024
loginActionButton->setVisible (true);
20292025
logoutButton->setVisible (true);
2030-
loginActionButton->setText (qt_translate (productType.toStdString ().c_str ()));
2026+
// 如果productType=Renew Early,后面加上♥️
2027+
if (productType == QStringLiteral ("Renew Early")) {
2028+
loginActionButton->setText (qt_translate (productType.toStdString ().c_str ()) + " ♥️");
2029+
} else {
2030+
loginActionButton->setText (qt_translate (productType.toStdString ().c_str ()));
2031+
}
20312032
}
20322033
}
20332034

20342035
void
2035-
qt_tm_widget_rep::logout () {
2036-
// 没有token,直接清除UI状态
2036+
qt_tm_widget_rep::showNotLoggedInDialog (const QString& errorMessage) {
20372037
updateDialogContent (
2038-
false, qt_translate ("Not logged in"),
2039-
qt_translate ("Please login to view your account information."),
2040-
"liii",qt_translate ("Non-member"),
2038+
false, qt_translate ("Not logged in"), errorMessage,
2039+
"liii", qt_translate ("Non-member"),
20412040
"","","");
2041+
}
2042+
2043+
void
2044+
qt_tm_widget_rep::logout () {
2045+
// 没有token,直接清除UI状态
2046+
showNotLoggedInDialog (qt_translate ("Please login to view your account information."));
20422047
// 关闭登录对话框
20432048
if (m_loginDialog && m_loginDialog->isVisible ()) {
20442049
m_loginDialog->hide ();

src/Plugins/Qt/qt_tm_widget.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class qt_tm_widget_rep : public qt_window_widget_rep {
119119
const QString& periodLabel,
120120
const QString& periodLabelColor,
121121
const QString& productType);
122+
void showNotLoggedInDialog (const QString& errorMessage);
122123
void logout ();
123124
void openRenewalPage ();
124125

0 commit comments

Comments
 (0)