Przeglądaj źródła

人工销假

master
leiyun 3 lat temu
rodzic
commit
cd2639fd7e
20 zmienionych plików z 800 dodań i 133 usunięć
  1. +5
    -3
      .idea/misc.xml
  2. +5
    -4
      app/build.gradle
  3. +22
    -19
      app/src/main/AndroidManifest.xml
  4. +24
    -0
      app/src/main/java/com/yzx/escreen/activity/CameraActivity.kt
  5. +35
    -11
      app/src/main/java/com/yzx/escreen/adapter/HomeDialogStepAdapter.kt
  6. +17
    -0
      app/src/main/java/com/yzx/escreen/adapter/HomeListAdapter.kt
  7. +1
    -0
      app/src/main/java/com/yzx/escreen/config/YzxInterface.kt
  8. +162
    -19
      app/src/main/java/com/yzx/escreen/fragment/HomeFragment.kt
  9. +2
    -6
      app/src/main/java/com/yzx/escreen/fragment/MyFragment.kt
  10. +38
    -2
      app/src/main/java/com/yzx/escreen/fragment/base/BaseFragment.kt
  11. +85
    -34
      app/src/main/java/com/yzx/escreen/model/StuLeave.kt
  12. +21
    -0
      app/src/main/java/com/yzx/escreen/model/Vacation.kt
  13. +33
    -8
      app/src/main/java/com/yzx/escreen/presenter/HomePresenter.kt
  14. +49
    -0
      app/src/main/java/com/yzx/escreen/utils/FileUpload.kt
  15. +9
    -0
      app/src/main/res/layout/activity_camera.xml
  16. +206
    -0
      app/src/main/res/layout/dialog_vacation.xml
  17. +23
    -0
      app/src/main/res/layout/fragment_home.xml
  18. +33
    -23
      app/src/main/res/layout/layout_leave_step.xml
  19. +26
    -4
      app/src/main/res/layout/layout_leave_table.xml
  20. +4
    -0
      app/src/main/res/xml/provider_paths.xml

+ 5
- 3
.idea/misc.xml Wyświetl plik

@@ -12,6 +12,7 @@
<entry key="..\:/work/escreen/app/src/main/res/drawable/switch_ios_track_on.xml" value="0.372" /> <entry key="..\:/work/escreen/app/src/main/res/drawable/switch_ios_track_on.xml" value="0.372" />
<entry key="..\:/work/escreen/app/src/main/res/drawable/switch_ios_track_selector.xml" value="0.372" /> <entry key="..\:/work/escreen/app/src/main/res/drawable/switch_ios_track_selector.xml" value="0.372" />
<entry key="..\:/work/escreen/app/src/main/res/layout/activity_book.xml" value="0.37135416666666665" /> <entry key="..\:/work/escreen/app/src/main/res/layout/activity_book.xml" value="0.37135416666666665" />
<entry key="..\:/work/escreen/app/src/main/res/layout/activity_home.xml" value="0.12378472222222223" />
<entry key="..\:/work/escreen/app/src/main/res/layout/activity_main.xml" value="0.4279711884753902" /> <entry key="..\:/work/escreen/app/src/main/res/layout/activity_main.xml" value="0.4279711884753902" />
<entry key="..\:/work/escreen/app/src/main/res/layout/activity_main1.xml" value="0.37135416666666665" /> <entry key="..\:/work/escreen/app/src/main/res/layout/activity_main1.xml" value="0.37135416666666665" />
<entry key="..\:/work/escreen/app/src/main/res/layout/activity_note.xml" value="0.37135416666666665" /> <entry key="..\:/work/escreen/app/src/main/res/layout/activity_note.xml" value="0.37135416666666665" />
@@ -20,11 +21,12 @@
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_exit.xml" value="0.30483112441214194" /> <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_exit.xml" value="0.30483112441214194" />
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_leave.xml" value="0.30483112441214194" /> <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_leave.xml" value="0.30483112441214194" />
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_test.xml" value="0.29827742520398914" /> <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_test.xml" value="0.29827742520398914" />
<entry key="..\:/work/escreen/app/src/main/res/layout/fragment_home.xml" value="0.6594650205761317" />
<entry key="..\:/work/escreen/app/src/main/res/layout/dialog_vacation.xml" value="0.10822707953855495" />
<entry key="..\:/work/escreen/app/src/main/res/layout/fragment_home.xml" value="0.2941427960666952" />
<entry key="..\:/work/escreen/app/src/main/res/layout/fragment_my.xml" value="0.45940721649484534" /> <entry key="..\:/work/escreen/app/src/main/res/layout/fragment_my.xml" value="0.45940721649484534" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_empty.xml" value="0.37135416666666665" /> <entry key="..\:/work/escreen/app/src/main/res/layout/layout_empty.xml" value="0.37135416666666665" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_leave_step.xml" value="0.4681549573210768" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_leave_table.xml" value="0.41030092592592593" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_leave_step.xml" value="0.1" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_leave_table.xml" value="0.21462163317657118" />
<entry key="..\:/work/escreen/app/src/main/res/layout/layout_loading.xml" value="0.30483112441214194" /> <entry key="..\:/work/escreen/app/src/main/res/layout/layout_loading.xml" value="0.30483112441214194" />
<entry key="..\:/work/escreen/app/src/main/res/layout/leave_dialog_title.xml" value="0.37135416666666665" /> <entry key="..\:/work/escreen/app/src/main/res/layout/leave_dialog_title.xml" value="0.37135416666666665" />
<entry key="..\:/work/escreen/app/src/main/res/layout/version_dialog.xml" value="0.30483112441214194" /> <entry key="..\:/work/escreen/app/src/main/res/layout/version_dialog.xml" value="0.30483112441214194" />


+ 5
- 4
app/build.gradle Wyświetl plik

@@ -16,8 +16,8 @@ android {
// minSdkVersion 26 // minSdkVersion 26
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 25 targetSdkVersion 25
versionCode 8
versionName "2.0.6"
versionCode 9
versionName "2.0.7"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"


// ndk { // ndk {
@@ -84,8 +84,8 @@ android {
// buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"' // buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"'
// buildConfigField "String", "M_URL", '"http://192.168.69.112:8098"' // buildConfigField "String", "M_URL", '"http://192.168.69.112:8098"'
// buildConfigField "String", "BASE_URL", '"https://oa.qbjjyyun.net/api"' // buildConfigField "String", "BASE_URL", '"https://oa.qbjjyyun.net/api"'
// buildConfigField "String", "OA_URL", '"https://oa.live.educlouddata.com"'
buildConfigField "String", "OA_URL", '"http://192.168.69.114:3000"'
buildConfigField "String", "OA_URL", '"https://oa.live.educlouddata.com"'
// buildConfigField "String", "OA_URL", '"http://192.168.69.114:3000"'
buildConfigField "String", "M_URL", '"https://m.live.educlouddata.com/"' buildConfigField "String", "M_URL", '"https://m.live.educlouddata.com/"'
buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"' buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"'
buildConfigField "String", "APP_NAME", '"家校互通(开发)"' buildConfigField "String", "APP_NAME", '"家校互通(开发)"'
@@ -186,4 +186,5 @@ dependencies {
implementation 'com.qmuiteam:qmui:2.0.0-alpha10' implementation 'com.qmuiteam:qmui:2.0.0-alpha10'


api 'com.tencent.tbs:tbssdk:44181' api 'com.tencent.tbs:tbssdk:44181'
implementation 'com.github.HuanTanSheng:EasyPhotos:3.1.5'
} }

+ 22
- 19
app/src/main/AndroidManifest.xml Wyświetl plik

@@ -17,9 +17,10 @@
<uses-permission android:name="android.permission.BATTERY_STATS" /> <uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.CAMERA" />


<application <application
android:name="com.yzx.escreen.App"
android:name=".App"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
@@ -30,31 +31,32 @@
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"> android:usesCleartextTraffic="true">
<activity <activity
android:name="com.yzx.escreen.MainActivity"
android:name=".activity.CameraActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboard" android:configChanges="orientation|keyboard"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan|stateHidden"
android:screenOrientation="landscape">
android:launchMode="singleInstance"
android:screenOrientation="landscape"
android:windowSoftInputMode="adjustPan|stateHidden">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />


<!-- <category android:name="android.intent.category.HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <category android:name="android.intent.category.HOME" /> -->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="com.yzx.escreen.activity.WebActivity"
android:name=".activity.WebActivity"
android:configChanges="orientation|keyboard" android:configChanges="orientation|keyboard"
android:screenOrientation="landscape" />
<!-- <activity-->
<!-- android:name="com.yzx.escreen.MainActivity"-->
<!-- android:configChanges="orientation|keyboard"-->
<!-- android:launchMode="singleTask"-->
<!-- android:screenOrientation="portrait" />-->

android:screenOrientation="landscape" /> <!-- <activity -->
<!-- android:name="com.yzx.escreen.MainActivity" -->
<!-- android:configChanges="orientation|keyboard" -->
<!-- android:launchMode="singleTask" -->
<!-- android:screenOrientation="portrait" /> -->
<provider <provider
android:name="com.yzx.escreen.utils.YzxFileProvider"
android:name=".utils.YzxFileProvider"
android:authorities="${applicationId}.fileProvider" android:authorities="${applicationId}.fileProvider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true" android:grantUriPermissions="true"
@@ -64,17 +66,18 @@
android:resource="@xml/provider_paths" android:resource="@xml/provider_paths"
tools:replace="name,resource" /> tools:replace="name,resource" />
</provider> </provider>

<service <service
android:name="com.tencent.smtt.export.external.DexClassLoaderProviderService" android:name="com.tencent.smtt.export.external.DexClassLoaderProviderService"
android:label="dexopt" android:label="dexopt"
android:process=":dexopt" >
</service>
android:process=":dexopt"></service>
<receiver <receiver
android:name=".receiver.BootReceiver" android:name=".receiver.BootReceiver"
android:enabled="true" android:enabled="true"
android:exported="true"> android:exported="true">
<intent-filter android:priority="1000"> <intent-filter android:priority="1000">
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
</application> </application>


+ 24
- 0
app/src/main/java/com/yzx/escreen/activity/CameraActivity.kt Wyświetl plik

@@ -0,0 +1,24 @@
package com.yzx.escreen.activity

import android.os.Bundle
import com.yzx.escreen.R
import com.yzx.escreen.activity.base.BaseActivity
import com.yzx.escreen.presenter.base.BasePresenter

class CameraActivity : BaseActivity<BasePresenter<*>>() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_camera)
}

override val inflateId: Int
get() = R.layout.activity_camera

override fun initView() {
}

override fun initData() {
}

override fun initPresenter(): BasePresenter<*>? = null
}

+ 35
- 11
app/src/main/java/com/yzx/escreen/adapter/HomeDialogStepAdapter.kt Wyświetl plik

@@ -1,6 +1,7 @@
package com.yzx.escreen.adapter package com.yzx.escreen.adapter


import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.graphics.Color
import android.view.View import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
@@ -10,24 +11,47 @@ import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toTime import com.yzx.escreen.utils.toTime
import kotlinx.android.synthetic.main.layout_leave_step.view.* import kotlinx.android.synthetic.main.layout_leave_step.view.*
import org.jetbrains.anko.dip import org.jetbrains.anko.dip
import org.jetbrains.anko.textColor


