YunLei 2 роки тому
джерело
коміт
e114414ed4
47 змінених файлів з 1671 додано та 711 видалено
  1. +1
    -1
      .idea/compiler.xml
  2. +17
    -0
      .idea/deploymentTargetDropDown.xml
  3. +1
    -3
      .idea/gradle.xml
  4. +6
    -0
      .idea/kotlinc.xml
  5. +1
    -2
      .idea/misc.xml
  6. +5
    -1
      app/src/main/AndroidManifest.xml
  7. +64
    -46
      app/src/main/java/com/yzx/escreen/MainActivity.kt
  8. +247
    -0
      app/src/main/java/com/yzx/escreen/activity/LoginActivity.kt
  9. +65
    -0
      app/src/main/java/com/yzx/escreen/activity/TestActivity.kt
  10. +39
    -3
      app/src/main/java/com/yzx/escreen/activity/base/BaseActivity.kt
  11. +17
    -71
      app/src/main/java/com/yzx/escreen/adapter/VisitorListAdapter.kt
  12. +8
    -5
      app/src/main/java/com/yzx/escreen/config/RefreshToken.kt
  13. +11
    -0
      app/src/main/java/com/yzx/escreen/config/YzxInterface.kt
  14. +60
    -0
      app/src/main/java/com/yzx/escreen/fragment/BlankFragment.kt
  15. +16
    -4
      app/src/main/java/com/yzx/escreen/fragment/MyFragment.kt
  16. +5
    -5
      app/src/main/java/com/yzx/escreen/fragment/VisitorFragment.kt
  17. +75
    -0
      app/src/main/java/com/yzx/escreen/model/CBClassInfo.kt
  18. +6
    -0
      app/src/main/java/com/yzx/escreen/model/EventBugBean.kt
  19. +1
    -1
      app/src/main/java/com/yzx/escreen/model/StuLeave.kt
  20. +15
    -0
      app/src/main/java/com/yzx/escreen/model/User.kt
  21. +1
    -1
      app/src/main/java/com/yzx/escreen/model/Visitor.kt
  22. +207
    -0
      app/src/main/java/com/yzx/escreen/presenter/LoginPresenter.kt
  23. +6
    -2
      app/src/main/java/com/yzx/escreen/presenter/VisitorPresenter.kt
  24. +3
    -4
      app/src/main/java/com/yzx/escreen/presenter/base/JsonCallBack.java
  25. +10
    -2
      app/src/main/java/com/yzx/escreen/utils/KotlinX.kt
  26. +2
    -2
      app/src/main/java/com/yzx/escreen/widget/LeaveDialog.kt
  27. +76
    -76
      app/src/main/java/com/yzx/escreen/widget/VisitorDialog.kt
  28. +5
    -0
      app/src/main/res/drawable/btn_blue_select.xml
  29. +8
    -0
      app/src/main/res/drawable/login_bg.xml
  30. +6
    -0
      app/src/main/res/drawable/shape_login_form.xml
  31. +5
    -0
      app/src/main/res/drawable/shape_login_round.xml
  32. +181
    -0
      app/src/main/res/layout/activity_login.xml
  33. +47
    -0
      app/src/main/res/layout/activity_test.xml
  34. +214
    -186
      app/src/main/res/layout/dialog_visitor.xml
  35. +14
    -0
      app/src/main/res/layout/fragment_blank.xml
  36. +10
    -22
      app/src/main/res/layout/fragment_visitor.xml
  37. +14
    -142
      app/src/main/res/layout/layout_visitor_table.xml
  38. BIN
      app/src/main/res/mipmap-xhdpi/ic_account.png
  39. BIN
      app/src/main/res/mipmap-xhdpi/ic_psw.png
  40. BIN
      app/src/main/res/mipmap-xhdpi/login_bg.jpg
  41. +2
    -1
      app/src/main/res/values/colors.xml
  42. +1
    -0
      app/src/main/res/values/ids.xml
  43. +2
    -0
      app/src/main/res/values/strings.xml
  44. BIN
      gradle/wrapper/gradle-wrapper.jar
  45. +1
    -2
      gradle/wrapper/gradle-wrapper.properties
  46. +172
    -110
      gradlew
  47. +24
    -19
      gradlew.bat

+ 1
- 1
.idea/compiler.xml Переглянути файл

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
<bytecodeTargetLevel target="1.8" />
</component>
</project>

+ 17
- 0
.idea/deploymentTargetDropDown.xml Переглянути файл

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\Administrator\.android\avd\EScreen_API_27.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-08-16T10:14:10.010653100Z" />
</component>
</project>

+ 1
- 3
.idea/gradle.xml Переглянути файл

@@ -4,18 +4,16 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="delegatedBuild" value="true" />
<option name="testRunner" value="GRADLE" />
<option name="disableWrapperSourceDistributionNotification" value="true" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>

+ 6
- 0
.idea/kotlinc.xml Переглянути файл

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.6.21" />
</component>
</project>

+ 1
- 2
.idea/misc.xml Переглянути файл

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
@@ -49,7 +48,7 @@
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">


+ 5
- 1
app/src/main/AndroidManifest.xml Переглянути файл

@@ -30,9 +30,13 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".activity.LoginActivity"
android:exported="false" />
<activity
android:name=".activity.CameraActivity"
android:exported="false" />
<!-- android:name=".MainActivity"-->
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboard"
@@ -70,7 +74,7 @@
<service
android:name="com.tencent.smtt.export.external.DexClassLoaderProviderService"
android:label="dexopt"
android:process=":dexopt"/>
android:process=":dexopt" />

<receiver
android:name=".receiver.BootReceiver"


+ 64
- 46
app/src/main/java/com/yzx/escreen/MainActivity.kt Переглянути файл

