Commit d71bc86a by 刘鹏

Merge remote-tracking branch 'origin/4.1.69(强绑手机号)' into 4.1.69(强绑手机号)

# Conflicts:
#	config.gradle
parents 81e6ae32 0239c319
......@@ -6,11 +6,11 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.66",
"m-consultant" : "0.0.59.68",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.18",
"m-home" : "0.0.22.55",
"m-im" : "0.0.18.44",
"m-user" : "0.0.61.22",
"m-home" : "0.0.22.59",
"m-im" : "0.0.18.41",
"m-dynamic" : "0.0.7.19",
"m-article" : "0.0.0.6",
......@@ -89,10 +89,10 @@ ext {
//第三步 若干
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.66",
"m-consultant" : "0.0.59.68",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.18",
"m-home" : "0.0.22.54",
"m-user" : "0.0.61.22",
"m-home" : "0.0.22.59",
"m-im" : "0.0.18.40",
"m-dynamic" : "0.0.7.19",
"m-article" : "0.0.0.6",
......
......@@ -175,9 +175,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="horizontal">
</LinearLayout>
android:orientation="horizontal" />
<!--61234人点评-->
<TextView
android:id="@+id/tv_zixunOrderNum"
......
......@@ -30,7 +30,7 @@
android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_12"
android:text="2.2W+师资"/>
android:text="3W+师资"/>
</RelativeLayout>
<RelativeLayout
......
......@@ -13,5 +13,6 @@ data class BindPhoneJavaParam(
var phoneNumber: String,//手机号
var verifyCode: String,// 验证码
var uid: String,
var type: Int = 2//2:Android
var type: Int = 2, //2:Android
var transferFlag:Int = 0 // 默认为0,1表示需要转换x账号到y账号触发 1800010011 code提醒触发重新登录标记
)
\ No newline at end of file
......@@ -12,6 +12,7 @@ import android.view.View
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
......@@ -31,6 +32,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_bind_phone.*
import kotlinx.android.synthetic.main.activity_bind_phone.et_phone_number
import kotlinx.android.synthetic.main.activity_bind_phone.iv_del
import java.util.concurrent.TimeUnit
class BindPhoneActivity : BaseActivity() {
......@@ -39,16 +42,17 @@ class BindPhoneActivity : BaseActivity() {
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 mIsForceBindPhone: Boolean = false // 是否强绑手机号
private var mIsFromGuide: Boolean = false // 是否来自启动页
companion object {
/**
* 启动BindPhoneActivity
*/
fun startActivity(context: Context, loginType: String) {
fun startActivity(context: Context, isForceBindPhone: Boolean, isFromGuide: Boolean) {
val intent = Intent(context, BindPhoneActivity::class.java)
intent.putExtra("login_type", loginType)
intent.putExtra("is_force_bind_phone", isForceBindPhone)
intent.putExtra("is_from_guide", isFromGuide)
context.startActivity(intent)
}
}
......@@ -60,19 +64,10 @@ class BindPhoneActivity : BaseActivity() {
override fun initDataAndEvent() {
setWindowStatusBarColor()
loginType = intent.getStringExtra("login_type")
mIsForceBindPhone = intent.getBooleanExtra("is_force_bind_phone",false)
mIsFromGuide = intent.getBooleanExtra("is_from_guide", false)
iv_back.setOnClickListener {
if (isForceBindPhone) {
//清除UserInfo
setUserinfo(null)
clearImData()
logout()
EventBus.getDefault().post(RefreshRecentContactListEvent())
finish()
} else {
LoginUtils.loginSuccessOperate(this)
}
onBackPressed()
}
tv_country_code.setOnClickListener {
val intent = Intent(this, CountryListActivity::class.java)
......@@ -86,7 +81,9 @@ class BindPhoneActivity : BaseActivity() {
}
// 获取验证码按钮
tv_get_code.setOnClickListener {
checkPhoneStatus()
if (checkPhone()) {
checkPhoneStatus()
}
}
// 收不到验证码
tv_no_get_code.setOnClickListener {
......@@ -144,31 +141,31 @@ class BindPhoneActivity : BaseActivity() {
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
})
getIsNeedForceBindPhone()
// getIsNeedForceBindPhone()
setTvGetCodeStatus()
}
/**
* 获取用户是否需要强绑定手机号
*/
@SuppressLint("CheckResult")
private fun getIsNeedForceBindPhone() {
val userInfo = UserHelper.getUserInfo()?.userInfo
val map = HashMap<String, String>()
map["login_type"] = loginType
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") {
isForceBindPhone = it.data
}
}, {
ToastUtil.toastShort(it.message)
})
}
// /**
// * 获取用户是否需要强绑定手机号
// */
// @SuppressLint("CheckResult")
// private fun getIsNeedForceBindPhone() {
// val userInfo = UserHelper.getUserInfo()?.userInfo
// val map = HashMap<String, String>()
// map["login_type"] = loginType
// 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") {
// isForceBindPhone = it.data
// }
// }, {
// ToastUtil.toastShort(it.message)
// })
// }
/**
* 检查手机号是否是用户版号码、是否有设置密码、是否被绑定
......@@ -223,19 +220,34 @@ class BindPhoneActivity : BaseActivity() {
val phone = et_phone_number.text.toString().replace(" ", "")
val code = et_code.text.toString()
val bindPhoneParams =
BindPhoneJavaParam("", countryCode, phone, code, UserHelper.getUserInfo()!!.uid!!)
BindPhoneJavaParam("", countryCode, phone, code, UserHelper.getUserInfo()!!.uid!!,transferFlag=1)
LoginApiRequestUtil.bindPhone(bindPhoneParams)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { showProgressDialog() }
.doAfterTerminate { dismissProgressDialog() }
.subscribe({
if (it.data != null && it.code == 200) {
ToastUtil.toastShort("手机号绑定成功")
if (it.code == 200) {
ToastUtil.toastShort("绑定成功")
UserHelper.getUserInfo()!!.userInfo!!.bind_phone = 1
UserHelper.getUserInfo()!!.userInfo!!.phone = phone
RxKeyboardTool.hideSoftInput(this)
LoginUtils.loginSuccessOperate(this)
if (mIsFromGuide) {
LoginUtils.loginSuccessOperate(this)
} else {
finish()
}
} else if (it.code == 1300000004) { // 如果不是10分钟内注册,提示“绑定失败,此手机号已注册”,并标记此账号为无需强绑
ToastUtil.toastShort(it.msg)
RxKeyboardTool.hideSoftInput(this)
if (mIsFromGuide) {
LoginUtils.loginSuccessOperate(this)
} else {
finish()
}
}else if(it.code==1800010011){
RegisterAndLoginActivity.startFromGuide(this,false,mIsFromGuide)
finish()
} else {
ToastUtil.toastShort(it.msg)//服务端返回{验证码错误&异常}信息
}
......@@ -244,6 +256,19 @@ class BindPhoneActivity : BaseActivity() {
})
}
override fun onBackPressed() {
if (mIsForceBindPhone) {
//清除UserInfo
setUserinfo(null)
clearImData()
logout()
EventBus.getDefault().post(RefreshRecentContactListEvent())
finish()
} else {
LoginUtils.loginSuccessOperate(this)
}
}
/**
* 开始倒计时
......@@ -334,6 +359,36 @@ class BindPhoneActivity : BaseActivity() {
}
}
/**
* 检查手机号规范
*/
private fun checkPhone(): Boolean {
val editPhone = et_phone_number.textContent
if (TextUtils.isEmpty(editPhone)) {
ToastUtil.toastShort("请输入手机号")
return false
}
LogUtil.e("本地userPhoneNumber赋值操作2:$editPhone")
//手机号码验证 国外手机号码不做限制
if (!TextUtils.equals("0086", countryCode)) {
return !TextUtils.isEmpty(editPhone)
}
return if (editPhone.length == 11 && editPhone.startsWith("1") && checkRegex(
editPhone.toString().trim()
)
) {
true
} else {
ToastUtil.toastShort("不是正确的手机号")
false
}
}
private fun checkRegex(phone: String): Boolean {
val regex = "^1+[23456789]+\\d{9}"
return phone.matches(regex.toRegex())
}
override fun onDestroy() {
super.onDestroy()
if (msgCodeDispoable != null) {
......
......@@ -44,6 +44,7 @@ import com.yidianling.user.UserHelper
import com.yidianling.user.UserHelper.isLogin
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.LoginApiRequestUtil
import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.PhoneLoginAutoParam
import com.yidianling.user.http.response.ChcekPhoneResponeBean
......@@ -54,6 +55,8 @@ import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.ui.CountryListActivity
import com.yidianling.user.ui.login.contract.ILoginContract
import com.yidianling.user.ui.login.presenter.LoginPresenterImpl
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.user_activity_register_and_login_bottom.*
import kotlinx.android.synthetic.main.user_activity_register_and_login_new.*
......@@ -531,28 +534,47 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
/**
*三方登录成功
*/
override fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo,thirdLoginPlatform:String) {
if (userInfo.bind_phone != 1) {
BindPhoneActivity.startActivity(this,thirdLoginPlatform)
finish()
} else {
when {
isFromGuide -> {
LoginUtils.loginSuccessOperate(this)
}
isFromOneKeyLogin -> {
if (OneKeyLoginHelp.mIsFromGuide) {
LoginUtils.loginSuccessOperate(this)
} else {
OneKeyLoginHelp.quitLoginPage()
@SuppressLint("CheckResult")
override fun thirdLoginSuccess(
userInfo: UserResponseBean.UserInfo,
thirdLoginPlatform: String
) {
val userInfo = UserHelper.getUserInfo()?.userInfo
val map = HashMap<String, String>()
map["login_type"] = thirdLoginPlatform
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.data) {
BindPhoneActivity.startActivity(this, it.data, isFromGuide)
finish()
} else {
when {
isFromGuide -> {
LoginUtils.loginSuccessOperate(this)
}
isFromOneKeyLogin -> {
if (OneKeyLoginHelp.mIsFromGuide) {
LoginUtils.loginSuccessOperate(this)
} else {
OneKeyLoginHelp.quitLoginPage()
finish()
}
}
else -> {
finish()
}
}
}
}
else -> {
finish()
}
}
}
}, {
ToastUtil.toastShort(it.message)
})
}
/**
......
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