陈奇
2018-11-26 50aacfed3ceb60997c2c9a4cc0f9e6fe6b5ed718
app/src/main/java/com/moral/yunfushao/activity/LoginActivity.java
@@ -20,6 +20,9 @@
import com.moral.yunfushao.httputils.HttpCallBack;
import com.moral.yunfushao.httputils.HttpUtils;
import com.moral.yunfushao.model.User;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import java.util.HashMap;
import java.util.Map;
@@ -29,9 +32,11 @@
 */
public class LoginActivity extends BaseActivity {
    private Button bt_sure;
    private Button bt_sure, weixinlogin;
    private TextView tv_forget,tv_register;
    private EditText et_phone, et_pwd;
    private IWXAPI iwxapi;
    @Override
    protected void getBundleExtras(Bundle extras) {
@@ -41,7 +46,23 @@
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        StatusBarUtil.translucentStatusBar(LoginActivity.this);
        regToWx();
    }
    private void regToWx() {
        iwxapi = WXAPIFactory.createWXAPI(this, "app_id", true);
        iwxapi.registerApp("app_id");
    }
    private void sendReq() {
        //授权
        SendAuth.Req req = new SendAuth.Req();
        req.scope = "snsapi_userinfo";
        req.state = "wechat_sdk_demo_test";
        iwxapi.sendReq(req);
        System.out.println("chenqi fasongcehngqo");
    }
    @Override
    protected int getLayoutId() {
@@ -55,6 +76,7 @@
        tv_register = findView(R.id.tv_register);
        et_phone = findView(R.id.et_phone);
        et_pwd = findView(R.id.et_pwd);
        weixinlogin = findView(R.id.weixinlogin);
//        et_phone.setText("18362724160");
//        et_pwd.setText("123456");
    }
@@ -95,9 +117,16 @@
                Intent intentRgister = new Intent(LoginActivity.this,RegisterActivity.class);
                startActivity(intentRgister);
                break;
            case R.id.weixinlogin:
                weixinlogin();
                break;
        }
    }
    private void weixinlogin() {
        sendReq();
    }
    @Override
    protected void onErrorPageClick() {