@@ -30,7 +30,7 @@ import com.lzy.okgo.OkGo
import com.lzy.okgo.callback.StringCallback
import com.lzy.okgo.model.Response
import com.qmuiteam.qmui.widget.dialog.QMUIDialog
import com.yzx.escreen.activity.WebActivity
import com.yzx.escreen.activity.LoginActivity
import com.yzx.escreen.activity.base.BaseActivity
import com.yzx.escreen.config.Config
import com.yzx.escreen.config.RefreshToken
@@ -112,7 +112,8 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
override fun initView() {
if (NetworkUtils.isConnected()) {
if (!User.isLogin() && User.getUser().token.isEmpty()) {
WebActivity.active(this, "${Config.OA_URL}/login")
// WebActivity.active(this, "${Config.OA_URL}/login")
LoginActivity.active(this)
finish()
}
if (!User.isLogin()) {
@@ -174,12 +175,12 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
private fun checkAuto() {
isAutoShowLeave = SPUtils.getInstance().getBoolean("auto_show_leave", false)
isAutoShowChange = SPUtils.getInstance().getBoolean("auto_show_change", false)
// if (isAutoShowLeave || isAutoShowChange) {
// mHandler.removeCallbacks(runnable)
// mHandler.postDelayed(runnable, 2000)
// } else {
// mHandler.removeCallbacks(runnable)
// }
if (isAutoShowLeave || isAutoShowChange) {
mHandler.removeCallbacks(runnable)
mHandler.postDelayed(runnable, 2000)
} else {
mHandler.removeCallbacks(runnable)
}
}

//接收消息
@@ -187,10 +188,11 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
fun onMessageEvent(event: AutoSwitchChange) {
checkAuto()
}

//接收消息
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(event: UserLoginEvent) {
if (client?.isOpen == true){
if (client?.isOpen == true) {
client?.close()
}
client = null
@@ -326,48 +328,48 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
}

private fun initWs() {
client =
object : WebSocketClient(URI.create(Config.WS_URL), Draft_6455(), null, 10 * 1000) {
override fun onOpen(handshakedata: ServerHandshake?) {
LogUtils.d("WebSocketClient-onOpen", handshakedata)
val user = User.getUser()
val clientInfo = YzxClientInfo()
clientInfo.type = 70
clientInfo.user_id = user.user_id.toString()
clientInfo.unit_id = user.school_id.toString()
clientInfo.token = user.token

client?.send(Gson().toJson(clientInfo))
Thread {
client =
object : WebSocketClient(URI.create(Config.WS_URL), Draft_6455(), null, 10 * 1000) {
override fun onOpen(handshakedata: ServerHandshake?) {
LogUtils.d("WebSocketClient-onOpen", handshakedata)
val user = User.getUser()
val clientInfo = YzxClientInfo()
clientInfo.type = 70
clientInfo.user_id = user.user_id.toString()
clientInfo.unit_id = user.school_id.toString()
clientInfo.token = user.token

client?.send(Gson().toJson(clientInfo))

}
}

override fun onClose(code: Int, reason: String?, remote: Boolean) {
LogUtils.d("WebSocketClient-onClose", code, reason, remote)
override fun onClose(code: Int, reason: String?, remote: Boolean) {
LogUtils.d("WebSocketClient-onClose", code, reason, remote)

}
}

override fun onMessage(message: String?) {
LogUtils.d("WebSocketClient-onMessage", message)
if (message?.startsWith("ECHO:", true) == false) {
viewPager2.post {
wsMessage(message)
override fun onMessage(message: String?) {
LogUtils.d("WebSocketClient-onMessage", message)
if (message?.startsWith("ECHO:", true) == false) {
wsMessage(message)
}
}
}

override fun onError(ex: Exception?) {
LogUtils.d("WebSocketClient-onError", ex)
override fun onError(ex: Exception?) {
LogUtils.d("WebSocketClient-onError", ex)

}
}

}
try {
client?.connectBlocking()
wsHeart()
} catch (e: InterruptedException) {
e.printStackTrace()
LogUtils.d("WebSocketClient-catch", e)
}
try {
client?.connectBlocking()
wsHeart()
} catch (e: InterruptedException) {
e.printStackTrace()
LogUtils.d("WebSocketClient-catch", e)
}
}.start()
}

private fun wsMessage(msg: String) {
@@ -376,13 +378,23 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
val res = gson.fromJson<YzxClientInfo>(msg, resultType)
if (res.data.student_id > 0) {
if (isAutoShowLeave || isAutoShowChange) {
mPresenter?.getLeaveShowIds("${res.data.student_id}")
EventBus.getDefault().post(EventLeaveIds("${res.data.student_id}"))
// mPresenter?.getLeaveShowIds("${res.data.student_id}")
}
}
}

//请假消息
@Subscribe(threadMode = ThreadMode.MAIN)
fun onMessageEvent(detail: EventLeaveIds) {
mPresenter?.getLeaveShowIds("${detail.ids}")
}



private fun wsHeart() {
viewPager2.postDelayed({
Thread{
Thread.sleep(10 * 1000)
if (client?.isOpen == true) {
client?.apply {
send(Gson().toJson(YzxHeart().getYzxHeader()))
@@ -395,7 +407,7 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
}
}
wsHeart()
}, 10 * 1000)
}.start()
}

private fun showNetworkError() {
@@ -464,7 +476,8 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
}
viewPager2.removeCallbacks(netLoadingRun)
if (!User.isLogin()) {
WebActivity.active(this, "${Config.OA_URL}/login?logout=1")
// WebActivity.active(this, "${Config.OA_URL}/login?logout=1")
LoginActivity.active(this)
finish()
}
checkVersion()
@@ -497,9 +510,11 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus
res.data.type == 1 -> { //强制升级
updateApp(res.data)
}

curr - lastTipTime > 24 * 60 * 60 * 1000 -> { //非强制一天以内提示一次
updateApp(res.data)
}

userCheck -> { //
updateApp(res.data)
}
@@ -618,17 +633,20 @@ class HomePagerAdapter(act: AppCompatActivity) : FragmentStateAdapter(act) {
0 -> {
return HomeFragment.getNewInstance()
}

1 -> {
return ChangeFragment.getNewInstance()
}

2 -> {
return VisitorFragment.getNewInstance()
}

3 -> {
return MyFragment.getNewInstance()
}
}
return HomeFragment.getNewInstance()
return HomeFragment()
}

}

+ 247
- 0
app/src/main/java/com/yzx/escreen/activity/LoginActivity.kt Переглянути файл

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

import android.app.Activity
import android.view.View
import com.blankj.utilcode.util.KeyboardUtils
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.SPUtils
import com.flyco.tablayout.listener.CustomTabEntity
import com.flyco.tablayout.listener.OnTabSelectListener
import com.qmuiteam.qmui.widget.dialog.QMUIDialog
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog.Builder.ICON_TYPE_FAIL
import com.yzx.escreen.MainActivity
import com.yzx.escreen.R
import com.yzx.escreen.activity.base.BaseActivity
import com.yzx.escreen.model.BaseUser
import com.yzx.escreen.model.TabEntity
import com.yzx.escreen.model.User
import com.yzx.escreen.presenter.LoginPresenter
import com.yzx.escreen.presenter.LoginView
import com.yzx.escreen.utils.hideNavigationBar
import com.yzx.escreen.utils.setSrc
import kotlinx.android.synthetic.main.activity_login.accountEdit
import kotlinx.android.synthetic.main.activity_login.accountLayout
import kotlinx.android.synthetic.main.activity_login.loginBtn
import kotlinx.android.synthetic.main.activity_login.pswCheckbox
import kotlinx.android.synthetic.main.activity_login.pswEdit
import kotlinx.android.synthetic.main.activity_login.qrCodeImg
import kotlinx.android.synthetic.main.activity_login.qrLayout
import kotlinx.android.synthetic.main.activity_login.tabLayout
import org.jetbrains.anko.startActivity

class LoginActivity : BaseActivity<LoginPresenter>(), LoginView {

companion object {
fun active(act: Activity) {
act.startActivity<LoginActivity>()
}
}

private var mTicket = ""

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

override fun initView() {
val tabData = arrayListOf<CustomTabEntity>()
tabData.add(TabEntity("账号密码登录", 0, 0))
tabData.add(TabEntity("微信扫码登录", 0, 0))
tabLayout.setTabData(tabData)
tabLayout.setOnTabSelectListener(object : OnTabSelectListener {
override fun onTabSelect(position: Int) {
if (position == 0) {
qrLayout.visibility = View.GONE
accountLayout.visibility = View.VISIBLE
SPUtils.getInstance().put("last_login_tab_index",0)
} else {
qrLayout.visibility = View.VISIBLE
accountLayout.visibility = View.GONE
SPUtils.getInstance().put("last_login_tab_index",1)
KeyboardUtils.hideSoftInput(this@LoginActivity)
}
}

override fun onTabReselect(position: Int) {

}
})
val lastLoginTabIndex = SPUtils.getInstance().getInt("last_login_tab_index",0)
if(lastLoginTabIndex == 1){
qrLayout.visibility = View.VISIBLE
accountLayout.visibility = View.GONE
tabLayout.currentTab = 1
}
loginBtn.setOnClickListener {
this.doLogin()
}
val isSavePsw = SPUtils.getInstance().getBoolean("is_save_psw", false)
if (isSavePsw) {
pswCheckbox.isChecked = true
val phone = SPUtils.getInstance().getString("login_save_phone", "")
val psw = SPUtils.getInstance().getString("login_save_psw", "")
accountEdit.setText(phone)
pswEdit.setText(psw)
} else {
pswCheckbox.isChecked = false
}
}

private fun doLogin() {
val phone = accountEdit.text.toString()
val psw = pswEdit.text.toString()
if (phone.isBlank()) {
showDialogToast("请输入账号", icon = QMUITipDialog.Builder.ICON_TYPE_FAIL)
return
}
if (psw.isBlank()) {
showDialogToast("请输入密码", icon = QMUITipDialog.Builder.ICON_TYPE_FAIL)
return
}
showLoading("登录中...")
if(pswCheckbox.isChecked){
SPUtils.getInstance().put("is_save_psw",true)
SPUtils.getInstance().put("login_save_phone",phone)
SPUtils.getInstance().put("login_save_psw",psw)
}else{
SPUtils.getInstance().put("is_save_psw",false)
SPUtils.getInstance().remove("login_save_phone")
SPUtils.getInstance().remove("login_save_psw")
}
mPresenter?.login(phone, psw)
}

override fun initData() {
mPresenter?.getWXQrCode()
}

override fun initPresenter(): LoginPresenter = LoginPresenter(this)

override fun onLoginSuccess(user: BaseUser, list: MutableList<BaseUser>) {
val teaList = list.filter {
return@filter it.type == 0
}
when {
teaList.isEmpty() -> {

if(user.type == 0){
mPresenter?.switchUser(user.token, user.user_id, user.school_id)
}else{
hideLoading()
this.showDialogToast("无登录权限", icon = ICON_TYPE_FAIL)
}
}

teaList.size == 1 -> { //多个角色
val item = teaList[0]
mPresenter?.switchUser(user.token, item.user_id, item.unit_id)
}

else -> {
mPresenter?.getUserRoleList(user.token)
}
}
}

override fun onLoginError(msg: String) {
hideLoading()
showDialogToast(msg, icon = ICON_TYPE_FAIL)
}

override fun onUserInfoSuccess(user: User) {
hideLoading()
startActivity<MainActivity>()
finish()
}

override fun onWxQrCodeSuccess(imgUrl: String, ticket: String) {
qrCodeImg.setSrc(imgUrl)
mTicket = ticket
mPresenter?.loginQuery(ticket)
}

override fun onDestroy() {
qrCodeImg?.apply {
removeCallbacks(null)
}
super.onDestroy()
}

private var mBindDialog: QMUIDialog? = null
private var mOverTimeDialog: QMUIDialog? = null

override fun onLoginQuerySuccess(user: BaseUser, code: Int) {
when (code) {
0 -> {
if (user.direct_login == 1) {
mPresenter?.getUserLoginInfo(user.token)
} else {
mPresenter?.getUserRoleInfoByPhone(user.phone, user.tmp_token)
}
}

451 -> {
if (mBindDialog == null) {
mBindDialog = QMUIDialog.MessageDialogBuilder(this)
.setTitle("温馨提示")
.setMessage("您还未绑定微信公众,请绑定后再试!")
.addAction("知道了") { dialog, index ->
dialog.dismiss()
}
.create()
mBindDialog?.show()
mBindDialog?.hideNavigationBar()
} else if (!mBindDialog!!.isShowing) {
mBindDialog?.show()
}
qrCodeImg.postDelayed({
mPresenter?.loginQuery(mTicket)
}, 1000)
}

452 -> {
qrCodeImg.postDelayed({
mPresenter?.loginQuery(mTicket)
}, 1000)
}

else -> {
if (mOverTimeDialog == null) {
mOverTimeDialog = QMUIDialog.MessageDialogBuilder(this)
.setTitle("温馨提示")
.setMessage("二维码已使用,请重新扫码!")
.addAction("知道了") { dialog, index ->
dialog.dismiss()
}
.create()
mOverTimeDialog!!.show()
mOverTimeDialog!!.hideNavigationBar()
} else if (!mOverTimeDialog!!.isShowing) {
mOverTimeDialog?.show()
}
mPresenter?.getWXQrCode()
}
}
}

override fun onUserListSuccess(list: MutableList<BaseUser>, token: String) {
LogUtils.d("onUserListSuccess", list)
hideLoading()
val builder = QMUIDialog.MenuDialogBuilder(this)
list.forEach {
builder.addItem(
it.unit_name
) { dialog, which ->
LogUtils.d("itemClick", which)
val item = list[which]
showLoading("登录中...")
if(item.school_id>0){
mPresenter?.switchUnit(item.user_id, item.unit_id,token)
}else{
mPresenter?.switchUser(token, item.user_id, item.unit_id)
}
}
}
builder.show()
}
}

+ 65
- 0
app/src/main/java/com/yzx/escreen/activity/TestActivity.kt Переглянути файл

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


import androidx.viewpager2.widget.ViewPager2
import com.blankj.utilcode.util.KeyboardUtils
import com.flyco.tablayout.listener.CustomTabEntity
import com.flyco.tablayout.listener.OnTabSelectListener
import com.yzx.escreen.HomePagerAdapter
import com.yzx.escreen.R
import com.yzx.escreen.activity.base.BaseActivity
import com.yzx.escreen.model.LeaveID
import com.yzx.escreen.model.TabEntity
import com.yzx.escreen.presenter.MainPresenter
import com.yzx.escreen.presenter.MainView
import kotlinx.android.synthetic.main.activity_test.tabLayout
import kotlinx.android.synthetic.main.activity_test.viewPager2

class TestActivity : BaseActivity<MainPresenter>(), MainView {
override val inflateId: Int
get() = R.layout.activity_test

override fun initView() {
val tabData = arrayListOf<CustomTabEntity>()
tabData.add(TabEntity("学生请假", R.mipmap.leave_select, R.mipmap.leave_unselect))
tabData.add(TabEntity("学籍异动", R.mipmap.change_select, R.mipmap.change_unselect))
tabData.add(TabEntity("访客管理", R.mipmap.visitor_select, R.mipmap.visitor_unselect))
tabData.add(TabEntity("我的", R.mipmap.my_select, R.mipmap.my_unselect))
tabLayout.setTabData(tabData)

viewPager2.adapter = HomePagerAdapter(this)
viewPager2.offscreenPageLimit = 3
viewPager2.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
super.onPageSelected(position)
tabLayout.currentTab = position
}
})
tabLayout.setOnTabSelectListener(object : OnTabSelectListener {
override fun onTabSelect(position: Int) {
// viewPager2.currentItem = position
viewPager2.setCurrentItem(position, false)
KeyboardUtils.hideSoftInput(viewPager2)
}

override fun onTabReselect(position: Int) {
}

})
}

override fun initData() {

}

override fun initPresenter(): MainPresenter=MainPresenter(this)


override fun onLeaveIDsSuccess(list: MutableList<LeaveID>) {

}

override fun onLeaveIDsError() {

}
}

+ 39
- 3
app/src/main/java/com/yzx/escreen/activity/base/BaseActivity.kt Переглянути файл

@@ -4,10 +4,9 @@ import android.os.Bundle
import android.view.View
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.BarUtils
import com.gyf.immersionbar.ktx.immersionBar
import com.yzx.escreen.R
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
import com.yzx.escreen.presenter.base.BasePresenter
import com.yzx.escreen.utils.hideNavigationBar

/**
* 类名:BaseActivity
@@ -25,6 +24,8 @@ abstract class BaseActivity<out P : BasePresenter<*>> : AppCompatActivity() {
*/
abstract val inflateId: Int

private var mLoadingDialog: QMUITipDialog? = null

/**
* 初始化视图操作在这里执行,执行时机为onCreate之后
*/
@@ -82,4 +83,39 @@ abstract class BaseActivity<out P : BasePresenter<*>> : AppCompatActivity() {

}

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

}

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

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

}