class HomeDialogStepAdapter(list: MutableList<LeaveActivity>) : class HomeDialogStepAdapter(list: MutableList<LeaveActivity>) :
BaseQuickAdapter<LeaveActivity, BaseViewHolder>(R.layout.layout_leave_step, list) { BaseQuickAdapter<LeaveActivity, BaseViewHolder>(R.layout.layout_leave_step, list) {


@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun convert(holder: BaseViewHolder, item: LeaveActivity) { override fun convert(holder: BaseViewHolder, item: LeaveActivity) {
if (item.is_approve == 0) {
holder.itemView.addUserName.visibility = View.VISIBLE
holder.itemView.addUserName.text = item.add_user_name
holder.itemView.approvalComments.visibility = View.GONE
} else {
holder.itemView.addUserName.visibility = View.GONE
holder.itemView.approvalComments.visibility = View.VISIBLE
var str = "审批人:${item.add_user_name}"
if (item.approval_comments != null && item.approval_comments.isNotEmpty()) {
str += "。${item.approval_comments}"
holder.itemView.inImg.visibility = View.GONE
when (item.is_approve) {
0 -> {
holder.itemView.addUserName.visibility = View.VISIBLE
holder.itemView.addUserName.text = item.add_user_name
holder.itemView.approvalComments.visibility = View.GONE
}
2 -> {
holder.itemView.addUserName.visibility = View.GONE
holder.itemView.approvalComments.visibility = View.VISIBLE
holder.itemView.approvalComments.text = item.approval_comments
holder.itemView.approvalComments.textColor = if (item.color.isNotEmpty()) {
Color.parseColor(item.color)
} else {
Color.parseColor("#333333")
}

val inItem = item.getInImg()
if (inItem != null) {
holder.itemView.inImg.visibility = View.VISIBLE
holder.itemView.inImg.setSrc(inItem.identity, inItem.attachment_id)
} else {
holder.itemView.inImg.visibility = View.GONE
}
}
else -> {
holder.itemView.addUserName.visibility = View.GONE
holder.itemView.approvalComments.visibility = View.VISIBLE
var str = "审批人:${item.add_user_name}"
if (item.approval_comments != null && item.approval_comments.isNotEmpty()) {
str += "。${item.approval_comments}"
}
holder.itemView.approvalComments.text = str
} }
holder.itemView.approvalComments.text = str
} }
if (item.add_user_type_name.isNullOrBlank()) { if (item.add_user_type_name.isNullOrBlank()) {
holder.itemView.addUserTypeName.visibility = View.GONE holder.itemView.addUserTypeName.visibility = View.GONE


+ 17
- 0
app/src/main/java/com/yzx/escreen/adapter/HomeListAdapter.kt Wyświetl plik

@@ -16,6 +16,10 @@ import org.jetbrains.anko.textColor
class HomeListAdapter(list: MutableList<StuLeave>) : class HomeListAdapter(list: MutableList<StuLeave>) :
BaseQuickAdapter<StuLeave, BaseViewHolder>(R.layout.layout_leave_table, list) { BaseQuickAdapter<StuLeave, BaseViewHolder>(R.layout.layout_leave_table, list) {


init {
addChildClickViewIds(R.id.cancelBtn)
}

@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun convert(holder: BaseViewHolder, item: StuLeave) { override fun convert(holder: BaseViewHolder, item: StuLeave) {
holder.itemView.studentName.text = item.leave_student_name holder.itemView.studentName.text = item.leave_student_name
@@ -36,12 +40,16 @@ class HomeListAdapter(list: MutableList<StuLeave>) :
1 -> "待处理" 1 -> "待处理"
2 -> "已确认" 2 -> "已确认"
3 -> "已拒绝" 3 -> "已拒绝"
4 -> "正常销假"
5 -> "超时销假"
else -> "--" else -> "--"
} }
holder.itemView.statusName.textColor = when (item.status) { holder.itemView.statusName.textColor = when (item.status) {
1 -> Color.parseColor("#333333") 1 -> Color.parseColor("#333333")
2 -> Color.parseColor("#3c7ef6") 2 -> Color.parseColor("#3c7ef6")
3 -> Color.parseColor("#ff4040") 3 -> Color.parseColor("#ff4040")
4 -> Color.parseColor("#3c7ef6")
5 -> Color.parseColor("#ff4040")
else -> Color.parseColor("#333333") else -> Color.parseColor("#333333")
} }
holder.itemView.applyTime.text = item.add_time.toTime() holder.itemView.applyTime.text = item.add_time.toTime()
@@ -51,5 +59,14 @@ class HomeListAdapter(list: MutableList<StuLeave>) :
} else { } else {
View.VISIBLE View.VISIBLE
} }


holder.itemView.cancelBtn.visibility = if(item.is_cancel_leave ==1 ){
holder.itemView.placeHolder.visibility = View.GONE
View.VISIBLE
}else{
holder.itemView.placeHolder.visibility = View.VISIBLE
View.GONE
}
} }
} }

+ 1
- 0
app/src/main/java/com/yzx/escreen/config/YzxInterface.kt Wyświetl plik

@@ -47,5 +47,6 @@ object YzxInterface {
const val INTERFACE_GET_STU_LEAVE_INFO_DETAIL= "/edu/attendance/getStudentLeaveRequestDetail" //获取学生的请假信息详情 const val INTERFACE_GET_STU_LEAVE_INFO_DETAIL= "/edu/attendance/getStudentLeaveRequestDetail" //获取学生的请假信息详情
const val INTERFACE_GET_TEACHER_INFO= "/rights/teacherWork/getTeacherByUserId"//获取人员信息 const val INTERFACE_GET_TEACHER_INFO= "/rights/teacherWork/getTeacherByUserId"//获取人员信息
const val INTERFACE_STUDENT_GET_SHOW_BOX_LIST= "/edu/attendance/student/getStudentLeaveIds" //获取需要弹出的数据 const val INTERFACE_STUDENT_GET_SHOW_BOX_LIST= "/edu/attendance/student/getStudentLeaveIds" //获取需要弹出的数据
const val INTERFACE_STUDENT_POST_LEAVE_VACATION= "/edu/attendance/student/studentLeaveVacation"//人工销假操作


} }

+ 162
- 19
app/src/main/java/com/yzx/escreen/fragment/HomeFragment.kt Wyświetl plik

@@ -1,6 +1,9 @@
package com.yzx.escreen.fragment package com.yzx.escreen.fragment


import android.Manifest
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.graphics.Color import android.graphics.Color
import android.os.Handler import android.os.Handler
@@ -9,27 +12,25 @@ import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import android.widget.EditText
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.blankj.utilcode.util.KeyboardUtils
import com.blankj.utilcode.util.NetworkUtils
import com.blankj.utilcode.util.SPUtils
import com.blankj.utilcode.util.*
import com.huantansheng.easyphotos.EasyPhotos
import com.huantansheng.easyphotos.models.album.entity.Photo
import com.qmuiteam.qmui.widget.dialog.QMUIDialog
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
import com.yzx.escreen.R import com.yzx.escreen.R
import com.yzx.escreen.adapter.HomeDialogStepAdapter import com.yzx.escreen.adapter.HomeDialogStepAdapter
import com.yzx.escreen.adapter.HomeListAdapter import com.yzx.escreen.adapter.HomeListAdapter
import com.yzx.escreen.fragment.base.BaseFragment import com.yzx.escreen.fragment.base.BaseFragment
import com.yzx.escreen.model.LeaveID
import com.yzx.escreen.model.Pager
import com.yzx.escreen.model.StuLeave
import com.yzx.escreen.model.*
import com.yzx.escreen.presenter.HomePresenter import com.yzx.escreen.presenter.HomePresenter
import com.yzx.escreen.presenter.HomeView import com.yzx.escreen.presenter.HomeView
import com.yzx.escreen.utils.durationStr
import com.yzx.escreen.utils.hideNavigationBar
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toTime
import com.yzx.escreen.utils.*
import com.yzx.escreen.widget.BaseDialog import com.yzx.escreen.widget.BaseDialog
import kotlinx.android.synthetic.main.fragment_home.* import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.layout_loading.view.* import kotlinx.android.synthetic.main.layout_loading.view.*
@@ -38,11 +39,14 @@ import org.jetbrains.anko.support.v4.act
import org.jetbrains.anko.support.v4.ctx import org.jetbrains.anko.support.v4.ctx
import org.jetbrains.anko.textColor import org.jetbrains.anko.textColor



class HomeFragment : BaseFragment<HomePresenter>(), HomeView, class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
NetworkUtils.OnNetworkStatusChangedListener {
NetworkUtils.OnNetworkStatusChangedListener, FileUploadCallBack {


companion object { companion object {


val CAMER_REQUEST_CODE = 0x01

@JvmStatic @JvmStatic
fun getNewInstance() = fun getNewInstance() =
HomeFragment() HomeFragment()
@@ -61,7 +65,11 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
private var isLoading = false private var isLoading = false
private val mShowList = mutableListOf<StuLeave>() private val mShowList = mutableListOf<StuLeave>()
private val mShowDialogList = mutableListOf<BaseDialog>() private val mShowDialogList = mutableListOf<BaseDialog>()

private var mCancelItem: StuLeave? = null
private var mCancelFaceImg: ImageView? = null
private var mDialogVacation: BaseDialog? = null
private val mVacation = Vacation()
private val mVacationAttachment = Attachment("","","")


private val mHandler = Handler(Looper.getMainLooper()) private val mHandler = Handler(Looper.getMainLooper())
private val runnable = object : Runnable { private val runnable = object : Runnable {
@@ -89,16 +97,20 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
status1Btn.setOnClickListener { changeStatus(1) } status1Btn.setOnClickListener { changeStatus(1) }
status2Btn.setOnClickListener { changeStatus(2) } status2Btn.setOnClickListener { changeStatus(2) }
status3Btn.setOnClickListener { changeStatus(3) } status3Btn.setOnClickListener { changeStatus(3) }
status4Btn.setOnClickListener { changeStatus(4) }
status5Btn.setOnClickListener { changeStatus(5) }
statusBtnList.add(allBtn) statusBtnList.add(allBtn)
statusBtnList.add(status1Btn) statusBtnList.add(status1Btn)
statusBtnList.add(status2Btn) statusBtnList.add(status2Btn)
statusBtnList.add(status3Btn) statusBtnList.add(status3Btn)
statusBtnList.add(status4Btn)
statusBtnList.add(status5Btn)
keywordInput.setOnKeyListener { _, keyCode, _ -> keywordInput.setOnKeyListener { _, keyCode, _ ->
if (!isLoading) { if (!isLoading) {
if (keyCode == KeyEvent.KEYCODE_ENTER) { if (keyCode == KeyEvent.KEYCODE_ENTER) {
keyword = keywordInput.text.toString() keyword = keywordInput.text.toString()
initData() initData()
KeyboardUtils.hideSoftInput( keywordInput)
KeyboardUtils.hideSoftInput(keywordInput)
} }
} }
false false
@@ -114,6 +126,16 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
mPresenter?.getDetail(mAdapter.getItem(position).id) mPresenter?.getDetail(mAdapter.getItem(position).id)
} }


mAdapter.setOnItemChildClickListener { adapter, view, position ->
LogUtils.d("setOnItemChildClickListener", position)
when (view.id) {
R.id.cancelBtn -> {
mCancelItem = mAdapter.getItem(position)
showCancelDialog()
}
}
}



switchBtn.setOnCheckedChangeListener { buttonView, isChecked -> switchBtn.setOnCheckedChangeListener { buttonView, isChecked ->
SPUtils.getInstance().put("auto_show_leave", isChecked) SPUtils.getInstance().put("auto_show_leave", isChecked)
@@ -152,10 +174,84 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,


}) })
filterLayout.setOnClickListener { filterLayout.setOnClickListener {
KeyboardUtils.hideSoftInput( keywordInput)
KeyboardUtils.hideSoftInput(keywordInput)
} }
} }


@SuppressLint("SetTextI18n")
private fun showCancelDialog() {
val dialogVacation = BaseDialog(act, R.style.BaseDialog, R.layout.dialog_vacation)
mCancelItem?.apply {
mVacation.id = id
mVacation.vacation_type = 2
mVacation.vacation_attachment = ""
mVacation.vacation_remark = "电子屏人工销假"
mVacationAttachment.clear()
dialogVacation.find<TextView>(R.id.leave_student_name).text = leave_student_name
dialogVacation.find<TextView>(R.id.class_name).text = "${grade_name}${class_name}"
dialogVacation.find<TextView>(R.id.add_time).text =
"${start_time.toTime()} - ${end_time.toTime()}"
val nowTime = (TimeUtils.getNowMills() / 1000).toInt()
dialogVacation.find<TextView>(R.id.vacation_time).text = nowTime.toTime()
mVacation.vacation_time = nowTime.toLong()
dialogVacation.find<EditText>(R.id.vacation_remark).setText(mVacation.vacation_remark)
dialogVacation.find<View>(R.id.cameraBtn).setOnClickListener { onCameraBtnClick() }
mCancelFaceImg = dialogVacation.find<ImageView>(R.id.face_img)
dialogVacation.find<View>(R.id.submitBtn).setOnClickListener {
postVacation()
}
dialogVacation.find<View>(R.id.closeBtn).setOnClickListener {
dialogVacation.dismiss()
}
}
//处理弹窗显示
dialogVacation.show()
dialogVacation.hideNavigationBar()
mDialogVacation = dialogVacation
}

private fun postVacation(){
if(mVacationAttachment.id.isNotEmpty()){
mVacation.vacation_attachment = GsonUtils.toJson(mutableListOf(mVacationAttachment))
}
showLoading("销假中")
mPresenter?.postVacation(mVacation)
}

private fun onCameraBtnClick() {
val isGranted = PermissionUtils.isGranted(Manifest.permission.CAMERA)
if (!isGranted) {
PermissionUtils.permission(Manifest.permission.CAMERA)
.callback { isAllGranted, granted, deniedForever, denied ->
if (!isAllGranted) {
val tipDialog = QMUIDialog.MessageDialogBuilder(activity)
.setTitle("温馨提示")
.setMessage("拍照权限被拒绝,请开启权限后重试")
.addAction("取消") { dialog, index ->
dialog.dismiss()
}
.addAction("确定") { dialog, index ->
dialog.dismiss()
PermissionUtils.launchAppDetailsSettings()
}
.create()
tipDialog.show()
tipDialog.hideNavigationBar()
}
}
.request()
} else {
openCamera()
}
}

private fun openCamera() {
EasyPhotos.createCamera(this, true)
.setFileProviderAuthority("${activity?.packageName}.fileProvider")
.start(CAMER_REQUEST_CODE)//也可以选择链式调用写法
}


private fun changeSwitchBtnTxt(isChecked: Boolean) { private fun changeSwitchBtnTxt(isChecked: Boolean) {
if (isChecked) { if (isChecked) {
switchBtnTxt.setTextColor(ctx.resources.getColor(R.color.green2)) switchBtnTxt.setTextColor(ctx.resources.getColor(R.color.green2))
@@ -181,7 +277,8 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
} }
dialog.find<TextView>(R.id.class_name).text = "${detail.grade_name}${detail.class_name}" dialog.find<TextView>(R.id.class_name).text = "${detail.grade_name}${detail.class_name}"
dialog.find<TextView>(R.id.leave_request_type_name).text = detail.leave_request_type_name dialog.find<TextView>(R.id.leave_request_type_name).text = detail.leave_request_type_name
dialog.find<TextView>(R.id.leave_duration_str).text = (detail.end_time - detail.start_time).durationStr()
dialog.find<TextView>(R.id.leave_duration_str).text =
(detail.end_time - detail.start_time).durationStr()
dialog.find<TextView>(R.id.add_time).text = dialog.find<TextView>(R.id.add_time).text =
"${detail.start_time.toTime()} - ${detail.end_time.toTime()}" "${detail.start_time.toTime()} - ${detail.end_time.toTime()}"
dialog.find<TextView>(R.id.leave_request_reason).text = detail.leave_request_reason dialog.find<TextView>(R.id.leave_request_reason).text = detail.leave_request_reason
@@ -190,6 +287,8 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
1 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_wait.png" 1 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_wait.png"
2 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_pass.png" 2 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_pass.png"
3 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_nopass.png" 3 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/stutakeleave_nopass.png"
4 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/cancellation.png"
5 -> "https://oa-edu-1259243469.cos.ap-chengdu.myqcloud.com/public/mini/cancellation_overtime.png"
else -> "" else -> ""
} }
) )
@@ -233,7 +332,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
} }


