refactor: 优化前端功能屏幕
- 优化AboutScreen关于页面 - 优化AccountManagementScreen账户管理页面 - 优化CreateMemoryScreen创建回忆页面 - 优化LegalDocumentScreen法律文档页面 - 优化ProfileScreen个人资料页面 - 优化ResetPasswordScreen重置密码页面 - 优化AuthViewModel认证ViewModel
This commit is contained in:
@@ -1,16 +1,20 @@
|
|||||||
package com.huaga.life_echo.ui.screens
|
package com.huaga.life_echo.ui.screens
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.huaga.life_echo.navigation.Screen
|
||||||
import com.huaga.life_echo.ui.components.common.TransparentTopAppBar
|
import com.huaga.life_echo.ui.components.common.TransparentTopAppBar
|
||||||
import com.huaga.life_echo.ui.components.common.TransparencyType
|
import com.huaga.life_echo.ui.components.common.TransparencyType
|
||||||
import com.huaga.life_echo.ui.icons.AppIcons
|
import com.huaga.life_echo.ui.icons.AppIcons
|
||||||
@@ -80,7 +84,7 @@ fun AboutScreen(
|
|||||||
|
|
||||||
// 应用名称
|
// 应用名称
|
||||||
Text(
|
Text(
|
||||||
text = "Life Echo",
|
text = "岁月史书",
|
||||||
fontSize = 28.sp,
|
fontSize = 28.sp,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
@@ -114,7 +118,7 @@ fun AboutScreen(
|
|||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "Life Echo 是一款智能回忆录助手应用,帮助您记录和整理生活中的美好回忆。通过AI对话的方式,轻松创建属于您的个人回忆录。",
|
text = "岁月史书是一款专为长辈设计的智能回忆录助手应用,帮助老年人轻松记录和整理一生中的美好回忆。通过简单的AI对话方式,无需复杂操作,就能将珍贵的人生故事转化为精美的个人回忆录。\n\n当然,无论您是什么年龄,都可以使用岁月史书来记录属于自己的故事。",
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -158,9 +162,41 @@ fun AboutScreen(
|
|||||||
color = MaterialTheme.colorScheme.outlineVariant
|
color = MaterialTheme.colorScheme.outlineVariant
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 法律条款
|
||||||
|
Text(
|
||||||
|
text = "法律条款",
|
||||||
|
fontSize = 20.sp,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(bottom = 12.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 用户协议
|
||||||
|
LegalDocumentItem(
|
||||||
|
title = "用户协议",
|
||||||
|
onClick = { navController?.navigate(Screen.Terms.route) }
|
||||||
|
)
|
||||||
|
|
||||||
|
// 隐私政策
|
||||||
|
LegalDocumentItem(
|
||||||
|
title = "隐私政策",
|
||||||
|
onClick = { navController?.navigate(Screen.Privacy.route) }
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
HorizontalDivider(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 16.dp),
|
||||||
|
color = MaterialTheme.colorScheme.outlineVariant
|
||||||
|
)
|
||||||
|
|
||||||
// 版权信息
|
// 版权信息
|
||||||
Text(
|
Text(
|
||||||
text = "© 2026 Life Echo. All rights reserved.",
|
text = "© 2026 岁月史书. All rights reserved.",
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
modifier = Modifier.padding(top = 16.dp)
|
modifier = Modifier.padding(top = 16.dp)
|
||||||
@@ -170,3 +206,35 @@ fun AboutScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 法律文档列表项
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
private fun LegalDocumentItem(
|
||||||
|
title: String,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
modifier: Modifier = Modifier
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clip(RoundedCornerShape(8.dp))
|
||||||
|
.clickable(onClick = onClick)
|
||||||
|
.padding(vertical = 12.dp, horizontal = 4.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = title,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
|
)
|
||||||
|
Icon(
|
||||||
|
imageVector = AppIcons.ChevronRight,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.size(20.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ fun AccountManagementScreen(
|
|||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onNavigateBack) {
|
IconButton(onClick = onNavigateBack) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.ArrowBack,
|
imageVector = AppIcons.ArrowBack,
|
||||||
contentDescription = "返回"
|
contentDescription = "返回"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
|
import com.huaga.life_echo.config.AppConfig
|
||||||
import com.huaga.life_echo.data.database.Message
|
import com.huaga.life_echo.data.database.Message
|
||||||
import com.huaga.life_echo.network.models.MessageDto
|
import com.huaga.life_echo.network.models.MessageDto
|
||||||
import com.huaga.life_echo.ui.components.chat.*
|
import com.huaga.life_echo.ui.components.chat.*
|
||||||
@@ -112,21 +113,23 @@ fun CreateMemoryScreen(
|
|||||||
onBackClick = { navController?.popBackStack() }
|
onBackClick = { navController?.popBackStack() }
|
||||||
)
|
)
|
||||||
|
|
||||||
// WebSocket调试面板(开发测试用)
|
// WebSocket调试面板(仅在开发模式下显示)
|
||||||
WebSocketDebugPanel(
|
if (AppConfig.isDebugMode) {
|
||||||
connectionStatus = connectionStatus,
|
WebSocketDebugPanel(
|
||||||
conversationId = conversationIdState,
|
connectionStatus = connectionStatus,
|
||||||
isConnected = wsIsConnected,
|
conversationId = conversationIdState,
|
||||||
isStreaming = isStreaming,
|
isConnected = wsIsConnected,
|
||||||
isTyping = isTyping,
|
isStreaming = isStreaming,
|
||||||
lastMessageType = lastMessageType,
|
isTyping = isTyping,
|
||||||
lastMessageTime = lastMessageTime,
|
lastMessageType = lastMessageType,
|
||||||
errorMessages = errorMessages,
|
lastMessageTime = lastMessageTime,
|
||||||
messageCount = messageCount,
|
errorMessages = errorMessages,
|
||||||
modifier = Modifier
|
messageCount = messageCount,
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
.fillMaxWidth()
|
||||||
)
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// 使用新的MessageList组件(包含所有消息、流式内容和输入指示器)
|
// 使用新的MessageList组件(包含所有消息、流式内容和输入指示器)
|
||||||
MessageList(
|
MessageList(
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package com.huaga.life_echo.ui.screens
|
|||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
import android.webkit.WebViewClient
|
import android.webkit.WebViewClient
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.filled.ArrowBack
|
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -13,6 +11,7 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.viewinterop.AndroidView
|
import androidx.compose.ui.viewinterop.AndroidView
|
||||||
import com.huaga.life_echo.config.AppConfig
|
import com.huaga.life_echo.config.AppConfig
|
||||||
|
import com.huaga.life_echo.ui.icons.AppIcons
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 法律文档页面(用户协议或隐私政策)
|
* 法律文档页面(用户协议或隐私政策)
|
||||||
@@ -34,7 +33,7 @@ fun LegalDocumentScreen(
|
|||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onNavigateBack) {
|
IconButton(onClick = onNavigateBack) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.ArrowBack,
|
imageVector = AppIcons.ArrowBack,
|
||||||
contentDescription = "返回"
|
contentDescription = "返回"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,6 +250,23 @@ fun ProfileScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 账户管理(登录后显示,放在靠前位置)
|
||||||
|
if (isLoggedIn) {
|
||||||
|
item {
|
||||||
|
SectionTitle("账户管理")
|
||||||
|
SettingCard {
|
||||||
|
SettingItem(
|
||||||
|
icon = AppIcons.ManageAccounts,
|
||||||
|
title = "账户管理",
|
||||||
|
subtitle = "修改密码、手机号、登出管理",
|
||||||
|
onClick = {
|
||||||
|
navController?.navigate(Screen.AccountManagement.route)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 套餐与付费
|
// 套餐与付费
|
||||||
item {
|
item {
|
||||||
SectionTitle("套餐与付费")
|
SectionTitle("套餐与付费")
|
||||||
@@ -358,17 +375,6 @@ fun ProfileScreen(
|
|||||||
},
|
},
|
||||||
onClick = { darkMode = !darkMode }
|
onClick = { darkMode = !darkMode }
|
||||||
)
|
)
|
||||||
if (isLoggedIn) {
|
|
||||||
HorizontalDivider(modifier = Modifier.padding(horizontal = 16.dp))
|
|
||||||
SettingItem(
|
|
||||||
icon = AppIcons.ManageAccounts,
|
|
||||||
title = "账户管理",
|
|
||||||
subtitle = "修改密码、手机号、登出管理",
|
|
||||||
onClick = {
|
|
||||||
navController?.navigate(Screen.AccountManagement.route)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ fun ResetPasswordScreen(
|
|||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onBackToLogin) {
|
IconButton(onClick = onBackToLogin) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.ArrowBack,
|
imageVector = AppIcons.ArrowBack,
|
||||||
contentDescription = "返回"
|
contentDescription = "返回"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class AuthViewModel(private val context: Context) : ViewModel() {
|
|||||||
_operationResult.value = OperationResult(
|
_operationResult.value = OperationResult(
|
||||||
success = true,
|
success = true,
|
||||||
message = "注册成功",
|
message = "注册成功",
|
||||||
details = "账号已创建,欢迎加入 Life Echo!正在跳转..."
|
details = "账号已创建,欢迎加入岁月史书!正在跳转..."
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onFailure = { exception ->
|
onFailure = { exception ->
|
||||||
@@ -419,7 +419,7 @@ class AuthViewModel(private val context: Context) : ViewModel() {
|
|||||||
_operationResult.value = OperationResult(
|
_operationResult.value = OperationResult(
|
||||||
success = true,
|
success = true,
|
||||||
message = "注册成功",
|
message = "注册成功",
|
||||||
details = "账号已创建,欢迎加入 Life Echo!正在跳转..."
|
details = "账号已创建,欢迎加入岁月史书!正在跳转..."
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onFailure = { exception ->
|
onFailure = { exception ->
|
||||||
|
|||||||
Reference in New Issue
Block a user