| @@ -4,6 +4,7 @@ | |||||
| <option name="filePathToZoomLevelMap"> | <option name="filePathToZoomLevelMap"> | ||||
| <map> | <map> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/btn_select.xml" value="0.321" /> | <entry key="..\:/work/escreen/app/src/main/res/drawable/btn_select.xml" value="0.321" /> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/progress_horizontal.xml" value="0.341" /> | |||||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/ripple_water.xml" value="0.3255" /> | <entry key="..\:/work/escreen/app/src/main/res/drawable/ripple_water.xml" value="0.3255" /> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/s_app_btn_bule.xml" value="0.161" /> | <entry key="..\:/work/escreen/app/src/main/res/drawable/s_app_btn_bule.xml" value="0.161" /> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/seekbar_bg.xml" value="0.2335" /> | <entry key="..\:/work/escreen/app/src/main/res/drawable/seekbar_bg.xml" value="0.2335" /> | ||||
| @@ -21,7 +22,7 @@ | |||||
| <entry key="..\:/work/escreen/app/src/main/res/layout/activity_main1.xml" value="0.37135416666666665" /> | <entry key="..\:/work/escreen/app/src/main/res/layout/activity_main1.xml" value="0.37135416666666665" /> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/layout/activity_note.xml" value="0.37135416666666665" /> | <entry key="..\:/work/escreen/app/src/main/res/layout/activity_note.xml" value="0.37135416666666665" /> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/layout/activity_read.xml" value="0.31567028985507245" /> | <entry key="..\:/work/escreen/app/src/main/res/layout/activity_read.xml" value="0.31567028985507245" /> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/layout/activity_web.xml" value="0.30483112441214194" /> | |||||
| <entry key="..\:/work/escreen/app/src/main/res/layout/activity_web.xml" value="0.1" /> | |||||
| <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_change.xml" value="0.12378472222222223" /> | <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_change.xml" value="0.12378472222222223" /> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_exit.xml" value="0.30483112441214194" /> | <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_exit.xml" value="0.30483112441214194" /> | ||||
| <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_leave.xml" value="0.30483112441214194" /> | <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_leave.xml" value="0.30483112441214194" /> | ||||
| @@ -19,8 +19,8 @@ android { | |||||
| // minSdkVersion 26 | // minSdkVersion 26 | ||||
| minSdkVersion 21 | minSdkVersion 21 | ||||
| targetSdkVersion 25 | targetSdkVersion 25 | ||||
| versionCode 22 | |||||
| versionName "2.1.5" | |||||
| versionCode 24 | |||||
| versionName "2.1.6" | |||||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||||
| // ndk { | // ndk { | ||||
| @@ -72,7 +72,7 @@ android { | |||||
| buildConfigField "String", "OA_URL", '"https://oa.qbjjyyun.net"' | buildConfigField "String", "OA_URL", '"https://oa.qbjjyyun.net"' | ||||
| buildConfigField "String", "APP_NAME", '"一体化平台"' | buildConfigField "String", "APP_NAME", '"一体化平台"' | ||||
| buildConfigField "String", "MP_APPID", '"wx358f1c471740cb95"' | buildConfigField "String", "MP_APPID", '"wx358f1c471740cb95"' | ||||
| buildConfigField "String", "WS_URL", '"wss://oa.qbjjyyun.net/ws2api/"' | |||||
| // buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"' | // buildConfigField "String", "BASE_URL", '"http://192.168.69.99:9009"' | ||||
| // buildConfigField "String", "M_URL", '"http://192.168.69.99:8098"' | // buildConfigField "String", "M_URL", '"http://192.168.69.99:8098"' | ||||
| // buildConfigField "String", "APP_NAME", '"家校互通(测试)"' | // buildConfigField "String", "APP_NAME", '"家校互通(测试)"' | ||||
| @@ -94,6 +94,7 @@ android { | |||||
| buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"' | buildConfigField "String", "BASE_URL", '"https://oa.live.educlouddata.com/api"' | ||||
| buildConfigField "String", "APP_NAME", '"一体化平台(开发)"' | buildConfigField "String", "APP_NAME", '"一体化平台(开发)"' | ||||
| buildConfigField "String", "MP_APPID", '"wxbb397ddae71bb14c"' | buildConfigField "String", "MP_APPID", '"wxbb397ddae71bb14c"' | ||||
| buildConfigField "String", "WS_URL", '"ws://192.168.69.114:9801/"' | |||||
| } | } | ||||
| yzx_test { | yzx_test { | ||||
| @@ -107,6 +108,7 @@ android { | |||||
| buildConfigField "String", "M_URL", '"http://192.168.69.99:8098"' | buildConfigField "String", "M_URL", '"http://192.168.69.99:8098"' | ||||
| buildConfigField "String", "APP_NAME", '"家校互通(测试)"' | buildConfigField "String", "APP_NAME", '"家校互通(测试)"' | ||||
| buildConfigField "String", "MP_APPID", '"wxbb397ddae71bb14c"' | buildConfigField "String", "MP_APPID", '"wxbb397ddae71bb14c"' | ||||
| buildConfigField "String", "WS_URL", '"wss://oa.live.educlouddata.com/ws2api/"' | |||||
| } | } | ||||
| applicationVariants.all { variant -> | applicationVariants.all { variant -> | ||||
| @@ -197,4 +199,6 @@ dependencies { | |||||
| implementation("org.greenrobot:eventbus:3.3.1") | implementation("org.greenrobot:eventbus:3.3.1") | ||||
| implementation 'com.github.chrisbanes:PhotoView:2.0.0' | implementation 'com.github.chrisbanes:PhotoView:2.0.0' | ||||
| implementation "org.java-websocket:Java-WebSocket:1.5.1" | |||||
| } | } | ||||
| @@ -47,8 +47,12 @@ import kotlinx.android.synthetic.main.activity_main.* | |||||
| import org.greenrobot.eventbus.EventBus | import org.greenrobot.eventbus.EventBus | ||||
| import org.greenrobot.eventbus.Subscribe | import org.greenrobot.eventbus.Subscribe | ||||
| import org.greenrobot.eventbus.ThreadMode | import org.greenrobot.eventbus.ThreadMode | ||||
| import org.java_websocket.client.WebSocketClient | |||||
| import org.java_websocket.drafts.Draft_6455 | |||||
| import org.java_websocket.handshake.ServerHandshake | |||||
| import org.jetbrains.anko.find | import org.jetbrains.anko.find | ||||
| import org.jetbrains.anko.toast | import org.jetbrains.anko.toast | ||||
| import java.net.URI | |||||
| import java.util.* | import java.util.* | ||||
| @@ -71,6 +75,8 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||||
| showNetworkError() | showNetworkError() | ||||
| } | } | ||||
| private var idsLoading = false | private var idsLoading = false | ||||
| private var isAutoShowLeave = false | |||||
| private var isAutoShowChange = false | |||||
| private val mHandler = Handler(Looper.getMainLooper()) | private val mHandler = Handler(Looper.getMainLooper()) | ||||
| private val runnable = object : Runnable { | private val runnable = object : Runnable { | ||||
| @@ -101,6 +107,8 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||||
| private val dialogList = mutableListOf<ConstraintLayout>() | private val dialogList = mutableListOf<ConstraintLayout>() | ||||
| private var client: WebSocketClient? = null | |||||
| override fun initView() { | override fun initView() { | ||||
| if (NetworkUtils.isConnected()) { | if (NetworkUtils.isConnected()) { | ||||
| if (!User.isLogin() && User.getUser().token.isEmpty()) { | if (!User.isLogin() && User.getUser().token.isEmpty()) { | ||||
| @@ -164,13 +172,14 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||||
| } | } | ||||
| private fun checkAuto() { | private fun checkAuto() { | ||||
| val isAutoShowLeave = SPUtils.getInstance().getBoolean("auto_show_leave", false) | |||||
| val isAutoShowChange = SPUtils.getInstance().getBoolean("auto_show_change", false) | |||||
| if (isAutoShowLeave || isAutoShowChange) { | |||||
| mHandler.postDelayed(runnable, 2000) | |||||
| } else { | |||||
| mHandler.removeCallbacks(runnable) | |||||
| } | |||||
| 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) | |||||
| // } | |||||
| } | } | ||||
| //接收消息 | //接收消息 | ||||
| @@ -178,10 +187,21 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||||
| fun onMessageEvent(event: AutoSwitchChange) { | fun onMessageEvent(event: AutoSwitchChange) { | ||||
| checkAuto() | checkAuto() | ||||
| } | } | ||||
| //接收消息 | |||||
| @Subscribe(threadMode = ThreadMode.MAIN) | |||||
| fun onMessageEvent(event: UserLoginEvent) { | |||||
| if (client?.isOpen == true){ | |||||
| client?.close() | |||||
| } | |||||
| client = null | |||||
| } | |||||
| override fun onDestroy() { | override fun onDestroy() { | ||||
| super.onDestroy() | super.onDestroy() | ||||
| mTimeHandler.removeCallbacks(timeRunnable) | mTimeHandler.removeCallbacks(timeRunnable) | ||||
| if (client?.isOpen == true) { | |||||
| client?.close() | |||||
| } | |||||
| } | } | ||||
| //接收请假消息 | //接收请假消息 | ||||
| @@ -298,6 +318,86 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||||
| } | } | ||||
| override fun onResume() { | |||||
| super.onResume() | |||||
| if (NetworkUtils.isConnected() && User.isLogin() && User.getUser().user_id > 0 && client?.isOpen !== true) { | |||||
| initWs() | |||||
| } | |||||
| } | |||||
| 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)) | |||||
| } | |||||
| 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 onError(ex: Exception?) { | |||||
| LogUtils.d("WebSocketClient-onError", ex) | |||||
| } | |||||
| } | |||||
| try { | |||||
| client?.connectBlocking() | |||||
| wsHeart() | |||||
| } catch (e: InterruptedException) { | |||||
| e.printStackTrace() | |||||
| LogUtils.d("WebSocketClient-catch", e) | |||||
| } | |||||
| } | |||||
| private fun wsMessage(msg: String) { | |||||
| val resultType = object : TypeToken<YzxClientInfo>() {}.type | |||||
| val gson = Gson() | |||||
| val res = gson.fromJson<YzxClientInfo>(msg, resultType) | |||||
| if (res.data.student_id > 0) { | |||||
| if (isAutoShowLeave || isAutoShowChange) { | |||||
| mPresenter?.getLeaveShowIds("${res.data.student_id}") | |||||
| } | |||||
| } | |||||
| } | |||||
| private fun wsHeart() { | |||||
| viewPager2.postDelayed({ | |||||
| if (client?.isOpen == true) { | |||||
| client?.apply { | |||||
| send(Gson().toJson(YzxHeart().getYzxHeader())) | |||||
| } | |||||
| } else { | |||||
| if (client != null) { | |||||
| client?.reconnectBlocking() | |||||
| } else { | |||||
| initWs() | |||||
| } | |||||
| } | |||||
| wsHeart() | |||||
| }, 10 * 1000) | |||||
| } | |||||
| private fun showNetworkError() { | private fun showNetworkError() { | ||||
| if (!NetworkUtils.isConnected()) { //无网提示 | if (!NetworkUtils.isConnected()) { //无网提示 | ||||
| val builder = QMUIDialog.MessageDialogBuilder(this) | val builder = QMUIDialog.MessageDialogBuilder(this) | ||||
| @@ -369,6 +469,7 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||||
| } | } | ||||
| checkVersion() | checkVersion() | ||||
| checkAuto() | checkAuto() | ||||
| initWs() | |||||
| } | } | ||||
| private fun checkVersion(userCheck: Boolean = false): Unit { | private fun checkVersion(userCheck: Boolean = false): Unit { | ||||
| @@ -478,14 +579,14 @@ class MainActivity : BaseActivity<MainPresenter>(), NetworkUtils.OnNetworkStatus | |||||
| val listLeave = list.filter { it.type == 0 }.toMutableList() | val listLeave = list.filter { it.type == 0 }.toMutableList() | ||||
| val listChange = list.filter { it.type == 1 }.toMutableList() | val listChange = list.filter { it.type == 1 }.toMutableList() | ||||
| var type = 0 | var type = 0 | ||||
| if (listLeave.isNotEmpty()) { | |||||
| if (listLeave.isNotEmpty() && isAutoShowLeave) { | |||||
| viewPager2.currentItem = 0 | viewPager2.currentItem = 0 | ||||
| type = 0 | type = 0 | ||||
| } else if (listChange.isNotEmpty()) { | |||||
| } else if (listChange.isNotEmpty() && isAutoShowChange) { | |||||
| viewPager2.currentItem = 1 | viewPager2.currentItem = 1 | ||||
| type = 1 | type = 1 | ||||
| } | } | ||||
| if (list.isNotEmpty()) { | |||||
| if (list.isNotEmpty() && (isAutoShowLeave || isAutoShowChange)) { | |||||
| viewPager2.postDelayed({ | viewPager2.postDelayed({ | ||||
| EventBus.getDefault().post(MessageEventAuto(list, type)) | EventBus.getDefault().post(MessageEventAuto(list, type)) | ||||
| }, 500) | }, 500) | ||||
| @@ -20,16 +20,16 @@ import com.allenliu.versionchecklib.v2.AllenVersionChecker | |||||
| import com.allenliu.versionchecklib.v2.builder.UIData | import com.allenliu.versionchecklib.v2.builder.UIData | ||||
| import com.allenliu.versionchecklib.v2.callback.CustomDownloadingDialogListener | import com.allenliu.versionchecklib.v2.callback.CustomDownloadingDialogListener | ||||
| import com.blankj.utilcode.util.AppUtils | import com.blankj.utilcode.util.AppUtils | ||||
| import com.blankj.utilcode.util.LogUtils | |||||
| import com.blankj.utilcode.util.NetworkUtils | |||||
| import com.blankj.utilcode.util.SPUtils | import com.blankj.utilcode.util.SPUtils | ||||
| import com.google.gson.Gson | import com.google.gson.Gson | ||||
| import com.google.gson.reflect.TypeToken | import com.google.gson.reflect.TypeToken | ||||
| import com.lzy.okgo.OkGo | import com.lzy.okgo.OkGo | ||||
| import com.lzy.okgo.callback.StringCallback | import com.lzy.okgo.callback.StringCallback | ||||
| import com.lzy.okgo.model.Response | import com.lzy.okgo.model.Response | ||||
| import com.tencent.smtt.export.external.interfaces.JsResult | |||||
| import com.tencent.smtt.export.external.interfaces.SslError | |||||
| import com.tencent.smtt.export.external.interfaces.SslErrorHandler | |||||
| import com.tencent.smtt.export.external.interfaces.WebResourceRequest | |||||
| import com.qmuiteam.qmui.widget.dialog.QMUIDialog | |||||
| import com.tencent.smtt.export.external.interfaces.* | |||||
| import com.tencent.smtt.sdk.WebChromeClient | import com.tencent.smtt.sdk.WebChromeClient | ||||
| import com.tencent.smtt.sdk.WebSettings | import com.tencent.smtt.sdk.WebSettings | ||||
| import com.tencent.smtt.sdk.WebView | import com.tencent.smtt.sdk.WebView | ||||
| @@ -40,10 +40,13 @@ import com.yzx.escreen.activity.base.BaseActivity | |||||
| import com.yzx.escreen.config.Config | import com.yzx.escreen.config.Config | ||||
| import com.yzx.escreen.model.BaseBean | import com.yzx.escreen.model.BaseBean | ||||
| import com.yzx.escreen.model.User | import com.yzx.escreen.model.User | ||||
| import com.yzx.escreen.model.UserLoginEvent | |||||
| import com.yzx.escreen.model.Version | import com.yzx.escreen.model.Version | ||||
| import com.yzx.escreen.presenter.base.BasePresenter | import com.yzx.escreen.presenter.base.BasePresenter | ||||
| import com.yzx.escreen.utils.hideNavigationBar | |||||
| import com.yzx.escreen.widget.BaseDialog | import com.yzx.escreen.widget.BaseDialog | ||||
| import kotlinx.android.synthetic.main.activity_web.* | import kotlinx.android.synthetic.main.activity_web.* | ||||
| import org.greenrobot.eventbus.EventBus | |||||
| import org.jetbrains.anko.ctx | import org.jetbrains.anko.ctx | ||||
| import org.jetbrains.anko.find | import org.jetbrains.anko.find | ||||
| import org.jetbrains.anko.startActivity | import org.jetbrains.anko.startActivity | ||||
| @@ -59,7 +62,7 @@ import java.util.* | |||||
| * 修改时间: | * 修改时间: | ||||
| * 修改备注: | * 修改备注: | ||||
| */ | */ | ||||
| class WebActivity : BaseActivity<BasePresenter<*>>() { | |||||
| class WebActivity : BaseActivity<BasePresenter<*>>(), NetworkUtils.OnNetworkStatusChangedListener { | |||||
| companion object { | companion object { | ||||
| @@ -74,6 +77,8 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||||
| private val run = Runnable { | private val run = Runnable { | ||||
| count = 0 | count = 0 | ||||
| } | } | ||||
| var netErrorDialog: QMUIDialog? = null | |||||
| override val inflateId: Int | override val inflateId: Int | ||||
| get() = R.layout.activity_web | get() = R.layout.activity_web | ||||
| @@ -200,6 +205,9 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||||
| btnRefresh.setOnClickListener { | btnRefresh.setOnClickListener { | ||||
| webView.reload() | webView.reload() | ||||
| } | } | ||||
| btnSetting.setOnClickListener { | |||||
| NetworkUtils.openWirelessSettings() | |||||
| } | |||||
| webView.layoutParams = LinearLayout.LayoutParams( | webView.layoutParams = LinearLayout.LayoutParams( | ||||
| ViewGroup.LayoutParams.MATCH_PARENT, | ViewGroup.LayoutParams.MATCH_PARENT, | ||||
| ViewGroup.LayoutParams.MATCH_PARENT | ViewGroup.LayoutParams.MATCH_PARENT | ||||
| @@ -241,7 +249,7 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||||
| super.onPageFinished(view, url) | super.onPageFinished(view, url) | ||||
| webView.settings.blockNetworkImage = false | webView.settings.blockNetworkImage = false | ||||
| if (!TextUtils.isEmpty(view.title)) { | if (!TextUtils.isEmpty(view.title)) { | ||||
| titleTv.text = view.title//webView获取到网页title | |||||
| // titleTv.text = view.title//webView获取到网页title | |||||
| } | } | ||||
| } | } | ||||
| @@ -252,6 +260,21 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||||
| ) { | ) { | ||||
| handler.proceed() | handler.proceed() | ||||
| } | } | ||||
| override fun onReceivedError( | |||||
| p0: WebView?, | |||||
| p1: WebResourceRequest?, | |||||
| p2: WebResourceError? | |||||
| ) { | |||||
| super.onReceivedError(p0, p1, p2) | |||||
| LogUtils.e("weberror-onReceivedError") | |||||
| // showNetworkError("网络环境异常或服务器数据加载异常,请检查!", force = true) | |||||
| } | |||||
| override fun onReceivedError(p0: WebView?, p1: Int, p2: String?, p3: String?) { | |||||
| super.onReceivedError(p0, p1, p2, p3) | |||||
| LogUtils.e("weberror-onReceivedError2") | |||||
| } | |||||
| } | } | ||||
| webView.webChromeClient = object : WebChromeClient() { | webView.webChromeClient = object : WebChromeClient() { | ||||
| override fun onProgressChanged(view: WebView?, newProgress: Int) { | override fun onProgressChanged(view: WebView?, newProgress: Int) { | ||||
| @@ -262,10 +285,10 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||||
| progressbar.visibility = View.GONE | progressbar.visibility = View.GONE | ||||
| if (view.canGoBack()) { | if (view.canGoBack()) { | ||||
| // btnBack.visibility = View.VISIBLE | // btnBack.visibility = View.VISIBLE | ||||
| btnClose.visibility = View.VISIBLE | |||||
| // btnClose.visibility = View.VISIBLE | |||||
| } else { | } else { | ||||
| // btnBack.visibility = View.GONE | // btnBack.visibility = View.GONE | ||||
| btnClose.visibility = View.GONE | |||||
| // btnClose.visibility = View.GONE | |||||
| } | } | ||||
| } | } | ||||
| } else { | } else { | ||||
| @@ -295,6 +318,8 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||||
| override fun initData() { | override fun initData() { | ||||
| webView.loadUrl(url) | webView.loadUrl(url) | ||||
| showNetworkError() | |||||
| } | } | ||||
| override fun initPresenter(): BasePresenter<*>? { | override fun initPresenter(): BasePresenter<*>? { | ||||
| @@ -350,6 +375,38 @@ class WebActivity : BaseActivity<BasePresenter<*>>() { | |||||
| } | } | ||||
| override fun onDisconnected() { | |||||
| } | |||||
| override fun onConnected(networkType: NetworkUtils.NetworkType?) { | |||||
| } | |||||
| private fun showNetworkError(msg: String = "你还没有连接网络,请先连接网络!", force: Boolean = false) { | |||||
| if (!NetworkUtils.isConnected() || force) { //无网提示 | |||||
| val builder = QMUIDialog.MessageDialogBuilder(this) | |||||
| builder.setMessage(msg) | |||||
| .setTitle("温馨提示") | |||||
| .setCancelable(false) | |||||
| .setCanceledOnTouchOutside(false) | |||||
| if (force) { | |||||
| builder.addAction("关闭") { dialog, index -> | |||||
| finish() | |||||
| } | |||||
| } | |||||
| builder.addAction( | |||||
| "去设置" | |||||
| ) { dialog, index -> | |||||
| NetworkUtils.openWirelessSettings() | |||||
| } | |||||
| netErrorDialog = builder.show() | |||||
| netErrorDialog?.hideNavigationBar() | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -387,6 +444,7 @@ class YzxJavascriptInterface(var ctx: Activity) { | |||||
| val resultType = object : TypeToken<User>() {}.type | val resultType = object : TypeToken<User>() {}.type | ||||
| val gson = Gson() | val gson = Gson() | ||||
| val user = gson.fromJson<User>(json, resultType) | val user = gson.fromJson<User>(json, resultType) | ||||
| EventBus.getDefault().post(UserLoginEvent()) | |||||
| user?.save() | user?.save() | ||||
| } | } | ||||
| @@ -8,6 +8,7 @@ object Config { | |||||
| var APP_NAME = BuildConfig.APP_NAME | var APP_NAME = BuildConfig.APP_NAME | ||||
| var M_URL = BuildConfig.M_URL | var M_URL = BuildConfig.M_URL | ||||
| var OA_URL = BuildConfig.OA_URL | var OA_URL = BuildConfig.OA_URL | ||||
| var WS_URL = BuildConfig.WS_URL | |||||
| var MP_APPID = BuildConfig.MP_APPID | var MP_APPID = BuildConfig.MP_APPID | ||||
| val APP_ID = 602 | val APP_ID = 602 | ||||
| @@ -2,7 +2,6 @@ package com.yzx.escreen.model | |||||
| import com.blankj.utilcode.util.TimeUtils | import com.blankj.utilcode.util.TimeUtils | ||||
| import com.yzx.escreen.utils.zhCn | import com.yzx.escreen.utils.zhCn | ||||
| import java.util.* | |||||
| data class MessageEventAuto( | data class MessageEventAuto( | ||||
| var list: MutableList<LeaveID>, | var list: MutableList<LeaveID>, | ||||
| @@ -31,8 +30,10 @@ data class TimeShow( | |||||
| hour = TimeUtils.getNowString(TimeUtils.getSafeDateFormat("HH").zhCn()) | hour = TimeUtils.getNowString(TimeUtils.getSafeDateFormat("HH").zhCn()) | ||||
| min = TimeUtils.getNowString(TimeUtils.getSafeDateFormat("mm").zhCn()) | min = TimeUtils.getNowString(TimeUtils.getSafeDateFormat("mm").zhCn()) | ||||
| sec = TimeUtils.getNowString(TimeUtils.getSafeDateFormat("ss").zhCn()) | sec = TimeUtils.getNowString(TimeUtils.getSafeDateFormat("ss").zhCn()) | ||||
| week = TimeUtils.getChineseWeek(System.currentTimeMillis()).replace("周","星期") | |||||
| week = TimeUtils.getChineseWeek(System.currentTimeMillis()).replace("周", "星期") | |||||
| return this | return this | ||||
| } | } | ||||
| } | |||||
| } | |||||
| data class UserLoginEvent(val isLogin: Boolean = true) | |||||
| @@ -125,6 +125,8 @@ data class StuLeave( | |||||
| item.approval_comments += "超出请假时长:${(item.add_time - end_time).durationStr()}。" | item.approval_comments += "超出请假时长:${(item.add_time - end_time).durationStr()}。" | ||||
| item.color = "#ff4040" | item.color = "#ff4040" | ||||
| } | } | ||||
| }else if(item.vacation_type == 3){ | |||||
| item.approval_comments = "系统自动销假。" | |||||
| } | } | ||||
| logList.add(item) | logList.add(item) | ||||
| } | } | ||||
| @@ -0,0 +1,25 @@ | |||||
| package com.yzx.escreen.model | |||||
| import com.blankj.utilcode.util.TimeUtils | |||||
| class YzxClientInfo { | |||||
| var type: Int = 0 | |||||
| var user_id: String = "" | |||||
| var unit_id: String = "" | |||||
| var token: String = "" | |||||
| var service_timestamp: Long = 0 | |||||
| var data: MsgStu = MsgStu() | |||||
| } | |||||
| data class MsgStu(val unit_id: Int = 0, val student_id: Int = 0) | |||||
| data class YzxHeart( | |||||
| val type: Int = 70, | |||||
| val msg: String = "heart", | |||||
| val timestamp: String = "" | |||||
| ) { | |||||
| fun getYzxHeader(): YzxHeart { | |||||
| return YzxHeart(timestamp = TimeUtils.getNowString()) | |||||
| } | |||||
| } | |||||
| @@ -15,19 +15,19 @@ import com.yzx.escreen.presenter.base.YzxResponse | |||||
| class MainPresenter(view: MainView) : BasePresenter<MainView>(view) { | class MainPresenter(view: MainView) : BasePresenter<MainView>(view) { | ||||
| fun getLeaveShowIds() { | |||||
| if(User.getUser().token.isEmpty()){ | |||||
| fun getLeaveShowIds(student_id: String = "") { | |||||
| if (User.getUser().token.isEmpty()) { | |||||
| return | return | ||||
| } | } | ||||
| val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_STUDENT_GET_SHOW_BOX_LIST}" | val url = "${Config.BASE_URL}${YzxInterface.INTERFACE_STUDENT_GET_SHOW_BOX_LIST}" | ||||
| OkGo.post<YzxResponse<LeaveID>>(url) | OkGo.post<YzxResponse<LeaveID>>(url) | ||||
| .tag(this) | .tag(this) | ||||
| .params("student_id", student_id) | |||||
| .execute(object : JsonCallBack<YzxResponse<LeaveID>>() { | .execute(object : JsonCallBack<YzxResponse<LeaveID>>() { | ||||
| override fun onSuccess(response: Response<YzxResponse<LeaveID>>?) { | override fun onSuccess(response: Response<YzxResponse<LeaveID>>?) { | ||||
| if (response?.isSuccessful == true) { | if (response?.isSuccessful == true) { | ||||
| mView?.onLeaveIDsSuccess(response.body().list) | mView?.onLeaveIDsSuccess(response.body().list) | ||||
| LogUtils.d("getLeaveShowIds",response.body().list) | |||||
| LogUtils.d("getLeaveShowIds", response.body().list) | |||||
| } | } | ||||
| } | } | ||||
| @@ -21,7 +21,7 @@ | |||||
| <clip> | <clip> | ||||
| <shape> | <shape> | ||||
| <corners android:radius="2dip" /> | <corners android:radius="2dip" /> | ||||
| <solid android:color="@color/black" /> | |||||
| <solid android:color="@color/colorPrimary" /> | |||||
| </shape> | </shape> | ||||
| </clip> | </clip> | ||||
| </item> | </item> | ||||
| @@ -7,7 +7,7 @@ | |||||
| tools:context=".activity.WebActivity"> | tools:context=".activity.WebActivity"> | ||||
| <com.google.android.material.appbar.AppBarLayout | <com.google.android.material.appbar.AppBarLayout | ||||
| android:visibility="gone" | |||||
| android:visibility="visible" | |||||
| android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
| android:layout_height="@dimen/title_height" | android:layout_height="@dimen/title_height" | ||||
| android:background="@color/white"> | android:background="@color/white"> | ||||
| @@ -22,7 +22,7 @@ | |||||
| android:layout_height="@dimen/title_height" | android:layout_height="@dimen/title_height" | ||||
| android:scaleType="centerInside" | android:scaleType="centerInside" | ||||
| android:src="@mipmap/ic_back_def" | android:src="@mipmap/ic_back_def" | ||||
| android:visibility="visible"/> | |||||
| android:visibility="gone"/> | |||||
| <ImageView | <ImageView | ||||
| android:id="@+id/btnClose" | android:id="@+id/btnClose" | ||||
| @@ -31,7 +31,7 @@ | |||||
| android:layout_toEndOf="@+id/btnBack" | android:layout_toEndOf="@+id/btnBack" | ||||
| android:scaleType="centerInside" | android:scaleType="centerInside" | ||||
| android:src="@mipmap/ic_close" | android:src="@mipmap/ic_close" | ||||
| android:visibility="gone" /> | |||||
| android:visibility="visible" /> | |||||
| <ImageView | <ImageView | ||||
| android:id="@+id/btnRefresh" | android:id="@+id/btnRefresh" | ||||
| @@ -46,16 +46,27 @@ | |||||
| android:layout_width="wrap_content" | android:layout_width="wrap_content" | ||||
| android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
| android:layout_centerInParent="true" | android:layout_centerInParent="true" | ||||
| android:layout_marginStart="360px" | |||||
| android:layout_marginEnd="360px" | |||||
| android:layout_marginStart="180dp" | |||||
| android:layout_marginEnd="180dp" | |||||
| android:gravity="center" | android:gravity="center" | ||||
| android:textColor="@color/black" | android:textColor="@color/black" | ||||
| android:textStyle="bold" | android:textStyle="bold" | ||||
| android:lines="1" | android:lines="1" | ||||
| android:text="登录一体化平台账号" | |||||
| android:singleLine="true" | android:singleLine="true" | ||||
| android:ellipsize="end" | android:ellipsize="end" | ||||
| android:textSize="@dimen/title_text_size" /> | android:textSize="@dimen/title_text_size" /> | ||||
| <ImageView | |||||
| android:id="@+id/btnSetting" | |||||
| android:layout_width="@dimen/title_height" | |||||
| android:layout_height="@dimen/title_height" | |||||
| android:scaleType="centerInside" | |||||
| android:src="@mipmap/ic_setting" | |||||
| android:visibility="visible" | |||||
| android:layout_alignParentEnd="true"/> | |||||
| <ProgressBar | <ProgressBar | ||||
| android:id="@+id/progressbar" | android:id="@+id/progressbar" | ||||
| style="?android:attr/progressBarStyleHorizontal" | style="?android:attr/progressBarStyleHorizontal" | ||||
| @@ -71,7 +82,7 @@ | |||||
| android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
| android:layout_height="1px" | android:layout_height="1px" | ||||
| android:layout_alignParentBottom="true" | android:layout_alignParentBottom="true" | ||||
| android:background="#000"/> | |||||
| android:background="#f5f5f5"/> | |||||
| </RelativeLayout> | </RelativeLayout> | ||||
| </com.google.android.material.appbar.AppBarLayout> | </com.google.android.material.appbar.AppBarLayout> | ||||
| @@ -1,8 +1,8 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | <resources> | ||||
| <dimen name="title_height">120px</dimen> | |||||
| <dimen name="title_text_size">40px</dimen> | |||||
| <dimen name="title_height">60dp</dimen> | |||||
| <dimen name="title_text_size">20dp</dimen> | |||||
| <dimen name="sp12">12sp</dimen> | <dimen name="sp12">12sp</dimen> | ||||
| <dimen name="sp14">14sp</dimen> | <dimen name="sp14">14sp</dimen> | ||||
| <dimen name="sp16">16sp</dimen> | <dimen name="sp16">16sp</dimen> | ||||