private fun changeStatus(status: Int) { private fun changeStatus(status: Int) {
KeyboardUtils.hideSoftInput( keywordInput)
KeyboardUtils.hideSoftInput(keywordInput)
if (isLoading) { if (isLoading) {
return return
} }
@@ -295,7 +394,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
} }


private fun pre() { private fun pre() {
KeyboardUtils.hideSoftInput( keywordInput)
KeyboardUtils.hideSoftInput(keywordInput)
if (isLoading) { if (isLoading) {
return return
} }
@@ -307,7 +406,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
} }


private fun next() { private fun next() {
KeyboardUtils.hideSoftInput( keywordInput)
KeyboardUtils.hideSoftInput(keywordInput)
if (isLoading) { if (isLoading) {
return return
} }
@@ -391,6 +490,20 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
} }
} }


override fun postVacationSuccess(msg: String) {
showDialogToast(msg,2000L)
hideLoading()
mDialogVacation?.apply {
dismiss()
refreshData()
}
}

override fun postVacationError(msg: String) {
hideLoading()
showDialogToast(msg,2000L,QMUITipDialog.Builder.ICON_TYPE_FAIL)
}

override fun onDisconnected() { override fun onDisconnected() {


} }
@@ -398,4 +511,34 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
override fun onConnected(networkType: NetworkUtils.NetworkType?) { override fun onConnected(networkType: NetworkUtils.NetworkType?) {
refreshData() refreshData()
} }
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == CAMER_REQUEST_CODE) {
val photos = data?.getParcelableArrayListExtra<Photo>(EasyPhotos.RESULT_PHOTOS)
LogUtils.d("photos", photos)
photos?.apply {
if (this.size > 0) {
mVacationAttachment.name = this[0].name
FileUpload.upload(this[0].path, this@HomeFragment)
}
}

}

}
super.onActivityResult(requestCode, resultCode, data)
}