+ 17
- 71
app/src/main/java/com/yzx/escreen/adapter/VisitorListAdapter.kt Переглянути файл

@@ -7,90 +7,35 @@ import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yzx.escreen.R
import com.yzx.escreen.model.Visitor
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toTime
import kotlinx.android.synthetic.main.layout_visitor_table.view.*
import kotlinx.android.synthetic.main.layout_visitor_table.view.applyTime
import kotlinx.android.synthetic.main.layout_visitor_table.view.bottomLine
import kotlinx.android.synthetic.main.layout_visitor_table.view.inOutTime
import kotlinx.android.synthetic.main.layout_visitor_table.view.isDrive
import kotlinx.android.synthetic.main.layout_visitor_table.view.receptionUser
import kotlinx.android.synthetic.main.layout_visitor_table.view.statusName
import kotlinx.android.synthetic.main.layout_visitor_table.view.userName
import org.jetbrains.anko.textColor

class VisitorListAdapter(list: MutableList<Visitor>) :
BaseQuickAdapter<Visitor, BaseViewHolder>(R.layout.layout_visitor_table, list) {

init {
addChildClickViewIds(R.id.faceEmpty,R.id.nucleinEmpty,R.id.tripCodeEmpty,R.id.healthCodeEmpty)
// addChildClickViewIds(R.id.faceEmpty)
}

@SuppressLint("SetTextI18n", "Range")
override fun convert(holder: BaseViewHolder, item: Visitor) {
holder.itemView.userName.text = item.user_name
if (item.face_key.isNotEmpty()) {
holder.itemView.faceImg.visibility = View.VISIBLE
holder.itemView.faceEmpty.visibility = View.GONE
holder.itemView.faceImg.setSrc(item.face_identity, item.face_key)
} else {
holder.itemView.faceEmpty.visibility = View.VISIBLE
holder.itemView.faceImg.visibility = View.GONE
}
when {
item.health_code_status >= 0 -> {
holder.itemView.healthCodeStatusLayout.visibility = View.VISIBLE
holder.itemView.healthCodeImg.visibility = View.GONE
holder.itemView.healthCodeEmpty.visibility = View.GONE
when (item.health_code_status) {
0 -> {
holder.itemView.healthCodeStatus.text = "状态:绿码"
holder.itemView.healthCodeStatus.textColor = Color.parseColor("#5DAD64")
}
1 -> {
holder.itemView.healthCodeStatus.text = "状态:黄码"
holder.itemView.healthCodeStatus.textColor = Color.parseColor("#FCCF13")
}
10 -> {
holder.itemView.healthCodeStatus.text = "状态:红码"
holder.itemView.healthCodeStatus.textColor = Color.parseColor("#FC0416")
}
}
}
item.health_code_key.isNotEmpty() -> {
holder.itemView.healthCodeStatusLayout.visibility = View.GONE
holder.itemView.healthCodeImg.visibility = View.VISIBLE
holder.itemView.healthCodeEmpty.visibility = View.GONE
holder.itemView.healthCodeImg.setSrc(
item.health_code_identity,
item.health_code_key
)

}
else -> {
holder.itemView.healthCodeStatusLayout.visibility = View.GONE
holder.itemView.healthCodeEmpty.visibility = View.VISIBLE
holder.itemView.healthCodeImg.visibility = View.GONE
}
}
if(item.nuclein_file_key.isNullOrBlank()){
holder.itemView.nucleinEmpty.visibility = View.VISIBLE
holder.itemView.nucleinImg.visibility = View.GONE
}else{
holder.itemView.nucleinImg.visibility = View.VISIBLE
holder.itemView.nucleinEmpty.visibility = View.GONE
holder.itemView.nucleinImg.setSrc(item.nuclein_file_identity, item.nuclein_file_key)
}
if(item.nuclein_time>0){
holder.itemView.nucleinStatusLayout.visibility = View.VISIBLE
holder.itemView.nucleinStatus.text = item.getNucleinStatusObj().nuclein_name
holder.itemView.nucleinStatus.setTextColor(Color.parseColor(item.getNucleinStatusObj().nuclein_color))
}else{
holder.itemView.nucleinStatusLayout.visibility = View.GONE
}
if (item.trip_code_key.isNullOrBlank()) {
holder.itemView.tripCodeEmpty.visibility = View.VISIBLE
holder.itemView.tripCodeImg.visibility = View.GONE
} else {
holder.itemView.tripCodeImg.visibility = View.VISIBLE
holder.itemView.tripCodeEmpty.visibility = View.GONE
holder.itemView.tripCodeImg.setSrc(item.trip_code_identity, item.trip_code_key)
}
// holder.itemView.userTypeName.text = when (item.user_type) {
// 0 -> ""
// 1 -> "老师"
// 2 -> "学生"
// 3 -> "访客"
// else -> "--"
// }
holder.itemView.isDrive.text = if (item.is_drive == 1) {
"是"
"是(${item.license_plate})"
} else {
"否"
}
@@ -111,6 +56,7 @@ class VisitorListAdapter(list: MutableList<Visitor>) :
}

holder.itemView.applyTime.text = item.add_time.toTime()
holder.itemView.inOutTime.text = "${item.start_time.toTime()} - ${item.end_time.toTime()}"

holder.itemView.bottomLine.visibility = if (holder.adapterPosition == data.size - 1) {
View.GONE


+ 8
- 5
app/src/main/java/com/yzx/escreen/config/RefreshToken.kt Переглянути файл

@@ -7,7 +7,7 @@ import com.lzy.okgo.OkGo
import com.lzy.okgo.model.Response
import com.yzx.escreen.App.Companion.getContext
import com.yzx.escreen.MainActivity
import com.yzx.escreen.activity.WebActivity
import com.yzx.escreen.activity.LoginActivity
import com.yzx.escreen.config.Config.OA_URL
import com.yzx.escreen.model.ReToken
import com.yzx.escreen.model.RefreshTokenEvent
@@ -15,7 +15,7 @@ import com.yzx.escreen.model.User
import com.yzx.escreen.presenter.base.JsonCallBack
import com.yzx.escreen.presenter.base.YzxResponse
import org.greenrobot.eventbus.EventBus
import java.util.*
import java.util.Date

object RefreshToken {
fun refresh(callBack:RefreshCallback) {
@@ -47,7 +47,8 @@ object RefreshToken {
super.onError(response)
LogUtils.d(response)
User.clearUserInfo()
val intent = Intent(getContext(), WebActivity::class.java)
// val intent = Intent(getContext(), WebActivity::class.java)
val intent = Intent(getContext(), LoginActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.putExtra("link", OA_URL + "/login?logout=1")
ActivityUtils.startActivity(intent)
@@ -57,7 +58,8 @@ object RefreshToken {
})
}else{
User.clearUserInfo()
val intent = Intent(getContext(), WebActivity::class.java)
// val intent = Intent(getContext(), WebActivity::class.java)
val intent = Intent(getContext(), LoginActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.putExtra("link", OA_URL + "/login?logout=1")
ActivityUtils.startActivity(intent)
@@ -67,7 +69,8 @@ object RefreshToken {
}else{
if (currTime - lastLoginTime > 365L * 24 * 60 * 60 * 1000){
User.clearUserInfo()
val intent = Intent(getContext(), WebActivity::class.java)
// val intent = Intent(getContext(), WebActivity::class.java)
val intent = Intent(getContext(), LoginActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.putExtra("link", OA_URL + "/login?logout=1")
ActivityUtils.startActivity(intent)


+ 11
- 0
app/src/main/java/com/yzx/escreen/config/YzxInterface.kt Переглянути файл

@@ -4,10 +4,21 @@ object YzxInterface {

const val FILE_UPLOAD_URL = "https://fileupload.oa.qbjjyyun.net/edufile/fileUpload"

const val INTERFACE_LOGIN_ALL= "/login/user2/doLoginAll" //老师学生统一登录
const val INTERFACE_USER_ROLE_LIST= "/login/user2/getUserLoginRoleList" //多角色获取角色列表
const val INTERFACE_USER_ROLE_LIST_BY_PHONE= "/edu/weixin/getRolesByPhone" //多角色获取角色列表
const val INTERFACE_USER_SWITCH= "/login/user2/switchLoginRole" //切换角色
const val INTERFACE_USER_SWITCH_UNIT= "/edu/weixin/switchUnit" //切换角色
const val INTERFACE_COMMON_LOGIN_BY_TOKEN= "/login/user2/getUserLoginInfo" // 通过token登陆
const val INTERFACE_GET_COMMON_YUN_AVATAR= "/edu/activeApi/getYkjHeadPortrait" //根据登录人获取云空间头像

const val INTERFACE_REFRESH_TOKEN = "/login/user2/refreshToken"// 刷新token
const val INTERFACE_GET_ACCESS_TOKEN= "/rights/weixin/getAccessTokenByAppId" // 通过app_id获取access_token
const val INTERFACE_GET_MINI_CODE= "/parent/mini/getMiniCode" // 获取小程序二维码

const val INTERFACE_GENERATE_WX_QR_TICKET= "/login/wechat/generateQrTicket" // 获取微信带参数二维码的ticket
const val INTERFACE_WX_DO_LOGIN_QUERY= "/edu/user/common/doLoginQuery" // 微信登录的轮询

/**
* 学生请假
*/


+ 60
- 0
app/src/main/java/com/yzx/escreen/fragment/BlankFragment.kt Переглянути файл

@@ -0,0 +1,60 @@
package com.yzx.escreen.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.yzx.escreen.R

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

/**
* A simple [Fragment] subclass.
* Use the [BlankFragment.newInstance] factory method to
* create an instance of this fragment.
*/
class BlankFragment : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
param1 = it.getString(ARG_PARAM1)
param2 = it.getString(ARG_PARAM2)
}
}

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_blank, container, false)
}

companion object {
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment BlankFragment.
*/
// TODO: Rename and change types and number of parameters
@JvmStatic
fun newInstance(param1: String, param2: String) =
BlankFragment().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)
}
}
}
}

+ 16
- 4
app/src/main/java/com/yzx/escreen/fragment/MyFragment.kt Переглянути файл

@@ -7,8 +7,7 @@ import com.blankj.utilcode.util.ScreenUtils
import com.qmuiteam.qmui.widget.dialog.QMUIDialog
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
import com.yzx.escreen.R
import com.yzx.escreen.activity.WebActivity
import com.yzx.escreen.config.Config
import com.yzx.escreen.activity.LoginActivity
import com.yzx.escreen.fragment.base.BaseFragment
import com.yzx.escreen.model.TeacherInfo
import com.yzx.escreen.model.TimeShow
@@ -16,7 +15,19 @@ import com.yzx.escreen.model.User
import com.yzx.escreen.presenter.MyPresenter
import com.yzx.escreen.presenter.MyView
import com.yzx.escreen.utils.hideNavigationBar
import kotlinx.android.synthetic.main.fragment_my.*
import kotlinx.android.synthetic.main.fragment_my.density
import kotlinx.android.synthetic.main.fragment_my.groupName
import kotlinx.android.synthetic.main.fragment_my.idCard
import kotlinx.android.synthetic.main.fragment_my.isLeader
import kotlinx.android.synthetic.main.fragment_my.jobName
import kotlinx.android.synthetic.main.fragment_my.jobType
import kotlinx.android.synthetic.main.fragment_my.logoutBtn
import kotlinx.android.synthetic.main.fragment_my.phone
import kotlinx.android.synthetic.main.fragment_my.sex
import kotlinx.android.synthetic.main.fragment_my.sysExitBtn
import kotlinx.android.synthetic.main.fragment_my.timeView
import kotlinx.android.synthetic.main.fragment_my.unitName
import kotlinx.android.synthetic.main.fragment_my.userName
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@@ -103,7 +114,8 @@ class MyFragment : BaseFragment<MyPresenter>(), MyView {
logoutBtn.setOnClickListener {
activity?.apply {
User.clearUserInfo()
WebActivity.active(this, "${Config.OA_URL}/login?logout=1")
// WebActivity.active(this, "${Config.OA_URL}/login?logout=1")
LoginActivity.active(this)
finish()
}
}


+ 5
- 5
app/src/main/java/com/yzx/escreen/fragment/VisitorFragment.kt Переглянути файл

@@ -113,11 +113,11 @@ class VisitorFragment : BaseFragment<VisitorPresenter>(), VisitorView,
val curr = TimeUtils.getNowMills()
if (curr - lastClickTime > 500) {
lastClickTime = curr
when (view.id) {
R.id.faceEmpty, R.id.nucleinEmpty, R.id.tripCodeEmpty, R.id.healthCodeEmpty -> {
mPresenter?.getDetail(mAdapter.getItem(position).id)
}
}
// when (view.id) {
// R.id.faceEmpty, R.id.nucleinEmpty, R.id.tripCodeEmpty, R.id.healthCodeEmpty -> {
// mPresenter?.getDetail(mAdapter.getItem(position).id)
// }
// }
}

}


+ 75
- 0
app/src/main/java/com/yzx/escreen/model/CBClassInfo.kt Переглянути файл

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

import com.yzx.escreen.utils.getImgUrl
import java.net.URLDecoder

data class CBClassInfo(
val brushed_face_num: Int = 0,
val class_student_num: Int = 0,
val class_teacher: ClassTeacher = ClassTeacher(),
val leave_num: Int = 0,
val unbrushed_face_num: Int = 0,
val user_photo: UserPhoto = UserPhoto()
)

data class ClassTeacher(
val user_id: Int = 0,
val user_name: String = ""
)

data class UserPhoto(
val head_portrait: String = "",
val identity: String = ""
)

data class ClassTeaInfo(
val subject_name: String = "",
val subject_id: String = "",
val user_name: String = "",
val user_id: String = "",
val type: Int = 0
)

data class TimeTable(
val lesson_no: Int = 0,
val lesson_name: String = "",
val subject_id: String = "",
val subject_name: String = ""
)

data class ClassActiveInfo(
val add_time: Int = 0,
val user_name: String = "",
val content: String = "",
val attachments: MutableList<ActiveAttachment> = mutableListOf()
){
fun getNewContent():String{
return URLDecoder.decode(content,"UTF-8")
}

fun getImgUrls():MutableList<String>{
val list = mutableListOf<String>()
attachments.forEach {
if (it.file_id?.isNotEmpty())
list.add(it.file_identity.getImgUrl(it.file_id))
}
return list
}
}

data class ActiveAttachment(
val file_id: String = "",
val file_identity: String = ""
)

data class ClassStylePic(
val identity: String = "",
val picture_id: String = ""
)

data class HeadClassInfo(
val class_id: Int = 0,
val class_name: String = "",
val grade_id: Int = 0,
val grade_name: String = ""
)

+ 6
- 0
app/src/main/java/com/yzx/escreen/model/EventBugBean.kt Переглянути файл

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

class EventBugBean {
}

data class EventLeaveIds(var ids:String="")

+ 1
- 1
app/src/main/java/com/yzx/escreen/model/StuLeave.kt Переглянути файл

@@ -19,7 +19,7 @@ data class StuLeave(
val end_time: Int = 0,
val entry_flag: Int = 0,
val face_identity: String = "",
val face_key: String = "",
val face_key: String ?= "",
val ftime: Int = 0,
val grade_id: Int = 0,
val grade_name: String = "",


+ 15
- 0
app/src/main/java/com/yzx/escreen/model/User.kt Переглянути файл

@@ -3,7 +3,22 @@ package com.yzx.escreen.model
import com.blankj.utilcode.util.SPUtils
import com.blankj.utilcode.util.TimeUtils

class BaseUser(var token: String,
var type:Int,
var role:String,
var user_id:Int,
var unit_id:Int,
var school_id:Int,
var unit_name:String,
var school_name:String,
var direct_login:Int,
var tmp_token:String,
var phone:String
)

class UserAvatar(val identity:String,val head_portrait:String)

class WxQrTicket(val ticket:String)
class User(
var user_name: String,
var user_id: Int,


+ 1
- 1
app/src/main/java/com/yzx/escreen/model/Visitor.kt Переглянути файл

@@ -11,7 +11,7 @@ data class Visitor(
val card_no: String = "",
val end_time: Int = 0,
val face_identity: String = "",
val face_key: String = "",
val face_key: String ?= "",
val health_code_identity: String = "",
val health_code_key: String = "",
val health_code_status: Int = -1,


+ 207
- 0
app/src/main/java/com/yzx/escreen/presenter/LoginPresenter.kt Переглянути файл

@@ -0,0 +1,207 @@
package com.yzx.escreen.presenter

import com.blankj.utilcode.util.LogUtils
import com.lzy.okgo.OkGo
import com.lzy.okgo.model.Response
import com.yzx.escreen.config.Config
import com.yzx.escreen.model.BaseUser
import com.yzx.escreen.model.User
import com.yzx.escreen.model.WxQrTicket
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
import com.yzx.escreen.config.YzxInterface

class LoginPresenter(view: LoginView) : BasePresenter<LoginView>(view) {
fun login(phone: String, psw: String) {
val url = Config.BASE_URL + YzxInterface.INTERFACE_LOGIN_ALL
OkGo.post<YzxResponse<BaseUser>>(url)
.tag(this)
.params("phone", phone)
.params("password", psw)
.params("original_password", psw)
.execute(object : JsonCallBack<YzxResponse<BaseUser>>() {
override fun onSuccess(response: Response<YzxResponse<BaseUser>>?) {
if (response?.isSuccessful == true) {
mView?.onLoginSuccess(response.body().data, response.body().list)
LogUtils.d("login", response.body().list)
}
}

override fun onError(response: Response<YzxResponse<BaseUser>>?) {
super.onError(response)
LogUtils.d(response)
mView?.onLoginError(response?.body()?.msg ?: "")
}
})
}

fun switchUser(token: String, user_id: Int, unit_id: Int) {
val url = Config.BASE_URL + YzxInterface.INTERFACE_USER_SWITCH
OkGo.post<YzxResponse<User>>(url)
.tag(this)
.params("token", token)
.params("user_id", user_id)
.params("unit_id", unit_id)
.params("type", 0)
.execute(object : JsonCallBack<YzxResponse<User>>() {
override fun onSuccess(response: Response<YzxResponse<User>>?) {
if (response?.isSuccessful == true) {
response.body().data.save()
getUserLoginInfo(response.body().data.token)
}
}

override fun onError(response: Response<YzxResponse<User>>?) {
super.onError(response)
LogUtils.d(response)
mView?.onLoginError(response?.body()?.msg ?: "")
}
})
}

fun switchUnit(user_id: Int, school_id: Int, tmp_token: String) {
val url = Config.BASE_URL + YzxInterface.INTERFACE_USER_SWITCH_UNIT
OkGo.post<YzxResponse<User>>(url)
.tag(this)
.params("school_id", school_id)
.params("user_id", user_id)
.params("tmp_token", tmp_token)
.params("client_id", 201)
.params("type", 0)
.execute(object : JsonCallBack<YzxResponse<User>>() {
override fun onSuccess(response: Response<YzxResponse<User>>?) {
if (response?.isSuccessful == true) {
getUserLoginInfo(response.body().data.token)
}
}

override fun onError(response: Response<YzxResponse<User>>?) {
super.onError(response)
LogUtils.d(response)
mView?.onLoginError(response?.body()?.msg ?: "")
}
})
}

fun getUserLoginInfo(token: String) {
val url = Config.BASE_URL + YzxInterface.INTERFACE_COMMON_LOGIN_BY_TOKEN
OkGo.post<YzxResponse<User>>(url)
.tag(this)
.params("token", token)
.execute(object : JsonCallBack<YzxResponse<User>>() {
override fun onSuccess(response: Response<YzxResponse<User>>?) {
if (response?.isSuccessful == true) {
response.body().data.save()
mView?.onUserInfoSuccess(response.body().data)
}
}

override fun onError(response: Response<YzxResponse<User>>?) {
super.onError(response)
LogUtils.d(response)
mView?.onLoginError(response?.body()?.msg ?: "")
}
})
}

fun getUserRoleInfoByPhone(phone: String, temp_token: String = "") {
val url = Config.BASE_URL + YzxInterface.INTERFACE_USER_ROLE_LIST_BY_PHONE
OkGo.post<YzxResponse<BaseUser>>(url)
.tag(this)
.params("phone", phone)
.execute(object : JsonCallBack<YzxResponse<BaseUser>>() {
override fun onSuccess(response: Response<YzxResponse<BaseUser>>?) {
if (response?.isSuccessful == true) {
val teaList = response.body().list.filter { return@filter it.role.toInt() == 0 }
.toMutableList()
teaList.forEach {
it.unit_name = it.school_name
it.unit_id = it.school_id
}
mView?.onUserListSuccess(teaList, temp_token)
}
}

override fun onError(response: Response<YzxResponse<BaseUser>>?) {
super.onError(response)
LogUtils.d(response)
mView?.onLoginError(response?.body()?.msg ?: "")
}
})
}

fun getUserRoleList(token: String) {
val url = Config.BASE_URL + YzxInterface.INTERFACE_USER_ROLE_LIST
OkGo.post<YzxResponse<BaseUser>>(url)
.tag(this)
.params("token", token)
.execute(object : JsonCallBack<YzxResponse<BaseUser>>() {
override fun onSuccess(response: Response<YzxResponse<BaseUser>>?) {
if (response?.isSuccessful == true) {
val teaList = response.body().list.filter { return@filter it.type == 0 }
.toMutableList()
mView?.onUserListSuccess(teaList, token)
}
}

override fun onError(response: Response<YzxResponse<BaseUser>>?) {
super.onError(response)
LogUtils.d(response)
mView?.onLoginError(response?.body()?.msg ?: "")
}
})
}

fun getWXQrCode() {
val url = Config.BASE_URL + YzxInterface.INTERFACE_GENERATE_WX_QR_TICKET
OkGo.post<YzxResponse<WxQrTicket>>(url)
.tag(this)
.params("mp_id", 4)
.execute(object : JsonCallBack<YzxResponse<WxQrTicket>>() {
override fun onSuccess(response: Response<YzxResponse<WxQrTicket>>?) {
if (response?.isSuccessful == true) {
val url =
"https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=${response.body().data.ticket}"
mView?.onWxQrCodeSuccess(url, response.body().data.ticket)
}
}

override fun onError(response: Response<YzxResponse<WxQrTicket>>?) {
super.onError(response)
LogUtils.d(response)
}
})
}

fun loginQuery(ticket: String) {
val url = Config.BASE_URL + YzxInterface.INTERFACE_WX_DO_LOGIN_QUERY

OkGo.post<YzxResponse<BaseUser>>(url)
.tag(this)
.params("ticket", ticket)
.execute(object : JsonCallBack<YzxResponse<BaseUser>>() {
override fun onSuccess(response: Response<YzxResponse<BaseUser>>?) {
if (response?.isSuccessful == true) {
val res = response.body()
mView?.onLoginQuerySuccess(res.data, res.code)
}
}

override fun onError(response: Response<YzxResponse<BaseUser>>?) {
super.onError(response)
LogUtils.d(response)
}
})
}
}

interface LoginView : IView {
fun onLoginSuccess(user: BaseUser, list: MutableList<BaseUser>)
fun onLoginError(msg: String)
fun onUserInfoSuccess(user: User)
fun onUserListSuccess(list: MutableList<BaseUser>, token: String)
fun onWxQrCodeSuccess(imgUrl: String, ticket: String)
fun onLoginQuerySuccess(user: BaseUser, code: Int)
}

+ 6
- 2
app/src/main/java/com/yzx/escreen/presenter/VisitorPresenter.kt Переглянути файл

@@ -5,7 +5,11 @@ import com.lzy.okgo.OkGo
import com.lzy.okgo.model.Response
import com.yzx.escreen.config.Config
import com.yzx.escreen.config.YzxInterface
import com.yzx.escreen.model.*
import com.yzx.escreen.model.AccessToken
import com.yzx.escreen.model.Pager
import com.yzx.escreen.model.QrCode
import com.yzx.escreen.model.User
import com.yzx.escreen.model.Visitor
import com.yzx.escreen.presenter.base.BasePresenter
import com.yzx.escreen.presenter.base.IView
import com.yzx.escreen.presenter.base.JsonCallBack
@@ -24,7 +28,7 @@ class VisitorPresenter(view: VisitorView) : BasePresenter<VisitorView>(view) {
.params("keyword", keyword)
.params("audit_status", status)
.params("user_type", 3)
.params("page_size", 6)
.params("page_size", 9)
.params("page_no", pageNo)
.execute(object : JsonCallBack<YzxResponse<Visitor>>() {



+ 3
- 4
app/src/main/java/com/yzx/escreen/presenter/base/JsonCallBack.java Переглянути файл

@@ -10,8 +10,7 @@ import com.lzy.okgo.model.HttpHeaders;
import com.lzy.okgo.request.base.Request;
import com.yzx.escreen.App;
import com.yzx.escreen.MainActivity;
import com.yzx.escreen.activity.WebActivity;
import com.yzx.escreen.config.Config;
import com.yzx.escreen.activity.LoginActivity;
import com.yzx.escreen.config.RefreshToken;
import com.yzx.escreen.model.User;
import com.yzx.escreen.utils.Monitor;
@@ -162,9 +161,9 @@ public abstract class JsonCallBack<T> extends AbsCallback<T> {
public void onError() {
LogUtils.d("onError");
User.Companion.clearUserInfo();
Intent intent = new Intent(App.Companion.getContext(),WebActivity.class);
Intent intent = new Intent(App.Companion.getContext(), LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("link", Config.INSTANCE.getOA_URL()+"/login?logout=1");
// intent.putExtra("link", Config.INSTANCE.getOA_URL()+"/login?logout=1");
ActivityUtils.startActivity(intent);
ActivityUtils.finishActivity(MainActivity.class);
}


+ 10
- 2
app/src/main/java/com/yzx/escreen/utils/KotlinX.kt Переглянути файл

@@ -5,16 +5,24 @@ import android.view.View
import android.widget.ImageView
import com.blankj.utilcode.util.TimeUtils
import com.bumptech.glide.Glide
import com.yzx.escreen.R
import java.text.SimpleDateFormat
import java.util.*
import java.util.TimeZone

fun ImageView.setSrc(identity: String, key: String) {
val url = "https://${identity}.oa.qbjjyyun.net/edufile/imageView?uniqueKey=${key}"
val url = "https://${identity.ifEmpty { "filea" }}.oa.qbjjyyun.net/edufile/imageView?uniqueKey=${key}"
Glide.with(this)
.load(url)
.placeholder(R.color.gray_1)
.into(this)
this.setTag(R.id.image_src_tag,url)
}

fun String.getImgUrl(key: String):String{
return "https://${this.ifEmpty { "filea" }}.oa.qbjjyyun.net/edufile/imageView?uniqueKey=${key}"
}


fun ImageView.setSrc(url: String) {
Glide.with(this)
.load(url)


+ 2
- 2
app/src/main/java/com/yzx/escreen/widget/LeaveDialog.kt Переглянути файл

@@ -55,7 +55,7 @@ class LeaveDialog(
@SuppressLint("SetTextI18n")
fun setData(detail: StuLeave) {
leave_student_name.text = detail.leave_student_name
if (detail.face_key.isNotEmpty()) {
if (detail.face_key?.isNotEmpty() == true) {
val img = find<ImageView>(R.id.face_img)
img.setSrc(detail.face_identity, detail.face_key)
img.visibility = View.VISIBLE
@@ -65,7 +65,7 @@ class LeaveDialog(
find<View>(R.id.face_img).visibility = View.GONE
}
find<ImageView>(R.id.face_img).setOnClickListener {
EventBus.getDefault().post(ViewImage(detail.id,detail.face_identity,detail.face_key))
EventBus.getDefault().post(ViewImage(detail.id,detail.face_identity,detail?.face_key?:""))
}
find<TextView>(R.id.class_name).text = "${detail.grade_name}${detail.class_name}"
find<TextView>(R.id.leave_request_type_name).text = detail.leave_request_type_name


+ 76
- 76
app/src/main/java/com/yzx/escreen/widget/VisitorDialog.kt Переглянути файл

@@ -17,9 +17,7 @@ import com.yzx.escreen.adapter.VisitorDialogStepAdapter
import com.yzx.escreen.model.ViewImage
import com.yzx.escreen.model.Visitor
import com.yzx.escreen.utils.setSrc
import com.yzx.escreen.utils.toDay
import com.yzx.escreen.utils.toTime
import kotlinx.android.synthetic.main.dialog_visitor.view.*
import org.greenrobot.eventbus.EventBus
import org.jetbrains.anko.find
import org.jetbrains.anko.textColor
@@ -59,89 +57,91 @@ class VisitorDialog(
//处理弹窗显示
find<TextView>(R.id.userName).text = "${detail.user_name} ${detail.user_phone}"
find<TextView>(R.id.id_card_num).text = "${detail.card_no}"
if (detail.face_key.isNotEmpty()) {
if (detail.face_key?.isNotEmpty() == true) {
val img = find<ImageView>(R.id.face_img)
img.setSrc(detail.face_identity, detail.face_key)
img.visibility = View.VISIBLE
find<View>(R.id.face_empty).visibility = View.GONE
find<View>(R.id.face_layout).visibility = View.VISIBLE
} else {
find<View>(R.id.face_empty).visibility = View.VISIBLE
find<View>(R.id.face_img).visibility = View.GONE
find<View>(R.id.face_layout).visibility = View.GONE
}
find<ImageView>(R.id.face_img).setOnClickListener {
EventBus.getDefault().post(ViewImage(detail.id, detail.face_identity, detail.face_key))
EventBus.getDefault().post(ViewImage(detail.id, detail.face_identity, detail?.face_key?:""))
}
when {
detail.health_code_status >= 0 -> {
healthCodeStatusLayout.visibility = VISIBLE
health_empty.visibility = GONE
health_img.visibility = GONE
when (detail.health_code_status) {
0 -> {
healthCodeStatus.text = "状态:绿码"
healthCodeStatus.textColor = Color.parseColor("#5DAD64")
}
1 -> {
healthCodeStatus.text = "状态:黄码"
healthCodeStatus.textColor = Color.parseColor("#FCCF13")
}
10 -> {
healthCodeStatus.text = "状态:红码"
healthCodeStatus.textColor = Color.parseColor("#FC0416")
}
}
}
detail.health_code_key.isNotEmpty() -> {
healthCodeStatusLayout.visibility = GONE
val img = find<ImageView>(R.id.health_img)
img.setSrc(detail.health_code_identity, detail.health_code_key)
img.visibility = View.VISIBLE
find<View>(R.id.health_empty).visibility = View.GONE
}
else -> {
healthCodeStatusLayout.visibility = GONE
find<View>(R.id.health_empty).visibility = View.VISIBLE
find<View>(R.id.health_img).visibility = View.GONE
}
}
find<ImageView>(R.id.health_img).setOnClickListener {
EventBus.getDefault()
.post(ViewImage(detail.id, detail.health_code_identity, detail.health_code_key))
}
if (detail.trip_code_key.isNotEmpty()) {
val img = find<ImageView>(R.id.trip_img)
img.setSrc(detail.trip_code_identity, detail.trip_code_key)
img.visibility = View.VISIBLE
find<View>(R.id.trip_empty).visibility = View.GONE
} else {
find<View>(R.id.trip_empty).visibility = View.VISIBLE
find<View>(R.id.trip_img).visibility = View.GONE
}
if(detail.nuclein_file_key.isNullOrBlank()){
nuclein_img.visibility = View.GONE
nuclein_empty.visibility = View.VISIBLE
}else{
nuclein_img.visibility = View.VISIBLE
nuclein_empty.visibility = View.GONE
nuclein_img.setSrc(detail.nuclein_file_identity, detail.nuclein_file_key)
}
if(detail.nuclein_time>0){
nucleinStatusLayout.visibility = VISIBLE
nucleinStatus.text = detail.getNucleinStatusObj().nuclein_name
nucleinStatus.setTextColor(Color.parseColor(detail.getNucleinStatusObj().nuclein_color))
}else{
nucleinStatusLayout.visibility = GONE
}
find<ImageView>(R.id.trip_img).setOnClickListener {
EventBus.getDefault()
.post(ViewImage(detail.id, detail.trip_code_identity, detail.trip_code_key))
}
find<ImageView>(R.id.nuclein_img).setOnClickListener {
EventBus.getDefault()
.post(ViewImage(detail.id, detail.nuclein_file_identity, detail.nuclein_file_key))
}
find<TextView>(R.id.reception_user).text = "${detail.reception_user}"
find<TextView>(R.id.visit_reason).text = "${detail.visit_reason}"
// when {
// detail.health_code_status >= 0 -> {
// healthCodeStatusLayout.visibility = VISIBLE
// health_empty.visibility = GONE
// health_img.visibility = GONE
// when (detail.health_code_status) {
// 0 -> {
// healthCodeStatus.text = "状态:绿码"
// healthCodeStatus.textColor = Color.parseColor("#5DAD64")
// }
// 1 -> {
// healthCodeStatus.text = "状态:黄码"
// healthCodeStatus.textColor = Color.parseColor("#FCCF13")
// }
// 10 -> {
// healthCodeStatus.text = "状态:红码"
// healthCodeStatus.textColor = Color.parseColor("#FC0416")
// }
// }
// }
// detail.health_code_key.isNotEmpty() -> {
// healthCodeStatusLayout.visibility = GONE
// val img = find<ImageView>(R.id.health_img)
// img.setSrc(detail.health_code_identity, detail.health_code_key)
// img.visibility = View.VISIBLE
// find<View>(R.id.health_empty).visibility = View.GONE
// }
// else -> {
// healthCodeStatusLayout.visibility = GONE
// find<View>(R.id.health_empty).visibility = View.VISIBLE
// find<View>(R.id.health_img).visibility = View.GONE
// }
// }
// find<ImageView>(R.id.health_img).setOnClickListener {
// EventBus.getDefault()
// .post(ViewImage(detail.id, detail.health_code_identity, detail.health_code_key))
// }
// if (detail.trip_code_key.isNotEmpty()) {
// val img = find<ImageView>(R.id.trip_img)
// img.setSrc(detail.trip_code_identity, detail.trip_code_key)
// img.visibility = View.VISIBLE
// find<View>(R.id.trip_empty).visibility = View.GONE
// } else {
// find<View>(R.id.trip_empty).visibility = View.VISIBLE
// find<View>(R.id.trip_img).visibility = View.GONE
// }
// if(detail.nuclein_file_key.isNullOrBlank()){
// nuclein_img.visibility = View.GONE
// nuclein_empty.visibility = View.VISIBLE
// }else{
// nuclein_img.visibility = View.VISIBLE
// nuclein_empty.visibility = View.GONE
// nuclein_img.setSrc(detail.nuclein_file_identity, detail.nuclein_file_key)
// }
// if(detail.nuclein_time>0){
// nucleinStatusLayout.visibility = VISIBLE
// nucleinStatus.text = detail.getNucleinStatusObj().nuclein_name
// nucleinStatus.setTextColor(Color.parseColor(detail.getNucleinStatusObj().nuclein_color))
// }else{
// nucleinStatusLayout.visibility = GONE
// }
// find<ImageView>(R.id.trip_img).setOnClickListener {
// EventBus.getDefault()
// .post(ViewImage(detail.id, detail.trip_code_identity, detail.trip_code_key))
// }
// find<ImageView>(R.id.nuclein_img).setOnClickListener {
// EventBus.getDefault()
// .post(ViewImage(detail.id, detail.nuclein_file_identity, detail.nuclein_file_key))
// }
// find<TextView>(R.id.reception_user).text = "${detail.reception_user}"
// find<TextView>(R.id.visit_reason).text = "${detail.visit_reason}"
find<TextView>(R.id.is_drive).text = when (detail.is_drive) {
1 -> "是"
0 -> "否"
@@ -171,7 +171,7 @@ class VisitorDialog(
else -> Color.parseColor("#333333")
}
find<TextView>(R.id.start_time).text =
"${detail.start_time.toDay()} - ${detail.end_time.toDay()} 可进出${detail.in_out_num}次"
"${detail.start_time.toTime()} - ${detail.end_time.toTime()}"
}

find<ImageView>(R.id.statusImg).setSrc(detail.getStatusImg())


+ 5
- 0
app/src/main/res/drawable/btn_blue_select.xml Переглянути файл

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/blue3" android:state_pressed="true" />
<item android:drawable="@color/blue2" />
</selector>

+ 8
- 0
app/src/main/res/drawable/login_bg.xml Переглянути файл

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="bottom"
android:dither="true"
android:src="@mipmap/login_bg"
android:tileMode="disabled">

</bitmap>

+ 6
- 0
app/src/main/res/drawable/shape_login_form.xml Переглянути файл

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp"></corners>
<solid android:color="@color/white"></solid>
<stroke android:width="@dimen/d_30" android:color="#01000000"></stroke>
</shape>

+ 5
- 0
app/src/main/res/drawable/shape_login_round.xml Переглянути файл

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="50dp"></corners>
<solid android:color="@color/black"></solid>
</shape>

+ 181
- 0
app/src/main/res/layout/activity_login.xml Переглянути файл

@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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.LoginActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/login_bg"
android:scaleType="centerCrop"/>

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="200dp"
android:gravity="center">


<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="成都市青白江区教育一体化综合平台"
android:textColor="#3ca0e9"
android:textSize="40dp"
android:textStyle="bold" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="14dp"
android:text="---------- Chengdu Qingbaijiang Integrated Education Platform ---------"
android:textColor="#3ca0e9"
android:textSize="16dp"
android:textStyle="normal" />

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="500dp"
android:layout_height="400dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/d_30"
android:background="@drawable/shape_login_form"
android:orientation="vertical"
android:padding="@dimen/d_20">

<com.flyco.tablayout.CommonTabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
app:tl_iconVisible="false"
app:tl_indicator_color="#3ca0e9"
app:tl_indicator_height="@dimen/dp_4"
app:tl_indicator_width="150dp"
app:tl_textSelectColor="#3ca0e9"
app:tl_textUnselectColor="#333"
app:tl_textsize="18dp" />

<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/qrLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/d_20"
android:orientation="vertical"
android:gravity="center_horizontal"
android:paddingHorizontal="@dimen/d_30"
android:visibility="gone">

<ImageView
android:id="@+id/qrCodeImg"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="@color/blue2"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="扫码 > 关注 > 登录"
android:layout_marginTop="@dimen/d_20"
android:background="@drawable/shape_login_round"
android:textColor="@color/white"
android:paddingVertical="@dimen/d_10"
android:paddingHorizontal="@dimen/d_30"/>

</androidx.appcompat.widget.LinearLayoutCompat>

<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/accountLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/d_20"
android:orientation="vertical"
android:paddingHorizontal="@dimen/d_30"
android:visibility="visible">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f0f3f5"
android:padding="@dimen/d_10"
android:gravity="center_vertical">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_psw" />

<EditText
android:id="@+id/accountEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/d_10"
android:layout_weight="1"
android:background="@null"
android:hint="账号"
android:text=""
android:inputType="phone"
android:singleLine="true" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/d_30"
android:background="#f0f3f5"
android:padding="@dimen/d_10"
android:gravity="center_vertical">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_account" />

<EditText
android:id="@+id/pswEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/d_10"
android:layout_weight="1"
android:background="@null"
android:inputType="textPassword"
android:hint="密码"
android:text=""
android:singleLine="true" />
</LinearLayout>

<CheckBox
android:id="@+id/pswCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="记住账号密码"
android:checked="true"
android:layout_marginTop="@dimen/d_20"/>

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/loginBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登 录"
android:layout_marginTop="@dimen/d_20"
android:background="@drawable/btn_blue_select"
android:textColor="@color/white"
android:textSize="@dimen/d_20"/>

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

+ 47
- 0
app/src/main/res/layout/activity_test.xml Переглянути файл

@@ -0,0 +1,47 @@
<?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:tl="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.TestActivity">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal">

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottomLine" />

<View
android:id="@+id/bottomLine"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_above="@id/tabLayout"
android:background="#cacbcc" />

<com.flyco.tablayout.CommonTabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#ffffff"
android:paddingVertical="@dimen/d_10"
android:paddingTop="5dp"
android:paddingBottom="5dp"
tl:tl_iconHeight="48dp"
tl:tl_iconWidth="44dp"
tl:tl_textSelectColor="@color/colorPrimary"
tl:tl_textUnselectColor="#999999"
tl:tl_textsize="@dimen/d_24" />
</RelativeLayout>
<FrameLayout
android:id="@+id/dialogLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>

+ 214
- 186
app/src/main/res/layout/dialog_visitor.xml Переглянути файл

@@ -99,199 +99,227 @@
android:text="颜小华 18780170404" />
</LinearLayout>

<LinearLayout style="@style/visitor_dialog_row">
<LinearLayout
android:id="@+id/face_layout"
style="@style/visitor_dialog_row">

<TextView
style="@style/leave_dialog_title"
android:layout_width="100dp"
android:text="" />

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="人脸"
android:textSize="@dimen/sp20" />

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/face_img"
android:layout_width="match_parent"
android:layout_height="190dp"
android:text="颜小华"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<TextView
android:id="@+id/face_empty"
android:layout_width="match_parent"
android:layout_height="190dp"
android:background="@color/gray_2"
android:gravity="center"
android:text="未设置"
android:textColor="@color/white"
android:visibility="gone"
app:qmui_corner_radius="@dimen/d_5" />
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/d_20"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="健康码"
android:textSize="@dimen/sp20" />

<LinearLayout
android:id="@+id/healthCodeStatusLayout"
android:layout_width="match_parent"
android:layout_height="190dp"
android:gravity="center"
android:orientation="vertical">

<TextView
android:id="@+id/healthCodeStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="状态:绿码"
android:textSize="@dimen/d_20" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="成都大数据中心提供"
android:textColor="@color/gray_1"
android:textSize="@dimen/d_15" />
</LinearLayout>

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/health_img"
android:layout_width="match_parent"
android:layout_height="190dp"
android:text="颜小华"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<TextView
android:id="@+id/health_empty"
android:layout_width="match_parent"
android:layout_height="190dp"
android:background="@color/gray_2"
android:gravity="center"
android:text="未上传"
android:textColor="@color/white"
android:visibility="gone"
app:qmui_corner_radius="@dimen/d_5" />
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/d_20"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="行程码"
android:textSize="@dimen/sp20" />

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/trip_img"
android:layout_width="match_parent"
android:layout_height="190dp"
android:text="颜小华"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<TextView
android:id="@+id/trip_empty"
android:layout_width="108dp"
android:layout_height="190dp"
android:background="@color/gray_2"
android:gravity="center"
android:text="未上传"
android:textColor="@color/white"
android:visibility="gone"
app:qmui_corner_radius="@dimen/d_5" />
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/d_20"
android:layout_weight="1"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="核酸报告"
android:textSize="@dimen/sp20" />


<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/nuclein_img"
android:layout_width="match_parent"
android:layout_height="190dp"
android:text="颜小华"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<TextView
android:id="@+id/nuclein_empty"
android:layout_width="match_parent"
android:layout_height="190dp"
android:background="@color/gray_2"
android:gravity="center"
android:text="未上传"
android:textColor="@color/white"
android:visibility="gone"
app:qmui_corner_radius="@dimen/d_5" />

<LinearLayout
android:id="@+id/nucleinStatusLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">

<TextView
android:id="@+id/nucleinStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="省内24小时:阴性"
android:textSize="@dimen/d_16" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="成都大数据中心提供"
android:textColor="@color/gray_1"
android:textSize="@dimen/d_15" />
</LinearLayout>
</LinearLayout>
android:text="人脸信息" />

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/face_img"
android:layout_width="150dp"
android:layout_height="190dp"
android:text="颜小华"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<TextView
android:id="@+id/face_empty"
android:layout_width="150dp"
android:layout_height="190dp"
android:background="@color/gray_2"
android:gravity="center"
android:text="未设置"
android:textColor="@color/white"
android:visibility="gone"
app:qmui_corner_radius="@dimen/d_5" />
</LinearLayout>

<!-- <LinearLayout style="@style/visitor_dialog_row">-->

<!-- <TextView-->
<!-- style="@style/leave_dialog_title"-->
<!-- android:layout_width="100dp"-->
<!-- android:text="" />-->

<!-- <LinearLayout-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="center_horizontal"-->
<!-- android:layout_weight="1"-->
<!-- android:orientation="vertical">-->

<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:gravity="center"-->
<!-- android:text="人脸"-->
<!-- android:textSize="@dimen/sp20" />-->

<!-- <com.qmuiteam.qmui.widget.QMUIRadiusImageView-->
<!-- android:id="@+id/face_img"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="190dp"-->
<!-- android:text="颜小华"-->
<!-- app:qmui_border_color="@color/white"-->
<!-- app:qmui_corner_radius="@dimen/d_5" />-->

<!-- <TextView-->
<!-- android:id="@+id/face_empty"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="190dp"-->
<!-- android:background="@color/gray_2"-->
<!-- android:gravity="center"-->
<!-- android:text="未设置"-->
<!-- android:textColor="@color/white"-->
<!-- android:visibility="gone"-->
<!-- app:qmui_corner_radius="@dimen/d_5" />-->
<!-- </LinearLayout>-->

<!-- <LinearLayout-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="@dimen/d_20"-->
<!-- android:layout_weight="1"-->
<!-- android:gravity="center_horizontal"-->
<!-- android:orientation="vertical">-->

<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:gravity="center"-->
<!-- android:text="健康码"-->
<!-- android:textSize="@dimen/sp20" />-->

<!-- <LinearLayout-->
<!-- android:id="@+id/healthCodeStatusLayout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="190dp"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical">-->

<!-- <TextView-->
<!-- android:id="@+id/healthCodeStatus"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="状态:绿码"-->
<!-- android:textSize="@dimen/d_20" />-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="成都大数据中心提供"-->
<!-- android:textColor="@color/gray_1"-->
<!-- android:textSize="@dimen/d_15" />-->
<!-- </LinearLayout>-->

<!-- <com.qmuiteam.qmui.widget.QMUIRadiusImageView-->
<!-- android:id="@+id/health_img"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="190dp"-->
<!-- android:text="颜小华"-->
<!-- app:qmui_border_color="@color/white"-->
<!-- app:qmui_corner_radius="@dimen/d_5" />-->

<!-- <TextView-->
<!-- android:id="@+id/health_empty"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="190dp"-->
<!-- android:background="@color/gray_2"-->
<!-- android:gravity="center"-->
<!-- android:text="未上传"-->
<!-- android:textColor="@color/white"-->
<!-- android:visibility="gone"-->
<!-- app:qmui_corner_radius="@dimen/d_5" />-->
<!-- </LinearLayout>-->

<!-- <LinearLayout-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="@dimen/d_20"-->
<!-- android:layout_weight="1"-->
<!-- android:gravity="center_horizontal"-->
<!-- android:orientation="vertical">-->

<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:gravity="center"-->
<!-- android:text="行程码"-->
<!-- android:textSize="@dimen/sp20" />-->

<!-- <com.qmuiteam.qmui.widget.QMUIRadiusImageView-->
<!-- android:id="@+id/trip_img"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="190dp"-->
<!-- android:text="颜小华"-->
<!-- app:qmui_border_color="@color/white"-->
<!-- app:qmui_corner_radius="@dimen/d_5" />-->

<!-- <TextView-->
<!-- android:id="@+id/trip_empty"-->
<!-- android:layout_width="108dp"-->
<!-- android:layout_height="190dp"-->
<!-- android:background="@color/gray_2"-->
<!-- android:gravity="center"-->
<!-- android:text="未上传"-->
<!-- android:textColor="@color/white"-->
<!-- android:visibility="gone"-->
<!-- app:qmui_corner_radius="@dimen/d_5" />-->
<!-- </LinearLayout>-->

<!-- <LinearLayout-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="@dimen/d_20"-->
<!-- android:layout_weight="1"-->
<!-- android:orientation="vertical">-->

<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:gravity="center"-->
<!-- android:text="核酸报告"-->
<!-- android:textSize="@dimen/sp20" />-->


<!-- <com.qmuiteam.qmui.widget.QMUIRadiusImageView-->
<!-- android:id="@+id/nuclein_img"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="190dp"-->
<!-- android:text="颜小华"-->
<!-- app:qmui_border_color="@color/white"-->
<!-- app:qmui_corner_radius="@dimen/d_5" />-->

<!-- <TextView-->
<!-- android:id="@+id/nuclein_empty"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="190dp"-->
<!-- android:background="@color/gray_2"-->
<!-- android:gravity="center"-->
<!-- android:text="未上传"-->
<!-- android:textColor="@color/white"-->
<!-- android:visibility="gone"-->
<!-- app:qmui_corner_radius="@dimen/d_5" />-->

<!-- <LinearLayout-->
<!-- android:id="@+id/nucleinStatusLayout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:gravity="center"-->
<!-- android:orientation="vertical">-->

<!-- <TextView-->
<!-- android:id="@+id/nucleinStatus"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="省内24小时:阴性"-->
<!-- android:textSize="@dimen/d_16" />-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="成都大数据中心提供"-->
<!-- android:textColor="@color/gray_1"-->
<!-- android:textSize="@dimen/d_15" />-->
<!-- </LinearLayout>-->
<!-- </LinearLayout>-->


<!-- </LinearLayout>-->

<LinearLayout
style="@style/visitor_dialog_row"
android:gravity="center_vertical">


+ 14
- 0
app/src/main/res/layout/fragment_blank.xml Переглянути файл

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.BlankFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />

</FrameLayout>

+ 10
- 22
app/src/main/res/layout/fragment_visitor.xml Переглянути файл

@@ -184,30 +184,15 @@

<TextView
style="@style/table_header"
android:layout_weight="0.6"
android:layout_weight="1"
android:paddingStart="@dimen/dp_40"
android:text="姓名" />

<TextView
style="@style/table_header"
android:layout_weight="0.6"
android:text="人脸" />

<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="健康码" />

<TextView
style="@style/table_header"
android:layout_weight="1"
android:text="行程码" />

<TextView
style="@style/table_header"
android:layout_weight="1.5"
android:text="核酸报告" />

<!-- <TextView-->
<!-- style="@style/table_header"-->
<!-- android:layout_weight="0.6"-->
<!-- android:paddingStart="@dimen/dp_40"-->
<!-- android:text="姓名" />-->

<TextView
style="@style/table_header"
@@ -223,7 +208,10 @@
style="@style/table_header"
android:layout_weight="1"
android:text="状态" />

<TextView
style="@style/table_header"
android:layout_weight="1.5"
android:text="可进出时间" />
<TextView
style="@style/table_header"
android:layout_weight="1"


+ 14
- 142
app/src/main/res/layout/layout_visitor_table.xml Переглянути файл

@@ -12,155 +12,22 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/d_12"
android:paddingBottom="@dimen/d_12">
android:paddingTop="@dimen/d_20"
android:paddingBottom="@dimen/d_20">

<TextView
android:id="@+id/userName"
style="@style/table_cell"
android:layout_weight="0.6"
android:layout_weight="1"
android:paddingStart="@dimen/dp_40"
android:text="请假学生" />

<FrameLayout
style="@style/table_cell"
android:layout_weight="0.6">

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/faceImg"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/faceEmpty"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
android:paddingTop="@dimen/d_5"
android:paddingBottom="@dimen/d_5"
android:text="未设置"
android:textColor="@color/white"
app:qmui_backgroundColor="#ccc"
app:qmui_borderColor="#ccc"
app:qmui_radius="@dimen/d_5" />
</FrameLayout>


<FrameLayout
style="@style/table_cell"
android:layout_weight="1">
<LinearLayout
android:id="@+id/healthCodeStatusLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/healthCodeStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="状态:绿码"
android:textSize="@dimen/d_20"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="成都大数据中心提供"
android:textColor="@color/gray_1"
android:textSize="@dimen/d_15"/>
</LinearLayout>
<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/healthCodeImg"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5"
android:visibility="gone"/>

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/healthCodeEmpty"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
android:paddingTop="@dimen/d_5"
android:paddingBottom="@dimen/d_5"
android:text="未上传"
android:textColor="@color/white"
app:qmui_backgroundColor="#ccc"
app:qmui_borderColor="#ccc"
app:qmui_radius="@dimen/d_5"
android:visibility="gone"/>
</FrameLayout>

<FrameLayout
style="@style/table_cell"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/tripCodeImg"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5" />

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/tripCodeEmpty"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
android:paddingTop="@dimen/d_5"
android:paddingBottom="@dimen/d_5"
android:text="未上传"
android:textColor="@color/white"
app:qmui_backgroundColor="#ccc"
app:qmui_borderColor="#ccc"
app:qmui_radius="@dimen/d_5" />
</FrameLayout>

<FrameLayout
style="@style/table_cell"
android:layout_weight="1.5">
<com.qmuiteam.qmui.widget.QMUIRadiusImageView
android:id="@+id/nucleinImg"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
app:qmui_border_color="@color/white"
app:qmui_corner_radius="@dimen/d_5"
android:visibility="gone"/>

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/nucleinEmpty"
android:layout_width="@dimen/d_70"
android:layout_height="@dimen/d_70"
android:paddingTop="@dimen/d_5"
android:paddingBottom="@dimen/d_5"
android:text="未上传"
android:textColor="@color/white"
app:qmui_backgroundColor="#ccc"
app:qmui_borderColor="#ccc"
app:qmui_radius="@dimen/d_5"
android:visibility="visible"/>
<LinearLayout
android:id="@+id/nucleinStatusLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/d_80">
<TextView
android:id="@+id/nucleinStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="状态:绿码"
android:textSize="@dimen/d_20"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="成都大数据中心提供"
android:textColor="@color/gray_1"
android:textSize="@dimen/d_15"/>
</LinearLayout>

</FrameLayout>
<!-- <TextView-->
<!-- android:id="@+id/userTypeName"-->
<!-- style="@style/table_cell"-->
<!-- android:layout_weight="0.6"-->
<!-- android:paddingStart="@dimen/dp_40"-->
<!-- android:text="请假学生" />-->

<TextView
android:id="@+id/isDrive"
@@ -179,6 +46,11 @@
style="@style/table_cell"
android:layout_weight="1"
android:text="状态" />
<TextView
android:id="@+id/inOutTime"
style="@style/table_cell"
android:layout_weight="1.5"
android:text="申请时间" />
<TextView
android:id="@+id/applyTime"
style="@style/table_cell"


BIN
app/src/main/res/mipmap-xhdpi/ic_account.png Переглянути файл

Перед Після
Ширина: 64  |  Висота: 64  |  Розмір: 869 B

BIN
app/src/main/res/mipmap-xhdpi/ic_psw.png Переглянути файл

Перед Після
Ширина: 64  |  Висота: 64  |  Розмір: 961 B

BIN
app/src/main/res/mipmap-xhdpi/login_bg.jpg Переглянути файл

Перед Після
Ширина: 2173  |  Висота: 1000  |  Розмір: 124 KiB

+ 2
- 1
app/src/main/res/values/colors.xml Переглянути файл

@@ -3,7 +3,7 @@
<color name="colorPrimary">#3ca0e9</color>
<color name="colorPrimary88">#883ca0e9</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="colorAccent">#3ca0e9</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="colorBlack10">#19000000</color>
@@ -25,6 +25,7 @@
<color name="green2">#53a051</color>
<color name="blue">#4d92dc</color>
<color name="blue2">#3ca0e9</color>
<color name="blue3">#aa3ca0e9</color>
<color name="orange">#ff8635</color>
<color name="transparent">@android:color/transparent</color>
<color name="nb.theme.background">@color/white</color>


+ 1
- 0
app/src/main/res/values/ids.xml Переглянути файл

@@ -2,4 +2,5 @@
<resources>
<item type="id" name="tag_dialog_name"/>
<item type="id" name="tag_dialog_type"/>
<item type="id" name="image_src_tag"/>
</resources>

+ 2
- 0
app/src/main/res/values/strings.xml Переглянути файл

@@ -2,4 +2,6 @@
<string name="app_name">一体化平台</string>
<string name="update_title">检测到新版本</string>
<string name="updatecontent">解决了若干bug</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>

BIN
gradle/wrapper/gradle-wrapper.jar Переглянути файл


+ 1
- 2
gradle/wrapper/gradle-wrapper.properties Переглянути файл

@@ -1,6 +1,5 @@
#Wed May 06 13:56:55 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

+ 172
- 110
gradlew Переглянути файл

@@ -1,78 +1,129 @@
#!/usr/bin/env sh
#!/bin/sh

#
# Copyright ? 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?,
# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?;
# * compound commands having a testable exit status, especially ?case?;
# * various built-in commands including ?command?, ?set?, and ?ulimit?.
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################

# Attempt to set APP_HOME

# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0

# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum

warn () {
echo "$*"
}
} >&2

die () {
echo
echo "$*"
echo
exit 1
}
} >&2

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
@@ -89,84 +140,95 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.

# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
i=$((i+1))
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#

eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"

+ 24
- 19
gradlew.bat Переглянути файл

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell


Завантаження…
Відмінити
Зберегти