diff --git a/background/src/main/AndroidManifest.xml b/background/src/main/AndroidManifest.xml
index 9362ec8..8324f49 100644
--- a/background/src/main/AndroidManifest.xml
+++ b/background/src/main/AndroidManifest.xml
@@ -29,6 +29,9 @@
+
\ No newline at end of file
diff --git a/background/src/main/java/com/gyf/csams/main/model/ManagementOfficerModel.kt b/background/src/main/java/com/gyf/csams/main/model/ManagementOfficerModel.kt
new file mode 100644
index 0000000..ff2fcb5
--- /dev/null
+++ b/background/src/main/java/com/gyf/csams/main/model/ManagementOfficerModel.kt
@@ -0,0 +1,123 @@
+package com.gyf.csams.main.model
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import com.gyf.lib.util.randomChinese
+import com.gyf.lib.util.randomNum
+import com.orhanobut.logger.Logger
+import kotlinx.coroutines.launch
+
+enum class ColumnType {
+ Text,
+ DropMenu
+}
+
+/**
+ * 职务
+ *
+ * @property desc
+ */
+enum class Duty(val desc: String) {
+ Minister("部长"),
+ Manager("干事")
+}
+
+/**
+ * 人员信息
+ *
+ * @property name 名字
+ * @property studentId 学号
+ * @property mobile 手机号
+ * @property duty 职务
+ * @property counselor 导员
+ */
+data class OfficerVo(
+ val name: String,
+ val studentId: String,
+ val mobile: String,
+ val duty: Duty,
+ val counselor: String
+)
+
+data class AllOfficerVo(
+ val secretariat: MutableList,
+ val propaganda: MutableList,
+ val publicRelationsDepartment: MutableList
+)
+
+/**
+ * 部门干事数据状态管理
+ *
+ */
+class ManagementOfficerModel : ViewModel() {
+ private val _data = MutableLiveData()
+ val data: LiveData = _data
+
+ init {
+ load()
+ }
+
+ private fun replace(
+ list: MutableList,
+ index: Int,
+ callback: (s: MutableList) -> Unit
+ ) {
+ val s = mutableListOf()
+ list[index] = list[index].copy(duty = Duty.Minister)
+ s.add(list[index])
+ s.addAll(list.filter { officerVo -> officerVo != list[index] }
+ .map { officerVo -> officerVo.copy(duty = Duty.Manager) })
+ callback(s)
+ }
+
+ fun updateDuty(list: MutableList, index: Int) {
+ _data.value?.apply {
+ Logger.i("$secretariat")
+ when (list) {
+ secretariat -> replace(list = list, index = index) {
+ _data.postValue(copy(secretariat = it))
+ }
+ propaganda -> replace(list = list, index = index) {
+ _data.postValue(copy(propaganda = it))
+ }
+ publicRelationsDepartment -> replace(list = list, index = index) {
+ _data.postValue(copy(publicRelationsDepartment = it))
+ }
+ }
+
+
+ }
+
+ }
+
+ /**
+ * TODO 加载部门成员
+ *
+ */
+ private fun load() {
+ viewModelScope.launch {
+ val officerVoList = mutableListOf()
+ val baseSize = 3
+ val peopleSize = 5
+ repeat(peopleSize * baseSize) {
+ officerVoList.add(
+ OfficerVo(
+ name = randomChinese(3), studentId = randomNum(8), mobile = randomNum(11),
+ if (it % peopleSize == 0) Duty.Minister else Duty.Manager, counselor = ""
+ )
+ )
+ }
+ val all = officerVoList.chunked(peopleSize)
+ _data.postValue(
+ AllOfficerVo(
+ secretariat = all[0].toMutableList(),
+ propaganda = all[1].toMutableList(),
+ publicRelationsDepartment = all[2].toMutableList()
+ )
+ )
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/background/src/main/java/com/gyf/csams/main/ui/ManagementOfficerActivity.kt b/background/src/main/java/com/gyf/csams/main/ui/ManagementOfficerActivity.kt
new file mode 100644
index 0000000..3928eea
--- /dev/null
+++ b/background/src/main/java/com/gyf/csams/main/ui/ManagementOfficerActivity.kt
@@ -0,0 +1,172 @@
+package com.gyf.csams.main.ui
+
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.annotation.StringRes
+import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.material.DropdownMenu
+import androidx.compose.material.DropdownMenuItem
+import androidx.compose.material.MaterialTheme
+import androidx.compose.material.Text
+import androidx.compose.runtime.*
+import androidx.compose.runtime.livedata.observeAsState
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.unit.dp
+import androidx.lifecycle.viewmodel.compose.viewModel
+import com.gyf.csams.R
+import com.gyf.csams.main.model.Duty
+import com.gyf.csams.main.model.ManagementOfficerModel
+import com.gyf.csams.main.model.MinisterVo
+import com.gyf.csams.main.model.OfficerVo
+import com.gyf.lib.uikit.*
+import com.orhanobut.logger.Logger
+
+/**
+ * 部门干事管理
+ *
+ */
+class ManagementOfficerActivity : ComponentActivity() {
+ @ExperimentalFoundationApi
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContent {
+ Body { scaffoldState ->
+ MainColumnFrame(background = { /*TODO*/ }) {
+ val weight = 1 / 3F
+ val model: ManagementOfficerModel = viewModel()
+ val data by model.data.observeAsState()
+ Logger.i("$data")
+ data?.apply {
+ Table(
+ modifier = Modifier
+ .weight(weight = weight),
+ id = R.string.secretariat,
+ officerVoList = secretariat
+ )
+ Table(
+ modifier = Modifier
+ .weight(weight = weight),
+ id = R.string.propaganda_department,
+ officerVoList = propaganda
+ )
+ Table(
+ modifier = Modifier
+ .weight(weight = weight),
+ id = R.string.public_relations_department,
+ officerVoList = publicRelationsDepartment
+ )
+ }
+
+ ShowSnackbar(scaffoldState = scaffoldState)
+ }
+ }
+ }
+ }
+
+ @Composable
+ private fun BoxItem(content: @Composable () -> Unit) {
+ Box(
+ Modifier
+ .width(150.dp)
+ .height(40.dp)
+ .border(
+ width = 1.dp,
+ color = MaterialTheme.colors.onBackground
+ )
+ .padding(vertical = 10.dp),
+ contentAlignment = Alignment.Center
+ ) {
+ content()
+ }
+ }
+
+ /**
+ *
+ * 表格
+ */
+ @ExperimentalFoundationApi
+ @Composable
+ private fun Table(
+ modifier: Modifier = Modifier,
+ model: ManagementOfficerModel = viewModel(),
+ scaffoldModel: ScaffoldModel = viewModel(),
+ @StringRes id: Int,
+ officerVoList: MutableList,
+ ) {
+ Column(
+ modifier = modifier
+ .padding(horizontal = 10.dp)
+ .border(width = 1.dp, color = MaterialTheme.colors.onBackground),
+ verticalArrangement = Arrangement.SpaceEvenly
+ ) {
+ val context = LocalContext.current
+
+ Spacer(modifier = Modifier.weight(0.05F))
+ Text(text = context.getString(id), modifier = Modifier.weight(0.1F))
+ Spacer(modifier = Modifier.weight(0.05F))
+ val columnSize = 4
+
+ LazyRow(modifier = Modifier.weight(0.6F)) {
+ officerVoList.withIndex().forEach {
+ item {
+ var expanded by remember {
+ mutableStateOf(false)
+ }
+ Profile(
+ modifier = Modifier
+ .width(200.dp)
+ .fillMaxHeight()
+ .border(width = 1.dp, color = MaterialTheme.colors.onBackground),
+ personInfoVo =
+ MinisterVo(
+ name = it.value.name,
+ duty = it.value.duty.desc,
+ headImg = "",
+ desc = it.value.mobile
+ )
+ ) {
+
+ Text(
+ text = it.value.duty.desc,
+ modifier = Modifier.clickable(onClick = {
+ if (it.value.duty.desc != Duty.Minister.desc) expanded =
+ true else scaffoldModel
+ .update(message = context.getString(R.string.update_duty_error))
+ })
+ )
+// Text(
+// text = it.duty.desc,
+// modifier = Modifier.clickable(onClick = {
+// if (duty.desc != Duty.Minister.desc) expanded =
+// true else scaffoldModel
+// .update(message = context.getString(R.string.update_duty_error))
+// })
+// )
+ DropdownMenu(
+ expanded = expanded,
+ onDismissRequest = { /*TODO*/ }) {
+ DropdownMenuItem(onClick = {
+ model.updateDuty(list = officerVoList, index = it.index)
+ expanded = false
+ }) {
+ Text(text = Duty.Minister.desc)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Spacer(modifier = Modifier.weight(0.05F))
+
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/background/src/main/res/values-en/strings.xml b/background/src/main/res/values-en/strings.xml
index a647dc1..5e5c3e9 100644
--- a/background/src/main/res/values-en/strings.xml
+++ b/background/src/main/res/values-en/strings.xml
@@ -11,4 +11,10 @@
专门负责学校社团各种活动的宣传,出海报以及网络上的宣传工作。 负责学生思想政治教育和学生会各项宣传报道工作的组织和规划。 围绕学院各阶段的中心工作和学院组织和各项活动,做好宣传鼓动工作。 组织学生参加社团开设的学术讲座和学术活动,督促和指导各班学习委员开展工作。
部门介绍
+ 名字
+ 学号
+ 手机号
+ 职务
+ 导员
+ 只能调整干事职务!
\ No newline at end of file
diff --git a/background/src/main/res/values-zh/strings.xml b/background/src/main/res/values-zh/strings.xml
index a647dc1..5e5c3e9 100644
--- a/background/src/main/res/values-zh/strings.xml
+++ b/background/src/main/res/values-zh/strings.xml
@@ -11,4 +11,10 @@
专门负责学校社团各种活动的宣传,出海报以及网络上的宣传工作。 负责学生思想政治教育和学生会各项宣传报道工作的组织和规划。 围绕学院各阶段的中心工作和学院组织和各项活动,做好宣传鼓动工作。 组织学生参加社团开设的学术讲座和学术活动,督促和指导各班学习委员开展工作。
部门介绍
+ 名字
+ 学号
+ 手机号
+ 职务
+ 导员
+ 只能调整干事职务!
\ No newline at end of file
diff --git a/background/src/main/res/values/strings.xml b/background/src/main/res/values/strings.xml
index a647dc1..5e5c3e9 100644
--- a/background/src/main/res/values/strings.xml
+++ b/background/src/main/res/values/strings.xml
@@ -11,4 +11,10 @@
专门负责学校社团各种活动的宣传,出海报以及网络上的宣传工作。 负责学生思想政治教育和学生会各项宣传报道工作的组织和规划。 围绕学院各阶段的中心工作和学院组织和各项活动,做好宣传鼓动工作。 组织学生参加社团开设的学术讲座和学术活动,督促和指导各班学习委员开展工作。
部门介绍
+ 名字
+ 学号
+ 手机号
+ 职务
+ 导员
+ 只能调整干事职务!
\ No newline at end of file
diff --git a/foreground/src/main/java/com/gyf/csams/activity/ui/ActivityDetailActivity.kt b/foreground/src/main/java/com/gyf/csams/activity/ui/ActivityDetailActivity.kt
index 27ba081..8b44fd0 100644
--- a/foreground/src/main/java/com/gyf/csams/activity/ui/ActivityDetailActivity.kt
+++ b/foreground/src/main/java/com/gyf/csams/activity/ui/ActivityDetailActivity.kt
@@ -261,7 +261,7 @@ class ActivityDetailActivity : ComponentActivity() {
// TODO 解决Build Warnning
Logger.i("$vo")
Box(
- modifier = modifier.border(width = 1.dp, color = MaterialTheme.colors.background),
+ modifier = modifier.border(width = 1.dp, color = MaterialTheme.colors.onBackground),
contentAlignment = Alignment.Center
) {
Image(
@@ -312,7 +312,7 @@ class ActivityDetailActivity : ComponentActivity() {
.fillMaxWidth()
.weight(0.8F)
.padding(10.dp)
- .border(width = 1.dp, color = MaterialTheme.colors.background)
+ .border(width = 1.dp, color = MaterialTheme.colors.onBackground)
) {
val listState = rememberLazyListState()
participant?.let {
@@ -407,7 +407,7 @@ class ActivityDetailActivity : ComponentActivity() {
modifier = Modifier
.weight(0.9F)
.padding(10.dp)
- .border(width = 1.dp, color = MaterialTheme.colors.background)
+ .border(width = 1.dp, color = MaterialTheme.colors.onBackground)
) {
val listState = rememberLazyListState()
val data by model.data.observeAsState()
diff --git a/foreground/src/main/java/com/gyf/csams/association/ui/RegAssociationActivity.kt b/foreground/src/main/java/com/gyf/csams/association/ui/RegAssociationActivity.kt
index 8828280..bb86cb0 100644
--- a/foreground/src/main/java/com/gyf/csams/association/ui/RegAssociationActivity.kt
+++ b/foreground/src/main/java/com/gyf/csams/association/ui/RegAssociationActivity.kt
@@ -25,7 +25,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
@@ -131,7 +130,7 @@ class RegAssociationActivity : ComponentActivity() {
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center, modifier = Modifier
.fillMaxSize()
- .border(width = 1.dp, color = Color.Black)
+ .border(width = 1.dp, color = MaterialTheme.colors.onBackground)
) {
if (uri == null) {
diff --git a/foreground/src/main/java/com/gyf/csams/uikit/BaseView.kt b/foreground/src/main/java/com/gyf/csams/uikit/BaseView.kt
index 987739c..0c0dea1 100644
--- a/foreground/src/main/java/com/gyf/csams/uikit/BaseView.kt
+++ b/foreground/src/main/java/com/gyf/csams/uikit/BaseView.kt
@@ -557,7 +557,7 @@ fun MyBottomAppBarPreview() {
Column(
modifier = Modifier
.weight(1F / arr.size)
- .border(width = 1.dp, color = MaterialTheme.colors.background)
+ .border(width = 1.dp, color = MaterialTheme.colors.onBackground)
) {
Row(
modifier = Modifier.fillMaxWidth(),
diff --git a/lib/src/main/java/com/gyf/lib/uikit/Profile.kt b/lib/src/main/java/com/gyf/lib/uikit/Profile.kt
index 77c5103..faed256 100644
--- a/lib/src/main/java/com/gyf/lib/uikit/Profile.kt
+++ b/lib/src/main/java/com/gyf/lib/uikit/Profile.kt
@@ -25,7 +25,8 @@ abstract class PersonInfoVo {
@Composable
fun Profile(
modifier: Modifier,
- personInfoVo: PersonInfoVo
+ personInfoVo: PersonInfoVo,
+ duty: @Composable () -> Unit = { Text(text = personInfoVo.duty) }
) {
var headImg: ImageBitmap? by remember {
mutableStateOf(null)
@@ -41,7 +42,7 @@ fun Profile(
modifier = Modifier
.fillMaxWidth()
.weight(0.7F)
- .border(width = 1.dp, color = MaterialTheme.colors.background),
+ .border(width = 1.dp, color = MaterialTheme.colors.onBackground),
horizontalArrangement = Arrangement.SpaceBetween
) {
headImg.let {
@@ -68,12 +69,12 @@ fun Profile(
modifier = Modifier
.weight(0.4F)
.fillMaxHeight()
- .border(width = 1.dp, color = MaterialTheme.colors.background),
+ .border(width = 1.dp, color = MaterialTheme.colors.onBackground),
verticalArrangement = Arrangement.SpaceEvenly,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = personInfoVo.name)
- Text(text = personInfoVo.duty)
+ duty()
}
}