override fun onSuccess(identity: String, key: String) {
LogUtils.d(identity, key)
mCancelFaceImg?.setSrc(identity, key)
mVacationAttachment.identity = identity
mVacationAttachment.id = key
}

override fun onError(msg: String) {
LogUtils.d(msg)
}
}


+ 2
- 6
app/src/main/java/com/yzx/escreen/fragment/MyFragment.kt Wyświetl plik

@@ -1,14 +1,12 @@
package com.yzx.escreen.fragment package com.yzx.escreen.fragment


import android.text.InputType import android.text.InputType
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.KeyboardUtils import com.blankj.utilcode.util.KeyboardUtils
import com.blankj.utilcode.util.LogUtils import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.ScreenUtils import com.blankj.utilcode.util.ScreenUtils
import com.blankj.utilcode.util.ToastUtils
import com.qmuiteam.qmui.widget.dialog.QMUIDialog import com.qmuiteam.qmui.widget.dialog.QMUIDialog
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
import com.yzx.escreen.MainActivity
import com.yzx.escreen.R import com.yzx.escreen.R
import com.yzx.escreen.activity.WebActivity import com.yzx.escreen.activity.WebActivity
import com.yzx.escreen.config.Config import com.yzx.escreen.config.Config
@@ -18,9 +16,7 @@ import com.yzx.escreen.model.User
import com.yzx.escreen.presenter.MyPresenter import com.yzx.escreen.presenter.MyPresenter
import com.yzx.escreen.presenter.MyView import com.yzx.escreen.presenter.MyView
import com.yzx.escreen.utils.hideNavigationBar import com.yzx.escreen.utils.hideNavigationBar
import kotlinx.android.synthetic.main.activity_home.*
import kotlinx.android.synthetic.main.fragment_my.* import kotlinx.android.synthetic.main.fragment_my.*
import org.jetbrains.anko.startActivity
import kotlin.system.exitProcess import kotlin.system.exitProcess


