Commit 9d0fb931 by YKai

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

parent 8bb340ea
......@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.65",
"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-im" : "0.0.18.40",
"m-dynamic" : "0.0.7.19",
......@@ -91,7 +91,7 @@ ext {
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.65",
"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-im" : "0.0.18.40",
"m-dynamic" : "0.0.7.19",
......
......@@ -36,18 +36,19 @@ import java.util.concurrent.TimeUnit
class BindPhoneActivity : BaseActivity() {
private val REQUEST_CODE_COUNTRY = 1001
private var countryCode: String = "0086"//国家或地区手机区号
private var countryName: String = "中国"
private var msgCodeDispoable: Disposable? = null
private var mKeFuDialog: ZDialog? = null
private var isForceBindPhone:Boolean=false // 是否强绑手机号
private lateinit var loginType:String // 第三方登录方式 qq/微信
private var isForceBindPhone: Boolean = false // 是否强绑手机号
private lateinit var loginType: String // 第三方登录方式 qq/微信
companion object {
/**
* 启动BindPhoneActivity
*/
fun startActivity(context: Context,loginType:String) {
fun startActivity(context: Context, loginType: String) {
val intent = Intent(context, BindPhoneActivity::class.java)
intent.putExtra("login_type",loginType)
intent.putExtra("login_type", loginType)
context.startActivity(intent)
}
}
......@@ -62,14 +63,14 @@ class BindPhoneActivity : BaseActivity() {
loginType = intent.getStringExtra("login_type")
iv_back.setOnClickListener {
if (isForceBindPhone){
if (isForceBindPhone) {
//清除UserInfo
setUserinfo(null)
clearImData()
logout()
EventBus.getDefault().post(RefreshRecentContactListEvent())
finish()
}else{
} else {
LoginUtils.loginSuccessOperate(this)
}
}
......@@ -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)
if (et_code.text.isNotEmpty()) {
setTvBindPhoneStatus(true, R.drawable.bg_one_click_login)
}
} else {
if ((tv_country_code.text == "+86")) {
if ((tv_country_code.text == "中国")) {
setTvGetCodeStatus()
setTvBindPhoneStatus()
return@setListener
}
if (!tv_country_code.text?.equals("+86")!! && it.toString().isNotEmpty()) {
if (!tv_country_code.text?.equals("中国")!! && it.toString().isNotEmpty()) {
setTvGetCodeStatus(true, 1f)
if (et_code.text.isNotEmpty()) {
setTvBindPhoneStatus(true, R.drawable.bg_one_click_login)
......@@ -151,20 +152,20 @@ class BindPhoneActivity : BaseActivity() {
* 获取用户是否需要强绑定手机号
*/
@SuppressLint("CheckResult")
private fun getIsNeedForceBindPhone(){
private fun getIsNeedForceBindPhone() {
val userInfo = UserHelper.getUserInfo()?.userInfo
val map = HashMap<String,String>()
val map = HashMap<String, String>()
map["login_type"] = loginType
map["openid"] = userInfo?.open_id_qqapp?:""
map["unionid"] = userInfo?.union_id?:""
map["openid"] = userInfo?.open_id_qqapp ?: ""
map["unionid"] = userInfo?.union_id ?: ""
LoginApiRequestUtil.isNeedForceBindPhone(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code=="200"){
if (it.code == "200") {
isForceBindPhone = it.data
}
},{
}, {
ToastUtil.toastShort(it.message)
})
}
......@@ -197,11 +198,11 @@ class BindPhoneActivity : BaseActivity() {
* @param phone
*/
@SuppressLint("CheckResult")
private fun getBindPhoneCode(phone:String){
LoginApiRequestUtil.sendLoginMsgCode(phone,countryCode)
private fun getBindPhoneCode(phone: String) {
LoginApiRequestUtil.sendLoginMsgCode(phone, countryCode)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { showProgressDialog()}
.doOnSubscribe { showProgressDialog() }
.doAfterTerminate { dismissProgressDialog() }
.subscribe({
if (it.code == 200) {
......@@ -221,7 +222,8 @@ class BindPhoneActivity : BaseActivity() {
private fun bindPhone() {
val phone = et_phone_number.text.toString().replace(" ", "")
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)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
......@@ -248,7 +250,7 @@ class BindPhoneActivity : BaseActivity() {
*/
@SuppressLint("SetTextI18n")
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
msgCodeDispoable = Observable.interval(0, 1, TimeUnit.SECONDS)
.subscribeOn(Schedulers.computation())
......@@ -271,8 +273,8 @@ class BindPhoneActivity : BaseActivity() {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == 45 && requestCode == REQUEST_CODE_COUNTRY) {
countryCode = data?.getStringExtra("code") ?: "0086"
tv_country_code.text = "+${countryCode.replace("00", "")}"
countryName = data?.getStringExtra("name") ?: "中国"
tv_country_code.text = countryName
}
}
......
......@@ -45,7 +45,7 @@
android:layout_marginTop="70dp"
android:drawableEnd="@drawable/user_triangle_down"
android:drawablePadding="@dimen/platform_dp_4"
android:text="+86"
android:text="中国"
android:textColor="@color/pay_color_666666"
android:textSize="17sp"
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