1、修改登录功能并验证,除了支付宝登录其他都已验证
2、完成个人中心的功能,个人主页完成、钱包完成、背包完成
This commit is contained in:
@@ -15,6 +15,7 @@ import com.qxcm.modulelogin.databinding.ActivityLoginBinding;
|
||||
import com.qxcm.modulelogin.present.LoginContacter;
|
||||
import com.qxcm.modulelogin.present.LoginPresenter;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
|
||||
public class ForgetPasswordActivity extends BaseMvpActivity<LoginPresenter, ActivityForgetPasswordBinding> implements LoginContacter.View, View.OnClickListener {
|
||||
|
||||
@@ -35,8 +36,19 @@ public class ForgetPasswordActivity extends BaseMvpActivity<LoginPresenter, Acti
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess(String phoneNumber) {
|
||||
public void sendCodeSuccess1(String phoneNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(UserBean userBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authorizationSuccess(String s) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.qxcm.modulelogin.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
@@ -18,11 +19,14 @@ import com.qxcm.modulelogin.present.ImproveInfoContacts;
|
||||
import com.qxcm.modulelogin.present.ImproveInfoPresenter;
|
||||
import com.qxcm.modulemain.activity.MainActivity;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.bean.UserPictrue;
|
||||
import com.qxcm.moduleutil.utils.DateSelectDialog;
|
||||
import com.qxcm.moduleutil.utils.GlideEngine;
|
||||
import com.qxcm.moduleutil.utils.ImageLoader;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
import com.qxcm.moduleutil.utils.MyPictureParameterStyle;
|
||||
import com.qxcm.moduleutil.utils.SpUtil;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
|
||||
|
||||
@@ -43,6 +47,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
||||
private boolean isBoySelected = false;
|
||||
private DateSelectDialog mDateSelectDialog;
|
||||
private boolean isFirst = false;
|
||||
UserBean userBean;
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
@@ -54,8 +59,16 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
mBinding.edNickName.setText(nickname);
|
||||
Bundle extras = getIntent().getExtras();
|
||||
userBean= extras != null ? (UserBean) extras.getSerializable("userBean") : null;
|
||||
assert userBean != null;
|
||||
if (userBean.getNickname().isEmpty()){
|
||||
MvpPre.updateNickname();
|
||||
}else {
|
||||
mBinding.edNickName.setText(userBean.getNickname());
|
||||
}
|
||||
mBinding.edNickName.setClearIconVisible(true);
|
||||
ImageUtils.loadHeadCC(userBean.getAvatar(), mBinding.rvUserHead);
|
||||
if (!TextUtils.isEmpty(user_no_parent) && !"0".equals(user_no_parent)) {
|
||||
mBinding.etInviteCode.setText(user_no_parent);
|
||||
mBinding.etInviteCode.setKeyListener(null);
|
||||
@@ -234,13 +247,16 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
||||
|
||||
@Override
|
||||
public void upLoadSuccess(String url, int type) {
|
||||
MvpPre.updateAvatar(url);
|
||||
// MvpPre.updateAvatar(url);
|
||||
ImageUtils.loadHeadCC(url, mBinding.rvUserHead);
|
||||
map.put("avatar", url);
|
||||
isFirst = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAvatarSuccess(String headPicture) {
|
||||
ImageLoader.loadHead(this, mBinding.rvUserHead, headPicture);
|
||||
map.put("head_picture", headPicture);
|
||||
map.put("avatar", headPicture);
|
||||
isFirst = true;
|
||||
}
|
||||
|
||||
@@ -251,14 +267,15 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSexTrue(UserPictrue sex) {
|
||||
ImageLoader.loadHead(this, mBinding.rvUserHead,sex.getDefaultAvatar());
|
||||
map.put("head_picture", sex.getDefaultAvatar());
|
||||
public void updateSexTrue(String sex) {
|
||||
ImageLoader.loadHead(this, mBinding.rvUserHead,sex);
|
||||
map.put("avatar", sex);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSuccess() {
|
||||
public void updateSuccess(UserBean userBean) {
|
||||
SpUtil.saveUserInfo(userBean);
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.qxcm.modulelogin.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
@@ -12,6 +15,11 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alipay.sdk.app.AlipayApi;
|
||||
import com.alipay.sdk.app.AlipayResultActivity;
|
||||
import com.alipay.sdk.app.AuthTask;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.modulelogin.R;
|
||||
import com.qxcm.modulelogin.databinding.ActivityLoginBinding;
|
||||
@@ -20,19 +28,28 @@ import com.qxcm.modulelogin.present.LoginContacter;
|
||||
import com.qxcm.modulelogin.present.LoginPresenter;
|
||||
import com.qxcm.modulemain.activity.MainActivity;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.utils.BarUtils;
|
||||
import com.qxcm.moduleutil.utils.LanguageUtil;
|
||||
import com.qxcm.moduleutil.utils.PreferencesUtils;
|
||||
import com.qxcm.moduleutil.widget.CommonAppContext;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.modelmsg.SendAuth;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*@author
|
||||
*@data
|
||||
*@description: 密码登录
|
||||
* @author
|
||||
* @data
|
||||
* @description: 密码登录
|
||||
*/
|
||||
public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLoginBinding> implements LoginContacter.View, View.OnClickListener {
|
||||
|
||||
@@ -168,11 +185,24 @@ public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLogin
|
||||
disLoading();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess(String phoneNumber) {
|
||||
// ARouter.getInstance().build(ARouters.INPUT_CODE).withString("mobile", phoneNumber).navigation();
|
||||
public void sendCodeSuccess1(String phoneNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(UserBean userBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authorizationSuccess(String s) {
|
||||
zfbLogin(s);
|
||||
}
|
||||
|
||||
boolean isPasswordVisible = false;
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
@@ -196,22 +226,24 @@ public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLogin
|
||||
ToastUtils.showShort("请输入登录密码");
|
||||
return;
|
||||
}
|
||||
// MvpPre.login(phoneNumber, password, "", 1);
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
MvpPre.login(phoneNumber, password, "", 2);
|
||||
// Intent intent = new Intent(this, MainActivity.class);
|
||||
// startActivity(intent);
|
||||
// finish();
|
||||
} else if (id == R.id.iv_zfb) {
|
||||
if (!mBinding.cbPrivacy.isChecked()) {
|
||||
com.hjq.toast.ToastUtils.show("请先勾选服务条款");
|
||||
return;
|
||||
}
|
||||
MvpPre.authorization();
|
||||
MvpPre.authorization("zfb");
|
||||
// zfbLogin();
|
||||
} else if (id == R.id.iv_weixin) {
|
||||
|
||||
if (!mBinding.cbPrivacy.isChecked()) {
|
||||
com.hjq.toast.ToastUtils.show("请先勾选服务条款");
|
||||
return;
|
||||
}
|
||||
MvpPre.authorization();
|
||||
wcLogin();
|
||||
} else if (id == R.id.tv_yhxy) {
|
||||
MvpPre.ysxl();
|
||||
} else if (id == R.id.tv_ysxy) {
|
||||
@@ -226,12 +258,71 @@ public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLogin
|
||||
mBinding.edPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||
mBinding.ivEye.setImageResource(com.qxcm.moduleutil.R.mipmap.eye_close); // 设置按钮文本为显示密码
|
||||
}
|
||||
mBinding.edPassword.setSelection( mBinding.edPassword.getText().length()); // 将光标移动到文字末尾
|
||||
mBinding.edPassword.setSelection(mBinding.edPassword.getText().length()); // 将光标移动到文字末尾
|
||||
isPasswordVisible = !isPasswordVisible; // 切换状态
|
||||
}else if (id == R.id.tv_forget_password) {
|
||||
} else if (id == R.id.tv_forget_password) {
|
||||
Intent intent = new Intent(this, ForgetPasswordActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||
private void wcLogin() {
|
||||
//发起登陆请求前先注册微信api
|
||||
IWXAPI api = WXAPIFactory.createWXAPI(this, CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(), true);
|
||||
api.registerApp(CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId());
|
||||
if (!api.isWXAppInstalled()) {
|
||||
//todo 提醒未安装微信
|
||||
ToastUtils.showShort("请安装微信客户端");
|
||||
return;
|
||||
}
|
||||
//开始发起登陆请求
|
||||
final SendAuth.Req req = new SendAuth.Req();
|
||||
req.scope = "snsapi_userinfo";
|
||||
req.state = "wechat_sdk_demo_test";
|
||||
api.sendReq(req);
|
||||
}
|
||||
|
||||
private void zfbLogin(String s) {
|
||||
LogUtils.e("@@@",s);
|
||||
CommonAppContext.getInstance();
|
||||
if (!CommonAppContext.isAlipayInstalled(this)){
|
||||
ToastUtils.showShort("请安装支付宝客户端");
|
||||
return;
|
||||
}
|
||||
String authInfo = s;
|
||||
// String authInfo = "apiname=com.alipay.account.auth&app_id=2021005152631691&app_name=yusheng&auth_type=AUTHACCOUNT&biz_type=openservice&method=alipay.open.auth.sdk.code.get&pid=2088170624624316&product_id=APP_FAST_LOGIN&scope=kuaijie&sign_type=RSA2&target_id=20141225xxxx&sign=fMcp4GtiM6rxSIeFnJCVePJKV43eXrUP86CQgiLhDHH2u%2FdN75eEvmywc2ulkm7qKRetkU9fbVZtJIqFdMJcJ9Yp%2BJI%2FF%2FpESafFR6rB2fRjiQQLGXvxmDGVMjPSxHxVtIqpZy5FDoKUSjQ2%2FILDKpu3%2F%2BtAtm2jRw1rUoMhgt0%3D";
|
||||
Runnable authRunnable = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// 构造AuthTask 对象
|
||||
AuthTask authTask = new AuthTask(LoginActivity.this);
|
||||
// 调用授权接口,获取授权结果
|
||||
Map<String, String> result = authTask.authV2(authInfo, true);
|
||||
LogUtils.e(result);
|
||||
if (result.get("resultStatus").equals("9000")){
|
||||
Pattern pattern = Pattern.compile("auth_code=([^&]*)");
|
||||
Matcher matcher = pattern.matcher(result.get("result"));
|
||||
|
||||
if (matcher.find()) {
|
||||
String authCode = matcher.group(1);
|
||||
LogUtils.e("AuthCode", authCode);
|
||||
MvpPre.oauthLogin(authCode,2);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Thread authThread = new Thread(authRunnable);
|
||||
authThread.start();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void loginEvent(BaseResp event) {
|
||||
if (event.errCode ==BaseResp.ErrCode.ERR_OK){
|
||||
SendAuth.Resp authResp = (SendAuth.Resp)event;
|
||||
LogUtils.e("@@@",authResp.code);
|
||||
MvpPre.oauthLogin(authResp.code,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,29 +8,35 @@ import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.alipay.sdk.app.AuthTask;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.qxcm.modulelogin.R;
|
||||
import com.qxcm.modulelogin.databinding.ActivityLoginBinding;
|
||||
import com.qxcm.modulelogin.databinding.ActivityPasswordLoginBinding;
|
||||
import com.qxcm.modulelogin.even.LoginFinishEvent;
|
||||
import com.qxcm.modulelogin.present.LoginContacter;
|
||||
import com.qxcm.modulelogin.present.LoginPresenter;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.utils.BarUtils;
|
||||
import com.qxcm.moduleutil.utils.PreferencesUtils;
|
||||
import com.qxcm.moduleutil.widget.CommonAppContext;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.utils.logger.DataLogger;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.modelmsg.SendAuth;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, ActivityPasswordLoginBinding> implements LoginContacter.View, View.OnClickListener {
|
||||
|
||||
private CountDownTimer mTimer;
|
||||
@@ -109,6 +115,7 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
mBinding.ivZfb.setOnClickListener(this::onClick);
|
||||
mBinding.ivWeixin.setOnClickListener(this::onClick);
|
||||
mBinding.tvSendCode.setOnClickListener(this::onClick);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,7 +154,8 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
intent.putExtra("mobile", mBinding.edPhone.getText().toString());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else if (id == R.id.fl_login) {
|
||||
}
|
||||
else if (id == R.id.fl_login) {
|
||||
if (!mBinding.cbPrivacy.isChecked()) {
|
||||
ToastUtils.show("请先勾选服务条款");
|
||||
return;
|
||||
@@ -157,7 +165,12 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
|
||||
return;
|
||||
}
|
||||
MvpPre.sendCode(phone, 1);
|
||||
String code=mBinding.edPassword.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(code)){
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("请输入验证码");
|
||||
return;
|
||||
}
|
||||
MvpPre.login(phone, "", code, 1);
|
||||
} else if (id == R.id.tv_yhxy) {
|
||||
MvpPre.yhxy();
|
||||
} else if (id == R.id.tv_ysxy) {
|
||||
@@ -167,18 +180,49 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
ToastUtils.show("请先勾选服务条款");
|
||||
return;
|
||||
}
|
||||
MvpPre.authorization("zfb");
|
||||
// MvpPre.authorization(SHARE_MEDIA.QQ);
|
||||
} else if (id == R.id.iv_weixin) {
|
||||
if (!mBinding.cbPrivacy.isChecked()) {
|
||||
ToastUtils.show("请先勾选服务条款");
|
||||
return;
|
||||
}
|
||||
// MvpPre.authorization(SHARE_MEDIA.WEIXIN);
|
||||
// MvpPre.authorization("wx");
|
||||
wcLogin();
|
||||
} else if (id == R.id.tv_send_code) {
|
||||
sendCodeSuccess(mBinding.edPhone.getText().toString().trim());
|
||||
String phone = mBinding.edPhone.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(phone)) {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
|
||||
return;
|
||||
}
|
||||
sendCodeSuccess(phone);
|
||||
MvpPre.sendCode(phone, 1);
|
||||
}
|
||||
}
|
||||
private void wcLogin() {
|
||||
//发起登陆请求前先注册微信api
|
||||
IWXAPI api = WXAPIFactory.createWXAPI(this,CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(),true);
|
||||
api.registerApp(CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId());
|
||||
if (!api.isWXAppInstalled()){
|
||||
//todo 提醒未安装微信
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("请安装微信客户端");
|
||||
return;
|
||||
}
|
||||
//开始发起登陆请求
|
||||
final SendAuth.Req req = new SendAuth.Req();
|
||||
req.scope = "snsapi_userinfo";
|
||||
req.state = "wechat_sdk_demo_test";
|
||||
api.sendReq(req);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void loginEvent(BaseResp event) {
|
||||
if (event.errCode ==BaseResp.ErrCode.ERR_OK){
|
||||
SendAuth.Resp authResp = (SendAuth.Resp)event;
|
||||
LogUtils.e("@@@",authResp.code);
|
||||
MvpPre.oauthLogin(authResp.code,1);
|
||||
}
|
||||
}
|
||||
private void releaseTimer() {
|
||||
if (mTimer != null) {
|
||||
mTimer.cancel();
|
||||
@@ -211,4 +255,53 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
};
|
||||
mTimer.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess1(String s) {
|
||||
LogUtils.e(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(UserBean userBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authorizationSuccess(String s) {
|
||||
zfbLogin(s);
|
||||
}
|
||||
|
||||
private void zfbLogin(String s) {
|
||||
LogUtils.e("@@@",s);
|
||||
CommonAppContext.getInstance();
|
||||
if (!CommonAppContext.isAlipayInstalled(this)){
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("请安装支付宝客户端");
|
||||
return;
|
||||
}
|
||||
String authInfo = s;
|
||||
// String authInfo = "apiname=com.alipay.account.auth&app_id=2021005152631691&app_name=yusheng&auth_type=AUTHACCOUNT&biz_type=openservice&method=alipay.open.auth.sdk.code.get&pid=2088170624624316&product_id=APP_FAST_LOGIN&scope=kuaijie&sign_type=RSA2&target_id=20141225xxxx&sign=fMcp4GtiM6rxSIeFnJCVePJKV43eXrUP86CQgiLhDHH2u%2FdN75eEvmywc2ulkm7qKRetkU9fbVZtJIqFdMJcJ9Yp%2BJI%2FF%2FpESafFR6rB2fRjiQQLGXvxmDGVMjPSxHxVtIqpZy5FDoKUSjQ2%2FILDKpu3%2F%2BtAtm2jRw1rUoMhgt0%3D";
|
||||
Runnable authRunnable = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// 构造AuthTask 对象
|
||||
AuthTask authTask = new AuthTask(PasswordLoginActivity.this);
|
||||
// 调用授权接口,获取授权结果
|
||||
Map<String, String> result = authTask.authV2(authInfo, true);
|
||||
LogUtils.e(result);
|
||||
if (result.get("resultStatus").equals("9000")){
|
||||
Pattern pattern = Pattern.compile("auth_code=([^&]*)");
|
||||
Matcher matcher = pattern.matcher(result.get("result"));
|
||||
|
||||
if (matcher.find()) {
|
||||
String authCode = matcher.group(1);
|
||||
LogUtils.e("AuthCode", authCode);
|
||||
MvpPre.oauthLogin(authCode,2);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Thread authThread = new Thread(authRunnable);
|
||||
authThread.start();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.qxcm.modulelogin.activity;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.qxcm.modulelogin.R;
|
||||
import com.qxcm.modulelogin.adapter.SwitchAccountsAdapter;
|
||||
import com.qxcm.modulelogin.databinding.ActivitySwitchAccountsBinding;
|
||||
import com.qxcm.modulelogin.present.LoginContacter;
|
||||
import com.qxcm.modulelogin.present.LoginPresenter;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/19
|
||||
*@description: 选择账号
|
||||
*/
|
||||
public class SwitchAccountsActivity extends BaseMvpActivity<LoginPresenter, ActivitySwitchAccountsBinding> implements LoginContacter.View {
|
||||
|
||||
private List<UserBean> userBeanList=new ArrayList<>();
|
||||
private SwitchAccountsAdapter switchAccountsAdapter;
|
||||
@Override
|
||||
protected void initData() {
|
||||
mBinding.topBar.setTitle("选择账号");
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
if (bundle != null) {
|
||||
Object serializable = bundle.getSerializable("userbean", null);
|
||||
if (serializable instanceof List<?>) {
|
||||
userBeanList = (List<UserBean>) serializable;
|
||||
} else {
|
||||
// 可选:记录错误或提示
|
||||
Log.e("UserBeanError", "Expected List<UserBean> but got: " + (serializable != null ? serializable.getClass().getName() : "null"));
|
||||
}
|
||||
} else {
|
||||
Log.e("UserBeanError", "Bundle is null");
|
||||
}
|
||||
}
|
||||
if (userBeanList!=null&&userBeanList.size()>0){
|
||||
switchAccountsAdapter=new SwitchAccountsAdapter();
|
||||
mBinding.rvList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
|
||||
mBinding.rvList.setAdapter(switchAccountsAdapter);
|
||||
switchAccountsAdapter.setNewData(userBeanList);
|
||||
switchAccountsAdapter.setOnItemClickListener(item -> {
|
||||
MvpPre.switchAccounts(String.valueOf(item.getUser_id()));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_switch_accounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LoginPresenter bindPresenter() {
|
||||
return new LoginPresenter(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess1(String phoneNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(UserBean userBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authorizationSuccess(String s) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.qxcm.modulelogin.adapter;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.qxcm.modulelogin.R;
|
||||
import com.qxcm.moduleutil.bean.BlackUserBean;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/19
|
||||
*@description: 用户列表适配器
|
||||
*/
|
||||
public class SwitchAccountsAdapter extends BaseQuickAdapter<UserBean, BaseViewHolder> {
|
||||
|
||||
// 定义接口用于回调点击事件
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(UserBean item);
|
||||
}
|
||||
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
|
||||
public SwitchAccountsAdapter() {
|
||||
super(R.layout.item_switch_accounts);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, UserBean item) {
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.im_user));
|
||||
helper.setText(R.id.tv_nick_name, item.getNickname());
|
||||
ImageView imageView= helper.getView(R.id.im_g);
|
||||
// 根据 type 设置图片资源
|
||||
// 根据 type 和 status 设置图片资源
|
||||
imageView.setImageResource(com.qxcm.moduleutil.R.mipmap.yigz);
|
||||
// 设置点击事件
|
||||
imageView.setOnClickListener(v -> {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.app.Activity;
|
||||
import com.qxcm.modulelogin.bean.UserFillResp;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.bean.UserPictrue;
|
||||
|
||||
import java.io.File;
|
||||
@@ -23,9 +24,9 @@ public final class ImproveInfoContacts {
|
||||
|
||||
void updateNicknameSuccess(String nickname);
|
||||
|
||||
void updateSexTrue(UserPictrue sex);
|
||||
void updateSexTrue(String sex);
|
||||
|
||||
void updateSuccess();
|
||||
void updateSuccess(UserBean userBean);
|
||||
}
|
||||
|
||||
public interface IImproveInfoPre extends IPresenter {
|
||||
|
||||
@@ -4,8 +4,10 @@ import android.content.Context;
|
||||
|
||||
|
||||
import com.qxcm.modulelogin.bean.UserFillResp;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.utils.oss.OSSOperUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
@@ -18,21 +20,18 @@ public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View
|
||||
}
|
||||
@Override
|
||||
public void upDateUserInfo(Map<String, String> map) {
|
||||
// ApiClient.getInstance().userUpdate(map, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
// MvpRef.get().updateSuccess();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// }
|
||||
// });
|
||||
api.userUpdate(map, new BaseObserver<UserBean>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(UserBean userBean) {
|
||||
MvpRef.get().updateSuccess(userBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void fill(String user_no, String nickname, String sex) {
|
||||
@@ -57,29 +56,29 @@ public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View
|
||||
|
||||
@Override
|
||||
public void uploadFile(File file, int type) {
|
||||
// MvpRef.get().showLoadings("上传中...");
|
||||
// String url = OSSOperUtils.getPath(file, type);
|
||||
// OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
// @Override
|
||||
// public void onSuccess() {
|
||||
// if (isViewAttach()) {
|
||||
// MvpRef.get().disLoadings();
|
||||
// MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail() {
|
||||
// if (isViewAttach()) {
|
||||
// MvpRef.get().disLoadings();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
MvpRef.get().showLoadings("上传中...");
|
||||
String url = OSSOperUtils.getPath(file, type);
|
||||
OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().disLoadings();
|
||||
MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().disLoadings();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAvatar(String headPicture) {
|
||||
MvpRef.get().showLoadings();
|
||||
// MvpRef.get().showLoadings();
|
||||
// ApiClient.getInstance().updateAvatar(headPicture, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
@@ -101,46 +100,42 @@ public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View
|
||||
@Override
|
||||
public void updateNickname() {
|
||||
// TODO: 2019/1/15 完善昵称修改功能
|
||||
MvpRef.get().showLoadings();
|
||||
// api.upUserNickname(new BaseObserver<UserNickBean>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(UserNickBean s) {
|
||||
// MvpRef.get().updateNicknameSuccess(s.getNickname());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// MvpRef.get().disLoadings();
|
||||
// }
|
||||
// });
|
||||
api.upUserNickname(new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().updateNicknameSuccess(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSexTrue(String sex) {
|
||||
// TODO: 2019/1/15 完善性别获取头像信息
|
||||
MvpRef.get().showLoadings();
|
||||
// api.upUserTrue(sex, new BaseObserver<UserPictrue>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(UserPictrue userPictrue) {
|
||||
// MvpRef.get().updateSexTrue(userPictrue);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// MvpRef.get().disLoadings();
|
||||
// }
|
||||
// });
|
||||
api.upUserPic(sex, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String userPictrue) {
|
||||
MvpRef.get().updateSexTrue(userPictrue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,14 @@ import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
|
||||
public final class LoginContacter {
|
||||
public interface View extends IView<Activity> {
|
||||
void sendCodeSuccess(String phoneNumber);
|
||||
void sendCodeSuccess1(String phoneNumber);
|
||||
void loginSuccess(UserBean userBean);
|
||||
|
||||
void authorizationSuccess(String s);
|
||||
}
|
||||
|
||||
public interface ILoginPre extends IPresenter {
|
||||
@@ -15,9 +19,12 @@ public final class LoginContacter {
|
||||
|
||||
void login(String mobile, String password, String code, int type);
|
||||
|
||||
void thirdPartyLogin(String oldOpenId, String openId, int three_party, String nickname, String head_pic);
|
||||
|
||||
void oauthLogin(String netease_token, String access_token, int type);
|
||||
void oauthLogin(String auth_code,int type);//阿里登录
|
||||
|
||||
void switchAccounts(String loginId);//切换账号
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,104 +1,214 @@
|
||||
package com.qxcm.modulelogin.present;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alipay.sdk.app.AuthTask;
|
||||
import com.blankj.utilcode.util.AppUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.modulelogin.activity.ImproveInfoActivity;
|
||||
import com.qxcm.modulelogin.activity.LoginActivity;
|
||||
import com.qxcm.modulelogin.activity.SwitchAccountsActivity;
|
||||
import com.qxcm.modulemain.activity.MainActivity;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.utils.PreferencesUtils;
|
||||
import com.tencent.mm.opensdk.modelmsg.SendAuth;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class LoginPresenter extends BasePresenter<LoginContacter.View> implements LoginContacter.ILoginPre {
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class LoginPresenter extends BasePresenter<LoginContacter.View> implements LoginContacter.ILoginPre {
|
||||
public LoginPresenter(LoginContacter.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCode(String phoneNumber, int type) {
|
||||
api.sendCode(phoneNumber,"default", new BaseObserver<Object>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Object o) {
|
||||
MvpRef.get().sendCodeSuccess1(o+"");
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param mobile 手机号
|
||||
* @param password 密码
|
||||
* @param code 验证码
|
||||
* @param type 1:手机号登录 2:密码登录
|
||||
*/
|
||||
@Override
|
||||
public void login(String mobile, String password, String code, int type) {
|
||||
if (type==1){
|
||||
api.login(mobile, code, new BaseObserver<List<UserBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserBean> userBeans) {
|
||||
loginSuccess(userBeans);
|
||||
}
|
||||
|
||||
});
|
||||
}else if (type==2){
|
||||
api.userLogin(mobile,password, new BaseObserver<List<UserBean>>(){
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserBean> userBeans) {
|
||||
loginSuccess(userBeans);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付宝登录
|
||||
* @param auth_code
|
||||
* @param type type=1:微信登录;type=2:支付宝登录
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void oauthLogin(String auth_code, int type) {
|
||||
api.authCode(auth_code,type, new BaseObserver<List<UserBean>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserBean> userBeans) {
|
||||
loginSuccess(userBeans);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void thirdPartyLogin(String oldOpenId, String openId, int three_party, String nickname, String head_pic) {
|
||||
public void switchAccounts(String loginId) {
|
||||
api.switchAccounts(loginId, new BaseObserver<List<UserBean>>() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void oauthLogin(String netease_token, String access_token, int type) {
|
||||
@Override
|
||||
public void onNext(List<UserBean> userBeans) {
|
||||
loginSuccess(userBeans);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
|
||||
}
|
||||
public void authorization() {
|
||||
// if (share_media.getName().equals(SHARE_MEDIA.QQ.getName())) {
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.A010304_qq, "be_null", "be_null");
|
||||
// if (!AppUtils.isAppInstalled("com.tencent.mobileqq")) {
|
||||
// ToastUtils.showShort("请安装QQ客户端");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// if (share_media.getName().equals(SHARE_MEDIA.WEIXIN.getName())) {
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.A010304_wx, "be_null", "be_null");
|
||||
// if (!AppUtils.isAppInstalled("com.tencent.mm")) {
|
||||
// ToastUtils.showShort("请安装微信客户端");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// UMShareAPI.get(MvpRef.get().getSelfActivity()).getPlatformInfo(MvpRef.get().getSelfActivity(), share_media, new UMAuthListener() {
|
||||
// @Override
|
||||
// public void onStart(SHARE_MEDIA share_media) {
|
||||
// Log.d(TAG, "onStart " + "授权开始");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) {
|
||||
// Log.d(TAG, "onComplete " + "授权完成");
|
||||
//
|
||||
// //sdk是6.4.4的,但是获取值的时候用的是6.2以前的(access_token)才能获取到值,未知原因
|
||||
// String uid = map.get("uid");
|
||||
// String openid = map.get("openid");//微博没有
|
||||
// String unionid = map.get("unionid");//微博没有
|
||||
// String access_token = map.get("access_token");
|
||||
// String refresh_token = map.get("refresh_token");//微信,qq,微博都没有获取到
|
||||
// String expires_in = map.get("expires_in");
|
||||
// String name = map.get("name");
|
||||
// String gender = map.get("gender");
|
||||
// String iconurl = map.get("iconurl");
|
||||
//
|
||||
// if (isViewAttach() && MvpRef.get().getSelfActivity() != null) {
|
||||
// MvpRef.get().getSelfActivity().runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// if (share_media.getName().equals(SHARE_MEDIA.QQ.getName())) {
|
||||
// thirdPartyLogin(uid, openid, 2, name, iconurl);
|
||||
// } else {
|
||||
// thirdPartyLogin(uid, openid, 1, name, iconurl);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {
|
||||
// Log.d(TAG, "onError " + "授权失败");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(SHARE_MEDIA share_media, int i) {
|
||||
// Log.d(TAG, "onCancel " + "授权取消");
|
||||
// }
|
||||
// });
|
||||
public void loginSuccess(List<UserBean> userBean) {
|
||||
if (userBean==null) {
|
||||
ToastUtils.showShort("登录失败请重试");
|
||||
return;
|
||||
}
|
||||
if (userBean.size()==1) {
|
||||
|
||||
CommonAppContext.getInstance().setUser(userBean.get(0));
|
||||
|
||||
// PreferencesUtils.putString( CommonAppContext.getInstance(), "mobile", userBean.get());
|
||||
|
||||
if (isViewAttach()) {
|
||||
// MvpRef.get().disLoadings();
|
||||
}
|
||||
if (userBean.get(0).getSex() == 0) {
|
||||
try {
|
||||
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), ImproveInfoActivity.class);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("userBean", userBean.get(0));
|
||||
intent.putExtras(bundle);
|
||||
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
com.blankj.utilcode.util.ActivityUtils.startActivity(MainActivity.class);
|
||||
}
|
||||
}else {
|
||||
Intent intent=new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), SwitchAccountsActivity.class);
|
||||
Bundle bundle=new Bundle();
|
||||
bundle.putSerializable("userBean", userBean.get(0));
|
||||
intent.putExtras(bundle);
|
||||
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
|
||||
|
||||
}
|
||||
// EventBus.getDefault().post(new LoginFinishEvent());
|
||||
// EventBus.getDefault().post(new SplashFinishEvent());
|
||||
// AppLog.setUserUniqueID(userBean.getUser_id()); // 设置您自己的账号体系ID, 并保证其唯一性 !
|
||||
}
|
||||
public void authorization(String type) {
|
||||
|
||||
if (type.equals("wx")) {
|
||||
if (!AppUtils.isAppInstalled("com.tencent.mm")) {
|
||||
ToastUtils.showShort("请安装微信客户端");
|
||||
return;
|
||||
}
|
||||
// IWXAPI api = WXEntryActivity.getWXAPI();
|
||||
// final SendAuth.Req req = new SendAuth.Req();
|
||||
// req.scope = "snsapi_userinfo"; // 只能填 snsapi_userinfo
|
||||
// req.state = "wechat_sdk_demo_test";
|
||||
// api.sendReq(req);
|
||||
}else if (type.equals("zfb")){
|
||||
// Map<String, String> result = authTask.authV2(authInfo, true);
|
||||
api.authorization(new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().authorizationSuccess(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void ysxl() {
|
||||
// ARouter.getInstance().build(ARouters.H5).withString("url", Constant.URL.URL_USER_YSXY).withString("title", "隐私协议").navigation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user