Browse Source

优化显示效果

bjb 3 months ago
parent
commit
92cc0c92ef

+ 1 - 1
.idea/deploymentTargetSelector.xml

@@ -4,7 +4,7 @@
     <selectionStates>
       <SelectionState runConfigName="app">
         <option name="selectionMode" value="DROPDOWN" />
-        <DropdownSelection timestamp="2026-01-21T03:54:14.252565200Z">
+        <DropdownSelection timestamp="2026-01-23T01:34:05.292277800Z">
           <Target type="DEFAULT_BOOT">
             <handle>
               <DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\ISCS\.android\avd\Resizable.avd" />

+ 1 - 1
app/src/main/java/com/iscs/bozzys/api/ApiBean.kt

@@ -84,7 +84,7 @@ data class User(
     val postIds: List<Int> = listOf(),
     val email: String? = null,
     val mobile: String? = null,
-    val sex: Int = 0,
+    val sex: Int = 1,
     val avatar: String = "",
     val status: Int = 0,
     val loginIp: String = "",

+ 1 - 1
app/src/main/java/com/iscs/bozzys/ui/pages/compose/JobListItem.kt

@@ -136,7 +136,7 @@ fun JobListItem(job: Job) {
                 )
                 Spacer(modifier = Modifier.weight(1f))
                 // 显示创建日期
-                Text(job.createTime.getShowDateOrTime(), fontSize = 14.sp, color = Text.copy(alpha = 0.6f))
+                Text(job.createTime.getShowDateOrTime(), fontSize = 12.sp, color = Text.copy(alpha = 0.6f))
             }
         }
     }

+ 1 - 1
app/src/main/java/com/iscs/bozzys/ui/pages/compose/TaskListItem.kt

@@ -126,7 +126,7 @@ fun TaskListItem(task: Task) {
                 )
                 Spacer(modifier = Modifier.weight(1f))
                 // 显示工作日期
-                Text(task.workTime.getShowDateOrTime(), fontSize = 14.sp, color = Text.copy(alpha = 0.6f))
+                Text(task.workTime.getShowDateOrTime(), fontSize = 12.sp, color = Text.copy(alpha = 0.6f))
             }
         }
     }

+ 1 - 1
app/src/main/java/com/iscs/bozzys/ui/pages/home/HomeCompose.kt

@@ -371,7 +371,7 @@ fun MessageListItem(msg: Message, vm: VMHome) {
                 Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
                     Text("作业管理", fontSize = 12.sp, color = Color(0xFF999999))
                     Spacer(Modifier.weight(1f))
-                    Text(msg.createTime.getShowDateOrTime(), fontSize = 14.sp, color = Text.copy(alpha = 0.6f))
+                    Text(msg.createTime.getShowDateOrTime(), fontSize = 12.sp, color = Text.copy(alpha = 0.6f))
                 }
             }
 //            Spacer(

+ 24 - 5
app/src/main/java/com/iscs/bozzys/ui/pages/profile/PageProfile.kt

@@ -43,6 +43,8 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.draw.clip
 import androidx.compose.ui.draw.rotate
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Brush
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.SolidColor
 import androidx.compose.ui.platform.LocalContext
@@ -128,6 +130,7 @@ class PageProfile : PageBase() {
             Title(pv, "个人信息")
             // 头像信息
             CardContainer(modifier = Modifier.padding(16.dp), topRadius = 16.dp, bottomRadius = 16.dp) {
+                // 头像布局
                 Column {
                     Row(
                         modifier = Modifier
@@ -139,11 +142,27 @@ class PageProfile : PageBase() {
                     ) {
                         Text("头像", fontSize = 16.sp, fontWeight = FontWeight.Bold, color = Text)
                         Spacer(modifier = Modifier.weight(1f))
-                        AsyncImage(
-                            model = state.user.avatar, contentDescription = null, modifier = Modifier
+                        // 默认背景
+                        Box(
+                            modifier = Modifier
                                 .size(52.dp)
-                                .clip(CircleShape)
-                        )
+                                .background(
+                                    brush = Brush.linearGradient(
+                                        colors = listOf(Color(0xFFFFAE00), Color(0xFFF7C700)),
+                                        start = Offset(0f, 0f),
+                                        end = Offset.Infinite
+                                    ),
+                                    shape = RoundedCornerShape(50)
+                                ),
+                            contentAlignment = Alignment.Center
+                        ) {
+                            Text("${state.user.nickname.ifEmpty { "P" }[0]}", color = Text, fontWeight = FontWeight.Bold)
+                            AsyncImage(
+                                model = state.user.avatar, contentDescription = null, modifier = Modifier
+                                    .size(52.dp)
+                                    .clip(CircleShape)
+                            )
+                        }
                         Icon(
                             painter = painterResource(R.drawable.back),
                             contentDescription = null,
@@ -310,10 +329,10 @@ class PageProfile : PageBase() {
     fun SpacerLine() {
         Spacer(
             modifier = Modifier
+                .padding(horizontal = 12.dp)
                 .fillMaxWidth()
                 .height(1.dp)
                 .background(Color.Gray.copy(alpha = 0.2f))
-                .padding(horizontal = 12.dp)
         )
     }
 

+ 3 - 5
app/src/main/java/com/iscs/bozzys/utils/DateUtil.kt

@@ -1,8 +1,6 @@
 package com.iscs.bozzys.utils
 
 import android.os.Build
-import android.util.Log
-import java.lang.System
 import java.text.SimpleDateFormat
 import java.time.Instant
 import java.time.LocalDateTime
@@ -78,7 +76,7 @@ object DateUtil {
             return if (localDate == dat[0]) {
                 // 说明是当天
                 "今天"
-            } else if (localDate == "$year-$month-${(day.toInt() - 1).toString().padStart(2, '0')}") {
+            } else if (localDate == "$year-$month-${(day.toInt() + 1).toString().padStart(2, '0')}") {
                 // 说明是昨天
                 "昨天"
             } else if (localDate.startsWith("$year-")) {
@@ -115,8 +113,8 @@ object DateUtil {
             val time = dat[1]
             return if (localDate == dat[0]) {
                 // 说明是当天
-                time
-            } else if (localDate == "$year-$month-${(day.toInt() - 1).toString().padStart(2, '0')}") {
+                "今天 $time"
+            } else if (localDate == "$year-$month-${(day.toInt() + 1).toString().padStart(2, '0')}") {
                 // 说明是昨天
                 "昨天 $time"
             } else if (localDate.startsWith("$year-")) {