Commit 9d0fb931 by YKai

feat:绑定手机号界面,+86改为显示国家

parent 8bb340ea
...@@ -8,7 +8,7 @@ ext { ...@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.49.02", "m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.65", "m-consultant" : "0.0.59.65",
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.17", "m-user" : "0.0.61.18",
"m-home" : "0.0.22.55", "m-home" : "0.0.22.55",
"m-im" : "0.0.18.40", "m-im" : "0.0.18.40",
"m-dynamic" : "0.0.7.19", "m-dynamic" : "0.0.7.19",
...@@ -91,7 +91,7 @@ ext { ...@@ -91,7 +91,7 @@ ext {
"m-confide" : "0.0.49.02", "m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.65", "m-consultant" : "0.0.59.65",
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.17", "m-user" : "0.0.61.18",
"m-home" : "0.0.22.54", "m-home" : "0.0.22.54",
"m-im" : "0.0.18.40", "m-im" : "0.0.18.40",
"m-dynamic" : "0.0.7.19", "m-dynamic" : "0.0.7.19",
......
...@@ -36,18 +36,19 @@ import java.util.concurrent.TimeUnit ...@@ -36,18 +36,19 @@ import java.util.concurrent.TimeUnit
class BindPhoneActivity : BaseActivity() { class BindPhoneActivity : BaseActivity() {
private val REQUEST_CODE_COUNTRY = 1001 private val REQUEST_CODE_COUNTRY = 1001
private var countryCode: String = "0086"//国家或地区手机区号 private var countryCode: String = "0086"//国家或地区手机区号
private var countryName: String = "中国"
private var msgCodeDispoable: Disposable? = null private var msgCodeDispoable: Disposable? = null
private var mKeFuDialog: ZDialog? = null private var mKeFuDialog: ZDialog? = null
private var isForceBindPhone:Boolean=false // 是否强绑手机号 private var isForceBindPhone: Boolean = false // 是否强绑手机号
private lateinit var loginType:String // 第三方登录方式 qq/微信 private lateinit var loginType: String // 第三方登录方式 qq/微信
companion object { companion object {
/** /**
* 启动BindPhoneActivity * 启动BindPhoneActivity
*/ */
fun startActivity(context: Context,loginType:String) { fun startActivity(context: Context, loginType: String) {
val intent = Intent(context, BindPhoneActivity::class.java) val intent = Intent(context, BindPhoneActivity::class.java)
intent.putExtra("login_type",loginType) intent.putExtra("login_type", loginType)
context.startActivity(intent) context.startActivity(intent)
} }
} }
...@@ -62,14 +63,14 @@ class BindPhoneActivity : BaseActivity() { ...@@ -62,14 +63,14 @@ class BindPhoneActivity : BaseActivity() {
loginType = intent.getStringExtra("login_type") loginType = intent.getStringExtra("login_type")
iv_back.setOnClickListener { iv_back.setOnClickListener {
if (isForceBindPhone){ if (isForceBindPhone) {
//清除UserInfo //清除UserInfo
setUserinfo(null) setUserinfo(null)
clearImData() clearImData()
logout() logout()
EventBus.getDefault().post(RefreshRecentContactListEvent()) EventBus.getDefault().post(RefreshRecentContactListEvent())
finish() finish()
}else{ } else {
LoginUtils.loginSuccessOperate(this) LoginUtils.loginSuccessOperate(this)
} }
} }
...@@ -105,18 +106,18 @@ class BindPhoneActivity : BaseActivity() { ...@@ -105,18 +106,18 @@ class BindPhoneActivity : BaseActivity() {
} }
// 判断绑定按钮状态 // 判断绑定按钮状态
if ((tv_country_code.text == "+86") && it.toString().length == 13) { if ((tv_country_code.text == "中国") && it.toString().length == 13) {
setTvGetCodeStatus(true, 1f) setTvGetCodeStatus(true, 1f)
if (et_code.text.isNotEmpty()) { if (et_code.text.isNotEmpty()) {
setTvBindPhoneStatus(true, R.drawable.bg_one_click_login) setTvBindPhoneStatus(true, R.drawable.bg_one_click_login)
} }
} else { } else {
if ((tv_country_code.text == "+86")) { if ((tv_country_code.text == "中国")) {
setTvGetCodeStatus() setTvGetCodeStatus()
setTvBindPhoneStatus() setTvBindPhoneStatus()
return@setListener return@setListener
} }
if (!tv_country_code.text?.equals("+86")!! && it.toString().isNotEmpty()) { if (!tv_country_code.text?.equals("中国")!! && it.toString().isNotEmpty()) {
setTvGetCodeStatus(true, 1f) setTvGetCodeStatus(true, 1f)
if (et_code.text.isNotEmpty()) { if (et_code.text.isNotEmpty()) {
setTvBindPhoneStatus(true, R.drawable.bg_one_click_login) setTvBindPhoneStatus(true, R.drawable.bg_one_click_login)
...@@ -151,20 +152,20 @@ class BindPhoneActivity : BaseActivity() { ...@@ -151,20 +152,20 @@ class BindPhoneActivity : BaseActivity() {
* 获取用户是否需要强绑定手机号 * 获取用户是否需要强绑定手机号
*/ */
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private fun getIsNeedForceBindPhone(){ private fun getIsNeedForceBindPhone() {
val userInfo = UserHelper.getUserInfo()?.userInfo val userInfo = UserHelper.getUserInfo()?.userInfo
val map = HashMap<String,String>() val map = HashMap<String, String>()
map["login_type"] = loginType map["login_type"] = loginType
map["openid"] = userInfo?.open_id_qqapp?:"" map["openid"] = userInfo?.open_id_qqapp ?: ""
map["unionid"] = userInfo?.union_id?:"" map["unionid"] = userInfo?.union_id ?: ""
LoginApiRequestUtil.isNeedForceBindPhone(map) LoginApiRequestUtil.isNeedForceBindPhone(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ .subscribe({
if (it.code=="200"){ if (it.code == "200") {
isForceBindPhone = it.data isForceBindPhone = it.data
} }
},{ }, {
ToastUtil.toastShort(it.message) ToastUtil.toastShort(it.message)
}) })
} }
...@@ -197,11 +198,11 @@ class BindPhoneActivity : BaseActivity() { ...@@ -197,11 +198,11 @@ class BindPhoneActivity : BaseActivity() {
* @param phone * @param phone
*/ */
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private fun getBindPhoneCode(phone:String){ private fun getBindPhoneCode(phone: String) {
LoginApiRequestUtil.sendLoginMsgCode(phone,countryCode) LoginApiRequestUtil.sendLoginMsgCode(phone, countryCode)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { showProgressDialog()} .doOnSubscribe { showProgressDialog() }
.doAfterTerminate { dismissProgressDialog() } .doAfterTerminate { dismissProgressDialog() }
.subscribe({ .subscribe({
if (it.code == 200) { if (it.code == 200) {
...@@ -221,7 +222,8 @@ class BindPhoneActivity : BaseActivity() { ...@@ -221,7 +222,8 @@ class BindPhoneActivity : BaseActivity() {
private fun bindPhone() { private fun bindPhone() {
val phone = et_phone_number.text.toString().replace(" ", "") val phone = et_phone_number.text.toString().replace(" ", "")
val code = et_code.text.toString() val code = et_code.text.toString()
val bindPhoneParams = BindPhoneJavaParam("", countryCode, phone, code, UserHelper.getUserInfo()!!.uid!!) val bindPhoneParams =
BindPhoneJavaParam("", countryCode, phone, code, UserHelper.getUserInfo()!!.uid!!)
LoginApiRequestUtil.bindPhone(bindPhoneParams) LoginApiRequestUtil.bindPhone(bindPhoneParams)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
...@@ -248,7 +250,7 @@ class BindPhoneActivity : BaseActivity() { ...@@ -248,7 +250,7 @@ class BindPhoneActivity : BaseActivity() {
*/ */
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun startCountdown(remainTime: Int) { private fun startCountdown(remainTime: Int) {
et_code.postDelayed({RxKeyboardTool.showSoftInput(this,et_code)},300) et_code.postDelayed({ RxKeyboardTool.showSoftInput(this, et_code) }, 300)
tv_get_code.isEnabled = false tv_get_code.isEnabled = false
msgCodeDispoable = Observable.interval(0, 1, TimeUnit.SECONDS) msgCodeDispoable = Observable.interval(0, 1, TimeUnit.SECONDS)
.subscribeOn(Schedulers.computation()) .subscribeOn(Schedulers.computation())
...@@ -271,8 +273,8 @@ class BindPhoneActivity : BaseActivity() { ...@@ -271,8 +273,8 @@ class BindPhoneActivity : BaseActivity() {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
if (resultCode == 45 && requestCode == REQUEST_CODE_COUNTRY) { if (resultCode == 45 && requestCode == REQUEST_CODE_COUNTRY) {
countryCode = data?.getStringExtra("code") ?: "0086" countryCode = data?.getStringExtra("code") ?: "0086"
countryName = data?.getStringExtra("name") ?: "中国"
tv_country_code.text = "+${countryCode.replace("00", "")}" tv_country_code.text = countryName
} }
} }
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
android:layout_marginTop="70dp" android:layout_marginTop="70dp"
android:drawableEnd="@drawable/user_triangle_down" android:drawableEnd="@drawable/user_triangle_down"
android:drawablePadding="@dimen/platform_dp_4" android:drawablePadding="@dimen/platform_dp_4"
android:text="+86" android:text="中国"
android:textColor="@color/pay_color_666666" android:textColor="@color/pay_color_666666"
android:textSize="17sp" android:textSize="17sp"
app:layout_constraintStart_toStartOf="@id/tv_title" app:layout_constraintStart_toStartOf="@id/tv_title"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment