|
|
@@ -0,0 +1,261 @@
|
|
|
+package cn.muchinfo.rma.view.base.home.rolemanagement
|
|
|
+
|
|
|
+import android.os.Bundle
|
|
|
+import android.view.Gravity
|
|
|
+import android.view.View
|
|
|
+import android.view.inputmethod.EditorInfo
|
|
|
+import android.widget.EditText
|
|
|
+import cn.muchinfo.rma.R
|
|
|
+import cn.muchinfo.rma.view.autoWidget.*
|
|
|
+import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
+import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
+import com.blankj.utilcode.util.ToastUtils
|
|
|
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
|
|
|
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
|
|
|
+import org.jetbrains.anko.*
|
|
|
+
|
|
|
+/**
|
|
|
+ * 用户重置密码
|
|
|
+ */
|
|
|
+class ResetAccountPasswordActivity : BaseActivity<ResetAccountPasswordViewModel>(){
|
|
|
+
|
|
|
+ val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
|
|
|
+
|
|
|
+ private val logincode by lazy { intent.getStringExtra("logincode") }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 输入的原密码
|
|
|
+ */
|
|
|
+ lateinit var old_password : EditText
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 输入的新密码
|
|
|
+ */
|
|
|
+ lateinit var new_password : EditText
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 再次输入的新密码
|
|
|
+ */
|
|
|
+ lateinit var new_again_password : EditText
|
|
|
+
|
|
|
+
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
+ viewModel.loginidQuery(account = logincode ?: "")
|
|
|
+ verticalLayout {
|
|
|
+ dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
|
|
|
+ background = resources.getDrawable(R.color.main_hit_bg_color)
|
|
|
+ //页面标题
|
|
|
+ topBar {
|
|
|
+ commonLeftButton()
|
|
|
+ commonTitle {
|
|
|
+ text = "重置登录密码"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ textView {
|
|
|
+ visibility = View.INVISIBLE
|
|
|
+ text = "*"
|
|
|
+ textColorInt = R.color.rma_star_color
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(37)
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "登录账号:"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = logincode
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(132))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "*"
|
|
|
+ textColorInt = R.color.rma_star_color
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(37)
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "原密码"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ editText {
|
|
|
+ gravity = Gravity.RIGHT
|
|
|
+ old_password = this
|
|
|
+ hint = "请输入原密码"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
+// setDecimalInputType()
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(matchParent, autoSize(132)) {
|
|
|
+ marginStart = autoSize(80)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(132))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "*"
|
|
|
+ textColorInt = R.color.rma_star_color
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(37)
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "新密码"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ editText {
|
|
|
+ gravity = Gravity.RIGHT
|
|
|
+ new_password = this
|
|
|
+ hint = "请输入8-20个字符的新密码"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
+// setDecimalInputType()
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(matchParent, autoSize(132)) {
|
|
|
+ marginStart = autoSize(80)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(132))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "*"
|
|
|
+ textColorInt = R.color.rma_star_color
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(37)
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "确认新密码"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ editText {
|
|
|
+ gravity = Gravity.RIGHT
|
|
|
+ new_password = this
|
|
|
+ hint = "请再次确认新密码"
|
|
|
+ background = null
|
|
|
+ inputType = EditorInfo.TYPE_CLASS_TEXT
|
|
|
+// setDecimalInputType()
|
|
|
+ hintColorStr = "#CCCCCC"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorStr = "#333333"
|
|
|
+ }.lparams(matchParent, autoSize(132)) {
|
|
|
+ marginStart = autoSize(80)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(132))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ background = resources.getDrawable(R.color.white)
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+
|
|
|
+ textView {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (check().not()){
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+
|
|
|
+ viewModel.LoginaccountOperateReq(
|
|
|
+ operatetype = 1,
|
|
|
+ loginid = viewModel.loginInfoAccount.value?.toLong() ?: 0,
|
|
|
+ password = new_password.text.toString()
|
|
|
+ ) {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ backgroundResource = R.mipmap.rma_submit_bg
|
|
|
+ text = "提交"
|
|
|
+ textColorInt = R.color.white
|
|
|
+ textSizeAuto = 38
|
|
|
+ }.lparams(matchParent, autoSize(119)) {
|
|
|
+ marginStart = autoSize(60)
|
|
|
+ marginEnd = autoSize(60)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(144)) {
|
|
|
+ gravity = Gravity.BOTTOM
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 数据提交前的校验
|
|
|
+ * @return Boolean
|
|
|
+ */
|
|
|
+ fun check() : Boolean{
|
|
|
+ if (old_password.text.toString().isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请输入原密码")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (new_password.text.toString().isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请输入新密码")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (new_password.text.toString().length < 8 || new_password.text.toString().length > 20){
|
|
|
+ ToastUtils.showLong("请输入8-20个字符的新密码")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (new_password.text.toString() != new_again_password.text.toString()){
|
|
|
+ ToastUtils.showLong("两次新密码输入不一致")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+}
|