class MyFragment : BaseFragment<MyPresenter>(), MyView { class MyFragment : BaseFragment<MyPresenter>(), MyView {
@@ -71,7 +67,7 @@ class MyFragment : BaseFragment<MyPresenter>(), MyView {
LogUtils.d("112233".equals(text)) LogUtils.d("112233".equals(text))
if ("112233" == text.toString()) { if ("112233" == text.toString()) {
activity?.finish() activity?.finish()
// exitProcess(0)
exitProcess(0)
} else { } else {
// ToastUtils.showShort("密码不正确") // ToastUtils.showShort("密码不正确")
showPwdErrorTip() showPwdErrorTip()


+ 38
- 2
app/src/main/java/com/yzx/escreen/fragment/base/BaseFragment.kt Wyświetl plik

@@ -6,7 +6,9 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
import com.yzx.escreen.presenter.base.BasePresenter import com.yzx.escreen.presenter.base.BasePresenter
import com.yzx.escreen.utils.hideNavigationBar


/** /**
* fragment 基类 * fragment 基类
@@ -18,6 +20,8 @@ abstract class BaseFragment<out P : BasePresenter<*>> : Fragment() {
*/ */
abstract val inflateId: Int abstract val inflateId: Int


private var mLoadingDialog: QMUITipDialog? = null

/** /**
* 初始化视图操作在这里执行,执行时机为onCreate之后 * 初始化视图操作在这里执行,执行时机为onCreate之后
*/ */
@@ -35,7 +39,6 @@ abstract class BaseFragment<out P : BasePresenter<*>> : Fragment() {
abstract fun initPresenter(): P? abstract fun initPresenter(): P?





override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,
@@ -52,8 +55,41 @@ abstract class BaseFragment<out P : BasePresenter<*>> : Fragment() {
} }





override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
} }

fun showDialogToast(
msg: String,
duration: Long = 1500,
@QMUITipDialog.Builder.IconType icon: Int = QMUITipDialog.Builder.ICON_TYPE_SUCCESS
) {
val tipDialog = QMUITipDialog.Builder(activity)
.setIconType(icon)
.setTipWord(msg)
.create()
tipDialog.show()
tipDialog.hideNavigationBar()
view?.postDelayed({
tipDialog.dismiss()
}, duration)
}

fun showLoading(msg: String = "加载中") {
mLoadingDialog = QMUITipDialog.Builder(activity)
.setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
.setTipWord(msg)
.create()
mLoadingDialog?.apply {
show()
}
}

fun hideLoading() {
mLoadingDialog?.apply {
if (isShowing) {
dismiss()
}
}
}
} }

+ 85
- 34
app/src/main/java/com/yzx/escreen/model/StuLeave.kt Wyświetl plik

@@ -2,6 +2,7 @@ package com.yzx.escreen.model


import android.app.Dialog import android.app.Dialog
import com.blankj.utilcode.util.LogUtils import com.blankj.utilcode.util.LogUtils
import com.yzx.escreen.utils.durationStr


data class StuLeave( data class StuLeave(
val activities: MutableList<LeaveActivity> = mutableListOf(), val activities: MutableList<LeaveActivity> = mutableListOf(),
@@ -24,6 +25,7 @@ data class StuLeave(
val grade_name: String = "", val grade_name: String = "",
val headteacher_id: Int = 0, val headteacher_id: Int = 0,
val id: Int = 0, val id: Int = 0,
val is_cancel_leave: Int = 0,
val leave_request_reason: String = "", val leave_request_reason: String = "",
val leave_request_type: Int = 0, val leave_request_type: Int = 0,
val leave_request_type_name: String = "", val leave_request_type_name: String = "",
@@ -37,54 +39,54 @@ data class StuLeave(
val status: Int = 0, val status: Int = 0,
val todo_list_id: Int = 0, val todo_list_id: Int = 0,
val todo_status: Int = 0 val todo_status: Int = 0
){
) {


fun getStep(): MutableList<LeaveActivity> { fun getStep(): MutableList<LeaveActivity> {
val logList = mutableListOf<LeaveActivity>() val logList = mutableListOf<LeaveActivity>()
for (item in activities) { for (item in activities) {
if(item.child.isNotEmpty()){
if (item.child.isNotEmpty()) {
for (it in item.child) { for (it in item.child) {
it.activity_name = when(it.approve_user_type){
0->"领导审批"
1->"自选"
2->if (it.role_type==3){
it.activity_name = when (it.approve_user_type) {
0 -> "领导审批"
1 -> "自选"
2 -> if (it.role_type == 3) {
"班主任审批" "班主任审批"
}else{
} else {
"任课老师审批" "任课老师审批"
} }
3->"专业部领导审批"
4->"值班领导审批"
else->"领导审批"
3 -> "专业部领导审批"
4 -> "值班领导审批"
else -> "领导审批"
} }
} }
val approvedList = item.child.filter { val approvedList = item.child.filter {
return@filter it.approval_status>1
return@filter it.approval_status > 1
} }
if(approvedList.isNotEmpty()){
if(item.approve_way==2){
if (approvedList.isNotEmpty()) {
if (item.approve_way == 2) {
logList.addAll(approvedList) logList.addAll(approvedList)
}else{
} else {
logList.addAll(item.child) logList.addAll(item.child)
} }
}else{
item.activity_name = when(item.approve_user_type){
0->"领导审批"
1->"自选"
2->if (item.role_type==3){
} else {
item.activity_name = when (item.approve_user_type) {
0 -> "领导审批"
1 -> "自选"
2 -> if (item.role_type == 3) {
"班主任审批" "班主任审批"
}else{
} else {
"任课老师审批" "任课老师审批"
} }
3->"专业部领导审批"
4->"值班领导审批"
else->"领导审批"
3 -> "专业部领导审批"
4 -> "值班领导审批"
else -> "领导审批"
} }
if(item.child.size>1){
item.activity_name += when(item.approve_way){
0-> "(依次审批)"
1-> "(会签)"
2-> "(或签)"
else->""
if (item.child.size > 1) {
item.activity_name += when (item.approve_way) {
0 -> "(依次审批)"
1 -> "(会签)"
2 -> "(或签)"
else -> ""
} }
} }
item.add_user_name = item.child.map { item.add_user_name = item.child.map {
@@ -95,14 +97,37 @@ data class StuLeave(
item.is_approve = 1 item.is_approve = 1
logList.add(item) logList.add(item)
} }
}else{ //提交人
item.activity_name = "提交申请"
if(item.add_user_type == 0){
} else if (item.is_approve == 0) { //提交人
if (item.activity_name.contains("并直接通过") || item.is_auto_pass == 1) {
item.activity_name = "提交申请(直接通过)"
} else {
item.activity_name = "提交申请"
}
if (item.add_user_type == 0) {
item.add_user_type_name = "老师" item.add_user_type_name = "老师"
}else if (item.add_user_type == 1){
} else if (item.add_user_type == 1) {
item.add_user_type_name = "学生家长" item.add_user_type_name = "学生家长"
} }
logList.add(item) logList.add(item)
} else if (item.is_approve == 2) { //学生返校销假
if (item.vacation_type == 2) { //销假/返校类型(1自动销假 2老师操作销假)
val remark = item.approval_comments
item.approval_comments = "人工销假,销假操作人:${item.add_user_name}。"
if (item.add_time > end_time) { //超时
item.approval_comments += "超出请假时长:${(item.add_time - end_time).durationStr()}。"
item.color = "#ff4040"
}
if (remark.isNotEmpty()) {
item.approval_comments += "备注:${remark}"
}
} else if (item.vacation_type == 1) {
item.approval_comments = "刷脸进校,自动销假。"
if (item.add_time > end_time) { //超时
item.approval_comments += "超出请假时长:${(item.add_time - end_time).durationStr()}。"
item.color = "#ff4040"
}
}
logList.add(item)
} }
} }


@@ -141,7 +166,33 @@ data class LeaveActivity(
var type: Int = 0, var type: Int = 0,
var unit_id: Int = 0, var unit_id: Int = 0,
var unit_name: String = "", var unit_name: String = "",
var add_user_type_name: String=""
var add_user_type_name: String = "",
var is_auto_pass: Int = 0,
var vacation_type: Int = 0,
var color: String = "",
val face_infos: MutableList<FaceInfo> = mutableListOf()
) { ) {
fun getInImg(): FaceInfo? {
val imgList = face_infos.filter { it.isImg() }
if (imgList.isNotEmpty()) {
return imgList[0]
}
return null
}
} }


data class FaceInfo(
var attachment_name: String = "",
var attachment_id: String = "",
var identity: String = ""
) {
fun isImg(): Boolean {
if (attachment_name.isNullOrBlank()) {
return false
}
if (attachment_name.endsWith(".jpg", true) || attachment_name.endsWith(".png", true)) {
return true
}
return false
}
}

+ 21
- 0
app/src/main/java/com/yzx/escreen/model/Vacation.kt Wyświetl plik

@@ -0,0 +1,21 @@
package com.yzx.escreen.model

data class Vacation(
var vacation_time: Long = 0,
var vacation_type: Int = 2,
var vacation_remark: String = "",
var vacation_attachment: String = "",
var id: Int = 0
)

data class Attachment(
var name: String,
var id: String,
var identity: String
){
fun clear(){
name =""
id =""
identity =""
}
}

+ 33
- 8
app/src/main/java/com/yzx/escreen/presenter/HomePresenter.kt Wyświetl plik

@@ -4,15 +4,9 @@ import com.blankj.utilcode.util.LogUtils
import com.lzy.okgo.OkGo import com.lzy.okgo.OkGo
import com.lzy.okgo.model.Response import com.lzy.okgo.model.Response
import com.yzx.escreen.config.Config import com.yzx.escreen.config.Config
import com.yzx.escreen.model.LeaveID
import com.yzx.escreen.model.Pager
import com.yzx.escreen.model.StuLeave
import com.yzx.escreen.model.User
import com.yzx.escreen.model.*
import com.yzx.escreen.presenter.base.*
import com.yzx.webebook.config.YzxInterface import com.yzx.webebook.config.YzxInterface
import com.yzx.escreen.presenter.base.BasePresenter
import com.yzx.escreen.presenter.base.IView
import com.yzx.escreen.presenter.base.JsonCallBack
import com.yzx.escreen.presenter.base.YzxResponse


class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) { class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {


@@ -94,6 +88,35 @@ class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {
}) })
} }


fun postVacation(data:Vacation){
if(!User.isLogin()){
return
}
val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_STUDENT_POST_LEAVE_VACATION}"
OkGo.post<SimpleResponse>(url)
.tag(this)
.params("id", data.id)
.params("vacation_type", data.vacation_type)
.params("vacation_time", data.vacation_time)
.params("vacation_remark", data.vacation_remark)
.params("vacation_attachment", data.vacation_attachment)
.execute(object : JsonCallBack<SimpleResponse>() {


override fun onSuccess(response: Response<SimpleResponse>?) {
LogUtils.d(response)
if (response?.isSuccessful == true) {
mView?.postVacationSuccess("销假成功!")
}
}

override fun onError(response: Response<SimpleResponse>?) {
super.onError(response)
LogUtils.d(response)
mView?.postVacationError(response?.body()?.msg ?: "销假失败,请重试!")
}
})
}


} }


@@ -103,4 +126,6 @@ interface HomeView : IView {
fun onLeaveDetailSuccess(detail: StuLeave) fun onLeaveDetailSuccess(detail: StuLeave)
fun onLeaveDetailError(error: String) fun onLeaveDetailError(error: String)
fun onLeaveIDsSuccess(list: MutableList<LeaveID>) fun onLeaveIDsSuccess(list: MutableList<LeaveID>)
fun postVacationSuccess(msg: String)
fun postVacationError(msg: String)
} }

+ 49
- 0
app/src/main/java/com/yzx/escreen/utils/FileUpload.kt Wyświetl plik

@@ -0,0 +1,49 @@
package com.yzx.escreen.utils

import com.lzy.okgo.OkGo
import com.lzy.okgo.callback.StringCallback
import com.lzy.okgo.model.Response
import com.yzx.escreen.model.User
import com.yzx.webebook.config.YzxInterface
import org.json.JSONObject
import java.io.File

object FileUpload {

fun upload(path: String, callBack: FileUploadCallBack) {
val user = User.getUser()
OkGo.post<String>(YzxInterface.FILE_UPLOAD_URL)
.tag(this)
.params("token", user.token)
.params("user", user.user_id)
.params("file", File(path))
.execute(object : StringCallback() {
override fun onSuccess(response: Response<String>) {
try {
val noteJson = response.body()
val noteJsonObject = JSONObject(noteJson)
val noteContent = noteJsonObject.optString("content")
val noteContentObject = JSONObject(noteContent)
val noteKey = noteContentObject.optString("key")
val noteIdentity = noteContentObject.optString("identity")
callBack.onSuccess(noteIdentity, noteKey)
} catch (e: Exception) {
}
}

override fun onError(response: Response<String>) {
super.onError(response)
callBack.onError("上传失败")
}

override fun onFinish() {
super.onFinish()
}
})
}
}

interface FileUploadCallBack {
fun onSuccess(identity: String, key: String)
fun onError(msg: String)
}

+ 9
- 0
app/src/main/res/layout/activity_camera.xml Wyświetl plik

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.CameraActivity">

</androidx.appcompat.widget.LinearLayoutCompat>

+ 206
- 0
app/src/main/res/layout/dialog_vacation.xml Wyświetl plik

@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
android:layout_width="1400dp"
android:layout_height="wrap_content"
android:minWidth="1400dp"
android:orientation="vertical"
app:qmui_backgroundColor="@color/white"
app:qmui_radius="@dimen/d_15">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:qmui_backgroundColor="@color/colorPrimary"
app:qmui_radiusTopLeft="@dimen/d_15"
app:qmui_radiusTopRight="@dimen/d_15">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/d_28"
android:text="人工销假"
android:textColor="@color/white"
android:textSize="@dimen/sp20"
android:textStyle="bold" />
</com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout>

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/d_20"
android:orientation="horizontal">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<ImageView
android:id="@+id/statusImg"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="40dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout style="@style/leave_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="请假学生" />

<TextView
android:id="@+id/leave_student_name"
style="@style/leave_dialog_left_content"
android:text="颜小华" />
</LinearLayout>


<LinearLayout style="@style/leave_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="班级" />

<TextView
android:id="@+id/class_name"
style="@style/leave_dialog_left_content"
android:text="颜小华" />
</LinearLayout>

<LinearLayout style="@style/leave_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="请假时间" />

<TextView
android:id="@+id/add_time"
style="@style/leave_dialog_left_content"
android:textColor="@color/colorPrimary"
tools:text="2022年4月21日15:38:15" />
</LinearLayout>

<LinearLayout style="@style/leave_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="返校时间" />

<TextView
android:id="@+id/vacation_time"
style="@style/leave_dialog_left_content"
android:text="2022年4月21日15:38:15" />
</LinearLayout>

<LinearLayout style="@style/leave_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:text="附件"
android:paddingVertical="@dimen/d_10"/>

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/cameraBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="点击拍照"
app:qmui_radius="@dimen/d_2"
android:paddingHorizontal="@dimen/d_20"
android:paddingVertical="@dimen/d_5"/>
</LinearLayout>

<LinearLayout
style="@style/leave_dialog_row"
android:paddingEnd="80dp">

<TextView
style="@style/leave_dialog_title"
android:text="备注" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:qmui_borderColor="@color/colorPrimary"
app:qmui_radius="@dimen/d_5"
app:qmui_borderWidth="1dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:padding="@dimen/d_1">

<EditText
android:id="@+id/vacation_remark"
style="@style/leave_dialog_left_content"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="@null"
android:gravity="top|left"
android:padding="@dimen/d_15"
android:text="2022年4月21日15:38:15" />
</com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout>

</LinearLayout>
</LinearLayout>
</RelativeLayout>
<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/face_img"
android:layout_width="180dp"
android:layout_height="222dp"
android:text="颜小华"
app:qmui_corner_radius="@dimen/d_5"
app:qmui_border_color="@color/white"
android:layout_marginEnd="100dp"/>
</androidx.appcompat.widget.LinearLayoutCompat>

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:layout_marginTop="@dimen/d_30">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/closeBtn"
android:layout_width="300dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginBottom="@dimen/d_20"
android:padding="@dimen/d_10"
android:text="关闭"
android:textColor="@color/black"
android:textSize="@dimen/sp20"
app:qmui_borderColor="@color/gray"
app:qmui_radius="@dimen/d_5" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/submitBtn"
android:layout_width="300dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginStart="@dimen/d_30"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginBottom="@dimen/d_20"
android:padding="@dimen/d_10"
android:text="确定销假"
android:textColor="@color/white"
android:textSize="@dimen/sp20"
app:qmui_backgroundColor="@color/colorPrimary"
app:qmui_borderColor="@color/colorPrimary"
app:qmui_radius="@dimen/d_5" />
</androidx.appcompat.widget.LinearLayoutCompat>
</com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
</FrameLayout>

+ 23
- 0
app/src/main/res/layout/fragment_home.xml Wyświetl plik

@@ -129,6 +129,22 @@
app:qmui_backgroundColor="#fff" app:qmui_backgroundColor="#fff"
app:qmui_borderColor="#dcdee0" /> app:qmui_borderColor="#dcdee0" />


<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/status4Btn"
style="@style/home_status_btn"
android:text="正常销假"
android:textColor="@color/gray_80"
app:qmui_backgroundColor="#fff"
app:qmui_borderColor="#dcdee0" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/status5Btn"
style="@style/home_status_btn"
android:text="超时销假"
android:textColor="@color/gray_80"
app:qmui_backgroundColor="#fff"
app:qmui_borderColor="#dcdee0" />

</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>


<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
@@ -185,6 +201,11 @@
<TextView <TextView
style="@style/table_header" style="@style/table_header"
android:text="申请时间" /> android:text="申请时间" />

<TextView
style="@style/table_header"
android:gravity="center"
android:text="操作" />
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>


<View <View
@@ -251,6 +272,8 @@
android:text="下一页" android:text="下一页"
android:textColor="#3ca0e9" android:textColor="#3ca0e9"
android:textSize="@dimen/sp18" /> android:textSize="@dimen/sp18" />


</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
</LinearLayout> </LinearLayout>

+ 33
- 23
app/src/main/res/layout/layout_leave_step.xml Wyświetl plik

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -9,18 +9,20 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal">
android:gravity="center_horizontal"
android:orientation="vertical">

<View <View
android:id="@+id/line1" android:id="@+id/line1"
android:layout_width="1px" android:layout_width="1px"
android:layout_height="8dp" android:layout_height="8dp"
android:background="@color/gray_1" /> android:background="@color/gray_1" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundFrameLayout
android:layout_width="@dimen/d_6" android:layout_width="@dimen/d_6"
android:layout_height="@dimen/d_6" android:layout_height="@dimen/d_6"
app:qmui_backgroundColor="#3ca0e9" app:qmui_backgroundColor="#3ca0e9"
app:qmui_radius="@dimen/d_3"/>
app:qmui_radius="@dimen/d_3" />


<View <View
android:id="@+id/line2" android:id="@+id/line2"
@@ -34,9 +36,9 @@
android:id="@+id/contentLayout" android:id="@+id/contentLayout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:layout_marginStart="@dimen/d_20" android:layout_marginStart="@dimen/d_20"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_40"> android:paddingBottom="@dimen/dp_40">


<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
@@ -49,8 +51,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp20" android:textSize="@dimen/sp20"
tools:text="王大仙"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="王大仙" />


<TextView <TextView
android:id="@+id/addUserTypeName" android:id="@+id/addUserTypeName"
@@ -58,55 +60,63 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp20" android:textSize="@dimen/sp20"
tools:text="(学生家长)"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="(学生家长)" />


<TextView <TextView
android:id="@+id/activityName" android:id="@+id/activityName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp20" android:textSize="@dimen/sp20"
tools:text="提交申请"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="提交申请" />


<TextView <TextView
android:id="@+id/statusName" android:id="@+id/statusName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/sp20" android:textSize="@dimen/sp20"
tools:text="提交申请"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="提交申请" />
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>


<TextView <TextView
android:id="@+id/approvalComments" android:id="@+id/approvalComments"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="审批人:颜小华。允许出校,请放行"
android:layout_marginTop="@dimen/dp_10"
android:textSize="@dimen/sp20" android:textSize="@dimen/sp20"
android:layout_marginTop="@dimen/dp_10" />
tools:text="审批人:颜小华。允许出校,请放行" />


<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/dp_10"
android:gravity="bottom" android:gravity="bottom"
android:layout_marginTop="@dimen/dp_10">
android:orientation="horizontal">


<ImageView <ImageView
android:id="@+id/signImg" android:id="@+id/signImg"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="75dp" android:layout_height="75dp"
android:background="@color/white"
android:layout_marginEnd="@dimen/dp_10"/>
android:layout_marginEnd="@dimen/dp_10"
android:background="@color/white" />


<TextView <TextView
android:id="@+id/stepTime" android:id="@+id/stepTime"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="2022-4-21 15:50:42"
android:textColor="@color/gray"
android:textSize="@dimen/sp20" android:textSize="@dimen/sp20"
android:textColor="@color/gray" />
tools:text="2022-4-21 15:50:42" />
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>

<ImageView
android:id="@+id/inImg"
android:layout_width="200dp"
android:layout_height="150dp"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/white"
android:scaleType="centerCrop"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

+ 26
- 4
app/src/main/res/layout/layout_leave_table.xml Wyświetl plik

@@ -17,8 +17,8 @@
android:id="@+id/studentName" android:id="@+id/studentName"
style="@style/table_cell" style="@style/table_cell"
android:layout_weight="1.5" android:layout_weight="1.5"
android:text="请假学生"
android:paddingStart="@dimen/dp_40"/>
android:paddingStart="@dimen/dp_40"
android:text="请假学生" />


<FrameLayout <FrameLayout
style="@style/table_cell" style="@style/table_cell"
@@ -29,8 +29,8 @@
android:id="@+id/faceImg" android:id="@+id/faceImg"
android:layout_width="@dimen/d_70" android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70" android:layout_height="@dimen/d_70"
app:qmui_corner_radius="@dimen/d_5"
app:qmui_border_color="@color/white"/>
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />


<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/faceEmpty" android:id="@+id/faceEmpty"
@@ -79,6 +79,28 @@
android:id="@+id/applyTime" android:id="@+id/applyTime"
style="@style/table_cell" style="@style/table_cell"
android:text="申请时间" /> android:text="申请时间" />

<FrameLayout style="@style/table_cell">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/cancelBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingHorizontal="@dimen/d_5"
android:paddingVertical="@dimen/d_3"
android:text="销假"
app:qmui_radius="@dimen/d_2" />

<TextView
android:id="@+id/placeHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="--"
android:textColor="#333"
android:textSize="@dimen/sp18" />
</FrameLayout>
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>


<View <View


+ 4
- 0
app/src/main/res/xml/provider_paths.xml Wyświetl plik

@@ -2,7 +2,11 @@
<resources> <resources>


<paths> <paths>
<root-path
name="camera_photos"
path="" />
<external-path path="" name="download"/> <external-path path="" name="download"/>

</paths> </paths>


</resources> </resources>

Ładowanie…
Anuluj
Zapisz